diff --git a/runtime/fundamentals/open_telemetry.md b/runtime/fundamentals/open_telemetry.md index dce7d351f..0e195b87a 100644 --- a/runtime/fundamentals/open_telemetry.md +++ b/runtime/fundamentals/open_telemetry.md @@ -92,6 +92,41 @@ You can also create your own metrics, traces, and logs using the `npm:@opentelemetry/api` package. [Learn more about user defined metrics](#user-metrics). +## Console exporter + +For local development and writing instrumentation, set +`OTEL_EXPORTER_OTLP_PROTOCOL=console` to make Deno write spans, logs, and +metrics directly to stderr in a human-readable text format. No OTLP collector +is needed and no endpoint configuration is required. + +```sh +OTEL_DENO=true OTEL_EXPORTER_OTLP_PROTOCOL=console deno run my_script.ts +``` + +Example output: + +``` +SPAN inner span [00000000000000000000000000000001/0000000000000002] Internal 0.495ms + parent: 0000000000000001 + scope: example-tracer + key: value +LOG [INFO] 2026-03-14T13:47:07.235Z "hello from inner" + scope: deno@2.8.0 + trace: 00000000000000000000000000000001/0000000000000002 +METRIC http.server.request.duration histogram + count: 3 sum: 0.012s +``` + +The console exporter is the recommended way to: + +- iterate on custom traces / metrics without round-tripping through a + collector, +- verify that auto-instrumentation is firing as expected, and +- include OTel output in CI logs for ad-hoc debugging. + +For production, switch to `http/protobuf`, `http/json`, or `grpc` — see +[Configuration](#configuration). + ## Auto instrumentation Deno automatically collects and exports some observability data to the OTLP