Skip to content

Semantic conventions

Every OTLP attribute the Sypnia server SDKs set and the engine reads, with its type, when it is required and an example, and how server spans and browser events become one trace.

Applies to EngineCloud
View as Markdown
On this page
  1. The attributes
  2. Resource attributes
  3. The request your service received
  4. A call to another service
  5. A database call
  6. An error
  7. Span status and errors outside a request
  8. What kind of span it is
  9. The browser’s part of the trace
  10. How one trace is put together
  11. What the engine does not use
  12. Limits and constants

The server SDKs (@sypnia/telemetry/node, @sypnia/telemetry/next) and the bridge (@sypnia/telemetry/otel) send traces in the OpenTelemetry protocol: OTLP/HTTP, in protobuf, to POST /v1/otlp/v1/traces. Any other OpenTelemetry exporter can send to the same endpoint. This page lists the attributes that matter to Sypnia, for both kinds of sender. It is the same for the open-source engine and for Sypnia Cloud.

The rule behind it: where OpenTelemetry has a name for something, Sypnia uses that name, as OpenTelemetry defines it. A sypnia.* attribute exists only where OpenTelemetry has none: the account, the use case, a request exported before it ended, a database reached through an HTTP API, how an error was caught. There is no project attribute: the project comes from the ingest key, as for every other sender.

It is generated from spec/otlp-conventions.yaml in the docs repository. When this page and that file disagree, the file is right. The browser’s own events are in the event schema.

The attributes

«Sent by» says who sets the attribute: SDK is @sypnia/telemetry/node and @sypnia/telemetry/next, bridge is @sypnia/telemetry/otel, any exporter means the engine reads it from any OpenTelemetry sender that sets it.

Resource attributes

Once per ResourceSpans: they describe the service that sent the spans.

NameOriginTypeRequiredSent byMeaningExample
service.nameOpenTelemetrystringalwaysSDK, bridge, any exporterThe service, as set in init (service). Up to 80 characters. The engine uses unknown_service when it is missing, as OpenTelemetry does.shop-api
deployment.environment.nameOpenTelemetrystringoptionalSDK, bridge, any exporterThe environment, 1 to 40 characters. The older deployment.environment is read when this one is missing. production when both are missing. Counts toward the project’s 20 environment names.production
service.versionOpenTelemetrystringoptionalSDK, bridge, any exporterThe release, up to 40 characters: the short git commit. It is how a problem can say «since yesterday’s change» and how a server stack finds its source maps.4f2a91c
telemetry.sdk.nameOpenTelemetrystringoptionalSDK, bridge, any exporterWhich library built the spans. The Sypnia SDKs write their package name; with the bridge it is OpenTelemetry’s own value. Shown in sypnia doctor and in the ingest counters, never used to decide anything.@sypnia/telemetry/node
telemetry.sdk.versionOpenTelemetrystringoptionalSDK, bridge, any exporterThe version of that library.0.1.0

The request your service received

On the span of kind SPAN_KIND_SERVER that a service opens for each request it handles. It is the root of that service’s part of the trace.

NameOriginTypeRequiredSent byMeaningExample
http.request.methodOpenTelemetrystringalwaysSDK, bridge, any exporterThe HTTP method, upper case.POST
http.routeOpenTelemetrystringalwaysSDK, bridge, any exporterThe route template: the path with ids replaced, /orders/:id. The SDK takes the framework’s pattern when it can read it (Express, Fastify, the Next.js file route) and otherwise applies the same rule as the browser. A server span without it is stored, shown in its trace, and left out of Performance./api/checkout
url.pathOpenTelemetrystringoptionalSDK, bridge, any exporterThe path that was called, up to 500 characters. Never the query string: the SDK never sends url.query or url.full, and the engine drops both./api/checkout
http.response.status_codeOpenTelemetryintwhen: The answer was sent. Missing on a partial span.SDK, bridge, any exporterThe HTTP status the service answered. 500 or above makes the request a failure.400
session.idOpenTelemetrystringwhen: The request came from a page that runs the browser SDK.SDK, bridgeThe browser session, copied from the x-sypnia-session request header: 32 lowercase hex characters. It puts the request in that session’s timeline and gives the trace the session’s person. Any other value is dropped. Other exporters can set it the same way.8f3a6c1e9b2d4f07a5c3e1b8d6f4a2c0
user.idOpenTelemetrystringwhen: The app called identify() on the server during this request.SDK, bridgeThe person the request belongs to, the id given to identify(), up to 128 characters. Only the id: names and e-mail addresses are never sent as attributes. Without it the trace takes the person of its session.u_1042
sypnia.account.idSypniastringwhen: identify() on the server named an account.SDK, bridgeThe account the person belongs to in your app (a team, a company, a club), up to 128 characters. OpenTelemetry has no name for it.acc_77
sypnia.caseSypniastringwhen: The request or job serves a use case. On a scheduled job or a listener, set it on the job’s root span.SDK, bridge, any exporterThe id of the use case this work serves, as it is on the map, up to 128 characters (place-order). Sypnorm and Sypnia Run set it for the cases they run; other code sets it with setSpanAttributes() of @sypnia/telemetry or the OpenTelemetry API. The trace takes the case of its first span that carries one. See Use cases and places.place-order
sypnia.case.outcomeSypniastringwhen: The span carries sypnia.case and the case ended.SDK, bridge, any exporterThe name of the outcome or failure the case ended in, up to 80 characters (OrderPlaced, OutOfStock). A declared failure is counted as an outcome, not as an error. When the work throws before the case can end, it is error (Sypnorm and the Cases runtime set it); a span with sypnia.case and no outcome is counted as an error too.OrderPlaced
faas.coldstartOpenTelemetrybooleanoptionalSDK, any exportertrue on the first request of a new process: a cold start on serverless. Sent only when true.true
sypnia.partialSypniabooleanwhen: The request was still running after slowRequestMs (20,000 ms by default).SDKThis span was exported while the request was still running, with its end time set to the moment of export. If the request finishes, the SDK exports the same span id again without this attribute, and the full span replaces the partial one. If the platform kills the request, the partial span is what remains, and the engine reports it as a timeout.true
sypnia.dropped_spansSypniaintwhen: The request had more than 200 spans.SDKHow many spans of this request the SDK did not send. It keeps the first 200 of each request.0

A call to another service

On a span of kind SPAN_KIND_CLIENT for an outgoing HTTP call (fetch, http.request, https.request).

NameOriginTypeRequiredSent byMeaningExample
http.request.methodOpenTelemetrystringalwaysSDK, bridge, any exporterThe method. Its presence makes the span a call (kind http) unless it also has db.system.name.POST
server.addressOpenTelemetrystringalwaysSDK, bridge, any exporterThe host that was called.api.payments.example
url.pathOpenTelemetrystringoptionalSDK, bridge, any exporterThe path that was called, with ids replaced by :id. Never the query./v1/payments
http.response.status_codeOpenTelemetryintwhen: An answer arrived.SDK, bridge, any exporterThe status of the answer. No answer, 400, or 500 and above make the call a failure; other answers, such as 401, 404 or 409, do not.400
error.typeOpenTelemetrystringwhen: The call failed.SDK, bridge, any exporterWhy it failed: the status as text (400), or the error’s class when there was no answer (ECONNRESET, TimeoutError).400

A database call

On a span of kind SPAN_KIND_CLIENT for a query: a pg query, or a Supabase or PostgREST call recognized by its path (/rest/v1/…).

NameOriginTypeRequiredSent byMeaningExample
db.system.nameOpenTelemetrystringalwaysSDK, bridge, any exporterThe database. Its presence makes the span a database call (kind db). The older db.system is read when this one is missing.postgresql
db.operation.nameOpenTelemetrystringalwaysSDK, bridge, any exporterThe operation: SELECT, INSERT, UPDATE, DELETE, or CALL for a PostgREST function. A PostgREST PUT, an upsert, is INSERT. With the table it is the span’s name, SELECT carts.SELECT
db.collection.nameOpenTelemetrystringwhen: The SDK could read the table from the statement or the PostgREST path.SDK, bridge, any exporterThe table, or the function for a PostgREST CALL.carts
db.namespaceOpenTelemetrystringoptionalSDK, bridge, any exporterThe database name, from the connection. Not sent for PostgREST calls.shop
server.addressOpenTelemetrystringoptionalSDK, bridge, any exporterThe host of the database, or of the PostgREST API.db.shop.internal
db.response.status_codeOpenTelemetrystringwhen: The query failed, or a PostgREST call answered 400 or above.SDK, bridge, any exporterThe database’s error code: the Postgres SQLSTATE, or PostgREST’s own code (PGRST116), read from the answer of a PostgREST call. With captureDbErrors: false a PostgREST call is not read and carries its HTTP status instead; a pg error keeps its SQLSTATE, which holds no value. On a database span the engine takes this code before http.response.status_code as the failed call’s code, so a PostgREST call that answered HTTP 400 is DB 23505, not DB 400.23505
sypnia.db.messageSypniastringwhen: A pg query threw, or a PostgREST call answered 400 or above, and the app did not set captureDbErrors: false.SDKThe database’s message, as the database wrote it, values included, up to 2,000 characters: PostgREST’s message, then its details and hint on lines of their own (message\nDetail: …\nHint: …), read from the first 4 KB of the answer, or the message of the pg error with its detail and hint joined the same way. The values are in it: the detail is where the database writes them. It can hold personal data the database put in it. When the call failed (400, 500+, or a pg error) it is also the span’s status message; an answer such as 404 or 409 keeps status OK and carries it as an attribute. The engine keeps it as sent. OpenTelemetry has no name for it.duplicate key value violates unique constraint "users_email_key"\nDetail: Key (email)=(maria@example.com) already exists.
sypnia.db.viaSypniastringwhen: The query went through an HTTP API instead of a database connection.SDKpostgrest for Supabase and PostgREST calls. The span keeps its HTTP attributes too. OpenTelemetry has no name for it.postgrest

An error

On a span event named exception, on the span where the error happened. Span events with any other name are dropped.

NameOriginTypeRequiredSent byMeaningExample
exception.typeOpenTelemetrystringalwaysSDK, bridge, any exporterThe error’s name or class, up to 100 characters: TypeError. console.error when a logged value was not an Error.PaymentError
exception.messageOpenTelemetrystringalwaysSDK, bridge, any exporterThe message, up to 500 characters.amount is required (POST /v1/payments)
exception.stacktraceOpenTelemetrystringoptionalSDK, bridge, any exporterThe stack as the runtime wrote it, up to 4,000 characters. The engine translates it with the release’s source maps.PaymentError: amount is required (POST /v1/payments) at createCharge (/app/dist/payments.js:1:2380)
sypnia.error.sourceSypniastringoptionalSDKHow the SDK learned of it: uncaught (nobody caught it), log (console.error during a request) or manual (reportError()). uncaught when missing, which is what an exception from any other exporter is.uncaught
sypnia.error.fingerprintSypniastringoptionalSDK16 hex characters: the fingerprint the SDK computed, which it also uses to send one error per fingerprint per request. When missing, the engine computes it with the same algorithm. Errors with the same fingerprint are one problem.3b9e0d1c7a2f4e58
sypnia.error.digestSypniastringoptionalSDKThe id a framework gave the error (the Next.js digest), up to 100 characters. The browser’s error for the same failure carries the same digest, so the two are joined.2716153340

Span status and errors outside a request

On any span.

NameOriginTypeRequiredSent byMeaningExample
status.codeOpenTelemetryintoptionalSDK, bridge, any exporterThe span’s status, a field of the span rather than an attribute. STATUS_CODE_ERROR (2) marks a failed call or a request that threw. The engine also marks a span failed from the rules above (no answer, 400, 500+) when an exporter left the status unset.2
status.messageOpenTelemetrystringoptionalSDK, bridge, any exporterFor a failed call, its message. A failed database call’s message, from the Sypnia SDKs, is the database’s own, as written, values included, up to 2,000 characters: the same text as sypnia.db.message, and the engine keeps it as sent when the span carries that attribute. Any other message is up to 500 characters, and the Sypnia SDKs redact it before it leaves your server: e-mail addresses, URLs, UUIDs, quoted values, long tokens and every run of digits are replaced. Other exporters send what they send; the engine applies the same redaction on arrival to every status message of a span without sypnia.db.message.amount is required
sypnia.error.standaloneSypniabooleanwhen: An error happened outside any request: at startup, in a timer, in a queue worker.SDKThe span exists only to carry the error: one span of kind SPAN_KIND_INTERNAL, named uncaught, with the exception event. The engine records the error and lists no trace for it.true
sypnia.runningSypniabooleanwhen: The span was still running when a partial request was exported.SDKThis call had not finished; its end time is the moment of export. Shown as running in the trace.true

What kind of span it is

The engine gives every span one of five kinds. The Traces API returns them in kind.

In OTLPSypnia kindWhat it is
SPAN_KIND_SERVERserverA request a service handled. With http.route, one API call in Performance.
SPAN_KIND_CLIENT with db.system.namedbA database call.
SPAN_KIND_CLIENT with http.request.methodhttpA call to another service.
Any other span (INTERNAL, PRODUCER, CONSUMER, or CLIENT without either attribute)internalA step, shown in the trace.
A browser request event (not OTLP)browserThe call as the page saw it. Made by the engine, below.

The browser’s part of the trace

The browser SDK does not speak OTLP: it sends its compact request event. The engine turns each request event that has a trace id into a span of kind browser:

Field of requestIn the browser span
tidThe trace id.
spanThe span id. It is the parent id the SDK put in traceparent, so the server span whose parentSpanId equals it hangs under it.
(none)The parent: none. The browser span is the root of the trace.
method and pathThe name, POST /api/checkout, and the attributes http.request.method and url.path.
hostserver.address. Missing for calls to the page’s own origin.
ts and durStart and duration.
status, code, msghttp.response.status_code; the span failed on 0, 400 or 500+; code and msg as error.type and the status message.
sid, person, account, env, verThe trace’s session, person, account, environment and release. The service is browser.

How one trace is put together

  1. One trace is one trace id. The browser SDK creates it for each recorded call, with a span id for the call, and sends both in traceparent (00-<trace id>-<span id>-01) to your own origin and to traceTargets.
  2. The server SDK reads traceparent: its server span takes the trace id and uses the browser’s span id as parentSpanId. Without the header it starts a new trace. On every outgoing call it sends traceparent with its own span id, so the next service continues the trace.
  3. The engine makes one span of kind browser from each request event, as in the table above. It is the root. The server spans hang under it through parentSpanId.
  4. A span whose parent is not in the trace (the parent was dropped, lost or sampled out) hangs under the root, so the tree never breaks.
  5. The trace’s session is the browser event’s sid, else session.id on a server span. Its person is user.id on a server span, else the session’s person.
  6. Spans of one trace can arrive in different requests and from different services. Ingest stores each request as it comes; the roll-up joins everything with the same trace id when it builds the trace, within the 10 minutes of the freshness promise.
  7. Times are kept as each sender’s clock gave them. The engine does not shift one service’s clock to fit another’s, so a server span can look a few milliseconds outside its browser span.

The shop’s checkout, in these terms: the page’s POST /api/checkout is the browser span 0f1e2d3c4b5a6978, 3,870 ms, answered 400. The server span of shop-api, a1b2c3d4e5f60718, has that span as its parent and takes 3,842 ms. Under it, SELECT carts (db, 12 ms) and POST /v1/payments (http, 3,790 ms, error.type 400, status message amount is required). One trace id, 7c2e9a4b1d8f4e6a9b3c5d7e1f2a4b6c, joins the four. The full request body is in the OTLP reference.

What the engine does not use

  • Span events other than exception, span links, tracestate and baggage: dropped.
  • url.query, url.full, db.query.text and any attribute whose name contains authorization, cookie, password, secret or token: dropped at ingest.
  • Attributes beyond 64 on a span: dropped. Values beyond 256 characters: cut, except exception.stacktrace (4,000), exception.message and status.message (500), and sypnia.db.message and the status message of a span that carries it (2,000).
  • The sampled flag in traceparent: not used. Sypnia stores what it receives.
  • Any attribute not listed on this page: kept with the span and shown in the trace, never used to decide anything.

Limits and constants

Part of the contract: the SDKs and the engine implement these values.

ConstantValueMeaning
spans_per_request200Spans the server SDKs keep per request. The rest are counted in sypnia.dropped_spans.
span_attributes64Attributes kept per span.
span_attribute_chars256Characters kept per attribute value, with the exceptions above.
failures_per_request5exception events the server SDKs send per request, one per fingerprint.
log_failures_per_request3Of those, at most this many from console.error.
slow_request_ms20,000When a request still running is exported as partial (sypnia.partial). The option slowRequestMs changes it; 0 turns it off.
export_interval_ms2,000How long finished spans wait in memory before the server SDKs export them in one request.
export_max_spans512Spans in one export request from the server SDKs. A request’s spans are never split across two exports.
body_bytes_after_decompression4,000,000The largest body the endpoint accepts, from any sender.
spans_per_export2,000The most spans the endpoint accepts in one request, from any sender.
spans_per_trace500Spans the engine keeps per trace. The rest are counted in the trace’s dropped_spans.
  1. The attributes
  2. Resource attributes
  3. The request your service received
  4. A call to another service
  5. A database call
  6. An error
  7. Span status and errors outside a request
  8. What kind of span it is
  9. The browser’s part of the trace
  10. How one trace is put together
  11. What the engine does not use
  12. Limits and constants

    Search pages, sections and terms