-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor and extend the interface for metrics with configurable labels #1548
Conversation
e4a96e9
to
4b4010f
Compare
This is a non-functional change, only reorganising code for easier development. Signed-off-by: Anna Kapuscinska <[email protected]>
This commit chnanges the logic behind counters with configurable labels. It introduces a new type, labelFilter, which defines the known and enabled labels. The labelFilter is included in the granularCounter type, which exposes filter and mustFilter methods. With this approach, the label filtering doesn't rely on the global config option. Additionally, granularCounter exposes WithLabelValues method, so that metric updates can be done with the same interface as for prometheus CounterVec. Technically it is a breaking change, but only developer facing. Signed-off-by: Anna Kapuscinska <[email protected]>
Signed-off-by: Anna Kapuscinska <[email protected]>
4b4010f
to
b7cbfee
Compare
"github.com/cilium/tetragon/pkg/metrics/consts" | ||
"github.com/cilium/tetragon/pkg/option" | ||
"github.com/prometheus/client_golang/prometheus" | ||
"golang.org/x/exp/slices" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @lambdanis I think you reintroduced golang.org/x/exp/slices
here, I don't know if it's intended since you removed that #1560.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just rebased one of my PR and noticed that go.mod needed to include the new dependency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really don't understand how the tests pass here and not on my rebased PR... https://github.com/cilium/tetragon/actions/runs/6508448671/job/17677830078?pr=1562#step:5:610
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the tests passed on this PR a while ago, before some deps got updated?
Anyway, thanks for fixing this import.
See commits for details.