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

Deprecate semconv module #5786

Merged
merged 5 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,13 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti

### API

| Component | Description | Artifact ID | Version | Javadoc |
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | <!--VERSION_STABLE-->1.29.0<!--/VERSION_STABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) |
| [Events API](./api/events) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | <!--VERSION_UNSTABLE-->1.29.0-alpha<!--/VERSION_UNSTABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) |
| [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | <!--VERSION_STABLE-->1.29.0<!--/VERSION_STABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-context.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) |
| [Semantic Conventions](./semconv) | Generated code for OpenTelemetry semantic conventions | `opentelemetry-semconv` | <!--VERSION_UNSTABLE-->1.29.0-alpha<!--/VERSION_UNSTABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-semconv.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-semconv) |

| Component | Description | Artifact ID | Version | Javadoc |
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [API](./api/all) | OpenTelemetry API, including metrics, traces, baggage, context | `opentelemetry-api` | <!--VERSION_STABLE-->1.29.0<!--/VERSION_STABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api) |
| [Events API](./api/events) | OpenTelemetry Event API for emitting events. | `opentelemetry-api-events` | <!--VERSION_UNSTABLE-->1.29.0-alpha<!--/VERSION_UNSTABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-api-events.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-api-events) |
| [Context API](./context) | OpenTelemetry context API | `opentelemetry-context` | <!--VERSION_STABLE-->1.29.0<!--/VERSION_STABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-context.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-context) |
| [Semantic Conventions](./semconv) | Generated code for OpenTelemetry semantic conventions (deprecated, moved to [open-telemetry/semantic-conventions-java](https://github.com/open-telemetry/semantic-conventions-java)) | `opentelemetry-semconv` | <!--VERSION_UNSTABLE-->1.29.0-alpha<!--/VERSION_UNSTABLE--> | [![Javadocs](https://www.javadoc.io/badge/io.opentelemetry/opentelemetry-semconv.svg)](https://www.javadoc.io/doc/io.opentelemetry/opentelemetry-semconv) |

### API Extensions

Expand Down
1 change: 1 addition & 0 deletions all/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ dependencies {
testImplementation("io.opentelemetry:opentelemetry-extension-aws")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-resources")
testImplementation("io.opentelemetry:opentelemetry-sdk-extension-aws")
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv")

testImplementation("com.tngtech.archunit:archunit-junit5")
}
Expand Down
11 changes: 10 additions & 1 deletion bom-alpha/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.function.Consumer
jack-berg marked this conversation as resolved.
Show resolved Hide resolved

plugins {
id("otel.bom-conventions")
}
Expand All @@ -14,4 +16,11 @@ javaPlatform.allowDependencies()
dependencies {
// Add dependency on opentelemetry-bom to ensure synchronization between alpha and stable artifacts
api(platform(project(":bom")))
}

// Get the semconv version from :dependencyManagement
val semconvConstraint = project(":dependencyManagement").dependencyProject.configurations["api"].allDependencyConstraints
.find { it.group.equals("io.opentelemetry.semconv")
&& it.name.equals("opentelemetry-semconv") }
?: throw Exception("semconv constraint not found")
otelBom.addExtra(semconvConstraint.group, semconvConstraint.name, semconvConstraint.version ?: throw Exception("missing version"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
package io.opentelemetry.gradle

import org.gradle.api.Project
import org.gradle.api.model.ObjectFactory
import org.gradle.api.provider.Property
import java.util.function.Predicate

abstract class OtelBomExtension {
abstract val projectFilter: Property<Predicate<Project>>
val fallbacks: MutableSet<String> = hashSetOf()
val additionalDependencies: MutableSet<String> = hashSetOf()

fun addFallback(artifactId: String, version: String) {
this.fallbacks.add("io.opentelemetry:" + artifactId + ":" + version)
this.additionalDependencies.add("io.opentelemetry:" + artifactId + ":" + version)
}
}

fun addExtra(groupId: String, artifactId: String, version: String) {
this.additionalDependencies.add(groupId + ":" + artifactId + ":" + version)
}
}
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/otel.bom-conventions.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ afterEvaluate {
}
}
}
otelBom.fallbacks.forEach { fallback ->
otelBom.additionalDependencies.forEach { dependency ->
dependencies {
constraints {
api(fallback)
api(dependency)
}
}
}
Expand Down
1 change: 1 addition & 0 deletions dependencyManagement/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ val DEPENDENCIES = listOf(
"io.jaegertracing:jaeger-client:1.8.1",
"io.opentelemetry.proto:opentelemetry-proto:1.0.0-alpha",
"io.opentelemetry.contrib:opentelemetry-aws-xray-propagator:1.29.0-alpha",
"io.opentelemetry.semconv:opentelemetry-semconv:1.21.0-alpha",
"io.opentracing:opentracing-api:0.33.0",
"io.opentracing:opentracing-noop:0.33.0",
"junit:junit:4.13.2",
Expand Down
2 changes: 1 addition & 1 deletion exporters/jaeger-thrift/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
api(project(":sdk:all"))

implementation(project(":sdk:all"))
implementation(project(":semconv"))
implementation("io.opentelemetry.semconv:opentelemetry-semconv")

implementation("com.fasterxml.jackson.jr:jackson-jr-objects")
implementation("io.jaegertracing:jaeger-client") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.trace.SdkTracerProvider;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.time.Duration;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import io.opentelemetry.sdk.testing.trace.TestSpanData;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.data.StatusData;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.time.Duration;
Expand Down
2 changes: 1 addition & 1 deletion exporters/jaeger/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies {

implementation(project(":exporters:common"))
implementation(project(":exporters:sender:okhttp"))
implementation(project(":semconv"))
implementation("io.opentelemetry.semconv:opentelemetry-semconv")
implementation(project(":sdk-extensions:autoconfigure-spi"))

compileOnly("io.grpc:grpc-stub")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import io.opentelemetry.exporter.internal.marshal.Serializer;
import io.opentelemetry.exporter.jaeger.proto.api_v2.internal.Process;
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.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import io.opentelemetry.sdk.trace.IdGenerator;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.data.StatusData;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.net.InetAddress;
import java.net.URISyntaxException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.opentelemetry.sdk.trace.SdkTracerProvider;
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.time.Duration;
import okhttp3.OkHttpClient;
import okhttp3.Request;
Expand Down
2 changes: 1 addition & 1 deletion exporters/prometheus/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies {

annotationProcessor("com.google.auto.value:auto-value")

testImplementation(project(":semconv"))
testImplementation("io.opentelemetry.semconv:opentelemetry-semconv")

testImplementation("io.opentelemetry.proto:opentelemetry-proto")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import io.opentelemetry.proto.metrics.v1.Sum;
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.io.UncheckedIOException;
import java.time.Duration;
import java.util.ArrayList;
Expand Down
2 changes: 1 addition & 1 deletion exporters/zipkin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dependencies {
api("io.zipkin.reporter2:zipkin-reporter")

implementation(project(":exporters:common"))
implementation(project(":semconv"))
implementation("io.opentelemetry.semconv:opentelemetry-semconv")
implementation(project(":sdk-extensions:autoconfigure-spi"))

implementation("io.zipkin.reporter2:zipkin-sender-okhttp3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
package io.opentelemetry.exporter.zipkin;

import static io.opentelemetry.api.common.AttributeKey.stringKey;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_PORT;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_SOCK_PEER_ADDR;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.PEER_SERVICE;
import static io.opentelemetry.semconv.SemanticAttributes.PEER_SERVICE;
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_ADDRESS;
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_PORT;
import static java.util.concurrent.TimeUnit.NANOSECONDS;

import io.opentelemetry.api.common.AttributeKey;
Expand All @@ -21,7 +21,7 @@
import io.opentelemetry.sdk.trace.data.EventData;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.data.StatusData;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import java.net.InetAddress;
import java.util.List;
import java.util.function.Supplier;
Expand Down Expand Up @@ -173,8 +173,8 @@ private static Endpoint getRemoteEndpoint(SpanData spanData) {
if (serviceName != null) {
Endpoint.Builder endpoint = Endpoint.newBuilder();
endpoint.serviceName(serviceName);
endpoint.ip(attributes.get(NET_SOCK_PEER_ADDR));
Long port = attributes.get(NET_PEER_PORT);
endpoint.ip(attributes.get(SERVER_SOCKET_ADDRESS));
Long port = attributes.get(SERVER_SOCKET_PORT);
if (port != null) {
endpoint.port(port.intValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
import static io.opentelemetry.exporter.zipkin.ZipkinTestUtil.spanBuilder;
import static io.opentelemetry.exporter.zipkin.ZipkinTestUtil.zipkinSpan;
import static io.opentelemetry.exporter.zipkin.ZipkinTestUtil.zipkinSpanBuilder;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_PEER_PORT;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.NET_SOCK_PEER_ADDR;
import static io.opentelemetry.semconv.trace.attributes.SemanticAttributes.PEER_SERVICE;
import static io.opentelemetry.semconv.SemanticAttributes.PEER_SERVICE;
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_ADDRESS;
import static io.opentelemetry.semconv.SemanticAttributes.SERVER_SOCKET_PORT;
import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;

Expand All @@ -29,8 +29,8 @@
import io.opentelemetry.sdk.resources.Resource;
import io.opentelemetry.sdk.trace.data.SpanData;
import io.opentelemetry.sdk.trace.data.StatusData;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import io.opentelemetry.semconv.ResourceAttributes;
import io.opentelemetry.semconv.SemanticAttributes;
import java.net.InetAddress;
import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -176,8 +176,8 @@ void generateSpan_RemoteEndpointMapping(SpanKind spanKind) {
Attributes attributes =
Attributes.builder()
.put(PEER_SERVICE, "remote-test-service")
.put(NET_SOCK_PEER_ADDR, "8.8.8.8")
.put(NET_PEER_PORT, 42L)
.put(SERVER_SOCKET_ADDRESS, "8.8.8.8")
.put(SERVER_SOCKET_PORT, 42L)
.build();

SpanData spanData =
Expand All @@ -201,8 +201,8 @@ void generateSpan_RemoteEndpointMapping(SpanKind spanKind) {
.localEndpoint(expectedLocalEndpoint)
.remoteEndpoint(expectedRemoteEndpoint)
.putTag(PEER_SERVICE.getKey(), "remote-test-service")
.putTag(NET_SOCK_PEER_ADDR.getKey(), "8.8.8.8")
.putTag(NET_PEER_PORT.getKey(), "42")
.putTag(SERVER_SOCKET_ADDRESS.getKey(), "8.8.8.8")
.putTag(SERVER_SOCKET_PORT.getKey(), "42")
.putTag(OtelToZipkinSpanTransformer.OTEL_STATUS_CODE, "OK")
.build();

Expand All @@ -217,8 +217,8 @@ void generateSpan_RemoteEndpointMappingWhenKindIsNotClientOrProducer(SpanKind sp
Attributes attributes =
Attributes.builder()
.put(PEER_SERVICE, "remote-test-service")
.put(NET_SOCK_PEER_ADDR, "8.8.8.8")
.put(NET_PEER_PORT, 42L)
.put(SERVER_SOCKET_ADDRESS, "8.8.8.8")
.put(SERVER_SOCKET_PORT, 42L)
.build();

SpanData spanData =
Expand All @@ -239,8 +239,8 @@ void generateSpan_RemoteEndpointMappingWhenKindIsNotClientOrProducer(SpanKind sp
.localEndpoint(expectedLocalEndpoint)
.remoteEndpoint(null)
.putTag(PEER_SERVICE.getKey(), "remote-test-service")
.putTag(NET_SOCK_PEER_ADDR.getKey(), "8.8.8.8")
.putTag(NET_PEER_PORT.getKey(), "42")
.putTag(SERVER_SOCKET_ADDRESS.getKey(), "8.8.8.8")
.putTag(SERVER_SOCKET_PORT.getKey(), "42")
.putTag(OtelToZipkinSpanTransformer.OTEL_STATUS_CODE, "OK")
.build();

Expand All @@ -253,7 +253,10 @@ void generateSpan_RemoteEndpointMappingWhenKindIsNotClientOrProducer(SpanKind sp
names = {"CLIENT", "PRODUCER"})
void generateSpan_RemoteEndpointMappingWhenServiceNameIsMissing(SpanKind spanKind) {
Attributes attributes =
Attributes.builder().put(NET_SOCK_PEER_ADDR, "8.8.8.8").put(NET_PEER_PORT, 42L).build();
Attributes.builder()
.put(SERVER_SOCKET_ADDRESS, "8.8.8.8")
.put(SERVER_SOCKET_PORT, 42L)
.build();

SpanData spanData =
spanBuilder()
Expand All @@ -272,8 +275,8 @@ void generateSpan_RemoteEndpointMappingWhenServiceNameIsMissing(SpanKind spanKin
zipkinSpan(toZipkinSpanKind(spanKind), localIp).toBuilder()
.localEndpoint(expectedLocalEndpoint)
.remoteEndpoint(null)
.putTag(NET_SOCK_PEER_ADDR.getKey(), "8.8.8.8")
.putTag(NET_PEER_PORT.getKey(), "42")
.putTag(SERVER_SOCKET_ADDRESS.getKey(), "8.8.8.8")
.putTag(SERVER_SOCKET_PORT.getKey(), "42")
.putTag(OtelToZipkinSpanTransformer.OTEL_STATUS_CODE, "OK")
.build();

Expand All @@ -288,7 +291,7 @@ void generateSpan_RemoteEndpointMappingWhenPortIsMissing(SpanKind spanKind) {
Attributes attributes =
Attributes.builder()
.put(PEER_SERVICE, "remote-test-service")
.put(NET_SOCK_PEER_ADDR, "8.8.8.8")
.put(SERVER_SOCKET_ADDRESS, "8.8.8.8")
.build();

SpanData spanData =
Expand All @@ -312,7 +315,7 @@ void generateSpan_RemoteEndpointMappingWhenPortIsMissing(SpanKind spanKind) {
.localEndpoint(expectedLocalEndpoint)
.remoteEndpoint(expectedRemoteEndpoint)
.putTag(PEER_SERVICE.getKey(), "remote-test-service")
.putTag(NET_SOCK_PEER_ADDR.getKey(), "8.8.8.8")
.putTag(SERVER_SOCKET_ADDRESS.getKey(), "8.8.8.8")
.putTag(OtelToZipkinSpanTransformer.OTEL_STATUS_CODE, "OK")
.build();

Expand Down Expand Up @@ -417,7 +420,10 @@ void generateSpan_WithInstrumentationLibraryInfo() {
void generateSpan_AlreadyHasHttpStatusInfo() {
Attributes attributes =
Attributes.of(
SemanticAttributes.HTTP_STATUS_CODE, 404L, stringKey("error"), "A user provided error");
SemanticAttributes.HTTP_RESPONSE_STATUS_CODE,
404L,
stringKey("error"),
"A user provided error");
SpanData data =
spanBuilder()
.setAttributes(attributes)
Expand All @@ -430,7 +436,7 @@ void generateSpan_AlreadyHasHttpStatusInfo() {
.isEqualTo(
zipkinSpan(Span.Kind.CLIENT, localIp).toBuilder()
.clearTags()
.putTag(SemanticAttributes.HTTP_STATUS_CODE.getKey(), "404")
.putTag(SemanticAttributes.HTTP_RESPONSE_STATUS_CODE.getKey(), "404")
.putTag(OtelToZipkinSpanTransformer.OTEL_STATUS_CODE, "ERROR")
.putTag("error", "A user provided error")
.build());
Expand Down