Get started with auto-instrumentation ΒΆ

Auto-instrumentation injects an OpenTelemetry agent into your application at startup. The agent hooks into popular libraries and frameworks to collect traces and runtime metrics β€” without code changes. Log export via OpenTelemetry is available as an opt-in.

Supported runtimes: Java/Kotlin, Node.js, Python, and SDK-only mode for Go and other languages that provide their own OpenTelemetry setup.

What you get ΒΆ

Once enabled, the agent automatically instruments:

CategoryExamples (vary by runtime)
HTTP serversSpring MVC, Ktor, Express, Flask, Koa
HTTP clientsOkHttp, Apache HttpClient, node-fetch, requests
DatabasesPostgreSQL (JDBC, node-postgres), Valkey/Redis
MessagingKafka producers/consumers
gRPCClient and server calls
FrameworksSpring Boot, Ktor, Micrometer bridge

This data powers the Nais APM dashboards β€” service inventory, RED metrics (Rate/Errors/Duration), dependency maps, and runtime metrics β€” with no extra configuration.

Enable auto-instrumentation ΒΆ

Add the following to your nais.yaml and deploy:

yaml
yaml
yaml

This sets up the OpenTelemetry environment variables but does not inject an agent. Use this when your application configures the OpenTelemetry SDK itself.

yaml

Verify it works ΒΆ

After deploying, check that traces are flowing:

  1. Find your application in the list β€” it should appear within a few minutes
  2. Click through to see RED dashboards, operations breakdown, and dependencies

If your app does not appear, check the auto-instrumentation configuration reference for troubleshooting environment variables, and make sure your application is receiving traffic.

You can also verify in Grafana Explore using the Tempo data source:

Plaintext

Next steps ΒΆ