I’m trying to use OpenTelemetry auto-instrumentation in Deno with the following environment variables:
OTEL_DENO=true
OTEL_EXPORTER_OTLP_ENDPOINT=
OTEL_SERVICE_NAME=service-1-development
OTEL_METRIC_EXPORT_INTERVAL=10000
I'm running my Deno server with the --unstable-otel
flag.
The OpenTelemetry Collector is running as a Docker container on a remote system and is exposed via a Cloudflare Tunnel, which forwards traffic to http://otel-connector:4318.
If I manually test the endpoint using curl or a browser, I get a 404 page not found, which indicates that the connection itself is working. The tunnel is currently not protected by authentication.
However, when I start my Deno server and send a request, I receive the following error in the logs after a few seconds:
name="BatchSpanProcessor.Flush.ExportError" reason="Other(hyper_util::client::legacy::Error(Connect, ConnectError(\"tcp connect error\", Os { code: 61, kind: ConnectionRefused, message: \"Connection refused\" })))" message=Failed during the export process
Here is my OpenTelemetry Collector configuration (otel-connector-config.yaml
):
receivers:
otlp:
protocols:
http:
endpoint: ":4318"
cors:
allowed_origins:
processors:
batch:
timeout: 1s
send_batch_size: 1024
exporters:
otlphttp:
endpoint: "http://loki:3100/otlp"
service:
telemetry:
logs:
level: "debug"
pipelines:
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
Things I've tried:
- Setting endpoint:
0.0.0.0:4318
in the OTEL Collector config - Using
localhost:4318
instead of otel-connector:4318 - Adding
allowed_origins
explicitly and leaving it empty
None of these changes have resolved the issue.
Question: What could be causing this Connection refused error? Am I missing any configuration steps to make OpenTelemetry auto-instrumentation work with Deno?
Thanks in advance for any help!