Skip to content

add end to end test for declarative config for aws #2047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Jul 22, 2025

See #2014 (comment)

I'll add the other cloud providers, too, if this is a good pattern.


testImplementation("com.linecorp.armeria:armeria-junit5")
testRuntimeOnly("org.bouncycastle:bcpkix-jdk15on")
testImplementation("com.google.guava:guava")
testImplementation("org.skyscreamer:jsonassert")
testImplementation("org.junit-pioneer:junit-pioneer")
Copy link
Member

Choose a reason for hiding this comment

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

what is this added dependency used for?

@@ -19,6 +24,22 @@ void providerIsLoaded() {
Iterable<ComponentProvider> providers =
ComponentLoader.forClassLoader(ResourceComponentProviderTest.class.getClassLoader())
.load(ComponentProvider.class);
assertThat(providers).extracting(ComponentProvider::getName).containsExactly("aws");
assertThat(providers).extracting(ComponentProvider::getName).contains("aws");
Copy link
Member

Choose a reason for hiding this comment

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

I was curious about the need for changing containsExactly to contains so i tried to put this back to containsExactly to see what would happen, and noticed that in the test failure it lists console 3 times, plus an additional service:

Expecting actual:
  ["aws", "console", "console", "console", "service"]
to contain exactly (and in same order):
  ["aws"]
but some elements were not expected:
  ["console", "console", "console", "service"]

I changed the test code to get some insights into what was actually loaded to see. Looks like this is because declarative configuration is automatically adding additional console exporters for metrics and logs plus the service resource detector.

Expecting actual:
  [io.opentelemetry.contrib.aws.resource.internal.AwsResourceDetector,
    io.opentelemetry.exporter.logging.internal.ConsoleMetricExporterComponentProvider,
    io.opentelemetry.exporter.logging.internal.ConsoleSpanExporterComponentProvider,
    io.opentelemetry.exporter.logging.internal.ConsoleLogRecordExporterComponentProvider,
    io.opentelemetry.sdk.extension.incubator.fileconfig.ServiceResourceDetector]

This surprised me a bit because I thought if the metric and log exporters weren't explicitly defined, they wouldn't be configured. Is my understanding off here?

Copy link
Member

@jaydeluca jaydeluca left a comment

Choose a reason for hiding this comment

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

I'll add the other cloud providers, too, if this is a good pattern.

This seems like a reasonable approach to me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants