Skip to content

New - Upgrade OpenTelemetry Dependencies and Fix Declarative Configuration#413

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

New - Upgrade OpenTelemetry Dependencies and Fix Declarative Configuration#413
cleverchuk wants to merge 1 commit intomainfrom
cc/NH-126259

Conversation

@cleverchuk
Copy link
Contributor

🎯 Overview

This PR upgrades OpenTelemetry dependencies to the latest versions and refactors declarative configuration implementation to align with API changes in OpenTelemetry SDK 1.58.0 and Java Instrumentation 2.24.0.

📦 Dependency Updates

Core Dependencies

  • OpenTelemetry Java Agent: 2.23.02.24.0
  • OpenTelemetry SDK: 1.57.01.58.0
  • ByteBuddy: 1.15.101.18.4
  • OpenTelemetry Java Contrib: 1.52.0-alpha1.53.0-alpha

🔧 Key Changes

1. Declarative Configuration Refactoring

Introduction of Typed Property Models

Replaced usage of Collections.emptyMap() and raw Map<String, Object> with strongly-typed property model classes:

  • ExperimentalResourceDetectorPropertyModel
  • SpanProcessorPropertyModel
  • SamplerPropertyModel
  • PushMetricExporterPropertyModel
  • ExperimentalLanguageSpecificInstrumentationPropertyModel

Impact: Improves type safety and aligns with OpenTelemetry SDK's declarative configuration API changes.

Example Transformation

Before:

new ExperimentalResourceDetectorModel()
    .withAdditionalProperty(
        ResourceComponentProvider.COMPONENT_NAME, Collections.emptyMap());

After:

new ExperimentalResourceDetectorModel()
    .withAdditionalProperty(
        ResourceComponentProvider.COMPONENT_NAME,
        new ExperimentalResourceDetectorPropertyModel());

2. Metric Export Configuration Updates

Updated default metric export settings in SharedConfigCustomizerProvider:

Property Old Value New Value
temporality_preference cumulative delta
default_histogram_aggregation explicit_bucket_histogram base2_exponential_bucket_histogram

3. API Signature Updates

IgnoredTypesConfigurer Interface

Updated method signature to match OpenTelemetry API changes:

// Before
void configure(IgnoredTypesBuilder builder, ConfigProperties config)

// After
void configure(IgnoredTypesBuilder builder)

4. Test Improvements

New Test Coverage

Added comprehensive unit tests for DeclarativeLoader to validate:

  • Declarative configuration parsing
  • Configuration loading via beforeAgent hook
  • Service key and collector endpoint configuration

Enhanced Mock-Based Testing

Updated exporter customizer tests to use proper mocking instead of creating real instances:

Improvements:

  • Mock builder pattern usage for exporters
  • Verify setProxyOptions()/setProxy() calls instead of object inequality
  • More focused unit tests that test behavior rather than implementation

Before:

OtlpHttpSpanExporter originalExporter = OtlpHttpSpanExporter.builder().build();
SpanExporter result = tested.apply(originalExporter, configProperties);
assertNotSame(originalExporter, result);

After:

OtlpHttpSpanExporter originalExporter = mock(OtlpHttpSpanExporter.class);
OtlpHttpSpanExportBuilder builder = mock(OtlpHttpSpanExporterBuilder.class);

when(originalExporter.toBuilder()).thenReturn(builder);
when(builder.setProxy(any(ProxyOptions.class))).thenReturn(builder);
when(builder.build()).thenReturn(mock(OtlpHttpSpanExporter.class));

tested.apply(originalExporter, configProperties);
verify(builder).setProxy(any(ProxyOptions.class));

Test Data Refactoring

  • Replaced anonymous inner classes with typed property models
  • Updated test assertions to reflect metric configuration changes (delta temporality, exponential histograms)
  • Improved type safety in test setup

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 5, 2026 20:10
@cleverchuk cleverchuk requested a review from Copilot February 6, 2026 05:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades OpenTelemetry dependencies (Java Agent 2.23.0→2.24.0, SDK 1.57.0→1.58.0, ByteBuddy 1.15.10→1.18.4, Java Contrib 1.52.0→1.53.0-alpha) and refactors declarative configuration to use strongly-typed property models instead of raw maps, aligning with API changes in the new versions.

Changes:

  • Replaced Collections.emptyMap() and Map<String, Object> with typed property model classes for declarative configuration
  • Updated metric export defaults (temporality_preference: cumulative→delta, default_histogram_aggregation: explicit_bucket_histogram→base2_exponential_bucket_histogram)
  • Updated IgnoredTypesConfigurer interface signature to remove unused ConfigProperties parameter

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
dependencyManagement/build.gradle.kts Updates OpenTelemetry and ByteBuddy dependency versions
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/SharedConfigCustomizerProvider.java Replaces raw maps with typed property models and updates metric export configuration values
libs/shared/src/main/java/com/solarwinds/opentelemetry/extensions/SolarwindsIgnoredTypesConfigurer.java Removes unused ConfigProperties parameter from configure method
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/provider/CustomConfigCustomizerProvider.java Replaces Collections.emptyMap() with typed property models for resource detectors and processors
custom/src/main/java/com/solarwinds/opentelemetry/extensions/config/DeclarativeLoader.java Refactors configuration loading to use ExtendedOpenTelemetry API instead of ConfigProvider
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/config/provider/SharedConfigCustomizerProviderTest.java Updates tests to use typed property models and validates new metric configuration defaults
libs/shared/src/test/java/com/solarwinds/opentelemetry/extensions/MetricExporterCustomizerTest.java Refactors test to use mocks and verify behavior instead of object inequality
custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/SpanExporterCustomizerTest.java Refactors test to use mocks and verify setProxy call
custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/LogRecordExporterCustomizerTest.java Refactors test to use mocks and verify setProxyOptions call
custom/src/test/java/com/solarwinds/opentelemetry/extensions/config/DeclarativeLoaderTest.java Adds new test coverage for declarative configuration parsing
README.md Updates OTEL version badge from 2.3.0 to 2.24.0

Copy link
Contributor

@cheempz cheempz left a comment

Choose a reason for hiding this comment

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

LGTM! left a couple questions :)

new PushMetricExporterPropertyModel()
.withAdditionalProperty("timeout", 10000)
.withAdditionalProperty("protocol", "grpc")
.withAdditionalProperty("compression", "gzip")
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a premature question since we haven't officialy introduce declarative config for APM Java--just noticed here the protocol is set to grpc. For the proxy config feature #345 we switched to http/proto, so wondering:

  1. should we set it to same here?
  2. if a customer has both proxy config and uses declarative file, would the settings here like compression, temporality, etc be carried over to the customized proxy-enabled exporter?

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