Search code examples
kubernetescontainersprometheusmetrics

How can i get save metric per second on prometheus?


For k8s v1.8 and Prometheus v2.2.1

I want to know number of metrics per second stored by Prometheus

How do I extract that information?


Solution

  • Prometheus exposes the metric prometheus_tsdb_head_samples_appended_total in the /metrics path of your prometheus instance. This counter represents the Total number of appended samples.

    You can then use if for computing the rate of ingestion:

    rate(prometheus_tsdb_head_samples_appended_total[1m])
    

    Which is effectively the number of metrics per second stored by Prometheus as taken from the last minute.

    If you want to sample the instantaneous number of metrics per second, you can also use irate() instead.