fix(deps): update dependency io.prometheus:prometheus-metrics-exporter-httpserver to v1.3.2 (#6805)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jack Berg <jberg@newrelic.com>
This commit is contained in:
parent
1e3cf0b7e3
commit
2de12fee5a
|
@ -71,7 +71,7 @@ val DEPENDENCIES = listOf(
|
|||
"io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha",
|
||||
"io.opentracing:opentracing-api:0.33.0",
|
||||
"io.opentracing:opentracing-noop:0.33.0",
|
||||
"io.prometheus:prometheus-metrics-exporter-httpserver:1.3.1",
|
||||
"io.prometheus:prometheus-metrics-exporter-httpserver:1.3.2",
|
||||
"junit:junit:4.13.2",
|
||||
"nl.jqno.equalsverifier:equalsverifier:3.17.1",
|
||||
"org.awaitility:awaitility:4.2.2",
|
||||
|
|
|
@ -33,6 +33,7 @@ import io.opentelemetry.sdk.resources.Resource;
|
|||
import io.prometheus.metrics.model.snapshots.ClassicHistogramBuckets;
|
||||
import io.prometheus.metrics.model.snapshots.CounterSnapshot;
|
||||
import io.prometheus.metrics.model.snapshots.CounterSnapshot.CounterDataPointSnapshot;
|
||||
import io.prometheus.metrics.model.snapshots.DataPointSnapshot;
|
||||
import io.prometheus.metrics.model.snapshots.Exemplar;
|
||||
import io.prometheus.metrics.model.snapshots.Exemplars;
|
||||
import io.prometheus.metrics.model.snapshots.GaugeSnapshot;
|
||||
|
@ -109,11 +110,11 @@ final class Otel2PrometheusConverter {
|
|||
if (metricDataCollection == null || metricDataCollection.isEmpty()) {
|
||||
return MetricSnapshots.of();
|
||||
}
|
||||
Map<String, MetricSnapshot> snapshotsByName = new HashMap<>(metricDataCollection.size());
|
||||
Map<String, MetricSnapshot<?>> snapshotsByName = new HashMap<>(metricDataCollection.size());
|
||||
Resource resource = null;
|
||||
Set<InstrumentationScopeInfo> scopes = new LinkedHashSet<>();
|
||||
for (MetricData metricData : metricDataCollection) {
|
||||
MetricSnapshot snapshot = convert(metricData);
|
||||
MetricSnapshot<?> snapshot = convert(metricData);
|
||||
if (snapshot == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -135,7 +136,7 @@ final class Otel2PrometheusConverter {
|
|||
}
|
||||
|
||||
@Nullable
|
||||
private MetricSnapshot convert(MetricData metricData) {
|
||||
private MetricSnapshot<?> convert(MetricData metricData) {
|
||||
|
||||
// Note that AggregationTemporality.DELTA should never happen
|
||||
// because PrometheusMetricReader#getAggregationTemporality returns CUMULATIVE.
|
||||
|
@ -548,10 +549,10 @@ final class Otel2PrometheusConverter {
|
|||
}
|
||||
|
||||
private static void putOrMerge(
|
||||
Map<String, MetricSnapshot> snapshotsByName, MetricSnapshot snapshot) {
|
||||
Map<String, MetricSnapshot<?>> snapshotsByName, MetricSnapshot<?> snapshot) {
|
||||
String name = snapshot.getMetadata().getPrometheusName();
|
||||
if (snapshotsByName.containsKey(name)) {
|
||||
MetricSnapshot merged = merge(snapshotsByName.get(name), snapshot);
|
||||
MetricSnapshot<?> merged = merge(snapshotsByName.get(name), snapshot);
|
||||
if (merged != null) {
|
||||
snapshotsByName.put(name, merged);
|
||||
}
|
||||
|
@ -567,7 +568,9 @@ final class Otel2PrometheusConverter {
|
|||
* type. If the type differs, we log a message and drop one of them.
|
||||
*/
|
||||
@Nullable
|
||||
private static MetricSnapshot merge(MetricSnapshot a, MetricSnapshot b) {
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends DataPointSnapshot> MetricSnapshot<T> merge(
|
||||
MetricSnapshot<?> a, MetricSnapshot<?> b) {
|
||||
MetricMetadata metadata = mergeMetadata(a.getMetadata(), b.getMetadata());
|
||||
if (metadata == null) {
|
||||
return null;
|
||||
|
@ -577,27 +580,27 @@ final class Otel2PrometheusConverter {
|
|||
List<GaugeDataPointSnapshot> dataPoints = new ArrayList<>(numberOfDataPoints);
|
||||
dataPoints.addAll(((GaugeSnapshot) a).getDataPoints());
|
||||
dataPoints.addAll(((GaugeSnapshot) b).getDataPoints());
|
||||
return new GaugeSnapshot(metadata, dataPoints);
|
||||
return (MetricSnapshot<T>) new GaugeSnapshot(metadata, dataPoints);
|
||||
} else if (a instanceof CounterSnapshot && b instanceof CounterSnapshot) {
|
||||
List<CounterDataPointSnapshot> dataPoints = new ArrayList<>(numberOfDataPoints);
|
||||
dataPoints.addAll(((CounterSnapshot) a).getDataPoints());
|
||||
dataPoints.addAll(((CounterSnapshot) b).getDataPoints());
|
||||
return new CounterSnapshot(metadata, dataPoints);
|
||||
return (MetricSnapshot<T>) new CounterSnapshot(metadata, dataPoints);
|
||||
} else if (a instanceof HistogramSnapshot && b instanceof HistogramSnapshot) {
|
||||
List<HistogramDataPointSnapshot> dataPoints = new ArrayList<>(numberOfDataPoints);
|
||||
dataPoints.addAll(((HistogramSnapshot) a).getDataPoints());
|
||||
dataPoints.addAll(((HistogramSnapshot) b).getDataPoints());
|
||||
return new HistogramSnapshot(metadata, dataPoints);
|
||||
return (MetricSnapshot<T>) new HistogramSnapshot(metadata, dataPoints);
|
||||
} else if (a instanceof SummarySnapshot && b instanceof SummarySnapshot) {
|
||||
List<SummaryDataPointSnapshot> dataPoints = new ArrayList<>(numberOfDataPoints);
|
||||
dataPoints.addAll(((SummarySnapshot) a).getDataPoints());
|
||||
dataPoints.addAll(((SummarySnapshot) b).getDataPoints());
|
||||
return new SummarySnapshot(metadata, dataPoints);
|
||||
return (MetricSnapshot<T>) new SummarySnapshot(metadata, dataPoints);
|
||||
} else if (a instanceof InfoSnapshot && b instanceof InfoSnapshot) {
|
||||
List<InfoDataPointSnapshot> dataPoints = new ArrayList<>(numberOfDataPoints);
|
||||
dataPoints.addAll(((InfoSnapshot) a).getDataPoints());
|
||||
dataPoints.addAll(((InfoSnapshot) b).getDataPoints());
|
||||
return new InfoSnapshot(metadata, dataPoints);
|
||||
return (MetricSnapshot<T>) new InfoSnapshot(metadata, dataPoints);
|
||||
} else {
|
||||
THROTTLING_LOGGER.log(
|
||||
Level.WARNING,
|
||||
|
@ -638,7 +641,7 @@ final class Otel2PrometheusConverter {
|
|||
return new MetricMetadata(name, help, unit);
|
||||
}
|
||||
|
||||
private static String typeString(MetricSnapshot snapshot) {
|
||||
private static String typeString(MetricSnapshot<?> snapshot) {
|
||||
// Simple helper for a log message.
|
||||
return snapshot.getClass().getSimpleName().replace("Snapshot", "").toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@ import io.opentelemetry.sdk.metrics.internal.data.ImmutableSumData;
|
|||
import io.opentelemetry.sdk.resources.Resource;
|
||||
import io.prometheus.metrics.exporter.httpserver.HTTPServer;
|
||||
import io.prometheus.metrics.exporter.httpserver.MetricsHandler;
|
||||
import io.prometheus.metrics.expositionformats.generated.com_google_protobuf_3_25_3.Metrics;
|
||||
import io.prometheus.metrics.expositionformats.generated.com_google_protobuf_4_28_2.Metrics;
|
||||
import io.prometheus.metrics.model.registry.PrometheusRegistry;
|
||||
import io.prometheus.metrics.shaded.com_google_protobuf_3_25_3.TextFormat;
|
||||
import io.prometheus.metrics.shaded.com_google_protobuf_4_28_2.TextFormat;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.ServerSocket;
|
||||
|
|
Loading…
Reference in New Issue