diff --git a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/OTELEndpointFactory.java b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/OTELEndpointFactory.java index afecdfa..fe24f73 100644 --- a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/OTELEndpointFactory.java +++ b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/OTELEndpointFactory.java @@ -3,6 +3,7 @@ import com.octopus.teamcity.opentelemetry.server.endpoints.custom.CustomOTELEndpointHandler; import com.octopus.teamcity.opentelemetry.server.endpoints.honeycomb.HoneycombOTELEndpointHandler; import com.octopus.teamcity.opentelemetry.server.endpoints.zipkin.ZipKinOTELEndpointHandler; +import jetbrains.buildServer.serverSide.TeamCityNodes; import jetbrains.buildServer.web.openapi.PluginDescriptor; import org.jetbrains.annotations.NotNull; @@ -10,11 +11,15 @@ public class OTELEndpointFactory { @NotNull private final PluginDescriptor pluginDescriptor; + @NotNull + private final TeamCityNodes teamcityNodesService; public OTELEndpointFactory( - @NotNull PluginDescriptor pluginDescriptor) + @NotNull PluginDescriptor pluginDescriptor, + @NotNull TeamCityNodes teamcityNodesService) { this.pluginDescriptor = pluginDescriptor; + this.teamcityNodesService = teamcityNodesService; } public IOTELEndpointHandler getOTELEndpointHandler(String otelService) @@ -28,7 +33,7 @@ public IOTELEndpointHandler getOTELEndpointHandler(OTELService otelService) switch (otelService) { case HONEYCOMB: - return new HoneycombOTELEndpointHandler(pluginDescriptor); + return new HoneycombOTELEndpointHandler(pluginDescriptor, teamcityNodesService); case ZIPKIN: return new ZipKinOTELEndpointHandler(pluginDescriptor); case CUSTOM: diff --git a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/custom/CustomOTELEndpointHandler.java b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/custom/CustomOTELEndpointHandler.java index eac31fd..88e6f3c 100644 --- a/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/custom/CustomOTELEndpointHandler.java +++ b/server/src/main/java/com/octopus/teamcity/opentelemetry/server/endpoints/custom/CustomOTELEndpointHandler.java @@ -79,9 +79,6 @@ private SpanProcessor buildGrpcSpanProcessor(Map headers, String spanExporterBuilder.setEndpoint(exporterEndpoint); SpanExporter spanExporter = spanExporterBuilder.build(); - LOG.debug("OTEL_PLUGIN: Opentelemetry export headers: " + LogMasker.mask(headers.toString())); - LOG.debug("OTEL_PLUGIN: Opentelemetry export endpoint: " + exporterEndpoint); - return BatchSpanProcessor.builder(spanExporter) .setMaxQueueSize(BATCH_SPAN_PROCESSOR_MAX_QUEUE_SIZE) .setScheduleDelay(BATCH_SPAN_PROCESSOR_MAX_SCHEDULE_DELAY) 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 8e968b6..214c454 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 @@ -15,6 +15,7 @@ import io.opentelemetry.semconv.ServiceAttributes; import jetbrains.buildServer.serverSide.BuildPromotion; import jetbrains.buildServer.serverSide.SBuild; +import jetbrains.buildServer.serverSide.TeamCityNodes; import jetbrains.buildServer.serverSide.crypt.EncryptUtil; import jetbrains.buildServer.serverSide.crypt.RSACipher; import jetbrains.buildServer.web.openapi.PluginDescriptor; @@ -33,10 +34,12 @@ public class HoneycombOTELEndpointHandler implements IOTELEndpointHandler { private final PluginDescriptor pluginDescriptor; + private final TeamCityNodes nodesService; static Logger LOG = Logger.getLogger(HoneycombOTELEndpointHandler.class.getName()); - public HoneycombOTELEndpointHandler(PluginDescriptor pluginDescriptor) { + public HoneycombOTELEndpointHandler(PluginDescriptor pluginDescriptor, TeamCityNodes nodesService) { this.pluginDescriptor = pluginDescriptor; + this.nodesService = nodesService; } @NotNull @@ -93,7 +96,8 @@ private SpanProcessor buildGrpcSpanProcessor( var serviceNameResource = Resource .create(Attributes.of( ServiceAttributes.SERVICE_NAME, PluginConstants.SERVICE_NAME, - AttributeKey.stringKey("teamcity.build_promotion.id"), Long.toString(buildPromotion.getId()) + AttributeKey.stringKey("teamcity.build_promotion.id"), Long.toString(buildPromotion.getId()), + AttributeKey.stringKey("teamcity.node.id"), nodesService.getCurrentNode().getId() )); var meterProvider = OTELMetrics.getOTELMeterProvider(metricsExporter, serviceNameResource);