Skip to content

Commit

Permalink
add test that default exemplar filter with no span does not create ex…
Browse files Browse the repository at this point in the history
…emplar
  • Loading branch information
aabmass committed Nov 8, 2024
1 parent 882fd2c commit d5069e8
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions opentelemetry-sdk/tests/metrics/integration_test/test_exemplars.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,41 @@ def test_trace_based_exemplars(self):
],
)

def test_default_exemplar_filter_no_span(self):
reader = InMemoryMetricReader()
meter_provider = MeterProvider(
metric_readers=[reader],
)

meter = meter_provider.get_meter("testmeter")
counter = meter.create_counter("testcounter")
counter.add(10, {"label": "value1"})
data = reader.get_metrics_data()
metrics = data.resource_metrics[0].scope_metrics[0].metrics
self.assertEqual(
metrics,
[
Metric(
name="testcounter",
description="",
unit="",
data=Sum(
data_points=[
NumberDataPoint(
attributes={"label": "value1"},
start_time_unix_nano=mock.ANY,
time_unix_nano=mock.ANY,
value=10,
exemplars=[],
)
],
aggregation_temporality=AggregationTemporality.CUMULATIVE,
is_monotonic=True,
),
)
],
)

def test_default_exemplar_filter(self):
span_context = SpanContext(
trace_id=self.TRACE_ID,
Expand Down

0 comments on commit d5069e8

Please sign in to comment.