Skip to main content
Version: 1.0

Traces

Traces are essential for understanding the flow of messages through a distributed system. The wasmCloud host is instrumented to record traces for all control interface and RPC messages.

The wasmCloud host can record and export distributed traces using the OpenTelemetry (OTEL) specification. If you haven't worked with distributed traces before, this primer is a great place to start.

For more information on wasmCloud's implementation of OpenTelemetry, including advanced configuration options, see Observability with OpenTelemetry.

Configuration

By default, tracing is disabled in the wasmCloud host. The host can be configured using environment variables or host config flags.

To enable all OTEL signals, including traces, use the WASMCLOUD_OBSERVABILITY_ENABLED environment variable:

bash
WASMCLOUD_OBSERVABILITY_ENABLED="true"

To enable only traces, use the WASMCLOUD_TRACES_ENABLED environment variable:

bash
WASMCLOUD_TRACES_ENABLED="true"

By default, wasmCloud hosts export traces via HTTP/OpenTelemetry Protocol (otlp) on port 4318.

The endpoint for trace exports may be overwritten with the OTEL_EXPORTER_OTLP_TRACES_ENDPOINT environment variable:

bash
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://my-custom-host:4318

See the host config options for equivalent host configuration CLI flags.

Viewing traces with Grafana and Tempo

A set of sample configurations and Docker Compose files are available to help launch a local observability environment. After following the instructions to launch a wasmCloud observability ecosystem, you can navigate to http://localhost:5050/explore, click the dropdown in the upper left, and select "Tempo" to view traces.

There are several ways to query traces in Tempo. To see all traces from the host, change the "Query type" tab to "Search," then click the "Service Name" dropdown and select "wasmcloud-host." You can also increase the "Limit" field to something more than the default (20). To search, press Shift-Enter. You can click on any of the Trace IDs to view all the spans associated with the trace.

Refer to the OTEL_ environment variables in the Docker Compose file for a complete example configuration. The example uses Grafana and Tempo, but wasmCloud works with any OTEL-compatible tracing backend, such as Zipkin, Jaeger, DataDog, Honeycomb, etc.