-
Notifications
You must be signed in to change notification settings - Fork 169
declarative config: support Span stacktrace #2262
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
Changes from 48 commits
21d4a01
f9eb67b
35fc448
30d61fc
0f49549
fc7cd07
d786ea6
bf9c8e6
b70486a
4d56209
85ec1cb
83e74a7
9fe79a1
71f21b7
0618b39
27fc125
d27d7ce
1e77d6f
548c0c4
092fce3
dd10055
444833f
4211e85
e4de567
19d017d
fb4a7ef
a9d9c05
4a119c9
4f7014a
6587b31
d0718e6
e042b15
5bf5e78
b3bfd03
712cf27
d2e2ef4
85fad27
65d2f8e
91be485
bfe1c5e
454fe0d
4b10dda
26cc42d
17bbdf0
741de0f
2e4c0bd
4d82100
0dcce5e
0dbfb59
d6b0de2
e72361e
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 |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.contrib.stacktrace; | ||
|
|
||
| import com.google.auto.service.AutoService; | ||
| import io.opentelemetry.api.incubator.config.DeclarativeConfigProperties; | ||
| import io.opentelemetry.instrumentation.config.bridge.DeclarativeConfigPropertiesBridgeBuilder; | ||
| import io.opentelemetry.sdk.autoconfigure.spi.internal.ComponentProvider; | ||
| import io.opentelemetry.sdk.trace.SpanProcessor; | ||
|
|
||
| @SuppressWarnings("rawtypes") | ||
| @AutoService(ComponentProvider.class) | ||
| public class StackTraceComponentProvider implements ComponentProvider<SpanProcessor> { | ||
| @Override | ||
| public String getName() { | ||
| return "experimental-stacktrace"; | ||
|
||
| } | ||
|
|
||
| @Override | ||
| public SpanProcessor create(DeclarativeConfigProperties config) { | ||
| return StackTraceAutoConfig.create( | ||
| new DeclarativeConfigPropertiesBridgeBuilder() | ||
| .addMapping(StackTraceAutoConfig.PREFIX, "") | ||
| .build(config)); | ||
| } | ||
|
|
||
| @Override | ||
| public Class<SpanProcessor> getType() { | ||
| return SpanProcessor.class; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| /* | ||
| * Copyright The OpenTelemetry Authors | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| */ | ||
|
|
||
| package io.opentelemetry.contrib.stacktrace; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| import io.opentelemetry.sdk.OpenTelemetrySdk; | ||
| import io.opentelemetry.sdk.extension.incubator.fileconfig.DeclarativeConfiguration; | ||
| import java.io.ByteArrayInputStream; | ||
| import java.nio.charset.StandardCharsets; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| class StackTraceComponentProviderTest { | ||
| @Test | ||
| void endToEnd() { | ||
| String yaml = | ||
| "file_format: 1.0-rc.1\n" | ||
| + "tracer_provider:\n" | ||
| + " processors:\n" | ||
| + " - experimental-stacktrace:\n"; | ||
|
|
||
| OpenTelemetrySdk openTelemetrySdk = | ||
| DeclarativeConfiguration.parseAndCreate( | ||
| new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8))); | ||
|
|
||
| assertThat(openTelemetrySdk.getSdkTracerProvider().toString()) | ||
| .contains("StackTraceSpanProcessor"); | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.