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
I am exploring the option to use open-telemetry to export metrics over to Prometheus and below is the sample code i ran in local to understand how data is exported.
Expected behavior : I would like to see one data point reported for the specific timestamp Actual behavior : After executing this code and plotting a graph in grafana, i could see that the metrics are reported for a period of 5 minutes in 15 seconds interval.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am exploring the option to use open-telemetry to export metrics over to Prometheus and below is the sample code i ran in local to understand how data is exported.
Expected behavior : I would like to see one data point reported for the specific timestamp
Actual behavior : After executing this code and plotting a graph in grafana, i could see that the metrics are reported for a period of 5 minutes in 15 seconds interval.
Can someone help me understand why this happens?
exporter = PrometheusRemoteWriteMetricsExporter(
endpoint="https://endpoint.com/",
)
testing_labels = {"environment": "test"}
reader = PeriodicExportingMetricReader(exporter,30000)
provider = MeterProvider(metric_readers=[reader])
metrics.set_meter_provider(provider)
meter = metrics.get_meter(name)
def export_to_prometheus():
metric_one = meter.create_counter(name="metric_one",description="metric one")
metric_one.add(5,testing_labels)
metric_two = meter.create_histogram(name="metric_two")
metric_three = meter.create_up_down_counter(
name="metric_three",
description="metric three"
)
metric_two.record(17)
metric_three.add(56,testing_labels)
if name == "main":
export_to_prometheus(")
Beta Was this translation helpful? Give feedback.
All reactions