Observability

Build a telemetry baseline

Choose signals that can explain a failed request, then test that those signals survive the trip from the application to the backend.

Start with a user operation

Pick one operation that matters, such as submitting an order, and write down what a user would see if it failed. Record where it starts, which dependencies it calls and how the client learns that it succeeded. A successful HTTP response may arrive before asynchronous work completes. In that case, track completion separately and define how long the user is expected to wait.

Choose an owner for each decision the signals should support. For example, the service owner should be able to tell whether order failures rose after a release and whether one dependency accounts for most of the change.

Assign a role to each signal

Use a counter for request and error volume and a duration histogram for the distribution of response times. Use a normalized route such as /orders/{id} as a metric label, never the actual order ID. Distinct label combinations create distinct time series. User identifiers and full URLs can therefore drive storage and query work without helping a responder see a useful aggregate.

Write structured events for outcomes that need more context, such as a dependency timeout. Include a timestamp, service, route and outcome, with units in the field name where needed. A trace links spans for work done by different components in one request. When trace context is available, carry trace or span identifiers in related logs so a responder can move from an event to the relevant trace. Review attributes before collecting them. Request bodies, tokens and personal identifiers usually have no place in these signals.

Test the collection path

An OpenTelemetry Collector can receive signals, apply optional processors and export to a backend. Build one small path first. Emit a known successful request and a known failure in a test environment. In the backend, verify the service identity and route grouping, the duration unit, the error event and the relationship between child spans and their parent.

Signals flow from an instrumented service through a collector to an observability backend.
Example collection path for application metrics, logs and traces.

Test expected sampling and deliberately interrupt export in the test environment. Observe what remains available to the application, whether queues grow and how the collector reports export failures. Write down the behavior you actually observed. A quiet dashboard could mean healthy traffic, a stopped exporter or an incorrect query.

Review the local sample

The sample file contains synthetic request summaries in JSON Lines. Download it and the Python analyzer to the same folder, then run:

python analyze-events.py request-events.sample.jsonl

The analyzer groups requests by service and route, counts HTTP 5xx responses and calculates the nearest-rank p95 duration in milliseconds. In the sample, order-api POST /orders has five requests, one server error and a p95 of 280 ms. With five observations the p95 is the maximum. Treat that result as a way to verify the example. It provides too little evidence for a production latency decision.

Keep the first dashboard small enough to review during a handoff. Document the source of each panel, the expected delay in data and the owner who can verify it. Recheck the baseline after changing instrumentation, sampling or routing.

Working files

References