Skip to content

Commit 23837ba

Browse files
committed
Expose Linode Client Prometheus metrics
Add `--authorization-always-allow-paths="/metrics"` to command line to allow scraping these metrics. In addition to Linode Client metrics, standard controller and worqueue metrics are visible by default. To disambiguate CCM node controller work queue name, it's explicitly named "ccm_node". That is, "node", "service" are upstream work queues of k8s cloud-provider service controller and "ccm_node" is the work queue of Linode CCM node controller. Fixes #296
1 parent 441aec9 commit 23837ba

File tree

9 files changed

+533
-14
lines changed

9 files changed

+533
-14
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,16 @@ Values can be set/overrided by using the '--set var=value,...' flag or by passin
367367

368368
Recommendation: Use custom-values.yaml to override the variables to avoid any errors with template rendering
369369

370+
### Prometheus metrics
371+
372+
Cloud Controller Manager exposes metrics by default on port given by
373+
`--secure-port` flag. The endpoint is protected from unauthenticated access by
374+
default. To allow unauthenticated clients (`system:anonymous`) access
375+
Prometheus metrics, use `--authorization-always-allow-paths="/metrics"` command
376+
line flag.
377+
378+
Linode API calls can be monitored using `ccm_linode_client_requests_total` metric.
379+
370380
### Upstream Documentation Including Deployment Instructions
371381

372382
[Kubernetes Cloud Controller Manager](https://kubernetes.io/docs/tasks/administer-cluster/running-cloud-controller/).

cloud/linode/client/client.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package client
22

33
//go:generate go run github.com/golang/mock/mockgen -destination mocks/mock_client.go -package mocks github.com/linode/linode-cloud-controller-manager/cloud/linode/client Client
4+
//go:generate go run github.com/hexdigest/gowrap/cmd/gowrap gen -g -p github.com/linode/linode-cloud-controller-manager/cloud/linode/client -i Client -t ../../../hack/templates/prometheus.go.gotpl -o client_with_metrics.go -l ""
45

56
import (
67
"context"
@@ -9,6 +10,7 @@ import (
910
"os"
1011
"time"
1112

13+
_ "github.com/hexdigest/gowrap"
1214
"github.com/linode/linodego"
1315
"k8s.io/klog/v2"
1416
)

0 commit comments

Comments
 (0)