Skip to content

OpenTelemetry: Multiple problems sending telemetry to an endpoint #3834

@Ionaru

Description

@Ionaru

Using a fresh project and adding the required OpenTelemetry environment variables as described in https://usefresh.dev/docs/advanced/opentelemetry, shows no indication that OpenTelemetry is logging anything.

Summary of problems I found:

  • OTEL_TRACES_EXPORTER variable name is incorrect, should be OTEL_EXPORTER_OTLP_PROTOCOL.
  • Without OTEL_EXPORTER_OTLP_PROTOCOL=console, no metrics are sent to any endpoint.

Repro using console:

  1. Create a new project: deno run -Ar jsr:@fresh/init telemetry-test --tailwind false --vscode false
  2. cd telemetry-test
  3. deno task build
  4. OTEL_DENO=true OTEL_TRACES_EXPORTER=console deno task start
  5. Go to http://localhost:8000
  6. Navigate around a bit
  7. Notice no extra logging in the terminal
Image

Repro using Jaeger:

  1. Create a new project: deno run -Ar jsr:@fresh/init telemetry-test --tailwind false --vscode false
  2. Run Jaeger: docker run --rm --name jaeger -p 16686:16686 -p 4317:4317 -p 4318:4318 -p 5778:5778 -p 9411:9411 cr.jaegertracing.io/jaegertracing/jaeger:2.19.0
  3. cd telemetry-test
  4. deno task build
  5. OTEL_DENO=true OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317 deno task start
  6. Go to http://localhost:8000
  7. Navigate around a bit
  8. Go to http://localhost:16686
  9. Notice that the service (as unknown_service is not listed, only Jaeger itself is listed (after F5)
Image Image

Optionally check http://localhost:16686/api/v3/services to see if unknown_service is listed. That should be the Fresh application.


One problem I managed to solve by comparing the Fresh and Deno docs is that the OTEL_TRACES_EXPORTER variable should be named OTEL_EXPORTER_OTLP_PROTOCOL

With that variable change, the console starts logging things, confirming that OpenTelemetry is doing something.

Image

NOTE:

After a lot of testing, I found that OTEL_DENO=true OTEL_EXPORTER_OTLP_PROTOCOL=console deno task start also sends data to the Jaeger endpoint. Without OTEL_EXPORTER_OTLP_PROTOCOL=console I have not been able to make that happen.


deno 2.8.2 (stable, release, x86_64-unknown-linux-gnu)
v8 14.9.207.2-rusty
typescript 6.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions