Migrate usage of metrics.Handler to metricDefinition.With
Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
The problem is that calls to our metrics.Handler's methods often contain redundant information like this:
handler.Histogram( myHisto.Name(), myHisto.Unit() ).Record(...)
│ │ └───┐
│ │ │
└─────┐ └───────────┐ │
│ │ │
Redundant and Unsafe: 'Histogram' │ │
is specified despite knowing │ │
'myHisto' is a histogram. There's │ │
also a risk if 'myHisto.Name()' │ │
refers to a metric definition that │ │
is not a histogram. │ │
└─── Redundant information
However, we now have an alternative solution as of https://github.com/temporalio/temporal/pull/5187.
Describe the solution you'd like A clear and concise description of what you want to happen.
I'd like us to migrate all usage of metrics.metricDefinition objects to the new style of recording metrics. See this for an example. This should be a fairly mechanical refactoring. We may be able to utilize some automated structural refactoring tools, or this could be done manually.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Add any other context or screenshots about the feature request here.
@MichaelSnowden, I'm interested in working on it!
I think we can close this issue now 😄
Thanks for the support @MichaelSnowden.
Closed as fixed in https://github.com/temporalio/temporal/pull/5236