We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
AggreagationTempoarlity.DELTA
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe your environment
Steps to reproduce
Here's an example that exports to the console:
from opentelemetry import _metrics from opentelemetry.sdk._metrics import MeterProvider from opentelemetry.sdk._metrics.export import PeriodicExportingMetricReader, ConsoleMetricExporter from opentelemetry.sdk._metrics.point import AggregationTemporality class DeltaConsoleMetricExporter(ConsoleMetricExporter): @property def preferred_temporality(self) -> AggregationTemporality: return AggregationTemporality.DELTA if __name__ == '__main__': reader = PeriodicExportingMetricReader( export_interval_millis=3600000, exporter=DeltaConsoleMetricExporter()) _metrics.set_meter_provider(MeterProvider(metric_readers=[reader])) meter = _metrics.get_meter("my.meter") my_instrument = meter.create_histogram( name="my.instrument", ) my_instrument.record(10) reader.collect() my_instrument.record(10) reader.collect() my_instrument.record(10) reader.collect()
What is the expected behavior?
sum should not carry over from the last collection cycle to the next, should be 10 on every export.
sum
10
What is the actual behavior?
sum carries over from the previous collection cycle to the next.
Console Output from the example above:
{"attributes": "", "description": "", "instrumentation_info": "InstrumentationInfo(my.meter, , None)", "name": "my.instrument", "resource": "BoundedAttributes({'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.10.0', 'service.name': 'unknown_service'}, maxlen=None)", "unit": "", "point": {"start_time_unix_nano": 1647361426978696864, "time_unix_nano": 1647361426978710755, "bucket_counts": [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], "explicit_bounds": [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 1000.0], "sum": 10, "aggregation_temporality": 1}} {"attributes": "", "description": "", "instrumentation_info": "InstrumentationInfo(my.meter, , None)", "name": "my.instrument", "resource": "BoundedAttributes({'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.10.0', 'service.name': 'unknown_service'}, maxlen=None)", "unit": "", "point": {"start_time_unix_nano": 1647361426978710756, "time_unix_nano": 1647361427004077424, "bucket_counts": [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], "explicit_bounds": [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 1000.0], "sum": 20, "aggregation_temporality": 1}} {"attributes": "", "description": "", "instrumentation_info": "InstrumentationInfo(my.meter, , None)", "name": "my.instrument", "resource": "BoundedAttributes({'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.10.0', 'service.name': 'unknown_service'}, maxlen=None)", "unit": "", "point": {"start_time_unix_nano": 1647361427004077425, "time_unix_nano": 1647361427004196751, "bucket_counts": [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0], "explicit_bounds": [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 1000.0], "sum": 30, "aggregation_temporality": 1}} {"attributes": "", "description": "", "instrumentation_info": "InstrumentationInfo(my.meter, , None)", "name": "my.instrument", "resource": "BoundedAttributes({'telemetry.sdk.language': 'python', 'telemetry.sdk.name': 'opentelemetry', 'telemetry.sdk.version': '1.10.0', 'service.name': 'unknown_service'}, maxlen=None)", "unit": "", "point": {"start_time_unix_nano": 1647361427004196752, "time_unix_nano": 1647361427004373526, "bucket_counts": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], "explicit_bounds": [0.0, 5.0, 10.0, 25.0, 50.0, 75.0, 100.0, 250.0, 500.0, 1000.0], "sum": 30, "aggregation_temporality": 1}}
sum is kept over multiple collection cycles while bucket count is being reset.
The text was updated successfully, but these errors were encountered:
Reset histogram sum after collect
d0aec98
Fixes open-telemetry#2532
5b4ed2d
Successfully merging a pull request may close this issue.
Describe your environment
Steps to reproduce
Here's an example that exports to the console:
What is the expected behavior?
sum
should not carry over from the last collection cycle to the next, should be10
on every export.What is the actual behavior?
sum
carries over from the previous collection cycle to the next.Console Output from the example above:
sum
is kept over multiple collection cycles while bucket count is being reset.The text was updated successfully, but these errors were encountered: