|
1 | 1 | package io.prometheus.metrics.core.exemplars; |
2 | 2 |
|
3 | 3 | import io.prometheus.metrics.tracer.common.SpanContext; |
4 | | -import io.prometheus.metrics.tracer.initializer.SpanContextSupplier; |
5 | 4 | import io.prometheus.metrics.model.snapshots.Exemplar; |
6 | 5 | import io.prometheus.metrics.model.snapshots.Exemplars; |
7 | 6 | import io.prometheus.metrics.model.snapshots.Labels; |
@@ -46,8 +45,11 @@ public ExemplarSampler(ExemplarSamplerConfig config) { |
46 | 45 | /** |
47 | 46 | * Constructor with an additional {code spanContext} argument. |
48 | 47 | * 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. |
51 | 53 | */ |
52 | 54 | public ExemplarSampler(ExemplarSamplerConfig config, SpanContext spanContext) { |
53 | 55 | this.config = config; |
@@ -319,7 +321,10 @@ private long updateExemplar(int index, double value, long now) { |
319 | 321 | } |
320 | 322 |
|
321 | 323 | 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(); |
323 | 328 | try { |
324 | 329 | if (spanContext != null) { |
325 | 330 | if (spanContext.isCurrentSpanSampled()) { |
|
0 commit comments