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

Wrapper that adds the cluster name as a label. #8961

Merged
merged 6 commits into from
May 13, 2020
Merged

Conversation

mgritter
Copy link
Contributor

@mgritter mgritter commented May 8, 2020

The new telemetry metrics all use cluster as a label; this helper adds it automatically rather than specifying it in each location.

@mgritter mgritter requested review from ncabatoff and mjarmy May 8, 2020 20:57
append(labels, Label{"cluster", m.ClusterName}))
}

var globalClusterMetrics *ClusterMetricSink
Copy link
Collaborator

Choose a reason for hiding this comment

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

Every time I introduce a global I always wind up regretting it eventually (and I wish go-metrics did not rely on one). Are you sure this can't just be a field in Core instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems to me like we will want to introduce some metrics in places that are not in Core, such as individual secret engines. The new counts could probably all be handled by adding a member to Core, but then we would end up also passing the wrapper down to TokenStore and ExpirationManager and PassthroughBackend.

On the plus side, having it in core would give a more sensible way of initializing the cluster name. But I don't understand right now how it would get to all the other places.

One of the longer-term goals here is to be able to convert existing go-metrics calls (if we can find a sensible way to do so) so that they can start including the cluster ID too, which pushed me in the direction of more closely matching how go-metrics does things.

I'll give this some more thought.

Copy link
Collaborator

Choose a reason for hiding this comment

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

TokenStore and ExpirationManager have their own Core objects already, so I'm not sure why they need to be passed the wrapper.

What about adding something to the system view for use by secrets engines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, they can access it through Core if it's exported.

It seems like the parallel for backends would be to provide it in BackendConfig like the Logger.

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 would really not like to introduce a metrics sink here and then come back and do it all over again with the event system broker,, but I guess that's probably the best option.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed global variable; I'll do something with SystemView or BackendConfig when I am adding a real use case.

command/server.go Outdated Show resolved Hide resolved
@mgritter mgritter merged commit d5b1d5d into master May 13, 2020
@briankassouf briankassouf deleted the new_metrics_1 branch May 13, 2020 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants