Skip to main content
POST /v1/traces takes OTLP over HTTP on --http-addr (default 127.0.0.1:4318). The gRPC port, --grpc-addr (default 127.0.0.1:4317), takes OTLP/gRPC. With API keys, the key needs the write right. You do not call this route by hand: point an OpenTelemetry SDK or Collector at the server (OpenTelemetry guide). How the server maps a span: Mapping, cost and masking.

What bodies does it take?

The server writes spans with upsert: a batch that arrives twice (a retry) is stored once.

What the server answers

Partial success

The server refuses a bad span alone. The answer is 200 with partialSuccess (rejectedSpans, errorMessage), and the other spans are stored.
  • A span is refused for bad ids (not 16 or 8 bytes, or all zero; in JSON also an id that is not hex), no start time, or an end before its start.
  • In OTLP/JSON, a span is also refused for a value that is wrong for its field: a time that is no whole number from 0 to 2^64-1, an intValue that is no 64-bit integer, a bytesValue that is not base64, an item of attributes that is not an object.
  • The message names the span by its number in the request and the field by its path (span 7: attributes[1].value.intValue is not a whole number of 64 bits ...). It does not give the value.
  • A wrong value of a resource or a scope refuses the spans of that resource or scope.
The server reads values as the proto3 JSON mapping writes them:
  • "doubleValue": "NaN", "Infinity" and "-Infinity" are those doubles. The Go Collector writes them so. The server stores them as the text "NaN", as over protobuf.
  • A number may come as a text.
  • kind and status.code may be the names of their values ("SPAN_KIND_CLIENT").
  • null is the default of any field.
JSON writers (JSON.stringify, Python’s json.dumps) write the half of a UTF-16 surrogate pair that is left as an escape ("...\ud83d"). The server stores each such half as U+FFFD, what the protobuf exporters send for the same text. The answer is 200 with partialSuccess, rejectedSpans 0, and the count in errorMessage (the OTLP spec allows a warning so).The same holds for every JSON the server reads (the query API, import), and for the Node and Python packages.
A span has at most 64 levels (depth rule). A JSON text deeper than 128 levels gets 400. An OTLP body cannot bring a span that deep: the OTLP readers stop a deeper value first, also with 400. Protobuf stops at 100 of its own levels (a list in a list is two). JSON stops at 128 (a list in a list is three). Over gRPC the answer is INTERNAL, from the gRPC library, before the server sees the body.

OpenTelemetry guide

Point an app, a framework or a Collector at Magpie.

Find spans

Query the spans you sent.