-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
pkg/kube-metrics: Add initial operator specific metrics #1277
pkg/kube-metrics: Add initial operator specific metrics #1277
Conversation
This is ready for review, the WIP can be removed when the new kube-state-metrics release happens. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall, but a few nits and style suggestions need to be addressed.
67cdc23
to
6d2bc78
Compare
Done @estroz cam you PTAL, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since setting up metrics goes hand-in-hand with adding APIs, can we structure the scaffolding and registration of the metrics the same way that we structure the scaffolding and scheme building of the APIs?
I think that would mean:
- When
operator-sdk new
is called:- Create
pkg/metrics/metrics.go
, similar topkg/apis/apis.go
- In
cmd/manager/main.go
, use what's been setup via the exposed vars/functions inpkg/metrics/metrics.go
in the call toServeOperatorSpecificMetrics()
. Since the API-specific stuff would be handled elsewhere, I thinkServeOperatorSpecificMetrics
could be made generic and included in the SDK.
- Create
- When
operator-sdk add api
is called:- Create
pkg/metrics/addtometrics_group_version.go
, similar topkg/apis/addtoscheme_group_version.go
- Create
pkg/metrics/group/version/register.go
, similar topkg/apis/group/version/register.go
- Create
pkg/metrics/group/version/kind_metrics.go
, similar topkg/apis/group/version/kind_types.go
- Create
I think this approach would solve the issues I mentioned in the review, and it would align better with how we scaffold and register other project-specific resources.
For the namespace question, can we pass a slice of namespaces into ServeOperatorSpecificMetrics
(to be forward-compatible with upcoming multi-namespace support), and for now use what we get from k8sutil.GetWatchNamespace()
?
Lastly (and this may have been discussed before because it sounds familiar, so forgive me), is it possible/does it make sense to hook these metrics into the controller-runtime
metrics server so we don't have to run two servers on two ports?
No, because these metrics don't use the prometheus client_golang library we can't do that right now. |
da02b28
to
fda1196
Compare
fda1196
to
77ee3d2
Compare
77ee3d2
to
4046c9c
Compare
f703099
to
bdb4c90
Compare
Co-Authored-By: Joe Lanford <joe.lanford@gmail.com>
Co-Authored-By: Haseeb Tariq <hasbro17@gmail.com>
Co-Authored-By: Haseeb Tariq <hasbro17@gmail.com>
Co-Authored-By: Eric Stroczynski <estroczy@redhat.com>
Co-Authored-By: Eric Stroczynski <estroczy@redhat.com>
Co-Authored-By: Eric Stroczynski <estroczy@redhat.com>
Co-Authored-By: Eric Stroczynski <estroczy@redhat.com>
Co-Authored-By: Eric Stroczynski <estroczy@redhat.com>
16e4e0c
to
2834a72
Compare
Operator specific metrics are generated based on the api/kind given
deployed in the given namespace(s).
See https://github.com/operator-framework/operator-sdk/blob/master/doc/proposals/metering-operator-metrics.md for the full background on this work.
Things to be done:
Closes #616