Skip to content

Commit a438127

Browse files
authored
Deprecate semconv module (#5786)
1 parent 0660781 commit a438127

File tree

53 files changed

+278
-276
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+278
-276
lines changed

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,13 @@ dependency as follows, replacing `{{artifact-id}}` with the value from the "Arti
221221

222222
### API
223223

224-
| Component | Description | Artifact ID | Version | Javadoc |
225-
|-----------------------------------|--------------------------------------------------------------------------------------------------------------------------------|----------------------------|-------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|
226-
| [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) |
227-
| [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) |
228-
| [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) |
229-
| [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) |
224+
225+
| Component | Description | Artifact ID | Version | Javadoc |
226+
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ----------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
227+
| [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) |
228+
| [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) |
229+
| [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) |
230+
| [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) |
230231

231232
### API Extensions
232233

bom-alpha/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ javaPlatform.allowDependencies()
1414
dependencies {
1515
// Add dependency on opentelemetry-bom to ensure synchronization between alpha and stable artifacts
1616
api(platform(project(":bom")))
17-
}
17+
}

buildSrc/src/main/kotlin/io/opentelemetry/gradle/OtelBomExtension.kt

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
package io.opentelemetry.gradle
77

88
import org.gradle.api.Project
9-
import org.gradle.api.model.ObjectFactory
109
import org.gradle.api.provider.Property
1110
import java.util.function.Predicate
1211

1312
abstract class OtelBomExtension {
1413
abstract val projectFilter: Property<Predicate<Project>>
15-
val fallbacks: MutableSet<String> = hashSetOf()
14+
val additionalDependencies: MutableSet<String> = hashSetOf()
1615

1716
fun addFallback(artifactId: String, version: String) {
18-
this.fallbacks.add("io.opentelemetry:" + artifactId + ":" + version)
17+
this.additionalDependencies.add("io.opentelemetry:" + artifactId + ":" + version)
1918
}
20-
}
19+
20+
fun addExtra(groupId: String, artifactId: String, version: String) {
21+
this.additionalDependencies.add(groupId + ":" + artifactId + ":" + version)
22+
}
23+
}

buildSrc/src/main/kotlin/otel.bom-conventions.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ afterEvaluate {
6161
}
6262
}
6363
}
64-
otelBom.fallbacks.forEach { fallback ->
64+
otelBom.additionalDependencies.forEach { dependency ->
6565
dependencies {
6666
constraints {
67-
api(fallback)
67+
api(dependency)
6868
}
6969
}
7070
}

exporters/jaeger-thrift/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ dependencies {
1212
api(project(":sdk:all"))
1313

1414
implementation(project(":sdk:all"))
15-
implementation(project(":semconv"))
1615

1716
implementation("com.fasterxml.jackson.jr:jackson-jr-objects")
1817
implementation("io.jaegertracing:jaeger-client") {

exporters/jaeger-thrift/src/main/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftSpanExporter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111
import io.jaegertracing.thriftjava.Span;
1212
import io.jaegertracing.thriftjava.Tag;
1313
import io.jaegertracing.thriftjava.TagType;
14+
import io.opentelemetry.api.common.AttributeKey;
1415
import io.opentelemetry.sdk.common.CompletableResultCode;
1516
import io.opentelemetry.sdk.internal.ThrottlingLogger;
1617
import io.opentelemetry.sdk.resources.Resource;
1718
import io.opentelemetry.sdk.trace.data.SpanData;
1819
import io.opentelemetry.sdk.trace.export.SpanExporter;
19-
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
2020
import java.net.InetAddress;
2121
import java.net.UnknownHostException;
2222
import java.util.ArrayList;
@@ -40,6 +40,8 @@
4040
@Deprecated
4141
public final class JaegerThriftSpanExporter implements SpanExporter {
4242

43+
private static final AttributeKey<String> SERVICE_NAME = AttributeKey.stringKey("service.name");
44+
4345
static final String DEFAULT_ENDPOINT = "http://localhost:14268/api/traces";
4446

4547
private static final String DEFAULT_HOST_NAME = "unknown";
@@ -121,9 +123,9 @@ public CompletableResultCode export(Collection<SpanData> spans) {
121123
private Process createProcess(Resource resource) {
122124
Process result = new Process(this.process);
123125

124-
String serviceName = resource.getAttribute(ResourceAttributes.SERVICE_NAME);
126+
String serviceName = resource.getAttribute(SERVICE_NAME);
125127
if (serviceName == null || serviceName.isEmpty()) {
126-
serviceName = Resource.getDefault().getAttribute(ResourceAttributes.SERVICE_NAME);
128+
serviceName = Resource.getDefault().getAttribute(SERVICE_NAME);
127129
}
128130
// In practice should never be null unless the default Resource spec is changed.
129131
if (serviceName != null) {

exporters/jaeger-thrift/src/test/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftIntegrationTest.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package io.opentelemetry.exporter.jaeger.thrift;
77

8+
import static io.opentelemetry.api.common.AttributeKey.stringKey;
9+
810
import com.fasterxml.jackson.core.TreeNode;
911
import com.fasterxml.jackson.jr.ob.JSON;
1012
import com.fasterxml.jackson.jr.stree.JacksonJrsTreeCodec;
@@ -15,7 +17,6 @@
1517
import io.opentelemetry.sdk.resources.Resource;
1618
import io.opentelemetry.sdk.trace.SdkTracerProvider;
1719
import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
18-
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
1920
import java.time.Duration;
2021
import okhttp3.OkHttpClient;
2122
import okhttp3.Request;
@@ -84,7 +85,7 @@ private static OpenTelemetry initOpenTelemetry(boolean udp) {
8485
.addSpanProcessor(SimpleSpanProcessor.create(jaegerExporter.build()))
8586
.setResource(
8687
Resource.getDefault().toBuilder()
87-
.put(ResourceAttributes.SERVICE_NAME, SERVICE_NAME)
88+
.put(stringKey("service.name"), SERVICE_NAME)
8889
.build())
8990
.build())
9091
.build();

exporters/jaeger-thrift/src/test/java/io/opentelemetry/exporter/jaeger/thrift/JaegerThriftSpanExporterTest.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
package io.opentelemetry.exporter.jaeger.thrift;
77

8+
import static io.opentelemetry.api.common.AttributeKey.stringKey;
89
import static org.assertj.core.api.Assertions.assertThat;
910
import static org.mockito.Mockito.verify;
1011

@@ -17,7 +18,6 @@
1718
import io.jaegertracing.thriftjava.SpanRefType;
1819
import io.jaegertracing.thriftjava.Tag;
1920
import io.jaegertracing.thriftjava.TagType;
20-
import io.opentelemetry.api.common.AttributeKey;
2121
import io.opentelemetry.api.common.Attributes;
2222
import io.opentelemetry.api.trace.SpanContext;
2323
import io.opentelemetry.api.trace.SpanKind;
@@ -30,7 +30,6 @@
3030
import io.opentelemetry.sdk.testing.trace.TestSpanData;
3131
import io.opentelemetry.sdk.trace.data.SpanData;
3232
import io.opentelemetry.sdk.trace.data.StatusData;
33-
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
3433
import java.net.InetAddress;
3534
import java.net.UnknownHostException;
3635
import java.time.Duration;
@@ -79,9 +78,9 @@ void testExport() throws SenderException, UnknownHostException {
7978
testSpanData(
8079
Resource.create(
8180
Attributes.of(
82-
ResourceAttributes.SERVICE_NAME,
81+
stringKey("service.name"),
8382
"myServiceName",
84-
AttributeKey.stringKey("resource-attr-key"),
83+
stringKey("resource-attr-key"),
8584
"resource-attr-value")),
8685
"GET /api/endpoint",
8786
SPAN_CONTEXT,
@@ -140,9 +139,9 @@ void testExportMultipleResources() throws SenderException, UnknownHostException
140139
testSpanData(
141140
Resource.create(
142141
Attributes.of(
143-
ResourceAttributes.SERVICE_NAME,
142+
stringKey("service.name"),
144143
"myServiceName1",
145-
AttributeKey.stringKey("resource-attr-key-1"),
144+
stringKey("resource-attr-key-1"),
146145
"resource-attr-value-1")),
147146
"GET /api/endpoint/1",
148147
SPAN_CONTEXT,
@@ -152,9 +151,9 @@ void testExportMultipleResources() throws SenderException, UnknownHostException
152151
testSpanData(
153152
Resource.create(
154153
Attributes.of(
155-
ResourceAttributes.SERVICE_NAME,
154+
stringKey("service.name"),
156155
"myServiceName2",
157-
AttributeKey.stringKey("resource-attr-key-2"),
156+
stringKey("resource-attr-key-2"),
158157
"resource-attr-value-2")),
159158
"GET /api/endpoint/2",
160159
SPAN_CONTEXT_2,

exporters/jaeger/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ dependencies {
1717

1818
implementation(project(":exporters:common"))
1919
implementation(project(":exporters:sender:okhttp"))
20-
implementation(project(":semconv"))
2120
implementation(project(":sdk-extensions:autoconfigure-spi"))
2221

2322
compileOnly("io.grpc:grpc-stub")

exporters/jaeger/src/main/java/io/opentelemetry/exporter/jaeger/ProcessMarshaler.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,26 @@
55

66
package io.opentelemetry.exporter.jaeger;
77

8+
import io.opentelemetry.api.common.AttributeKey;
89
import io.opentelemetry.exporter.internal.marshal.MarshalerUtil;
910
import io.opentelemetry.exporter.internal.marshal.MarshalerWithSize;
1011
import io.opentelemetry.exporter.internal.marshal.Serializer;
1112
import io.opentelemetry.exporter.jaeger.proto.api_v2.internal.Process;
1213
import io.opentelemetry.sdk.resources.Resource;
13-
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
1414
import java.io.IOException;
1515
import java.util.List;
1616

1717
final class ProcessMarshaler extends MarshalerWithSize {
1818

19+
private static final AttributeKey<String> SERVICE_NAME = AttributeKey.stringKey("service.name");
20+
1921
private final byte[] serviceNameUtf8;
2022
private final List<KeyValueMarshaler> tags;
2123

2224
static ProcessMarshaler create(Resource resource) {
23-
String serviceName = resource.getAttribute(ResourceAttributes.SERVICE_NAME);
25+
String serviceName = resource.getAttribute(SERVICE_NAME);
2426
if (serviceName == null || serviceName.isEmpty()) {
25-
serviceName = Resource.getDefault().getAttribute(ResourceAttributes.SERVICE_NAME);
27+
serviceName = Resource.getDefault().getAttribute(SERVICE_NAME);
2628
}
2729

2830
return new ProcessMarshaler(

0 commit comments

Comments
 (0)