Skip to content

Commit

Permalink
Updates to fix deprecation warnings (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-richardson authored Nov 29, 2024
1 parent 3545f95 commit 67975a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
5 changes: 3 additions & 2 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
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;
import io.opentelemetry.sdk.metrics.export.MetricExporter;
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;
Expand Down Expand Up @@ -84,7 +85,12 @@ private MetricExporter buildMetricsExporter(String endpoint, Map<String, String>

private SpanProcessor buildGrpcSpanProcessor(Map<String, String> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 67975a6

Please sign in to comment.