问题
I have an application that exposes metrics in the Prometheus format at an HTTP endpoint but want to run it in an environment that uses StatsD. Prometheus provides a program that accepts StatsD metrics and exports them to Prometheus, but I can't seem to find a program to do the reverse. I understand that all metric types might not map cleanly, but are there any such programs out there or libraries that do some of the work for you?
回答1:
I'm not aware of any such tool, however several Prometheus clients have a parser for the Prometheus text format such as Python and that could be then munged and sent on to statsd.
回答2:
StatsD is a tool for aggregating events into metrics / time series. The data on Prometheus /metrics
endpoints is already in the form of metrics, so it has already been aggregated over time (e.g. a counter containing the count of many events). While you can go from events to metrics (which is what https://github.com/prometheus/statsd_exporter does), you can't go the other way around, since information is already lost. So I don't think it makes sense to send Prometheus metrics to a StatsD endpoint in general. You'd either have to instrument on an event basis (e.g. using a StatsD client library) in the first place, or you can just skip the StatsD step and instead scrape and write out the finished metrics into Graphite or whatever other TSDB your StatsD normally writes to.
来源:https://stackoverflow.com/questions/44706574/are-there-any-existing-programs-for-scraping-prometheus-formatted-metrics-and-se