Skip to content
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

added process metrics and Go runtime metrics #198

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions pkg/internal/controller/metrics/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ var (
)

func init() {
metrics.Registry.MustRegister(QueueLength)
metrics.Registry.MustRegister(ReconcileErrors)
metrics.Registry.MustRegister(ReconcileTime)
metrics.Registry.MustRegister(
QueueLength,
ReconcileErrors,
ReconcileTime,
// expose process metrics like CPU, Memory, file descriptor usage etc.
prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be worth adding the a namespace to the ProcessCollerctorOpts{}, if we add the namespace controller_runtime then all metrics here will be prefixed with controller_runtime_ and will fit in with the other metrics we are emitting from the library, WDYT?

Suggested change
prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{}),
prometheus.NewProcessCollector(prometheus.ProcessCollectorOpts{Namespace: "controller_runtime"}),

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about it and was a bit hesitant because these are not really controller-runtime specific metrics. If users are running other Go services (and k8s metrics for other components), they might already have configuration for processing these default prometheus metrics in their dashboards/pipelines. So keeping the same name might help them. WDYT ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good point, I've double checked with what the Kubernetes API server does and it doesn't prefix so let's keep it as is

// expose Go runtime metrics like GC stats, memory stats etc.
prometheus.NewGoCollector(),
)
}