Package com.linkedin.venice.utils
Class OpenTelemetryDataTestUtils
java.lang.Object
com.linkedin.venice.utils.OpenTelemetryDataTestUtils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointDatagetExponentialHistogramPointData(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) static io.opentelemetry.sdk.metrics.data.HistogramPointDatagetHistogramPointData(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) static io.opentelemetry.sdk.metrics.data.LongPointDatagetLongPointDataFromGauge(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) static io.opentelemetry.sdk.metrics.data.LongPointDatagetLongPointDataFromSum(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) static voidvalidateAnyGaugeDataPointAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long minValue, String metricName, String metricPrefix) Validate that at least one Gauge data point exists with value >= minValue, across all attribute combinations.static voidvalidateAnyGaugeDataPointAtLeast(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, long minValue, String metricName, String metricPrefix) static voidvalidateAnySumDataPointAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long minValue, String metricName, String metricPrefix) Validate that at least one Sum (counter) data point exists with value >= minValue, across all attribute combinations.static voidvalidateAnySumDataPointAtLeast(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, long minValue, String metricName, String metricPrefix) static voidvalidateExponentialHistogramPointData(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, double expectedMin, double expectedMax, long expectedCount, double expectedSum, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) static voidvalidateExponentialHistogramPointDataAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedMinCount, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate ExponentialHistogramPointData has at least expectedMinCount entries with sum > 0.static voidvalidateExponentialHistogramPointDataForLatency(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedCount, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate ExponentialHistogramPointData for latency metrics where min, max, and sum are not known but are > 0.static voidvalidateHistogramPointData(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, double expectedMin, double expectedMax, long expectedCount, double expectedSum, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) static voidvalidateLongPointDataFromCounter(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedValue, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) static voidvalidateLongPointDataFromCounterAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedMinValue, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate counter value is at least the expected minimum.static voidvalidateLongPointDataFromGauge(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedValue, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) static voidvalidateObservableCounterValue(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedValue, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate observable counter value for a specific attribute combination.
-
Constructor Details
-
OpenTelemetryDataTestUtils
public OpenTelemetryDataTestUtils()
-
-
Method Details
-
getLongPointDataFromSum
public static io.opentelemetry.sdk.metrics.data.LongPointData getLongPointDataFromSum(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) -
getLongPointDataFromGauge
public static io.opentelemetry.sdk.metrics.data.LongPointData getLongPointDataFromGauge(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) -
getExponentialHistogramPointData
public static io.opentelemetry.sdk.metrics.data.ExponentialHistogramPointData getExponentialHistogramPointData(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) -
getHistogramPointData
public static io.opentelemetry.sdk.metrics.data.HistogramPointData getHistogramPointData(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, String metricName, String prefix, io.opentelemetry.api.common.Attributes expectedAttributes) -
validateLongPointDataFromCounter
-
validateLongPointDataFromCounterAtLeast
public static void validateLongPointDataFromCounterAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedMinValue, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate counter value is at least the expected minimum. Use this in integration tests where the exact count is non-deterministic (e.g., TopicCleanupService may delete additional topics beyond those the test explicitly tracks). -
validateLongPointDataFromGauge
-
validateExponentialHistogramPointData
public static void validateExponentialHistogramPointData(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, double expectedMin, double expectedMax, long expectedCount, double expectedSum, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) -
validateExponentialHistogramPointDataForLatency
public static void validateExponentialHistogramPointDataForLatency(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedCount, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate ExponentialHistogramPointData for latency metrics where min, max, and sum are not known but are > 0. -
validateExponentialHistogramPointDataAtLeast
public static void validateExponentialHistogramPointDataAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedMinCount, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate ExponentialHistogramPointData has at least expectedMinCount entries with sum > 0. Use this in integration tests where the exact count is non-deterministic. -
validateHistogramPointData
public static void validateHistogramPointData(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, double expectedMin, double expectedMax, long expectedCount, double expectedSum, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) -
validateObservableCounterValue
public static void validateObservableCounterValue(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long expectedValue, io.opentelemetry.api.common.Attributes expectedAttributes, String metricName, String metricPrefix) Validate observable counter value for a specific attribute combination. Observable counters report as Sum data in OpenTelemetry. -
validateAnySumDataPointAtLeast
public static void validateAnySumDataPointAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long minValue, String metricName, String metricPrefix) Validate that at least one Sum (counter) data point exists with value >= minValue, across all attribute combinations. Use this in integration tests where the exact attributes are non-deterministic (e.g., replica type depends on leader election).Note: When validating multiple metrics, prefer collecting once via
reader.collectAllMetrics()and calling theCollection<MetricData>overload to avoid draining async counter adders between calls. -
validateAnySumDataPointAtLeast
public static void validateAnySumDataPointAtLeast(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, long minValue, String metricName, String metricPrefix) -
validateAnyGaugeDataPointAtLeast
public static void validateAnyGaugeDataPointAtLeast(io.opentelemetry.sdk.testing.exporter.InMemoryMetricReader inMemoryMetricReader, long minValue, String metricName, String metricPrefix) Validate that at least one Gauge data point exists with value >= minValue, across all attribute combinations. Use this in integration tests where the exact attributes are non-deterministic.Note: When validating multiple metrics, prefer collecting once via
reader.collectAllMetrics()and calling theCollection<MetricData>overload to avoid draining async counter adders between calls. -
validateAnyGaugeDataPointAtLeast
public static void validateAnyGaugeDataPointAtLeast(Collection<io.opentelemetry.sdk.metrics.data.MetricData> metricsData, long minValue, String metricName, String metricPrefix)
-