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

Support for WithSubsystem() #632

Open
rohsaini opened this issue Sep 6, 2023 · 5 comments
Open

Support for WithSubsystem() #632

rohsaini opened this issue Sep 6, 2023 · 5 comments

Comments

@rohsaini
Copy link
Contributor

rohsaini commented Sep 6, 2023

Similar to WithConstLabels(), can we also have WithSubsystem() in github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus? This will help to rename grpc metrics across different processes. Without this, it causes confusion and difficulty in understanding.

@johanbrandhorst
Copy link
Collaborator

What is a subsystem? I'm not a prometheus expert, could you elaborate on the problem and use case you have?

@rohsaini
Copy link
Contributor Author

rohsaini commented Sep 14, 2023

Hello,
Sorry for the delayed response.

Similar to ConstLabels, prometheus.CounterOpts, GaugeOpts, etc also accepts a parameter "Subsystem".
As per github.com/prometheus/client_golang/prometheus, Namespace, Subsystem, and Name are components of the fully-qualified name of the Metric (created by joining these components with "_"). Only Name is mandatory, the others merely help structuring the name.

Use case:
I have different microservices in my system. All expose metrics along with subsystem name. subsystem name is the identity/name of microservice.
ex:
SUB1_metricname, SUB2_metricname

So, this helps in readability and debuggability to understand which system component was the source of metric without even looking at metric instance label.

This is the reason for seeking subsystem support for grpc metrics also.

@johanbrandhorst
Copy link
Collaborator

OK, so the proposal is for a new WithSubsystem(subsystem string) option when insantiating the prometheus provider? That sounds reasonable to me. Are you interested in helping to implement this?

@rohsaini
Copy link
Contributor Author

Thanks Johan. Raised #639

@rohsaini
Copy link
Contributor Author

@johanbrandhorst Raised new PR #643 . I had to close earlier one due to some CLA issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants