• 🏷️ Create a Resource.

    Creates an OpenTelemetry resource with the given attributes. Resources identify the entity producing telemetry data (service, host, process, etc.).

    Parameters

    • attributes: Record<string, unknown> = {}

      Attributes describing the resource (defaults to empty object)

    Returns Resource

    A complete Resource object

    // Basic resource
    const basicResource = createResource();
    // Result: { attributes: [], droppedAttributesCount: 0 }

    // Service resource
    const serviceResource = createResource({
    "service.name": "turtle-fleet",
    "service.version": "1.0.0",
    "service.instance.id": "turtle-42"
    });

    // Turtle resource with location
    const turtleResource = createResource({
    "service.name": "turtle-miner",
    "turtle.id": 42,
    "turtle.type": "mining",
    "location.world": "overworld",
    "location.x": 100,
    "location.y": 64,
    "location.z": 200
    });