Skip to content

Commit 966360b

Browse files
committed
Remove import for SpanContextSupplier
Signed-off-by: Fabian Stäber <[email protected]>
1 parent 4b6e78f commit 966360b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

prometheus-metrics-core/src/main/java/io/prometheus/metrics/core/exemplars/ExemplarSampler.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package io.prometheus.metrics.core.exemplars;
22

33
import io.prometheus.metrics.tracer.common.SpanContext;
4-
import io.prometheus.metrics.tracer.initializer.SpanContextSupplier;
54
import io.prometheus.metrics.model.snapshots.Exemplar;
65
import io.prometheus.metrics.model.snapshots.Exemplars;
76
import io.prometheus.metrics.model.snapshots.Labels;
@@ -46,8 +45,11 @@ public ExemplarSampler(ExemplarSamplerConfig config) {
4645
/**
4746
* Constructor with an additional {code spanContext} argument.
4847
* This is useful for testing, but may also be useful in some production scenarios.
49-
* If {@code spanContext != null} that spanContext is used and {@link SpanContextSupplier} is not used.
50-
* If {@code spanContext == null} the {@link SpanContextSupplier#getSpanContext()} is called to find a span context.
48+
* If {@code spanContext != null} that spanContext is used and
49+
* {@link io.prometheus.metrics.tracer.initializer.SpanContextSupplier SpanContextSupplier} is not used.
50+
* If {@code spanContext == null}
51+
* {@link io.prometheus.metrics.tracer.initializer.SpanContextSupplier#getSpanContext() SpanContextSupplier.getSpanContext()}
52+
* is called to find a span context.
5153
*/
5254
public ExemplarSampler(ExemplarSamplerConfig config, SpanContext spanContext) {
5355
this.config = config;
@@ -319,7 +321,10 @@ private long updateExemplar(int index, double value, long now) {
319321
}
320322

321323
private Labels doSampleExemplar() {
322-
SpanContext spanContext = this.spanContext != null ? this.spanContext : SpanContextSupplier.getSpanContext();
324+
// Using the qualified name so that Micrometer can exclude the dependency on prometheus-metrics-tracer-initializer
325+
// as they provide their own implementation of SpanContextSupplier.
326+
// If we had an import statement for SpanContextSupplier the dependency would be needed in any case.
327+
SpanContext spanContext = this.spanContext != null ? this.spanContext : io.prometheus.metrics.tracer.initializer.SpanContextSupplier.getSpanContext();
323328
try {
324329
if (spanContext != null) {
325330
if (spanContext.isCurrentSpanSampled()) {

0 commit comments

Comments
 (0)