Centralize daemon metrics#49165
Conversation
9c5499e to
25750ec
Compare
25750ec to
16c21cc
Compare
| var testImageActions = sync.OnceValue(func() metrics.LabeledTimer { | ||
| ns := metrics.NewNamespace("test", "containerd", nil) | ||
| return ns.NewLabeledTimer("image_action", "Image actions", "action") | ||
| }) |
There was a problem hiding this comment.
I started to wonder; how much sense would it make to move all those timers to a metrics package, that would have some sync.OnceValue to get them? (instead of making these a field in the daemon).
Not sure if it's better, or if it would be worse. Mostly looking that some of the initialization is a bit sprinkled throughout, which means that some namespaces are registered multiple times in different locations, e.g. there's still one in daemon/events;
Lines 10 to 15 in a72026a
But I guess that won't work for this specific case if we want separate counters for testing
16c21cc to
999668e
Compare
|
Looks like some file may need a build-tag; |
b89a535 to
4777aae
Compare
|
One more linter failure 😅 |
4777aae to
01d451b
Compare
laurazard
left a comment
There was a problem hiding this comment.
LGTM, thanks! This is much better.
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM
found one find/replace issue; not a blocker for sure, but in case you want to fix it up ❤️
| @@ -0,0 +1,130 @@ | |||
| package metrics | |||
There was a problem hiding this comment.
For a follow-up; depending where this all ends up in (i.e. if it's also included in packages that are imported externally), we could even consider having a build-tag to disable metrics at compile time.
Next commits will introduce a new internal `metrics` package, so alias the "external" import to avoid confusion. Signed-off-by: Paweł Gronowski <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
Add wrapper for StartTimer inside the internal package Signed-off-by: Paweł Gronowski <[email protected]>
Signed-off-by: Paweł Gronowski <[email protected]>
01d451b to
0f7a432
Compare
Centralize daemon metrics in an
internal/metricspackage.