Metrics
The wasmCloud host can export metrics using the OpenTelemetry (OTEL) specification.
For more information on wasmCloud's implementation of OpenTelemetry, including advanced configuration options, see Observability with OpenTelemetry.
Configuration
By default, metrics are disabled in the wasmCloud host. The host can be configured using environment variables or host config flags.
To enable all OTEL signals, including metrics, use the WASMCLOUD_OBSERVABILITY_ENABLED
environment variable:
WASMCLOUD_OBSERVABILITY_ENABLED="true"
To enable only metrics, use the WASMCLOUD_METRICS_ENABLED
environment variable:
WASMCLOUD_METRICS_ENABLED="true"
By default, wasmCloud hosts export signals via HTTP/OpenTelemetry Protocol (otlp
) on port 4318.
The endpoint for metrics exports may be overwritten with the OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
environment variable:
OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=http://my-custom-host:4318
See the host config options for equivalent host configuration CLI flags.
Format
Metrics are exported in OpenTelemetry format. The OTEL collector converts OTEL-formatted metrics to Prometheus format for use with Prometheus systems.
Metric options
The following specific metrics are included with wasmCloud:
- Actors:
- Time to handle invocation in nanoseconds (
wasmcloud_host.handle_rpc_message.duration
) - Count of the number of invocations (
wasmcloud_host.actor.invocations
)- Count of errors (
wasmcloud_host.actor.errors
)
- Count of errors (
- Time to handle invocation in nanoseconds (
User feedback and proposals for specific metrics is encouraged—join the Slack or open an issue to discuss your ideas.
Viewing metrics with Grafana and Prometheus
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, there are two different ways to query metrics emitted by the wasmCloud host:
- Prometheus' built-in query interface at http://localhost:9090/graph.
- Grafana's "Explore" interface at http://localhost:5050/explore. Once you are in the "View," select "Prometheus" from the dropdown on the top-left corner and under the "Metric" field select the metric you would like to explore.
Depending on what you are trying to accomplish with the metrics, one or the other interface may be a better fit for you.
-
If you are in the process of emitting new metrics, or you are interested in exploring the metrics in a Prometheus-native interface, the Prometheus built-in query interface is probably the better fit.
-
If you are interested in seeing how the metrics would look in an interface that you might use in production, or you are looking to develop a metrics dashboard, the Grafana interface is the better fit.
Refer to the environment variables in the Docker Compose file for a complete example configuration. The example uses Grafana and Prometheus, but wasmCloud works with any OTEL-compatible backend.