...
You can verify that a metric is being properly published by visiting the metrics endpoint of your Connexion server (https://your-server:8092/metrics) and searching for the metric name.
...
Understanding Prometheus Metrics
Prometheus metrics are comprised of 2 parts: a name, and zero or more labels. The name identifies the metric (connexion_channel_message_count
in the image above), and the labels identify any association(s). The labels in the above image Group=X
, Tab=Y
, Channel=Z
etc. denote the group/tab/channel for which we are writing message count values. In Prometheus (and Grafana) we can query on these labels, allowing us to create a graph or table for a specific channel. We can also use functions to create other metrics, such as a sum
, average
, or delta
(among many others) of all queued messages with a tab label equal to ‘XYZ’.
If you create your own metrics, you will need to think about the types of visualizations you want to support, and ensure you supply labels which support this.
Metric Types
Connexion supports 3 types of metric: Counters, Gauges, and Histograms.
Counters are for data that only ever increases (such as request count) and reset to zero when the service restarts. When you want to show the rate/speed of an operation, you typically want a Counter.
Gauges are like counters, but allow values to increase and decrease. For example, cpu and memory metrics would be gauges.
Histograms allow you to measure the distribution, count, and rate/time. For example, if you wanted to measure the size of a payload, a histogram would show you how many of your payloads were between X and Y in size, and how many were between Y and Z in size etc. It can also calculate the rate payload operations as well as other more advanced metrics (such as how many payloads were above/below a certain threshold).