Skip to content

Fix - Simplify otel configuration and deprecate SW_APM_EXPORT_LOGS_ENABLED#421

Open
cleverchuk wants to merge 1 commit intomainfrom
cc/NH-130788
Open

Fix - Simplify otel configuration and deprecate SW_APM_EXPORT_LOGS_ENABLED#421
cleverchuk wants to merge 1 commit intomainfrom
cc/NH-130788

Conversation

@cleverchuk
Copy link
Contributor

Summary

Replaces per-signal OTLP configuration (separate endpoints, headers, and protocol for traces, metrics, and logs) with a single global OTLP configuration. This eliminates ~390 lines of duplicated logic across three nearly-identical methods and deprecates the SW_APM_EXPORT_LOGS_ENABLED environment variable.


Motivation

The previous implementation configured each OTLP signal (traces, metrics, logs) independently via dedicated methods (configureOtelTraceExport, configureOtelMetricExport, configureOtelLogExport). Each method:

  • Parsed the collector endpoint to extract data-cell and environment
  • Resolved the protocol (defaulting to http/protobuf)
  • Constructed a signal-specific endpoint with a path suffix (e.g., /v1/traces, /v1/metrics, /v1/logs)
  • Set signal-specific system properties (otel.exporter.otlp.traces.*, otel.exporter.otlp.metrics.*, otel.exporter.otlp.logs.*)

This was unnecessary because the OTel SDK natively supports global OTLP configuration (otel.exporter.otlp.endpoint, otel.exporter.otlp.headers) and automatically appends the correct signal path when per-signal overrides are absent. The agent was reimplementing logic the SDK already provides.

Changes

Unified configureOtel method

The three per-signal methods are replaced by a single configureOtel method that sets only two global properties:

  • otel.exporter.otlp.headers — Bearer token derived from the service key
  • otel.exporter.otlp.endpoint — Base collector URL (without signal path suffixes)

Both properties are set only if not already configured by the user (via system property or environment variable), preventing the agent from clobbering explicit user configuration.

Removed hardcoded protocol default

The agent no longer forces otel.exporter.otlp.protocol=http/protobuf. The OTel SDK's own default protocol is used instead. The lambda properties supplier also drops its otel.exporter.otlp.protocol=grpc override.

Metrics exporter no longer disabled by default

otel.metrics.exporter=none is removed from SolarwindsPropertiesSupplier. Metrics export is now enabled by default, aligning with the SDK's standard behavior.

Deprecated SW_APM_EXPORT_LOGS_ENABLED

Log export was previously gated behind SW_APM_EXPORT_LOGS_ENABLED. With global OTLP config, log export behavior is now controlled by the standard otel.logs.exporter property (still defaulted to none in the properties supplier). The custom flag is no longer evaluated.

Simplified internal helpers

Removed setSystemProperty, setEndpoint, setProtocol, and getConfigValue. Replaced with a single isConfigNotSet(key) predicate that checks both system properties and environment variables.

Testing

Tests are rewritten to validate the new global configuration behavior:

  • Endpoint is formed correctly from collector URL (with and without port)
  • AppOptics URLs are still rejected
  • Default endpoint falls back to na-01.cloud when no collector is configured
  • Global headers and endpoint are not overwritten when already set by the user

Test services data

  1. e-1712644058766987264
  2. e-1712643928659124224
  3. e-1742334541200846848
  4. e-1777406072376840192

@cleverchuk cleverchuk requested review from a team as code owners February 19, 2026 20:52
}

static void configureOtelMetricExport(ConfigContainer container) throws InvalidConfigException {
static void configureOtel(ConfigContainer container) throws InvalidConfigException {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just making sure:SW_APM_EXPORT_LOGS_ENABLED is deprecated from this, not fully dropped?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...i.e. we do want to drop its support, but I'm not clear on if this introduces deprecation-with-a-warning first

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes. it's noop now.

Copy link

@tammy-baylis-swi tammy-baylis-swi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! So much tidier and agree it's good to use what OTel SDK is already doing. Just had a question.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments