Skip to content

Telemetry

Each use case in production, from Sypnia Telemetry.

Applies to Cloud
View as Markdown
On this page
  1. Link it
  2. Chains of events
  3. Real clicks confirm the navigation map
  4. Sypnia uses it this way

When a request serves a use case, its trace carries the attribute sypnia.case with the case id, and sypnia.case.outcome with how the run ended. Sypnorm and the runtime set both for you: every run is a span usecase <case id>. With the OpenTelemetry API registered in your service, the outcome goes on that same span. With @sypnia/telemetry/node 0.4.0 or later, it goes on that span too, through setSpanAttributes. An older @sypnia/telemetry records the ending as a second, short span usecase <case id> → <Outcome> that carries both attributes.

Other code sets them on the active span, with setSpanAttributes from @sypnia/telemetry 0.4.0 or later, or with the OpenTelemetry API that Sypnia Telemetry accepts:

TypeScript
import { setSpanAttributes } from '@sypnia/telemetry/node';
setSpanAttributes({ 'sypnia.case': 'place-order', 'sypnia.case.outcome': 'OrderPlaced' });

// or, with the OpenTelemetry API
import { trace } from '@opentelemetry/api';
trace.getActiveSpan()?.setAttribute('sypnia.case', 'place-order');

A map’s owner links a Telemetry project, with a Telemetry API token that can read it:

Terminal
curl -X PUT https://cases.api.sypnia.com/v1/maps/la-espiga/telemetry \
  -H "Authorization: Bearer $SYPNIA_TOKEN" -H "Content-Type: application/json" \
  -d '{ "project": "la-espiga", "token": "<telemetry API token (read)>" }'

Cases keeps the token encrypted (AES-256-GCM) and reads each case’s figures from Telemetry’s use cases endpoint, GET /v1/cases?case=<case id>. DELETE on the same path unlinks it. A token Telemetry refuses shows on the case as «not allowed», and a Telemetry that does not answer within the link’s time budget as «not available right now»; the rest of the case still shows.

Linked, each case shows:

  • How often it runs, and its trend.
  • How it ends: each declared outcome and failure, counted. «Order for tomorrow ended in SoldOut 14 times today» is one number, with the words people read. For a case that starts with on_all, waits whose window closed first are counted here too, as WindowExpired.
  • Its errors and latency: errors nobody declared, p50 and p95.
  • Endings seen against endings declared. An error that keeps happening is often a failure the case should name: Cases suggests a proposal that adds it, with what people saw.
  • Its recent problems, linked to Telemetry.

Chains of events

An event carries its trace, so a whole chain is one trace in Telemetry: «Check the weather» at 4 pm, «Pause deliveries» a few milliseconds later, «Tell the baker» after that, each with the time its delivery waited and the attempts it took. Telemetry also opens a problem, and alerts the people who watch the project, when:

  • a listener has dead letters (Delivery);
  • a chain was cut with LoopStopped (Loops);
  • an on_all window closed before every outcome arrived (WindowExpired).

Real clicks confirm the navigation map

With the browser SDK (@sypnia/telemetry 0.4.0 or later), every page view, click, rage click and dead click carries place: the id of the innermost data-sypnia-place around it, a name from your code, never the page’s content (Use cases and places). The check compares the last 30 days of production with the navigation map and reports what does not match: a way people move that the tree lacks (nav-missing-edge), a place nobody reached (nav-unreached), a route with no place (nav-unknown-route), a case that never ran (case-unused), and, from what production ran, endings the case does not declare (undeclared-outcome) and cases the map does not have (unmapped). A move along the tree is fine: to a child, back up, to a sibling, to a root, or along a shortcut. Endings the runtime records itself (error, WindowExpired, LoopStopped) are never a gap.

The check reads Telemetry when the map names its project and a read token is at hand:

cases/map.yaml
app:
  telemetry: la-espiga
Terminal
SYPNIA_TELEMETRY_TOKEN=<telemetry API token (read)> npx @sypnia/cases check

[cases] telemetry in sypnia.toml names the project too, and SYPNIA_TELEMETRY_API points at another Telemetry engine. Without a token the check says so and goes on; --no-telemetry skips it.

Sypnia uses it this way

Sypnia Telemetry is Sypnia’s pilot: it uses every other Sypnia product, and every case of every product reports to it. When a case of Sypnia Data or Sypnia Git ends in a failure or a dead letter, Sypnia’s own team sees it here first.

  1. Link it
  2. Chains of events
  3. Real clicks confirm the navigation map
  4. Sypnia uses it this way

    Search pages, sections and terms