swift-server / swift-prometheus

Prometheus client library for Swift
https://swiftpackageindex.com/swift-server/swift-prometheus
Apache License 2.0
145 stars 30 forks source link

Support Exemplars #73

Open ktoso opened 2 years ago

ktoso commented 2 years ago

It's an experimental feature to corelate traces to metrics.

OpenMetrics introduces the ability for scrape targets to add exemplars to certain metrics. Exemplars are references to data outside of the MetricSet. A common use case are IDs of program traces.

Exemplar storage is implemented as a fixed size circular buffer that stores exemplars in memory for all series. Enabling this feature will enable the storage of exemplars scraped by Prometheus. The config file block storage/exemplars can be used to control the size of circular buffer by # of exemplars. An exemplar with just a traceID= uses roughly 100 bytes of memory via the in-memory exemplar storage. If the exemplar storage is enabled, we will also append the exemplars to WAL for local persistence (for WAL duration).

https://prometheus.io/docs/prometheus/latest/feature_flags/#exemplars-storage

Not sure entirely where these are attached when emitting metrics, probably need some extra metadata param or something