Skip to content

OTEL_SDK_DISABLED in v2 is not working the same way as v1 #185

@rmachado-studocu

Description

@rmachado-studocu

Note

TL;DR
OTEL_SDK_DISABLED behaves differently in v2 of @vercel/otel

If you are using this environment variable to enable/disable OpenTelemetry's SDK (and even @vercel/otel's start()), change the usage of "false" (or "0") to "".

In v2's @vercel/otel, the package evaluates OTEL_SDK_DISABLED as "if it is set, it is disabled, if it is not set (or is empty string), it is enabled".

In v1's case, because it made use of the removed parseEnvironment function from OpenTelemetry, it would evaluate the value as a boolean.
This means that OTEL_SDK_DISABLED=true and OTEL_SDK_DISABLED=false would evaluate as the boolean value of true or false:

Now v2 is doing Boolean(env.OTEL_SDK_DISABLED). Meaning that Boolean("false") === true.

My take on this is that either @vercel/otel should backport parseEnviroment's functionality or at least state it as a breaking change, at least for those using this ENV variable, given that it disables completely the SDK whether you set it to "false" or "true" (old values).

In any case, setting it to "" instead of "false" should do the trick

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