-
Notifications
You must be signed in to change notification settings - Fork 163
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,13 @@ | |
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import io.opentelemetry.api.common.Attributes; | ||
import io.opentelemetry.common.ComponentLoader; | ||
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; | ||
import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; | ||
import io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions; | ||
import io.opentelemetry.semconv.incubating.CloudIncubatingAttributes; | ||
import org.assertj.core.api.InstanceOfAssertFactory; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class ResourceComponentProviderTest { | ||
|
@@ -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"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was curious about the need for changing
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.
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? |
||
} | ||
|
||
@Test | ||
void endToEnd() { | ||
assertThat( | ||
AutoConfiguredOpenTelemetrySdk.initialize() | ||
.getOpenTelemetrySdk() | ||
.getSdkTracerProvider()) | ||
.extracting("sharedState") | ||
.extracting("resource") | ||
.extracting( | ||
"attributes", | ||
new InstanceOfAssertFactory<>(Attributes.class, OpenTelemetryAssertions::assertThat)) | ||
.containsEntry( | ||
CloudIncubatingAttributes.CLOUD_PROVIDER, | ||
CloudIncubatingAttributes.CloudProviderIncubatingValues.AWS); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
file_format: "1.0-rc.1" | ||
resource: | ||
detection/development: | ||
detectors: | ||
- aws: | ||
tracer_provider: | ||
processors: | ||
- simple: | ||
exporter: | ||
console: |
There was a problem hiding this comment.
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?