optimizely / agent

Agent service for Optimizely Feature Experimentation and Optimizely Full Stack (legacy)
Apache License 2.0
31 stars 26 forks source link

[FSSDK-9412] add expose prometheus through custom collector #347

Closed 204Constie closed 1 year ago

204Constie commented 1 year ago

Summary

dirty PR that presents the idea of exposing metrics to prometheus via the use of custom prometheus collector

an implementation of the collector interface https://github.com/prometheus/client_golang/blob/main/prometheus/collector.go#L27 similar to this collector: https://github.com/prometheus/client_golang/blob/main/prometheus/expvar_collector.go it is not an ideal solution as the documentation states ( https://pkg.go.dev/github.com/prometheus/client_golang/prometheus/collectors#NewExpvarCollector )


An expvar Collector collects metrics from the expvar interface. It provides a quick way to expose numeric values that are already exported via expvar as Prometheus metrics. Note that the data models of expvar and Prometheus are fundamentally different, and that the expvar Collector is inherently slower than native Prometheus metrics. Thus, the expvar Collector is probably great for experiments and prototying, but you should seriously consider a more direct implementation of Prometheus metrics for monitoring production systems.```
however it does not require implementation of any generic instrumentation tooling like opentelemetry

## Issues
- "THING-1234" or "Fixes #123"
Tamara-Barum commented 1 year ago

Internal ticket for tracking: FSSDK-9412

pulak-opti commented 1 year ago

Hi @204Constie Thanks for the PR. Could you please update your branch with the master branch?

pulak-opti commented 1 year ago

Hi @204Constie Thanks for the idea about collecting Prometheus metrics. However, the feature is added here https://github.com/optimizely/agent/pull/348. Please reach out if you have anything.