You've already forked opentelemetry-go
mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-07-17 01:12:45 +02:00
Change prometheus to not aggregate metrics and only export them. (#385)
* draft using stop aggregating on prometheus client (counters) * remove prometheus client aggregations Measures are being exported as summaries since histograms doesn't exist on OpenTelemetry yet. Better error handling must be done. * make pre commit * add simple error callback * remove options from collector * refactor exporter to smaller methods * wording * change to snapshot * lock collection and checkpointset read * remove histogram options and unexported fields from the Exporter * documenting why prometheus uses a stateful batcher * add todo for histograms * change summaries objects to summary quantiles * remove histogram buckets from tests * wording * rename 'lockedCheckpoint' to 'syncCheckpointSet' * default summary quantiles should be defaulted to no buckets. * add quantiles options * refactor test.CheckpointSet and add docs * flip aggregators merge Co-authored-by: Joshua MacDonald <jmacd@users.noreply.github.com>
This commit is contained in:
committed by
rghetia
parent
99cb01b246
commit
6f04903876
@ -38,14 +38,20 @@ var (
|
||||
|
||||
func initMeter() *push.Controller {
|
||||
selector := simple.NewWithExactMeasure()
|
||||
exporter, err := prometheus.NewExporter(prometheus.Options{
|
||||
DefaultHistogramBuckets: []float64{0., 10., 15., 20.},
|
||||
})
|
||||
exporter, err := prometheus.NewExporter(prometheus.Options{})
|
||||
|
||||
if err != nil {
|
||||
log.Panicf("failed to initialize metric stdout exporter %v", err)
|
||||
}
|
||||
batcher := defaultkeys.New(selector, sdkmetric.NewDefaultLabelEncoder(), false)
|
||||
// Prometheus needs to use a stateful batcher since counters (and histogram since they are a collection of Counters)
|
||||
// are cumulative (i.e., monotonically increasing values) and should not be resetted after each export.
|
||||
//
|
||||
// Prometheus uses this approach to be resilient to scrape failures.
|
||||
// If a Prometheus server tries to scrape metrics from a host and fails for some reason,
|
||||
// it could try again on the next scrape and no data would be lost, only resolution.
|
||||
//
|
||||
// Gauges (or LastValues) and Summaries are an exception to this and have different behaviors.
|
||||
batcher := defaultkeys.New(selector, sdkmetric.NewDefaultLabelEncoder(), true)
|
||||
pusher := push.New(batcher, exporter, time.Second)
|
||||
pusher.Start()
|
||||
|
||||
|
Reference in New Issue
Block a user