Conversation
I see. I think given the current interface of MetricsRecorder this makes sense. I wonder if MetricsRecorder should be enhanced with some methods like:
I don't have a list of pro/cons with this, but it seems cleaner (?) or at least makes sense in my head. I think that recording the attempt should occur when the attempt started and not be dependent on getting a result. Given that we need to record the status, maybe that can be done separately from recording the attempt count? This probably doesn't need to be fixed now (or fixed at all), but just throwing some thoughts out. |
That's exactly what came to my mind when I thought about multiple attempts for a successful operation, should we keep a track of attempt_count somehow, with a counter maybe? But then I realized that we are calculating the metrics for each attempt, so keeping a track of number of attempts is irrelevant for us. For every attempt that resulted in something, we just increment the count by 1 with the corresponding attributes. |
|
We don't have to mention OpenTelemetry in the title, as this implementation is framework neutral. Please add more details to the description as well. |
Understood, changed title and added a detailed description. |
lqiu96
left a comment
There was a problem hiding this comment.
LGTM. I left a few nits if you could take a quick look at.
All changed and pushed. thank you. |
|
|

This PR adds framework-neutral
MetricsTracerto Gax. This class adds logics during the start and end of an RPC call to calculate the latencies and count the number of RPC calls. Metric recording responsibilities are delegated to theMetricsRecorder, providing flexibility for diverse observability frameworks.Unit tests are added for every implemented method, including tests for
MetricsTracerFactory(class responsible for creating one MetricsTacer per operation).