{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/logbrew/json-schema/logbrew-trace-summary-response-schema.json",
  "title": "TraceSummaryResponse",
  "description": "Agent-friendly summary of one distributed trace.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/logbrew-traces-api-openapi.yml#/components/schemas/TraceSummaryResponse",
  "properties": {
    "duration_ms": {
      "description": "Wall-clock duration from the earliest start to the latest span end.",
      "format": "int64",
      "type": "integer"
    },
    "environments": {
      "description": "Distinct environments represented by the trace.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "error_span_count": {
      "description": "Number of spans with `error` status.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    },
    "error_spans": {
      "description": "Longest error spans, bounded by the API.",
      "items": {
        "$ref": "#/$defs/TraceSpanSummaryResponse"
      },
      "type": "array"
    },
    "project_count": {
      "description": "Number of distinct projects represented by the trace.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    },
    "releases": {
      "description": "Distinct releases represented by the trace.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "root_span": {
      "anyOf": [
        {
          "$ref": "#/$defs/TraceSpanSummaryResponse"
        },
        {
          "type": "null"
        }
      ],
      "description": "Earliest span without a known parent, or the earliest span as a fallback."
    },
    "service_count": {
      "description": "Number of distinct services represented by the trace.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    },
    "services": {
      "description": "Per-service trace health and latency summaries.",
      "items": {
        "$ref": "#/$defs/TraceServiceSummaryResponse"
      },
      "type": "array"
    },
    "slowest_child_span": {
      "anyOf": [
        {
          "$ref": "#/$defs/TraceSpanSummaryResponse"
        },
        {
          "type": "null"
        }
      ],
      "description": "Longest non-root span, when one exists."
    },
    "slowest_path": {
      "description": "Known parent chain from a root toward the slowest child span.",
      "items": {
        "$ref": "#/$defs/TraceSpanSummaryResponse"
      },
      "type": "array"
    },
    "span_count": {
      "description": "Total number of spans included in this summary.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    },
    "started_at": {
      "description": "Earliest observed span start.",
      "format": "date-time",
      "type": "string"
    },
    "trace_id": {
      "description": "Distributed trace ID.",
      "type": "string"
    }
  },
  "required": [
    "trace_id",
    "span_count",
    "error_span_count",
    "service_count",
    "project_count",
    "started_at",
    "duration_ms",
    "root_span",
    "slowest_child_span",
    "slowest_path",
    "error_spans",
    "services",
    "releases",
    "environments"
  ],
  "type": "object",
  "$defs": {
    "TraceServiceSummaryResponse": {
      "description": "Per-service trace health and latency summary.",
      "properties": {
        "error_span_count": {
          "description": "Number of spans with `error` status.",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "max_duration_ms": {
          "description": "Longest span duration for this service.",
          "format": "int64",
          "type": "integer"
        },
        "service_name": {
          "description": "Logical service name.",
          "type": "string"
        },
        "span_count": {
          "description": "Number of spans emitted by this service.",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        }
      },
      "required": [
        "service_name",
        "span_count",
        "error_span_count",
        "max_duration_ms"
      ],
      "type": "object"
    },
    "TraceSpanSummaryResponse": {
      "description": "Privacy-safe trace span metadata used by trace summaries.",
      "properties": {
        "duration_ms": {
          "description": "Span duration in milliseconds.",
          "format": "int64",
          "type": "integer"
        },
        "name": {
          "description": "Human-readable span name.",
          "type": "string"
        },
        "operation": {
          "description": "Operation category.",
          "type": "string"
        },
        "parent_span_id": {
          "description": "Parent span ID when the parent was supplied.",
          "type": [
            "string",
            "null"
          ]
        },
        "service_name": {
          "description": "Logical service name.",
          "type": "string"
        },
        "span_id": {
          "description": "Span ID unique within the trace.",
          "type": "string"
        },
        "started_at": {
          "description": "Span start timestamp.",
          "format": "date-time",
          "type": "string"
        },
        "status": {
          "description": "Span status.",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "span_id",
        "parent_span_id",
        "name",
        "operation",
        "status",
        "started_at",
        "duration_ms",
        "service_name"
      ],
      "type": "object"
    }
  }
}