temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Migrate usage of metrics.Handler to metricDefinition.With

Open MichaelSnowden opened this issue 2 years ago • 1 comments

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 avatar Dec 02 '23 00:12 MichaelSnowden

@MichaelSnowden, I'm interested in working on it!

luansapelli avatar Dec 07 '23 23:12 luansapelli

I think we can close this issue now 😄

Thanks for the support @MichaelSnowden.

luansapelli avatar Mar 09 '24 01:03 luansapelli

Closed as fixed in https://github.com/temporalio/temporal/pull/5236

stephanos avatar Mar 11 '24 23:03 stephanos