k3s-io / kine

Run Kubernetes on MySQL, Postgres, sqlite, dqlite, not etcd.
Apache License 2.0
1.56k stars 233 forks source link

Introduce metrics #121

Closed zqzten closed 2 years ago

zqzten commented 2 years ago

This PR introduce metrics to kine.

It'll expose below metrics:

If kine is running stand-alone, we can use the metrics-bind-address flag to configure the metrics http server address or disable the server. If kine is used as a library, we can set MetricsRegisterer of endpoint.Config to our own prometheus registerer to let kine register its metrics to it.

fixes #119

zqzten commented 2 years ago

@brandond Thanks for the comments! I have made changes accrodingly, PTAL.

For the JetStream driver, I omit it because it's not a SQL backend and cannot be included in the metrics introduced in this PR. Also, I'm not quite familiar with it so maybe we shall leave its own metric implementations to some other one who really need them.

zqzten commented 2 years ago

@brandond Brilliant solution 👍 I have modifed the code accroding to your solution, PTAL.

zqzten commented 2 years ago

@brandond Hi, are there any blocking issue on this PR? Seems that the test can't proceed with arm64 build for some unknown reason.

brandond commented 2 years ago

Restarted CI

zqzten commented 2 years ago

@brandond Mind merging this? We'd like to use this feature in community vendor, thanks!