grpc / grpc-go

The Go language implementation of gRPC. HTTP/2 based RPC
https://grpc.io
Apache License 2.0
20.87k stars 4.33k forks source link

Examples using the `experimental` stats package #7492

Open davinci26 opened 1 month ago

davinci26 commented 1 month ago

Hey folks,

I am looking into the metrics registered in https://github.com/grpc/grpc-go/blob/0b33bfe7863c548658efdb4eac6e742ef2c8f3de/balancer/weightedroundrobin/balancer.go#L4 and they seem quite useful but I have hard time figuring out how I can use the experimental stats/metrics package to extract them.

Do you have any examples/pointers?

purnesh42H commented 1 month ago

Are you looking for this https://github.com/grpc/grpc-go/blob/master/examples/features/stats_monitoring/README.md ?

davinci26 commented 4 weeks ago

@purnesh42H hmmm I have to look into this a bit more, I dont think this example is the best one because it is not immediately obvious how you can retrieve the values here https://github.com/grpc/grpc-go/blob/b45fc413ca1ffd56cb2c7fe51220d0ed9167243b/balancer/weightedroundrobin/balancer.go#L51-L58 for example

github-actions[bot] commented 3 weeks ago

This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.

purnesh42H commented 2 weeks ago

@davinci26 did you try enabling the metrics from opentelemetry API https://github.com/grpc/grpc-go/blob/master/examples/features/opentelemetry/README.md ?

they are are probably be already being exported through opentelemetry

davinci26 commented 2 weeks ago

Our infra doesnt really support opentelemetry so I was looking into how I can export this metrics into a format that is prometheus native. So I ended up seeing how otel is implemented and then create a prom integration based on that.

Basically you need to implement an estats.MetricsRecorder and then: register it as a MetricsRecorder

github-actions[bot] commented 1 week ago

This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.

github-actions[bot] commented 4 days ago

This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed.