apache / pulsar

Apache Pulsar - distributed pub-sub messaging system
https://pulsar.apache.org/
Apache License 2.0
14.26k stars 3.59k forks source link

[improve][misc] Disable OTel by default when running the pulsar-perf tool #23585

Open Shawyeok opened 1 week ago

Shawyeok commented 1 week ago

Fixes #23475

Motivation

Since pulsar 3.3.0 (https://github.com/apache/pulsar/pull/22179), pulsar-perf constantly print warning message on the console if user haven't configured a OTel-compatible metric collector in their environment. To align with broker, proxy, and other components, OTel metric collection should be disabled in pulsar-perf by default. https://github.com/apache/pulsar/pull/22010

With this patch, the following log will appear before running the performance test:

Nov 10, 2024 3:36:19 PM io.opentelemetry.api.GlobalOpenTelemetry maybeAutoConfigureAndSetGlobal
INFO: AutoConfiguredOpenTelemetrySdk found on classpath but automatic configuration is disabled. To enable, run your JVM with -Dotel.java.global-autoconfigure.enabled=true

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

Does this pull request potentially affect one of the following parts:

If the box was checked, please highlight the changes

Documentation

Matching PR in forked repository

PR in forked repository:

lhotari commented 1 week ago

An alternative would be to have OTel configured, but disabled by default as it's done in Pulsar's OpenTelemetryService: https://github.com/apache/pulsar/blob/dd1b57944b117d16ebd371996b44c02af2ce325c/pulsar-opentelemetry/src/main/java/org/apache/pulsar/opentelemetry/OpenTelemetryService.java#L74-L75 .

@dragosvictor Please review this PR and suggest a suitable approach.

Shawyeok commented 1 week ago

@lhotari Thanks for pointed out, otel.sdk.disabled=true is documented in PIP-320, so I think it would be better have a consistent toggle option to enable OTel in pulsar.