Skip to content

Commit

Permalink
Update opentelemetry-java to 1.30.1 (#9433)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurit authored Sep 11, 2023
1 parent 43ebdb8 commit 7e16e40
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 53 deletions.
6 changes: 6 additions & 0 deletions conventions/src/main/kotlin/otel.java-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,9 @@ configurations.configureEach {
exclude("io.opentelemetry.instrumentation", "opentelemetry-instrumentation-bom-alpha")
}
}

// Pin opentelemetry-semconv to last version where io.opentelemetry.semconv.trace.attributes.SemanticAttributes
// isn't deprecated.
configurations.configureEach {
resolutionStrategy.force("io.opentelemetry:opentelemetry-semconv:1.29.0-alpha")
}
2 changes: 1 addition & 1 deletion dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val dependencyVersions = hashMapOf<String, String>()
rootProject.extra["versions"] = dependencyVersions

// this line is managed by .github/scripts/update-sdk-version.sh
val otelSdkVersion = "1.29.0"
val otelSdkVersion = "1.30.1"
val otelSdkAlphaVersion = otelSdkVersion.replaceFirst("(-SNAPSHOT)?$".toRegex(), "-alpha$1")

// Need both BOM and groovy jars
Expand Down
2 changes: 1 addition & 1 deletion examples/distro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ subprojects {
ext {
versions = [
// this line is managed by .github/scripts/update-sdk-version.sh
opentelemetrySdk : "1.29.0",
opentelemetrySdk : "1.30.1",

// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "1.30.0-SNAPSHOT",
Expand Down
2 changes: 1 addition & 1 deletion examples/extension/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ version '1.0'
ext {
versions = [
// this line is managed by .github/scripts/update-sdk-version.sh
opentelemetrySdk : "1.29.0",
opentelemetrySdk : "1.30.1",

// these lines are managed by .github/scripts/update-version.sh
opentelemetryJavaagent : "1.30.0-SNAPSHOT",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static Resource buildResource() {
attributes.put(ResourceAttributes.HOST_ARCH, hostArch);
}

return Resource.create(attributes.build(), ResourceAttributes.SCHEMA_URL);
return Resource.create(attributes.build(), ResourceConstants.SCHEMA_URL);
}

private HostResource() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static Resource buildResource() {
String osDescription = version != null ? os + ' ' + version : os;
attributes.put(ResourceAttributes.OS_DESCRIPTION, osDescription);

return Resource.create(attributes.build(), ResourceAttributes.SCHEMA_URL);
return Resource.create(attributes.build(), ResourceConstants.SCHEMA_URL);
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private static Resource doBuildResource() {
}
}

return Resource.create(attributes.build(), ResourceAttributes.SCHEMA_URL);
return Resource.create(attributes.build(), ResourceConstants.SCHEMA_URL);
}

private ProcessResource() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import io.opentelemetry.api.common.Attributes;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;

/** Factory of a {@link Resource} which provides information about the Java runtime. */
public final class ProcessRuntimeResource {
Expand Down Expand Up @@ -43,7 +42,7 @@ static Resource buildResource() {
version,
PROCESS_RUNTIME_DESCRIPTION,
description),
ResourceAttributes.SCHEMA_URL);
ResourceConstants.SCHEMA_URL);
} catch (SecurityException ignored) {
return Resource.empty();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright The OpenTelemetry Authors
* SPDX-License-Identifier: Apache-2.0
*/

package io.opentelemetry.instrumentation.resources;

// TODO: this can be deleted after we start using the new semantic conventions artifact
final class ResourceConstants {
public static final String SCHEMA_URL = "https://opentelemetry.io/schemas/1.21.0";

private ResourceConstants() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void shouldCreateRuntimeAttributes() {
Attributes attributes = resource.getAttributes();

// then
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(attributes.get(ResourceAttributes.HOST_NAME)).isNotBlank();
assertThat(attributes.get(ResourceAttributes.HOST_ARCH)).isNotBlank();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class OsResourceTest {
@SetSystemProperty(key = "os.name", value = "Linux 4.11")
void linux() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.LINUX);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -33,7 +33,7 @@ void linux() {
@SetSystemProperty(key = "os.name", value = "MacOS X 11")
void macos() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.DARWIN);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -43,7 +43,7 @@ void macos() {
@SetSystemProperty(key = "os.name", value = "Windows 10")
void windows() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.WINDOWS);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -53,7 +53,7 @@ void windows() {
@SetSystemProperty(key = "os.name", value = "FreeBSD 10")
void freebsd() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.FREEBSD);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -63,7 +63,7 @@ void freebsd() {
@SetSystemProperty(key = "os.name", value = "NetBSD 10")
void netbsd() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.NETBSD);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -73,7 +73,7 @@ void netbsd() {
@SetSystemProperty(key = "os.name", value = "OpenBSD 10")
void openbsd() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.OPENBSD);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -83,7 +83,7 @@ void openbsd() {
@SetSystemProperty(key = "os.name", value = "DragonFlyBSD 10")
void dragonflybsd() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.DRAGONFLYBSD);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -93,7 +93,7 @@ void dragonflybsd() {
@SetSystemProperty(key = "os.name", value = "HP-UX 10")
void hpux() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.HPUX);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -103,7 +103,7 @@ void hpux() {
@SetSystemProperty(key = "os.name", value = "AIX 10")
void aix() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.AIX);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -113,7 +113,7 @@ void aix() {
@SetSystemProperty(key = "os.name", value = "Solaris 10")
void solaris() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.SOLARIS);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -123,7 +123,7 @@ void solaris() {
@SetSystemProperty(key = "os.name", value = "Z/OS 10")
void zos() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE))
.isEqualTo(ResourceAttributes.OsTypeValues.Z_OS);
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
Expand All @@ -133,7 +133,7 @@ void zos() {
@SetSystemProperty(key = "os.name", value = "RagOS 10")
void unknown() {
Resource resource = OsResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(resource.getAttribute(ResourceAttributes.OS_TYPE)).isNull();
assertThat(resource.getAttribute(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ProcessResourceTest {
@SetSystemProperty(key = "os.name", value = "Linux 4.12")
void notWindows() {
Resource resource = ProcessResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
Attributes attributes = resource.getAttributes();

assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isGreaterThan(1);
Expand All @@ -39,7 +39,7 @@ void notWindows() {
@SetSystemProperty(key = "os.name", value = "Windows 10")
void windows() {
Resource resource = ProcessResource.buildResource();
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
Attributes attributes = resource.getAttributes();

assertThat(attributes.get(ResourceAttributes.PROCESS_PID)).isGreaterThan(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void shouldCreateRuntimeAttributes() {
Attributes attributes = resource.getAttributes();

// then
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceAttributes.SCHEMA_URL);
assertThat(resource.getSchemaUrl()).isEqualTo(ResourceConstants.SCHEMA_URL);
assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_NAME)).isNotBlank();
assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_VERSION)).isNotBlank();
assertThat(attributes.get(ResourceAttributes.PROCESS_RUNTIME_DESCRIPTION)).isNotBlank();
Expand Down
Loading

0 comments on commit 7e16e40

Please sign in to comment.