Skip to content

Conversation

TravisStark
Copy link
Contributor

@TravisStark TravisStark commented Jul 31, 2025

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 TravisStark requested a review from a team as a code owner July 31, 2025 19:30
@TravisStark TravisStark changed the title tjstark/native histograms Add EnableNativeHistograms feature gate Jul 31, 2025
@dricross
Copy link
Contributor

dricross commented Aug 7, 2025

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.

Copy link
Contributor

This PR was marked stale due to lack of activity.

@github-actions github-actions bot added the Stale label Aug 15, 2025
@agarakan agarakan force-pushed the replace-telegrapf-prom-plugin branch from 4c87ab3 to ee3d344 Compare August 19, 2025 20:03
@github-actions github-actions bot removed the Stale label Aug 20, 2025
Copy link
Contributor

This PR was marked stale due to lack of activity.

@github-actions github-actions bot added the Stale label Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants