diff --git a/integration_tests/it_exemplars_otel_agent/pom.xml b/integration_tests/it_exemplars_otel_agent/pom.xml index 00a86e9e8..a7928612a 100644 --- a/integration_tests/it_exemplars_otel_agent/pom.xml +++ b/integration_tests/it_exemplars_otel_agent/pom.xml @@ -20,6 +20,13 @@ pom import + + io.prometheus + simpleclient_bom + ${project.version} + pom + import + @@ -33,26 +40,6 @@ okhttp compile - - io.prometheus - simpleclient - ${project.version} - - - io.prometheus - simpleclient_tracer_common - ${project.version} - - - io.prometheus - simpleclient_tracer_otel - ${project.version} - - - io.prometheus - simpleclient_tracer_otel_agent - ${project.version} - io.prometheus simpleclient_hotspot diff --git a/simpleclient_bom/pom.xml b/simpleclient_bom/pom.xml index d79c63d0b..2e8edbe44 100644 --- a/simpleclient_bom/pom.xml +++ b/simpleclient_bom/pom.xml @@ -71,6 +71,11 @@ simpleclient_httpserver ${project.version} + + io.prometheus + simpleclient_tracer_common + ${project.version} + io.prometheus simpleclient_jetty diff --git a/simpleclient_tracer/simpleclient_tracer_otel/src/main/java/io/prometheus/client/exemplars/tracer/otel/OpenTelemetrySpanContextSupplier.java b/simpleclient_tracer/simpleclient_tracer_otel/src/main/java/io/prometheus/client/exemplars/tracer/otel/OpenTelemetrySpanContextSupplier.java index 8226fe1d8..0ae3ce1ce 100644 --- a/simpleclient_tracer/simpleclient_tracer_otel/src/main/java/io/prometheus/client/exemplars/tracer/otel/OpenTelemetrySpanContextSupplier.java +++ b/simpleclient_tracer/simpleclient_tracer_otel/src/main/java/io/prometheus/client/exemplars/tracer/otel/OpenTelemetrySpanContextSupplier.java @@ -7,7 +7,7 @@ public class OpenTelemetrySpanContextSupplier implements SpanContextSupplier { - public static boolean isAvailable() { + public static boolean isAvailable() { try { if ("inactive".equalsIgnoreCase(System.getProperties().getProperty("io.prometheus.otelExemplars"))) { return false; @@ -15,6 +15,7 @@ public static boolean isAvailable() { OpenTelemetrySpanContextSupplier test = new OpenTelemetrySpanContextSupplier(); test.getSpanId(); test.getTraceId(); + test.isSampled(); return true; } catch (LinkageError ignored) { // NoClassDefFoundError: @@ -25,20 +26,20 @@ public static boolean isAvailable() { } } - @Override - public String getTraceId() { - String traceId = Span.current().getSpanContext().getTraceId(); - return TraceId.isValid(traceId) ? traceId : null; - } + @Override + public String getTraceId() { + String traceId = Span.current().getSpanContext().getTraceId(); + return TraceId.isValid(traceId) ? traceId : null; + } - @Override - public String getSpanId() { - String spanId = Span.current().getSpanContext().getSpanId(); - return SpanId.isValid(spanId) ? spanId : null; - } + @Override + public String getSpanId() { + String spanId = Span.current().getSpanContext().getSpanId(); + return SpanId.isValid(spanId) ? spanId : null; + } - @Override - public boolean isSampled() { - return Span.current().getSpanContext().isSampled(); - } + @Override + public boolean isSampled() { + return Span.current().getSpanContext().isSampled(); + } } diff --git a/simpleclient_tracer/simpleclient_tracer_otel_agent/src/main/java/io/prometheus/client/exemplars/tracer/otel_agent/OpenTelemetryAgentSpanContextSupplier.java b/simpleclient_tracer/simpleclient_tracer_otel_agent/src/main/java/io/prometheus/client/exemplars/tracer/otel_agent/OpenTelemetryAgentSpanContextSupplier.java index b8b0db197..3a5b418b2 100644 --- a/simpleclient_tracer/simpleclient_tracer_otel_agent/src/main/java/io/prometheus/client/exemplars/tracer/otel_agent/OpenTelemetryAgentSpanContextSupplier.java +++ b/simpleclient_tracer/simpleclient_tracer_otel_agent/src/main/java/io/prometheus/client/exemplars/tracer/otel_agent/OpenTelemetryAgentSpanContextSupplier.java @@ -20,6 +20,7 @@ public static boolean isAvailable() { OpenTelemetryAgentSpanContextSupplier test = new OpenTelemetryAgentSpanContextSupplier(); test.getSpanId(); test.getTraceId(); + test.isSampled(); return true; } catch (LinkageError ignored) { // NoClassDefFoundError: