-
Notifications
You must be signed in to change notification settings - Fork 874
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use autoconfigure SPI for trace-propagators extension. (#3294)
* Use autoconfigure SPI for trace-propagators extension. * final
- Loading branch information
Anuraag Agrawal
authored
Jun 8, 2021
1 parent
d191424
commit 39ec5ba
Showing
10 changed files
with
118 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
.../src/main/java/io/opentelemetry/extension/trace/propagation/B3ConfigurablePropagator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.extension.trace.propagation; | ||
|
||
import io.opentelemetry.context.propagation.TextMapPropagator; | ||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider; | ||
|
||
/** | ||
* A {@link ConfigurablePropagatorProvider} which allows enabling the {@linkplain | ||
* B3Propagator#injectingSingleHeader()} B3-single propagator} with the propagator name {@code b3}. | ||
*/ | ||
public final class B3ConfigurablePropagator implements ConfigurablePropagatorProvider { | ||
@Override | ||
public TextMapPropagator getPropagator() { | ||
return B3Propagator.injectingSingleHeader(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "b3"; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
...main/java/io/opentelemetry/extension/trace/propagation/B3MultiConfigurablePropagator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.extension.trace.propagation; | ||
|
||
import io.opentelemetry.context.propagation.TextMapPropagator; | ||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider; | ||
|
||
/** | ||
* A {@link ConfigurablePropagatorProvider} which allows enabling the {@linkplain | ||
* B3Propagator#injectingMultiHeaders() B3-multi propagator} with the propagator name {@code | ||
* b3multi}. | ||
*/ | ||
public final class B3MultiConfigurablePropagator implements ConfigurablePropagatorProvider { | ||
@Override | ||
public TextMapPropagator getPropagator() { | ||
return B3Propagator.injectingMultiHeaders(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "b3multi"; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
.../main/java/io/opentelemetry/extension/trace/propagation/JaegerConfigurablePropagator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.extension.trace.propagation; | ||
|
||
import io.opentelemetry.context.propagation.TextMapPropagator; | ||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider; | ||
|
||
/** | ||
* A {@link ConfigurablePropagatorProvider} which allows enabling the {@link JaegerPropagator} with | ||
* the propagator name {@code jaeger}. | ||
*/ | ||
public final class JaegerConfigurablePropagator implements ConfigurablePropagatorProvider { | ||
@Override | ||
public TextMapPropagator getPropagator() { | ||
return JaegerPropagator.getInstance(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "jaeger"; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...main/java/io/opentelemetry/extension/trace/propagation/OtTraceConfigurablePropagator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.extension.trace.propagation; | ||
|
||
import io.opentelemetry.context.propagation.TextMapPropagator; | ||
import io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider; | ||
|
||
/** | ||
* A {@link ConfigurablePropagatorProvider} which allows enabling the {@link OtTracePropagator} with | ||
* the propagator name {@code ottrace}. | ||
*/ | ||
public final class OtTraceConfigurablePropagator implements ConfigurablePropagatorProvider { | ||
@Override | ||
public TextMapPropagator getPropagator() { | ||
return OtTracePropagator.getInstance(); | ||
} | ||
|
||
@Override | ||
public String getName() { | ||
return "ottrace"; | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...s/META-INF/services/io.opentelemetry.sdk.autoconfigure.spi.ConfigurablePropagatorProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
io.opentelemetry.extension.trace.propagation.B3ConfigurablePropagator | ||
io.opentelemetry.extension.trace.propagation.B3MultiConfigurablePropagator | ||
io.opentelemetry.extension.trace.propagation.JaegerConfigurablePropagator | ||
io.opentelemetry.extension.trace.propagation.OtTraceConfigurablePropagator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters