Also sometimes you'll have some sort of a batch job, or a cron that can't be scrapped the regular way, checkout Prometheus Pushgateway https://prometheus.io/docs/practices/pushing/
> If you get serious about Prometheus, eventually you will want longer data retention, checkout https://thanos.io/
Any idea how it compares with https://victoriametrics.com/ ?
We're slowly looking for a replacement for InfluxDB (as 1.8 is essentially on life support), the low disk footprint is pretty big advantage here.
Prometheus remote_write is what people graduate to, this gets you the rest of the way, and you are correct it's less PITA at scale.
If you're looking for retention your choices are large, there's Cortex (CNCF), Mimir (most Cortex work moved here), Thanos, VictoriaMetrics, TimeScale, Chronosphere, and many others.
All seek to do a similar thing from a distance, they all store metrics (likely from Prometheus) and allow retention and some variety of how to query it (if you want SQL you got it, if you want non-standard functions you go it, if your reads are more important than your writes you got it, if you need a billion active series you got it, etc).
If what you want is "Prometheus but bigger" then the Prometheus project provides a compliance suite that you can run to help you evaluate your options: https://github.com/prometheus/compliance
I work for Grafana Labs, and we have maintainers working for us who have touched Prometheus, Thanos, Cortex and Mimir. Mimir is currently the largest investment we have https://github.com/grafana/mimir and it is 100% compliant with Prometheus (though that is about to be temporarily untrue as Native Histograms is landing in Prometheus soon https://github.com/prometheus/prometheus/milestone/10 and we'll need to add a perfectly compliant support to Mimir to get back to being compliant).
Pull does work like 90% of the time, + you get a handy uptime check built-in as well, as if the pull didn't work, the service is probably offline and you'll notice it immediately. With Push you still need a way of checking if the service is online/offline.
They have a blog post explaining their reasoning:
https://prometheus.io/blog/2016/07/23/pull-does-not-scale-or...
"Sure, Bob, just write a promql query against this interface"
https://news.ycombinator.com/item?id=1636348
(in case my point is too subtle: I believe that the value of long term metric retention is to support business decisions more than supporting availability related monitoring.
The tools "business deciders" use to look at "the things they call metrics" are simply unable to look at data lodged in a prometheus silo. So the data you have for long term retention is simply unusable for the thing it's most valuable)
(edited for clarity)
Do I point the biz at it? Only when I'm trying to show them availability related metrics.
Further, the vast majority of workaday devs are stressed out and under tremendous pressure to thing all the things in their ticket queue. They're probably pretty fluent in their thinging language and likely also conversant in SQL. Asking them "hey learn this other query language, because" is just adding stress to them. Sure, some are going to rise above and promql things too, but for lots, it's telling them to "write a distributed map reduce query in erlang."
However, Prometheus is not a tool that specializes in reporting availability to people who live in Excel. Prometheus scrapes metric from a lot of systems in a standard format, and enables you to see what's happening and write alerts to fix things when they break, without requiring complex frameworks. Reporting availability to people is just a small, tiny thing that Prometheus is able to do.
It doesn't rely on reading the Prometheus WAL (rather, it uses Prometheus's built-in remote-write functionality). This is both less fragile and has the benefit of being about to run Prometheus in stateless mode (or replace it entirely with something like Grafana Agent, vmagent, etc.
Grafana Labs has done a proof of concept showing Mimir scaling to 1 billion active timeseries. There are also "real" users serving 700+ million metrics in production.
Now, for something constructive:
what to metric and how?
Because time series DBs tend to "bin" metrics, that is put metrics into 1s/1m/5m "holes" you will end up being at the mercy of quantisation/averaging. To get round this, use counters for most thing. This has the advantage that its much simpler implement accurately as a programmer.
every time an error happens, increment an error, every time you get a 200, increment.
but why?
because if you do the math locally and work out the hit/second and emit that number, if you get a spike, and you aren't aware of the time binning, your 45k 1 minute spike will be averaged out as the retention lowers the temporal resolution. This means that your 45k spike could be halved each time you go down a temporal step.
Using incremental counters overcomes this, even if temporal resolution is thinned. (you can use derivative (well non negative derivative) to turn it into hit/s later on)
Microservices and metrics
Microservices tend to be simpler to add monitoring, as they _should_ be simple. Yes, by all means record memory, CPU, network and that, but you will most likely not look at that unless you have a difficult bug. make sure each of your instances of the service has a unique ID in the metric address. This will save you many hours of fuckery.
Have counters for all upstream and down stream requests(and error states). Then have gauges for response times of those requests. (beware that gauges will be averaged by time bin.) Do the same for all of the important actions your service does as well.
These metrics will give you a good base to make alerts from:
service x has had 1500 request errors from service y
conversely it can allow you to summarise all your metrics into a green/orange/red tile (ie if no errors in the last minute, be green)
See for example this (that also mentions Prometheus):
https://stanislas.blog/2018/04/monitoring-telegraf-influxdb-...
But the InfluxDB 2.0 migration have been really bad for me, how have it worked out for you?
I've stuck with InfluxDB v1.8. I dislike the new Flux language. I know there is a way to do InfluxQL queries using InfluxDB v2, but I haven't set it up yet.
https://docs.influxdata.com/influxdb/v2.5/query-data/influxq...
I've also heard good things about Sentry, though if you need to self-host it, then there's a bit of complexity to deal with: https://sentry.io/welcome/
Though of course, Prometheus and Grafana is a rather popular option as well!
Personal opinion: it doesn't seem to have gotten as much love or attention as many other commercial projects, currently being under Apache Foundation and just slowly trudging ahead. Someone else mentioned it being more popular in China which is fair, but also means that the docs and blog posts about it etc. aren't getting as much attention in the west and other places.
Personally, for many of my use cases (typically simpler projects, <20 services per environment), it's good enough, the platform support is mostly there for most of the popular languages: https://skywalking.apache.org/docs/
The docs are also there and configuring it is actually easier than Sentry, because of fewer moving parts: https://skywalking.apache.org/docs/main/next/en/setup/backen...
I don't particularly like using ElasticSearch which seems like the "happy path" but ES just loves to eat memory in general. Thankfully, there are actually some nice options for alternatives here, I wonder why other projects haven't embraced such modularity: https://skywalking.apache.org/docs/main/next/en/setup/backen...
I think that might not quite be the case in the latest versions: https://docs.sentry.io/product/performance/metrics/#custom-p...
In addition to the automatic performance metrics described above, Sentry supports setting custom performance metrics on transactions.
Custom performance metrics allow you to define metrics (beyond the ones mentioned above) that are important to your application and send them to Sentry.
For example, you might want to set a custom metric to track:
- Total memory usage during a transaction
- The amount of time being queried
- Number of times a user performed an action during a transaction
You define and configure custom metrics in the SDK.
Though for my use cases, Sentry's technical complexity is more of a stumbling block, were I to self-host it: https://github.com/getsentry/self-hosted/blob/master/docker-...I'll use alerts are for things that need acting on in the immediate to short term (e.g. a server's load being very high for over 10 minutes or an SSL certificate will need renewing in the next couple of weeks).
And I'll use Grafana dashboards to provide insight in to how a system is running (e.g. graphing number of events triggered over time or a heat map of web servers response times).
As a team we've got a handful of Grafana dashboards that we look at after we've walked our Kanban board. It only takes a few minutes and we all get to know what the current state of our systems are, and over time, what their norm is as well.
Ability to detect when something is broken right now => Monit, nagios, etc
Ideally, you have both.
We just pipe everything to collectd then riemann for downsampling and influxdb for storage but we're shopping for new stack as influxdb 1.8 is essentially on life support
[1] https://docs.victoriametrics.com/#how-to-send-data-from-infl...
[2] https://valyala.medium.com/insert-benchmarks-with-inch-influ...
https://docs.fluentbit.io/manual/pipeline/inputs/prometheus-...
It does have 64k stars on GitHub[0], but I had to google for months to find them.
Live demo: https://community-demo.coroot.com