Observability for Web Applications: A Practical Guide to Logs, Metrics and Traces
November 16, 2026 · Devhuset Team
When a customer says checkout is slow, “the server looks healthy” is not a useful answer. The web server may be responding normally while a payment call stalls, retries multiply, and only one region is affected. Observability gives a development team evidence to follow that failure through the system rather than guessing from one dashboard.
What observability means in practice
Monitoring tells you whether known conditions are occurring: error rates rose, a queue is filling, or a service crossed a latency threshold. Observability is the broader ability to investigate system behavior from the outputs the software produces. The distinction is practical, not philosophical. Monitoring alerts you to a symptom; useful telemetry helps explain why it appeared.
Start with user-facing outcomes. For a shop, that could mean successful checkout rate, time to confirmation, and the proportion of payment attempts that fail. Infrastructure measures such as CPU usage still matter, but they do not prove that a customer can complete a purchase. A healthy host can serve a broken application.
OpenTelemetry describes telemetry signals including traces, metrics and logs. They answer different questions and become much more useful when they share consistent service and request context.
Metrics show patterns over time
A metric is a numeric measurement recorded over time: request duration, error count, queue depth, or memory use. Metrics are good at showing whether a problem is widespread, when it began, and whether it is improving. A latency percentile can reveal that a small share of requests is extremely slow even when the average looks acceptable.
Choose metrics around service-level indicators (SLIs), which express reliability from a user’s perspective. For example, define a successful checkout as an order reaching a confirmed state within a stated time window. Track the share of eligible checkouts that meet that definition, then alert on sustained deterioration rather than every brief fluctuation.
Keep dimensions bounded. A metric labelled with a route template such as `/orders/{id}` remains useful; a raw URL or unique user ID can create a separate time series for every value. High cardinality increases storage and processing cost and can make analysis less reliable. OpenTelemetry’s metrics SDK documents cardinality limits and overflow behavior, but a limit is a backstop—not a reason to attach unlimited identifiers.
Traces follow a request across services
A distributed trace records a request’s path through operations called spans. A browser checkout might call an API, which queries inventory, requests a payment authorization, and writes an order. A trace places those steps on one timeline, making it easier to see whether the delay came from your code, a database, or a downstream service.
Context propagation carries trace identity between components. Without it, each service may report its own isolated timings, leaving engineers to correlate events by timestamp and guesswork. Instrument inbound and outbound requests, database calls, and asynchronous work where supported. Use stable, meaningful operation names; do not put raw user input or unique IDs in span names.
Tracing does not mean recording every request forever. Sampling controls the volume retained. Head sampling decides early, before the trace is complete; tail sampling can make a decision after seeing more of the trace, such as retaining errors and slow requests. Tail sampling needs infrastructure that keeps the spans of a trace together. Whatever policy you choose, preserve enough information to investigate rare failures, and understand what the sample rate means when interpreting counts.
Logs explain individual events
Logs record discrete events: a payment provider timed out, a retry was scheduled, or an order moved to a new state. Structured logs use consistent fields and types, so they can be searched and grouped. JSON by itself does not guarantee a stable schema; teams need agreed field names and meanings.
Include useful context such as service name, environment, operation, severity, and trace or span identifiers when available. Then an engineer can move from a failed trace to the relevant log events instead of searching all services by an approximate timestamp. Keep messages concise and describe the event, not a paragraph of repeated request data.
Before logging request bodies, headers, or customer details, decide what is necessary and permitted. Tokens, passwords, payment details and personal information can leak into telemetry through exceptions or debug statements. OpenTelemetry’s security guidance recommends controls such as attribute filtering and redaction processors, but prevention should begin in application code: do not emit secrets in the first place. Apply access controls and retention limits as well.
Make the signals work together
The strongest investigations move between signals. A checkout metric shows that failures rose after a release. A trace shows that the payment span is slow. Its identifiers lead to structured logs explaining that the provider returned a timeout and the retry limit was reached. Each signal supplies a different level of detail.
Use shared conventions for service identity, deployment environment, and operation names. OpenTelemetry semantic conventions provide standard attribute names for common kinds of telemetry. Adopting conventions makes dashboards and queries easier to reuse, especially when several teams or libraries emit data. Consistency matters more than collecting every optional field.
For example, an alert could identify an increase in failed checkout requests. The on-call engineer filters traces to the affected service and time range, checks whether the database or payment call dominates the duration, then pivots from a trace ID to logs for that request. A dashboard alone rarely answers all three questions.
Choose an instrumentation and collection approach
OpenTelemetry offers APIs and SDKs for producing telemetry and a Collector that can receive, process and export data. The Collector uses pipelines made from receivers, optional processors and exporters. This creates a useful separation: application code describes events and operations, while the collection layer can route or transform telemetry before it reaches one or more backends.
A small application can begin with an SDK exporting to a local or managed Collector. Larger environments may run agents near workloads and gateways for centralized filtering, sampling or export. The agent-to-gateway pattern is not mandatory; it adds operational components, so adopt it when central processing, network boundaries or scale justify it.
Pick a backend based on the questions your team needs to answer, data location and retention requirements, query experience, integration support, and cost. OpenTelemetry reduces dependence on a single vendor’s instrumentation format, but it does not make every backend interchangeable. Validate the attributes, dashboards, sampling behavior and export costs with a representative workload before committing.
Control cost, noise and sensitive data
Telemetry volume grows with traffic, verbosity and the number of unique attribute combinations. Set a budget per signal, define retention by purpose, and review high-volume sources. Sampling can reduce trace volume; log levels can prevent routine debug messages from flooding production; metric design can limit unnecessary series.
Do not treat cost reduction as indiscriminate deletion. If you sample away every error trace or discard all context needed to reproduce a fault, the bill may fall while incident duration rises. Keep a deliberate path for exceptional events and test that it works before an incident.
Treat telemetry as production data. Restrict who can query it, protect credentials used by collectors, secure transport, and review data sent to third-party services. Redact or drop sensitive attributes before export where possible, and periodically inspect real payloads—configuration intent alone cannot catch every accidental field.
Build a usable starting point
Begin with one critical user journey and a short set of questions. Instrument its key boundaries, create a few user-centered indicators, propagate trace context, and emit structured events for important decisions and failures. Add a dashboard and alerts tied to those indicators, not a wall of unrelated host graphs.
Run a controlled failure exercise: introduce a slow dependency in a test environment and confirm that the alert fires, the trace shows the delay, and associated logs are discoverable. Check that sensitive values are absent and that telemetry volume remains within budget. This validates the whole path from application to investigation, not merely that an SDK initialized.
Observability is an engineering capability built through clear questions, consistent data and careful operations. Start small, make each signal answer a distinct question, and expand only when the team can use the information to make a better decision.