Skip to content

feat: add otel support #554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: develop
Choose a base branch
from
Open

feat: add otel support #554

wants to merge 12 commits into from

Conversation

nyannyacha
Copy link
Contributor

@nyannyacha nyannyacha commented Jul 8, 2025

What kind of change does this PR introduce?

Feature, Enhancement

Description

This PR adds OpenTelemetry support

Usage

OTEL_EXPORTER_OTLP_ENDPOINT:
It is an OTLP endpoint that receives various trace data.
Please note that due to limitations in the current implementation of Deno Otel, only the HTTP protocol is supported.
An example of a valid value is http://127.0.0.1:4318/.

OTEL_SERVICE_NAME:
It is the service name used to identify various trace data.
It is not required, but please note that it will be displayed as unknown_service in tools such as SigNoz.

In addition to these environment variables, two CLI flags have been added. These are separate from user workers (otel settings for user workers can be configured in the main script) and are related to Otel settings in main and event workers.

--enable-otel[=<worker kind>...]:
Enables Otel (not user worker).
Otel is disabled by default for main and event worker.

If only the flag is specified, Otel is enabled for both main and event worker.
In addition, if you only want to enable Otel for the event worker, use --enable-otel=event

--otel-console[=<ignore, capture, replace>]:
Enables auto instrumentation for console.* in main and event workers.
The default value is ignore.
For more information about this value, see https://docs.deno.com/runtime/fundamentals/open_telemetry/#logs.

Enable Otel in the user worker:

When creating a user worker from the main worker, you can pass otelConfig as a parameter to EdgeRuntime.userWorkers.create().

await EdgeRuntime.userWorkers.create({
  ...
  otelConfig: {
    // Specify whether to enable tracing in this user worker. If not specified or set to false, instrumentation will not be performed.
    tracing_enabled: true,
    // Specify the propagators to be used to extract or inject from (in this case, HTTP requests or responses) the carrier.
    // TraceContext: https://www.w3.org/TR/trace-context
    // Baggage: https://www.w3.org/TR/baggage
    // "TraceContext" | "Baggage"[]
    propagators: ["TraceContext", "Baggage"],
    // See https://docs.deno.com/runtime/fundamentals/open_telemetry/#logs
    // "Ignore" | "Capture" | "Replace"
    console: "Ignore"
  },
});

(Detailed options for otelConfig can be found in types/global.d.ts in PR.)

Closes FUNC-254

nyannyacha and others added 2 commits July 8, 2025 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants