Skip to content

Matrix test for declarative config #14084

Open
@zeitlinger

Description

@zeitlinger

Is your feature request related to a problem? Please describe.

Even though the config bridge should make it transparent if declarative config is used or not, a matrix test would be good.

Describe the solution you'd like

We could run a matrix test with an env var DECLARATIVE_CONFIG=true that would

  • assumeFalse() on unit tests or spring starter (not sure how to do that)
  • collect all otel sys props on agent start and write them to a config file

The process is basically the reverse of

private <T> T getPropertyValue(
String property, BiFunction<DeclarativeConfigProperties, String, T> extractor) {
if (!property.startsWith(OTEL_INSTRUMENTATION_PREFIX)) {
return null;
}
String suffix = property.substring(OTEL_INSTRUMENTATION_PREFIX.length());
// Split the remainder of the property on ".", and walk to the N-1 entry
String[] segments = suffix.split("\\.");
if (segments.length == 0) {
return null;
}
DeclarativeConfigProperties target = instrumentationJavaNode;
if (segments.length > 1) {
for (int i = 0; i < segments.length - 1; i++) {
target = target.getStructured(segments[i], empty());
}
}
String lastPart = segments[segments.length - 1];
return extractor.apply(target, lastPart);
}

Depends on #14014 to get the test bridge (memory) exporter: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/58a23223dad5e39f0c110a029cfce0c8cb397297/testing/agent-exporter/src/main/java/io/opentelemetry/javaagent/testing/provider/TestBridgeLogRecordExporterComponentProvider.java

Describe alternatives you've considered

No response

Additional context

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestneeds triageNew issue that requires triage

Type

No type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions