Repository: prometheus/prometheus
File: scrape/metrics.go (Go)

Code before:
		prometheus.CounterOpts{
			Name: "prometheus_target_scrapes_exceeded_native_histogram_bucket_limit_total",
			Help: "Total number of scrapes that hit the native histogram bucket limit and were rejected.",
		},
	)
	sm.targetScrapeExemplarOutOfOrder = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "prometheus_target_scrapes_exemplar_out_of_order_total",
			Help: "Total number of exemplar rejected due to not being out of the expected order.",
		},
	)
	sm.targetScrapeCommitDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:                            "prometheus_scrape_commit_duration_seconds",
			Help:                            "Duration of the commit phase of the scrape in seconds.",
			Buckets:                         []float64{.001, .005, .01, .05, .1, .5, 1},
			NativeHistogramBucketFactor:     1.1,
			NativeHistogramMaxBucketNumber:  100,
			NativeHistogramMinResetDuration: 1 * time.Hour,
		},
	)
	sm.targetScrapeTotalDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:                            "prometheus_scrape_total_duration_seconds",
			Help:                            "Total duration of the scrape from start to commit completion in seconds.",
			Buckets:                         []float64{.01, .1, 1, 10, 60},
			NativeHistogramBucketFactor:     1.1,
			NativeHistogramMaxBucketNumber:  100,
			NativeHistogramMinResetDuration: 1 * time.Hour,
		},
	)

	for _, collector := range []prometheus.Collector{
		// Used by Manager.
		sm.targetMetadataCache,
		sm.targetScrapePools,
		sm.targetScrapePoolsFailed,
		// Used by scrapePool.
		sm.targetReloadIntervalLength,
		sm.targetScrapePoolReloads,
		sm.targetScrapePoolReloadsFailed,
		sm.targetSyncIntervalLength,
		sm.targetSyncIntervalLengthHistogram,
		sm.targetScrapePoolSyncsCounter,
		sm.targetScrapePoolExceededTargetLimit,
		sm.targetScrapePoolTargetLimit,
		sm.targetScrapePoolTargetsAdded,
		sm.targetScrapePoolSymbolTableItems,
		sm.targetSyncFailed,
		// Used by targetScraper.
		sm.targetScrapeExceededBodySizeLimit,

Review comment (suggestion):
I would suggest NOT emitting both classic and native histograms (cost, need to migrate off classic one), should we just use native histograms?

```suggestion
```

Code after:
			Name: "prometheus_target_scrapes_exceeded_native_histogram_bucket_limit_total",
			Help: "Total number of scrapes that hit the native histogram bucket limit and were rejected.",
		},
	)
	sm.targetScrapeExemplarOutOfOrder = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "prometheus_target_scrapes_exemplar_out_of_order_total",
			Help: "Total number of exemplar rejected due to not being out of the expected order.",
		},
	)
	sm.targetScrapeDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:                            "prometheus_target_scrape_duration_seconds",
			Help:                            "Total duration of the scrape from start to commit completion in seconds.",
			NativeHistogramBucketFactor:     1.1,
			NativeHistogramMaxBucketNumber:  100,
			NativeHistogramMinResetDuration: 1 * time.Hour,
		},
	)

	for _, collector := range []prometheus.Collector{
		// Used by Manager.
		sm.targetMetadataCache,
		sm.targetScrapePools,
		sm.targetScrapePoolsFailed,
		// Used by scrapePool.
		sm.targetReloadIntervalLength,
		sm.targetScrapePoolReloads,
		sm.targetScrapePoolReloadsFailed,
		sm.targetSyncIntervalLength,
		sm.targetSyncIntervalLengthHistogram,
		sm.targetScrapePoolSyncsCounter,
		sm.targetScrapePoolExceededTargetLimit,
		sm.targetScrapePoolTargetLimit,
		sm.targetScrapePoolTargetsAdded,
		sm.targetScrapePoolSymbolTableItems,
		sm.targetSyncFailed,
		// Used by targetScraper.
		sm.targetScrapeExceededBodySizeLimit,
		// Used by scrapeCache.
		sm.targetScrapeCacheFlushForced,
		// Used by scrapeLoop.
		sm.targetIntervalLength,
		sm.targetIntervalLengthHistogram,
		sm.targetScrapeSampleLimit,
		sm.targetScrapeSampleDuplicate,
		sm.targetScrapeSampleOutOfOrder,
		sm.targetScrapeSampleOutOfBounds,
		sm.targetScrapeExemplarOutOfOrder,
		sm.targetScrapePoolExceededLabelLimits,
		sm.targetScrapeNativeHistogramBucketLimit,