Skip to content

Commit

Permalink
Lint the code
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Aug 14, 2024
1 parent 22cebeb commit f0ecace
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ def __eq__(self, other: object) -> bool:
)

def __repr__(self) -> str:
return f"Observation(value={self.value}, attributes={self.attributes})"
return f"Observation(value={self.value}, attributes={self.attributes}, context={self.context})"
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
from opentelemetry.sdk.metrics._internal.exceptions import MetricsTimeoutError
from opentelemetry.sdk.metrics._internal.exemplar import (
AlignedHistogramBucketExemplarReservoir,
AlwaysOnExemplarFilter,
AlwaysOffExemplarFilter,
AlwaysOnExemplarFilter,
ExemplarFilter,
ExemplarReservoir,
SimpleFixedSizeExemplarReservoir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
)
from opentelemetry.test.globals_test import reset_metrics_globals


TEST_TIMESTAMP = 1_234_567_890


Expand Down Expand Up @@ -106,7 +105,9 @@ def test_console_exporter_with_exemplars(self):
reader = PeriodicExportingMetricReader(
exporter, export_interval_millis=100
)
provider = MeterProvider(metric_readers=[reader], exemplar_filter=AlwaysOnExemplarFilter())
provider = MeterProvider(
metric_readers=[reader], exemplar_filter=AlwaysOnExemplarFilter()
)
set_meter_provider(provider)
meter = get_meter(__name__)
counter = meter.create_counter(
Expand All @@ -128,4 +129,15 @@ def test_console_exporter_with_exemplars(self):

self.assertEqual(point["attributes"], {"a": "b"})
self.assertEqual(point["value"], 1)
self.assertEqual(point["exemplars"], [{"filtered_attributes": {}, "value": 1, "time_unix_nano": TEST_TIMESTAMP, "span_id": None, "trace_id": None}])
self.assertEqual(
point["exemplars"],
[
{
"filtered_attributes": {},
"value": 1,
"time_unix_nano": TEST_TIMESTAMP,
"span_id": None,
"trace_id": None,
}
],
)

0 comments on commit f0ecace

Please sign in to comment.