Skip to content

Commit

Permalink
Update otel version (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
trask authored Sep 17, 2023
1 parent d983e7f commit 811d8d7
Show file tree
Hide file tree
Showing 23 changed files with 73 additions and 60 deletions.
10 changes: 10 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
"config:base"
],
"packageRules": [
{
"matchPackageNames": [
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha"
],
// Renovate's default behavior is only to update from unstable -> unstable if it's for the
// major.minor.patch, under the assumption that you would want to update to the stable version
// of that release instead of the unstable version for a future release (but there's never any
// stable version of opentelemetry-instrumentation-bom-alpha so this logic doesn't apply
"ignoreUnstable": false
},
{
"matchPackagePrefixes": ["ch.qos.logback:"],
"groupName": "logback packages"
Expand Down
2 changes: 1 addition & 1 deletion aws-resources/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
api("io.opentelemetry:opentelemetry-api")
api("io.opentelemetry:opentelemetry-sdk")

implementation("io.opentelemetry:opentelemetry-semconv")
implementation("io.opentelemetry.semconv:opentelemetry-semconv")

compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.IOException;
import java.util.Collections;
import java.util.Locale;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.api.common.AttributesBuilder;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.util.Map;
import java.util.stream.Stream;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.File;
import java.io.IOException;
import java.util.ServiceLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.util.ServiceLoader;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Collections;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.File;
import java.io.IOException;
import java.util.ServiceLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.autoconfigure.spi.ResourceProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;
Expand Down
7 changes: 7 additions & 0 deletions aws-xray/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ testing {
}
}
}

configurations.all {
resolutionStrategy {
// TODO this module still needs to be updated to the latest semconv
force("io.opentelemetry:opentelemetry-semconv:1.28.0-alpha")
}
}
3 changes: 1 addition & 2 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ val DEPENDENCY_BOMS = listOf(
"com.linecorp.armeria:armeria-bom:1.25.2",
"org.junit:junit-bom:5.10.0",
"io.grpc:grpc-bom:1.58.0",
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.28.0-alpha",
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.30.0-alpha",
"org.testcontainers:testcontainers-bom:1.19.0"
)

Expand Down Expand Up @@ -46,7 +46,6 @@ val CORE_DEPENDENCIES = listOf(
)

val DEPENDENCIES = listOf(
"io.opentelemetry.javaagent:opentelemetry-javaagent:1.30.0",
"com.google.code.findbugs:annotations:3.0.1u2",
"com.google.code.findbugs:jsr305:3.0.2",
"com.squareup.okhttp3:okhttp:4.11.0",
Expand Down
4 changes: 0 additions & 4 deletions jmx-metrics/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ repositories {
includeGroupByRegex("""org\.terracotta.*""")
}
}
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
mavenLocal()
}

val groovyVersion = "3.0.19"
Expand Down
7 changes: 7 additions & 0 deletions maven-extension/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -60,3 +60,10 @@ tasks {
}

tasks.getByName("test").dependsOn("shadowJar")

configurations.all {
resolutionStrategy {
// TODO this module still needs to be updated to the latest semconv
force("io.opentelemetry:opentelemetry-semconv:1.28.0-alpha")
}
}
4 changes: 2 additions & 2 deletions resource-providers/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ dependencies {
compileOnly("io.opentelemetry:opentelemetry-sdk")
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
compileOnly("io.opentelemetry:opentelemetry-semconv")
compileOnly("io.opentelemetry.semconv:opentelemetry-semconv")
compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling")
testImplementation("io.opentelemetry:opentelemetry-semconv")
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv")
testImplementation("com.google.auto.service:auto-service")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
testImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

package io.opentelemetry.contrib.resourceproviders;

import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_NAME;
import static io.opentelemetry.semconv.ResourceAttributes.SERVICE_NAME;
import static java.util.logging.Level.FINE;
import static java.util.logging.Level.INFO;
import static java.util.logging.Level.WARNING;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import io.opentelemetry.api.common.AttributeKey;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
Expand Down
2 changes: 1 addition & 1 deletion samplers/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ otelJava.moduleName.set("io.opentelemetry.contrib.sampler")

dependencies {
api("io.opentelemetry:opentelemetry-sdk")
api("io.opentelemetry:opentelemetry-semconv")
api("io.opentelemetry.semconv:opentelemetry-semconv")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure")
api("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi")
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@
import io.opentelemetry.api.trace.TraceFlags;
import io.opentelemetry.api.trace.TraceState;
import io.opentelemetry.context.Context;
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdkBuilder;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.autoconfigure.spi.internal.DefaultConfigProperties;
import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk;
import io.opentelemetry.sdk.trace.IdGenerator;
import io.opentelemetry.sdk.trace.data.LinkData;
import io.opentelemetry.sdk.trace.samplers.Sampler;
import io.opentelemetry.sdk.trace.samplers.SamplingDecision;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.jupiter.api.Test;

class LinksBasedSamplerTest {
Expand Down Expand Up @@ -191,23 +190,22 @@ void testTwoUnsampled() {
}

@Test
void testProvider() throws Exception {
Method method =
Class.forName("io.opentelemetry.sdk.autoconfigure.TracerProviderConfiguration")
.getDeclaredMethod(
"configureSampler", String.class, ConfigProperties.class, ClassLoader.class);
method.setAccessible(true);

Sampler sampler =
(Sampler)
method.invoke(
null,
"linksbased_parentbased_always_on",
DefaultConfigProperties.createForTest(Collections.emptyMap()),
AutoConfiguredOpenTelemetrySdkBuilder.class.getClassLoader());

assertThat(sampler.getDescription())
.isEqualTo(
LinksBasedSampler.create(Sampler.parentBased(Sampler.alwaysOn())).getDescription());
void testProvider() {
Map<String, String> config = new HashMap<>();
config.put("otel.traces.exporter", "none");
config.put("otel.metrics.exporter", "none");
config.put("otel.logs.exporter", "none");
config.put("otel.traces.sampler", "linksbased_parentbased_always_on");
AutoConfiguredOpenTelemetrySdk.builder()
.addPropertiesSupplier(() -> config)
.addSamplerCustomizer(
(sampler, configProperties) -> {
assertThat(sampler.getDescription())
.isEqualTo(
LinksBasedSampler.create(Sampler.parentBased(Sampler.alwaysOn()))
.getDescription());
return sampler;
})
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

package io.opentelemetry.contrib.sampler;

import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_TARGET;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.HTTP_URL;
import static io.opentelemetry.semconv.SemanticAttributes.URL_FULL;
import static io.opentelemetry.semconv.SemanticAttributes.URL_PATH;
import static java.util.Collections.emptyList;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
Expand Down Expand Up @@ -57,8 +57,8 @@ public void setup() {
when(delegate.shouldSample(any(), any(), any(), any(), any(), any()))
.thenReturn(SamplingResult.create(SamplingDecision.RECORD_AND_SAMPLE));

patterns.add(new SamplingRule(HTTP_URL, ".*/healthcheck", Sampler.alwaysOff()));
patterns.add(new SamplingRule(HTTP_TARGET, "/actuator", Sampler.alwaysOff()));
patterns.add(new SamplingRule(URL_FULL, ".*/healthcheck", Sampler.alwaysOff()));
patterns.add(new SamplingRule(URL_PATH, "/actuator", Sampler.alwaysOff()));
}

@Test
Expand All @@ -83,7 +83,7 @@ public void testThatThrowsOnNullParameter() {

assertThatExceptionOfType(NullPointerException.class)
.isThrownBy(
() -> RuleBasedRoutingSampler.builder(SPAN_KIND, delegate).drop(HTTP_URL, null));
() -> RuleBasedRoutingSampler.builder(SPAN_KIND, delegate).drop(URL_FULL, null));

assertThatExceptionOfType(NullPointerException.class)
.isThrownBy(
Expand All @@ -93,7 +93,7 @@ public void testThatThrowsOnNullParameter() {
.isThrownBy(
() ->
RuleBasedRoutingSampler.builder(SPAN_KIND, delegate)
.recordAndSample(HTTP_URL, null));
.recordAndSample(URL_FULL, null));
}

@Test
Expand All @@ -109,7 +109,7 @@ public void testThatDelegatesIfNoRulesGiven() {
clearInvocations(delegate);

// with http.url attribute
attributes = Attributes.of(HTTP_URL, "https://example.com");
attributes = Attributes.of(URL_FULL, "https://example.com");
sampler.shouldSample(parentContext, traceId, SPAN_NAME, SPAN_KIND, attributes, emptyList());
verify(delegate)
.shouldSample(parentContext, traceId, SPAN_NAME, SPAN_KIND, attributes, emptyList());
Expand Down Expand Up @@ -160,7 +160,7 @@ public void testDelegateOnMalformedUrl() {
public void testVerifiesAllGivenAttributes() {
RuleBasedRoutingSampler sampler =
addRules(RuleBasedRoutingSampler.builder(SPAN_KIND, delegate)).build();
Attributes attributes = Attributes.of(HTTP_TARGET, "/actuator/info");
Attributes attributes = Attributes.of(URL_PATH, "/actuator/info");
assertThat(
sampler
.shouldSample(parentContext, traceId, SPAN_NAME, SPAN_KIND, attributes, emptyList())
Expand All @@ -170,10 +170,10 @@ public void testVerifiesAllGivenAttributes() {

@Test
void customSampler() {
Attributes attributes = Attributes.of(HTTP_TARGET, "/test");
Attributes attributes = Attributes.of(URL_PATH, "/test");
RuleBasedRoutingSampler testSampler =
RuleBasedRoutingSampler.builder(SPAN_KIND, delegate)
.customize(HTTP_TARGET, ".*test", new AlternatingSampler())
.customize(URL_PATH, ".*test", new AlternatingSampler())
.build();
assertThat(
testSampler
Expand All @@ -188,13 +188,13 @@ void customSampler() {
}

private SamplingResult shouldSample(Sampler sampler, String url) {
Attributes attributes = Attributes.of(HTTP_URL, url);
Attributes attributes = Attributes.of(URL_FULL, url);
return sampler.shouldSample(
parentContext, traceId, SPAN_NAME, SPAN_KIND, attributes, emptyList());
}

private static RuleBasedRoutingSamplerBuilder addRules(RuleBasedRoutingSamplerBuilder builder) {
return builder.drop(HTTP_URL, ".*/healthcheck").drop(HTTP_TARGET, "/actuator");
return builder.drop(URL_FULL, ".*/healthcheck").drop(URL_PATH, "/actuator");
}

/** Silly sampler that alternates decisions for testing. */
Expand Down
4 changes: 0 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ plugins {
dependencyResolutionManagement {
repositories {
mavenCentral()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
}
mavenLocal()
}
}

Expand Down

0 comments on commit 811d8d7

Please sign in to comment.