Getting Started with Observability in Nais ΒΆ
This tutorial walks you through enabling observability for your Nais application and finding your data in the Grafana stack.
Prerequisites ΒΆ
- A Nais application deployed to a cluster
- Access to your team's Grafana instance
1. Enable auto-instrumentation ΒΆ
Add auto-instrumentation to your nais.yaml and deploy:
yaml
spec:
observability:
autoInstrumentation:
enabled: true
runtime: java # or: nodejs, python, sdkNais injects the OpenTelemetry agent at startup. No code changes needed.
π― Full auto-instrumentation guide
2. Find your app in APM ΒΆ
Open the Nais APM service inventory. Your application should appear within a few minutes of receiving traffic. The APM shows:
- RED dashboards β request rate, error rate, and latency
- Operations breakdown β which endpoints are slowest
- Dependencies β downstream services, databases, and message brokers
- Runtime metrics β JVM heap, Go goroutines, Node.js event loop
3. Explore metrics ΒΆ
Metrics are scraped automatically from your application's /metrics endpoint and stored in Mimir.
- Open Grafana Explore and select a Mimir/Prometheus data source
- Query your metrics with PromQL, e.g.
http_server_request_duration_seconds_bucket{service_name="my-app"} - Create dashboards or use the default Nais app dashboard
4. Explore logs ΒΆ
Logs sent to stdout/stderr are collected automatically by Loki.
- In Grafana Explore, select a Loki data source
- Query:
{app="my-app"} | logfmt - For private logs, configure Team Logs
5. Explore traces ΒΆ
Traces collected by the OpenTelemetry agent are stored in Tempo.
- In the APM, click any operation to jump to matching traces
- Or use Grafana Explore with a Tempo data source to run TraceQL queries
- Correlate traces with logs for full request context
Next steps ΒΆ
- Add custom spans and metrics for business-specific tracing