Skip to content

Use cases and places

How Sypnia measures each use case of your app in production, and checks with real clicks that people move through your app the way its navigation map says.

Applies to EngineCloud
View as Markdown
On this page
  1. A use case in a trace
  2. What each case shows
  3. Places: where people are
  4. The navigation check
  5. Reading the figures
  6. How Sypnia uses it

This page is for anyone who builds with use cases: a map of what people can do in your app, kept in Sypnia Cases or written as code with Sypnorm. It works with the open-source engine and with Sypnia Cloud. Without a map, nothing here changes how the rest of Sypnia works.

A use case in a trace

When a request or a job serves a use case, its span carries two attributes:

AttributeWhat it holdsExample
sypnia.caseThe case id, as it is on the mapplace-order
sypnia.case.outcomeHow the case ended: the name of one of its outcomes or failuresOrderPlaced, OutOfStock

You rarely set them yourself:

  • Sypnorm sets both on every use case it runs: each run is a span usecase <case id> carrying sypnia.case, and the outcome (error when the run threw) is set on that same span, with setSpanAttributes() of @sypnia/telemetry 0.4.0 or later, or with the OpenTelemetry API when one is registered. With an older @sypnia/telemetry, whose span() takes its attributes when it starts, the ending is recorded as a second, short span usecase <case id> → <Outcome> with both attributes.
  • Sypnia Run sets both on the cases it runs: routes, scheduled jobs and listeners (how Run runs use cases).
  • Any other code sets them on the span that serves the case, with setSpanAttributes() of @sypnia/telemetry (from version 0.4.0; in Next.js from @sypnia/telemetry/next/server). It finds the request’s span for you, and the outcome can be set after the work ended (Node SDK):
checkout.ts
import { setSpanAttributes } from '@sypnia/telemetry/node';

setSpanAttributes({ 'sypnia.case': 'place-order' });
// … the work of the case …
setSpanAttributes({ 'sypnia.case.outcome': 'OrderPlaced' });

With OpenTelemetry, the same with its API:

checkout.ts
import { trace } from '@opentelemetry/api';

const span = trace.getActiveSpan();
span?.setAttribute('sypnia.case', 'place-order');
// … the work of the case …
span?.setAttribute('sypnia.case.outcome', 'OrderPlaced');

A trace belongs to the case of its first span that carries one. Calls made inside that work, to Sypnia AI, Files, Mail or your own services, are spans of the same trace, so the case shows everything it did. Both attributes are in the semantic conventions.

What each case shows

FigureWhat it counts
RunsHow many times the case ran in the range, and the trend
OutcomesHow many runs ended in each outcome and each failure, by name
ErrorsRuns that threw, answered 500 or above, or ended without any outcome the case declares
Durationp50 and p95 of the span that carries the case
ProblemsThe problems whose failures happened inside the case

A declared failure is not an error. When the bread is sold out, OutOfStock is the case doing its job: it is counted under outcomes, with the message people saw. An error is something the case did not plan for. So a problem reads «3 people could not finish Place an order: the card form never loaded», and the case’s page shows it next to the 41 runs that ended in OrderPlaced.

A case that starts only when several events have arrived (on_all in Cases) has a window to wait for them. When the window closes before they all arrive, the case does not run, and its page shows the wait as WindowExpired, with the events that did arrive. It is counted under outcomes, not as an error.

Places: where people are

Inside an app, every use case has a place: a screen, a tab, a dialog or a menu, on the app’s navigation map. In Cases this is the case’s where, and each place has one parent, so the way to get there is always known: «Shop › Checkout».

The browser SDK reads places from your pages. The element that shows a place carries its id:

HTML
<main data-sypnia-place="shop.checkout">
  …
  <dialog open data-sypnia-place="shop.checkout.change-address">…</dialog>
</main>

Every page_view and click, rage and dead clicks included, then carries place (from version 0.4.0 of the browser SDK): the id of the innermost place around it. A dialog open over the checkout is its own place. Pieces generated by Sypnia Design and the components of @sypnia/ui set the attribute for you from the case’s where. A place id is a name from your code: it is never the page’s content, and masking does not change it.

The navigation check

From those events Sypnia knows how people move: a click in one place, then the next place they see. With the project linked to a Cases map, it compares those moves with the navigation tree:

What Sypnia findsWhat it meansWhat to do
A move along the treePeople get there the way the map saysNothing
A move the tree does not haveA shortcut or a link nobody put on the mapAdd it to the map as a shortcut, or remove the link
A place nobody reached in 30 daysA screen people cannot find, or no longer needCheck the way to it, or remove it from the map
A route with no placeA screen that is not on the mapGive it a place, or find out why it exists

It does the same for use cases:

What Sypnia findsWhat it means
An outcome the case does not declareA gap in the map: something happens that no one agreed on. Cases proposes a change to the case, with what people saw
A case on the map that never ran in 30 daysIt is not built, not reachable, or not used
A case id that is not on the mapCode that does something no case describes

The comparison happens where the map lives: Sypnia Cases reads these figures from Sypnia and shows them on each case and each place (Cases and Telemetry). A self-hosted Cases engine reads them from your own engine with an API token.

Reading the figures

  • In the app, each use case and each place has its page, linked from the traces and problems that belong to it.
  • The API gives the same figures: GET /v1/cases, GET /v1/places, and the case filter on GET /v1/traces.

How Sypnia uses it

Sypnia measures its own products this way. Every product of the suite has its map of cases, and their spans and places arrive in Sypnia Telemetry, the pilot: Telemetry, the pilot.

  1. A use case in a trace
  2. What each case shows
  3. Places: where people are
  4. The navigation check
  5. Reading the figures
  6. How Sypnia uses it

    Search pages, sections and terms