Skip to content

Commit

Permalink
metrics: Expose go_sched_latencies_seconds
Browse files Browse the repository at this point in the history
It's a useful metric. From https://pkg.go.dev/runtime/metrics:

/sched/latencies:seconds
  Distribution of the time goroutines have spent in the scheduler
  in a runnable state before actually running. Bucket counts
  increase monotonically.

Signed-off-by: Anna Kapuscinska <[email protected]>
  • Loading branch information
lambdanis committed Aug 15, 2024
1 parent ecdb38f commit 52e082e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/content/en/docs/reference/metrics.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion pkg/metricsconfig/initmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package metricsconfig

import (
"regexp"

"github.com/cilium/tetragon/pkg/metrics/eventmetrics"
"github.com/cilium/tetragon/pkg/metrics/syscallmetrics"
"github.com/prometheus/client_golang/prometheus"
Expand All @@ -12,7 +14,10 @@ import (

func initResourcesMetrics(registry *prometheus.Registry) {
// register common third-party collectors
registry.MustRegister(collectors.NewGoCollector())
registry.MustRegister(collectors.NewGoCollector(
collectors.WithGoCollectorRuntimeMetrics(
collectors.GoRuntimeMetricsRule{Matcher: regexp.MustCompile(`^/sched/latencies:seconds`)},
)))
registry.MustRegister(collectors.NewProcessCollector(collectors.ProcessCollectorOpts{}))
}

Expand Down

0 comments on commit 52e082e

Please sign in to comment.