flant / shell-operator

Shell-operator is a tool for running event-driven scripts in a Kubernetes cluster
https://flant.github.io/shell-operator/
Apache License 2.0
2.39k stars 214 forks source link

Improve the way of updating metrics collectors' labelsets #629

Closed miklezzzz closed 1 month ago

miklezzzz commented 1 month ago

Overview

The pr updates the way new labelset are applied to metrics collectors. Also, a collector is updated only if a new metric's labelset isn't a subset of the collector's labelset (there is/are new label(s) on the metric).

What this PR does / why we need it

When a metric is saved, it is checked that the metric's labels are a subset of the corresponding collector (if there is any) and if it isn't the case, the collector's labelset and stored metrics' labelsets are updated according to a new labelset (previous labels plus new labels from the metric about to store). New labelsets for metrics collectors are sorted before applying.

Special notes for your reviewer