New Relic · JSON Structure

Trace Api Span Structure

A single distributed trace span in New Relic format

Type: object Properties: 4 Required: 2
AnalysisAnalyticsAPMDevOpsInfrastructureMonitoringObservabilityPerformancePlatform

Span is a JSON Structure definition published by New Relic, describing 4 properties, of which 2 are required. It conforms to the https://json-structure.org/meta/core/v0/# meta-schema.

Properties

id trace.id timestamp attributes

Meta-schema: https://json-structure.org/meta/core/v0/#

JSON Structure

Raw ↑
{
  "$schema": "https://json-structure.org/meta/core/v0/#",
  "$id": "https://raw.githubusercontent.com/api-evangelist/new-relic/refs/heads/main/json-structure/trace-api-span-structure.json",
  "name": "Span",
  "description": "A single distributed trace span in New Relic format",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Unique identifier for this span (16 hex characters)",
      "example": "500123"
    },
    "trace.id": {
      "type": "string",
      "description": "Trace ID that groups all spans in a distributed trace",
      "example": "500123"
    },
    "timestamp": {
      "type": "int32",
      "description": "Unix epoch timestamp in milliseconds when the span started",
      "example": 1718153645993
    },
    "attributes": {
      "type": "object",
      "description": "Span attributes",
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the operation represented by this span"
        },
        "parent.id": {
          "type": "string",
          "description": "The span ID of the parent span"
        },
        "duration.ms": {
          "type": "double",
          "description": "Duration of the span in milliseconds"
        },
        "service.name": {
          "type": "string",
          "description": "Name of the service that generated this span"
        },
        "error": {
          "type": "boolean",
          "description": "Whether the span represents an error"
        },
        "db.statement": {
          "type": "string",
          "description": "Database query statement if applicable"
        },
        "http.url": {
          "type": "string",
          "description": "HTTP URL for outbound calls"
        },
        "http.method": {
          "type": "string",
          "description": "HTTP method for outbound calls"
        },
        "http.statusCode": {
          "type": "int32",
          "description": "HTTP response status code"
        }
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "string"
          },
          {
            "type": "double"
          },
          {
            "type": "boolean"
          }
        ]
      },
      "example": {
        "name": "example-resource-01",
        "parent.id": "500123",
        "duration.ms": 0.42,
        "service.name": "myService",
        "error": true,
        "db.statement": "example_string",
        "http.url": "https://portal.example.com/path/abc123",
        "http.method": "example_string",
        "http.statusCode": 200
      }
    }
  },
  "required": [
    "id",
    "trace.id"
  ]
}