Skip to content

Commit c2ea609

Browse files
renovate[bot]trask
andauthored
Update dependency io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha to v1.31.0-alpha (#1072)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Trask Stalnaker <[email protected]>
1 parent 5041ea5 commit c2ea609

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

Diff for: dependencyManagement/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ val DEPENDENCY_BOMS = listOf(
1313
"com.linecorp.armeria:armeria-bom:1.25.2",
1414
"org.junit:junit-bom:5.10.0",
1515
"io.grpc:grpc-bom:1.58.0",
16-
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.30.0-alpha",
16+
"io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:1.31.0-alpha",
1717
"org.testcontainers:testcontainers-bom:1.19.1"
1818
)
1919

Diff for: prometheus-client-bridge/src/main/java/io/opentelemetry/contrib/metrics/prometheus/clientbridge/PrometheusCollector.java

+3-8
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import io.opentelemetry.sdk.metrics.data.MetricData;
1212
import io.opentelemetry.sdk.metrics.export.CollectionRegistration;
1313
import io.opentelemetry.sdk.metrics.export.MetricReader;
14-
import io.opentelemetry.sdk.metrics.internal.export.MetricProducer;
1514
import io.prometheus.client.Collector;
1615
import io.prometheus.client.CollectorRegistry;
1716
import java.util.ArrayList;
@@ -28,10 +27,10 @@
2827
public final class PrometheusCollector implements MetricReader {
2928

3029
private final Collector collector;
31-
private volatile MetricProducer metricProducer = MetricProducer.noop();
30+
private volatile CollectionRegistration collectionRegistration = CollectionRegistration.noop();
3231

3332
PrometheusCollector() {
34-
this.collector = new CollectorImpl(() -> getMetricProducer().collectAllMetrics());
33+
this.collector = new CollectorImpl(() -> collectionRegistration.collectAllMetrics());
3534
this.collector.register();
3635
}
3736

@@ -43,13 +42,9 @@ public static PrometheusCollector create() {
4342
return new PrometheusCollector();
4443
}
4544

46-
private MetricProducer getMetricProducer() {
47-
return metricProducer;
48-
}
49-
5045
@Override
5146
public void register(CollectionRegistration registration) {
52-
this.metricProducer = MetricProducer.asMetricProducer(registration);
47+
this.collectionRegistration = registration;
5348
}
5449

5550
@Override

Diff for: prometheus-client-bridge/src/test/java/io/opentelemetry/contrib/metrics/prometheus/clientbridge/PrometheusCollectorTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
import io.opentelemetry.sdk.metrics.SdkMeterProvider;
1717
import io.opentelemetry.sdk.metrics.data.AggregationTemporality;
1818
import io.opentelemetry.sdk.metrics.data.MetricData;
19+
import io.opentelemetry.sdk.metrics.export.CollectionRegistration;
1920
import io.opentelemetry.sdk.metrics.internal.data.ImmutableDoublePointData;
2021
import io.opentelemetry.sdk.metrics.internal.data.ImmutableLongPointData;
2122
import io.opentelemetry.sdk.metrics.internal.data.ImmutableMetricData;
2223
import io.opentelemetry.sdk.metrics.internal.data.ImmutableSumData;
23-
import io.opentelemetry.sdk.metrics.internal.export.MetricProducer;
2424
import io.opentelemetry.sdk.resources.Resource;
2525
import io.prometheus.client.CollectorRegistry;
2626
import io.prometheus.client.exporter.common.TextFormat;
@@ -36,14 +36,14 @@
3636

3737
@ExtendWith(MockitoExtension.class)
3838
class PrometheusCollectorTest {
39-
@Mock MetricProducer metricProducer;
39+
@Mock CollectionRegistration collectionRegistration;
4040
PrometheusCollector prometheusCollector;
4141

4242
@BeforeEach
4343
void setUp() {
4444
// Apply the SDK metric producer registers with prometheus.
4545
prometheusCollector = new PrometheusCollector();
46-
prometheusCollector.register(metricProducer);
46+
prometheusCollector.register(collectionRegistration);
4747
}
4848

4949
@Test
@@ -60,7 +60,7 @@ void registerWithSdkMeterProvider() {
6060

6161
@Test
6262
void registerToDefault() throws IOException {
63-
when(metricProducer.collectAllMetrics()).thenReturn(generateTestData());
63+
when(collectionRegistration.collectAllMetrics()).thenReturn(generateTestData());
6464
StringWriter stringWriter = new StringWriter();
6565
TextFormat.write004(stringWriter, CollectorRegistry.defaultRegistry.metricFamilySamples());
6666
assertThat(stringWriter.toString())

Diff for: static-instrumenter/maven-plugin/src/main/java/io/opentelemetry/contrib/staticinstrumenter/plugin/maven/ZipEntryCreator.java

+8
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ static void moveEntryUpdating(
2424
FileSystem targetFs, String targetPath, JarEntry sourceEntry, JarFile sourceJar)
2525
throws IOException {
2626

27+
if (targetPath.equals(
28+
"META-INF/services/io.opentelemetry.javaagent.tooling.BeforeAgentListener")) {
29+
// TEMPORARY hack to make things pass after a BeforeAgentListener was added in the agent
30+
// in https://github.com/open-telemetry/opentelemetry-java-instrumentation/pull/9301
31+
// which then causes conflict with the BeforeAgentListener in this module
32+
return;
33+
}
34+
2735
Path entry = targetFs.getPath("/", targetPath);
2836
Files.createDirectories(entry.getParent());
2937
try (InputStream sourceInput = sourceJar.getInputStream(sourceEntry)) {

0 commit comments

Comments
 (0)