diff --git a/server/build.gradle b/server/build.gradle index a40a68c..10b3423 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -19,13 +19,14 @@ dependencies { implementation('io.opentelemetry:opentelemetry-sdk:1.44.1') implementation('io.opentelemetry:opentelemetry-exporter-otlp:1.44.1') implementation 'io.opentelemetry:opentelemetry-sdk-metrics:1.44.1' - implementation('io.opentelemetry:opentelemetry-semconv:1.31.0-alpha-SNAPSHOT') + implementation('io.opentelemetry.semconv:opentelemetry-semconv') + implementation("io.opentelemetry.semconv:opentelemetry-semconv-incubating:1.26.0-alpha") implementation('io.opentelemetry:opentelemetry-exporter-zipkin') implementation 'io.grpc:grpc-netty-shaded:1.68.1' testImplementation 'org.jetbrains.teamcity:tests-support:2024.07' testImplementation 'org.jetbrains.teamcity:server-api:2024.07' - testImplementation 'org.apache.commons:commons-lang3:3.17.0' + testImplementation 'org.apache.commons:commons-text:1.12.0' testImplementation 'org.mockito:mockito-junit-jupiter:5.14.2' testImplementation 'org.mockito:mockito-core:5.14.2' testImplementation 'org.junit.jupiter:junit-jupiter:5.11.3' diff --git a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/honeycomb/HoneycombOTELEndpointHandler.java b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/honeycomb/HoneycombOTELEndpointHandler.java index 2651980..a1fc2a7 100644 --- a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/honeycomb/HoneycombOTELEndpointHandler.java +++ b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/honeycomb/HoneycombOTELEndpointHandler.java @@ -4,6 +4,7 @@ import com.octopus.teamcity.opentelemetry.server.*; import com.octopus.teamcity.opentelemetry.server.endpoints.IOTELEndpointHandler; import com.octopus.teamcity.opentelemetry.server.helpers.OTELMetrics; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter; import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter; @@ -11,7 +12,7 @@ import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.SpanProcessor; import io.opentelemetry.sdk.trace.export.BatchSpanProcessor; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ServiceAttributes; import jetbrains.buildServer.serverSide.SBuild; import jetbrains.buildServer.serverSide.crypt.EncryptUtil; import jetbrains.buildServer.serverSide.crypt.RSACipher; @@ -84,7 +85,12 @@ private MetricExporter buildMetricsExporter(String endpoint, Map private SpanProcessor buildGrpcSpanProcessor(Map headers, String exporterEndpoint, @Nullable MetricExporter metricsExporter) { - var serviceNameResource = Resource.create(Attributes.of(ResourceAttributes.SERVICE_NAME, PluginConstants.SERVICE_NAME)); + //todo: centralise the definition of this + var serviceNameResource = Resource + .create(Attributes.of( + ServiceAttributes.SERVICE_NAME, PluginConstants.SERVICE_NAME + )); + var meterProvider = OTELMetrics.getOTELMeterProvider(metricsExporter, serviceNameResource); var spanExporterBuilder = OtlpGrpcSpanExporter.builder(); diff --git a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELHelperImpl.java b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELHelperImpl.java index 9d87b58..d48fe4a 100644 --- a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELHelperImpl.java +++ b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/helpers/OTELHelperImpl.java @@ -12,7 +12,7 @@ import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.SdkTracerProvider; import io.opentelemetry.sdk.trace.SpanProcessor; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ServiceAttributes; import org.apache.log4j.Logger; import javax.annotation.Nullable; @@ -30,7 +30,7 @@ public class OTELHelperImpl implements OTELHelper { public OTELHelperImpl(SpanProcessor spanProcessor, String helperName) { this.helperName = helperName; Resource serviceNameResource = Resource - .create(Attributes.of(ResourceAttributes.SERVICE_NAME, PluginConstants.SERVICE_NAME)); + .create(Attributes.of(ServiceAttributes.SERVICE_NAME, PluginConstants.SERVICE_NAME)); this.sdkTracerProvider = SdkTracerProvider.builder() .setResource(Resource.getDefault().merge(serviceNameResource)) .addSpanProcessor(spanProcessor)