You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run the following test code to test opentelemetry's metric (simple counter)
from re import I
import time
from opentelemetry._metrics import get_meter_provider, set_meter_provider
from opentelemetry.sdk._metrics.export import ConsoleMetricExporter
from opentelemetry.exporter.otlp.proto.grpc._metric_exporter import (
OTLPMetricExporter,
)
from opentelemetry.sdk._metrics import MeterProvider
from opentelemetry.sdk._metrics.export import PeriodicExportingMetricReader
exporter = ConsoleMetricExporter()
print("setting up metric reader..")
reader = PeriodicExportingMetricReader(exporter=exporter, export_interval_millis=1000)
provider = MeterProvider(metric_readers=[reader])
print("setting meter provider..")
set_meter_provider(provider)
print("getting meter provider..")
# meter = get_meter_provider().get_meter("getting-started")
meter = provider.get_meter("howard")
print(meter)
print("creating counter..")
counter = meter.create_counter("first_counter")
print("adding 1")
counter.add(1)
time.sleep(3)
print("adding 5")
counter.add(5)
time.sleep(5)
print("adding 5")
counter.add(5)
What is the expected behavior?
Expected to see a successful list of metrics being emitted into the console.
What is the actual behavior?
I saw the following error in my script:
setting up metric reader..
setting meter provider..
getting meter provider..
<opentelemetry.sdk._metrics.Meter object at 0x105b192b0>
creating counter..
adding 1
Traceback (most recent call last):
File "/Users/howardyoo/python/otel/otelmetric.py", line 30, in <module>
counter.add(1)
File "/Users/howardyoo/git/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/instrument.py", line 97, in add
self._measurement_consumer.consume_measurement(
File "/Users/howardyoo/git/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/measurement_consumer.py", line 61, in consume_measurement
reader_storage.consume_measurement(measurement)
File "/Users/howardyoo/git/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/metric_reader_storage.py", line 101, in consume_measurement
matches.consume_measurement(measurement)
File "/Users/howardyoo/git/opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/_metrics/_view_instrument_match.py", line 71, in consume_measurement
self._attributes_aggregation[attributes] = self._aggregation()
TypeError: 'SumAggregation' object is not callable
Additional context
Looks like the line 71 in _view_instrument_match.py had an incorrect '()' at the end of the object's assignment - since the object is not a function, the TypeError: 'SumAggregation' object is not callable was resulted.
The text was updated successfully, but these errors were encountered:
Environment
Python 3.9.9 on MacOS Monterey (version 12.2.1) on M1 Arm Architecture
Steps to reproduce
Run the following test code to test opentelemetry's metric (simple counter)
What is the expected behavior?
Expected to see a successful list of metrics being emitted into the console.
What is the actual behavior?
I saw the following error in my script:
Additional context
Looks like the line 71 in _view_instrument_match.py had an incorrect '()' at the end of the object's assignment - since the object is not a function, the
TypeError: 'SumAggregation' object is not callable
was resulted.The text was updated successfully, but these errors were encountered: