amazon-cloudwatch-agent icon indicating copy to clipboard operation
amazon-cloudwatch-agent copied to clipboard

Add EnableNativeHistograms feature gate

Open TravisStark opened this issue 6 months ago • 3 comments

Description of the issue

To enable native histograms, we need to add the following feature gate

receiver.prometheusreceiver.EnableNativeHistograms

sample:

--feature-gates=receiver.prometheusreceiver.EnableNativeHistograms

Description of changes

  • Add EnableNativeHistograms feature gate

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Tests

Sample prometheus metrics:

prometheus_test_untyped{include="yes",prom_type="untyped"} 1
# TYPE prometheus_test_counter counter
prometheus_test_counter{include="yes",prom_type="counter"} 1
# TYPE prometheus_test_counter_exclude counter
prometheus_test_counter_exclude{include="no",prom_type="counter"} 1
# TYPE prometheus_test_gauge gauge
prometheus_test_gauge{include="yes",prom_type="gauge"} 500
# TYPE prometheus_test_summary summary
prometheus_test_summary_sum{include="yes",prom_type="summary"} 200
prometheus_test_summary_count{include="yes",prom_type="summary"} 50
prometheus_test_summary{include="yes",quantile="0",prom_type="summary"} 0.1
prometheus_test_summary{include="yes",quantile="0.5",prom_type="summary"} 0.25
prometheus_test_summary{include="yes",quantile="1",prom_type="summary"} 5.5
# TYPE prometheus_test_histogram histogram
prometheus_test_histogram_sum{include="yes",prom_type="histogram"} 300
prometheus_test_histogram_count{include="yes",prom_type="histogram"} 75
prometheus_test_histogram_bucket{include="yes",le="0",prom_type="histogram"} 1
prometheus_test_histogram_bucket{include="yes",le="0.5",prom_type="histogram"} 12
prometheus_test_histogram_bucket{include="yes",le="2.5",prom_type="histogram"} 35
prometheus_test_histogram_bucket{include="yes",le="5",prom_type="histogram"} 60
prometheus_test_histogram_bucket{include="yes",le="+Inf",prom_type="histogram"} 75

# TYPE prometheus_test_native_histogram histogram
# HELP prometheus_test_native_histogram This is a native histogram example
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="-Inf"} 0
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="-1.0"} 0
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="0.0"} 5
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="1.0"} 18
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="2.0"} 25
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="3.0"} 42
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="4.0"} 56
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="5.0"} 67
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="10.0"} 89
prometheus_test_native_histogram_bucket{include="yes",prom_type="native_histogram",le="+Inf"} 100
prometheus_test_native_histogram_count{include="yes",prom_type="native_histogram"} 100
prometheus_test_native_histogram_sum{include="yes",prom_type="native_histogram"} 450.25
prometheus_test_native_histogram_created{include="yes",prom_type="native_histogram"} 1753987200.0
Screenshot 2025-07-31 at 3 40 30 PM

Requirements

Before commiting your code, please do the following steps.

  1. Run make fmt and make fmt-sh
  2. Run make lint

Integration Tests

To run integration tests against this PR, add the ready for testing label.

TravisStark avatar Jul 31 '25 19:07 TravisStark

I'm not sure if the sample metrics you used in the test are actually native prometheus histograms. They look like classic histograms that are just named native. We need to find the definition for prometheus native histograms.

dricross avatar Aug 07 '25 16:08 dricross

This PR was marked stale due to lack of activity.

github-actions[bot] avatar Aug 15 '25 00:08 github-actions[bot]

This PR was marked stale due to lack of activity.

github-actions[bot] avatar Aug 27 '25 00:08 github-actions[bot]