Skip to content
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

Update SDK version from 1.19.0 to 1.20.1 #7223

Merged
merged 5 commits into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions bom-alpha/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ javaPlatform {
allowDependencies()
}

val otelVersion: String by project

dependencies {
api(platform("io.opentelemetry:opentelemetry-bom:${otelVersion}"))
api(platform("io.opentelemetry:opentelemetry-bom-alpha:${otelVersion}-alpha"))
api(platform("io.opentelemetry:opentelemetry-bom"))
api(platform("io.opentelemetry:opentelemetry-bom-alpha"))
api(platform(project(":bom")))
}

Expand Down
4 changes: 1 addition & 3 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ javaPlatform {
allowDependencies()
}

val otelVersion: String by project

dependencies {
api(platform("io.opentelemetry:opentelemetry-bom:${otelVersion}"))
api(platform("io.opentelemetry:opentelemetry-bom"))
}

otelBom.projectFilter.set { it.findProperty("otel.stable") == "true" }
9 changes: 2 additions & 7 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ data class DependencySet(val group: String, val version: String, val modules: Li
val dependencyVersions = hashMapOf<String, String>()
rootProject.extra["versions"] = dependencyVersions

// this line is managed by .github/scripts/update-sdk-version.sh
val otelVersion = "1.19.0"
Copy link
Member

Choose a reason for hiding this comment

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

Oops 🙊

Copy link
Member Author

Choose a reason for hiding this comment

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

ya 😞


rootProject.extra["otelVersion"] = otelVersion

// Need both BOM and groovy jars
val groovyVersion = "4.0.6"

Expand All @@ -34,8 +29,8 @@ val DEPENDENCY_BOMS = listOf(
"com.fasterxml.jackson:jackson-bom:2.14.0",
"com.google.guava:guava-bom:31.1-jre",
"org.apache.groovy:groovy-bom:${groovyVersion}",
"io.opentelemetry:opentelemetry-bom:${otelVersion}",
"io.opentelemetry:opentelemetry-bom-alpha:${otelVersion}-alpha",
"io.opentelemetry:opentelemetry-bom:1.20.1",
"io.opentelemetry:opentelemetry-bom-alpha:1.20.1-alpha",
"org.junit:junit-bom:5.9.1",
"org.testcontainers:testcontainers-bom:1.17.6",
"org.spockframework:spock-bom:2.3-groovy-4.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.context.propagation.TextMapGetter;
import io.opentelemetry.context.propagation.TextMapSetter;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import java.util.Collections;
import java.util.Map;
import org.apache.camel.Endpoint;
Expand All @@ -28,8 +27,9 @@ private static boolean isAwsPropagated(Endpoint endpoint) {
return endpoint.getClass().getName().endsWith("SqsEndpoint");
}

@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
private static Context extractAwsPropagationParent(Map<String, Object> exchangeHeaders) {
return AwsXrayPropagator.getInstance()
return io.opentelemetry.extension.aws.AwsXrayPropagator.getInstance()
.extract(
Context.current(),
Collections.singletonMap("X-Amzn-Trace-Id", exchangeHeaders.get("AWSTraceHeader")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import io.opentelemetry.api.trace.SpanContext;
import io.opentelemetry.context.Context;
import io.opentelemetry.context.propagation.TextMapGetter;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import java.util.Collections;
import java.util.Locale;
import java.util.Map;
Expand Down Expand Up @@ -54,8 +53,9 @@ private static Context fromHttpHeaders(
// lower-case map getter used for extraction
static final String AWS_TRACE_HEADER_PROPAGATOR_KEY = "x-amzn-trace-id";

@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
public static Context fromXrayHeader(String parentHeader) {
return AwsXrayPropagator.getInstance()
return io.opentelemetry.extension.aws.AwsXrayPropagator.getInstance()
.extract(
// see BaseTracer#extract() on why we're using root() here
Context.root(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.api.OpenTelemetry;
import io.opentelemetry.context.propagation.ContextPropagators;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import io.opentelemetry.extension.trace.propagation.B3Propagator;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -42,11 +41,14 @@ public void shouldCreateNoopRequestIfNoPropagatorsSet() throws IOException {
}

@Test
@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
public void shouldCreateNoopRequestIfXrayPropagatorsSet() throws IOException {
// given
InputStream mock = mock(InputStream.class);
GlobalOpenTelemetry.set(
OpenTelemetry.propagating(ContextPropagators.create(AwsXrayPropagator.getInstance())));
OpenTelemetry.propagating(
ContextPropagators.create(
io.opentelemetry.extension.aws.AwsXrayPropagator.getInstance())));
// when
ApiGatewayProxyRequest created = ApiGatewayProxyRequest.forStream(mock);
// then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.propagation.TextMapGetter;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import java.util.Collections;
import java.util.Map;

Expand All @@ -29,9 +28,10 @@ public String get(Map<String, String> map, String s) {

static final String AWS_TRACE_SYSTEM_ATTRIBUTE = "AWSTraceHeader";

@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
static Context ofSystemAttributes(Map<String, String> systemAttributes) {
String traceHeader = systemAttributes.get(AWS_TRACE_SYSTEM_ATTRIBUTE);
return AwsXrayPropagator.getInstance()
return io.opentelemetry.extension.aws.AwsXrayPropagator.getInstance()
.extract(
Context.root(),
Collections.singletonMap("X-Amzn-Trace-Id", traceHeader),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import com.amazonaws.handlers.HandlerContextKey;
import com.amazonaws.handlers.RequestHandler2;
import io.opentelemetry.context.Context;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import java.util.List;
import javax.annotation.Nullable;
Expand All @@ -33,14 +32,16 @@ final class TracingRequestHandler extends RequestHandler2 {
}

@Override
@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
public void beforeRequest(Request<?> request) {
Context parentContext = Context.current();
if (!requestInstrumenter.shouldStart(parentContext, request)) {
return;
}
Context context = requestInstrumenter.start(parentContext, request);

AwsXrayPropagator.getInstance().inject(context, request, HeaderSetter.INSTANCE);
io.opentelemetry.extension.aws.AwsXrayPropagator.getInstance()
.inject(context, request, HeaderSetter.INSTANCE);

request.addHandlerContext(CONTEXT, context);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import io.opentelemetry.context.Context;
import io.opentelemetry.context.propagation.TextMapGetter;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import java.util.Collections;
import java.util.Map;

Expand All @@ -29,9 +28,10 @@ public String get(Map<String, String> map, String s) {

static final String AWS_TRACE_SYSTEM_ATTRIBUTE = "AWSTraceHeader";

@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
static Context ofSystemAttributes(Map<String, String> systemAttributes) {
String traceHeader = systemAttributes.get(AWS_TRACE_SYSTEM_ATTRIBUTE);
return AwsXrayPropagator.getInstance()
return io.opentelemetry.extension.aws.AwsXrayPropagator.getInstance()
.extract(
Context.root(),
Collections.singletonMap("X-Amzn-Trace-Id", traceHeader),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import io.opentelemetry.api.trace.Span;
import io.opentelemetry.context.Scope;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import java.util.ArrayList;
Expand Down Expand Up @@ -124,6 +123,7 @@ private static List<String> getAttributeNames(SdkRequest request) {
}

@Override
@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
public SdkHttpRequest modifyHttpRequest(
Context.ModifyHttpRequest context, ExecutionAttributes executionAttributes) {
SdkHttpRequest httpRequest = context.httpRequest();
Expand All @@ -134,7 +134,8 @@ public SdkHttpRequest modifyHttpRequest(
}

SdkHttpRequest.Builder builder = httpRequest.toBuilder();
AwsXrayPropagator.getInstance().inject(otelContext, builder, RequestHeaderSetter.INSTANCE);
io.opentelemetry.extension.aws.AwsXrayPropagator.getInstance()
.inject(otelContext, builder, RequestHeaderSetter.INSTANCE);
return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import io.opentelemetry.api.baggage.propagation.W3CBaggagePropagator;
import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
import io.opentelemetry.context.propagation.TextMapPropagator;
import io.opentelemetry.extension.aws.AwsXrayPropagator;
import io.opentelemetry.extension.trace.propagation.B3Propagator;
import io.opentelemetry.extension.trace.propagation.JaegerPropagator;
import io.opentelemetry.extension.trace.propagation.OtTracePropagator;
Expand All @@ -27,6 +26,7 @@ public final class CompositeTextMapPropagatorFactory {
private static final Logger logger =
Logger.getLogger(CompositeTextMapPropagatorFactory.class.getName());

@SuppressWarnings("deprecation") // deprecated class to be updated once published in new location
static TextMapPropagator getCompositeTextMapPropagator(
BeanFactory beanFactory, List<String> types) {

Expand Down Expand Up @@ -70,8 +70,8 @@ static TextMapPropagator getCompositeTextMapPropagator(
if (isOnClasspath("io.opentelemetry.extension.aws.AwsXrayPropagator")) {
propagators.add(
beanFactory
.getBeanProvider(AwsXrayPropagator.class)
.getIfAvailable(AwsXrayPropagator::getInstance));
.getBeanProvider(io.opentelemetry.extension.aws.AwsXrayPropagator.class)
.getIfAvailable(io.opentelemetry.extension.aws.AwsXrayPropagator::getInstance));
}
break;
case "tracecontext":
Expand Down
Loading