{"record":{"id":"a12cf53fa1d04c4b","repo":"temporalio/temporal","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/matching/pri_metrics_handler.go","lineNumber":67,"sourceCode":"}\n\nfunc (p priMetricHandler) Stop(logger log.Logger) {\n\tp.handler.Stop(logger)\n}\n\nfunc (p priMetricHandler) Counter(name string) metrics.CounterIface {\n\treturn priMetricsCounter{name: name, handler: p.handler}\n}\nfunc (p priMetricHandler) Timer(name string) metrics.TimerIface {\n\treturn priMetricsTimer{name: name, handler: p.handler}\n}\n\nfunc (p priMetricHandler) Gauge(name string) metrics.GaugeIface {\n\treturn priMetricsGauge{name: name, handler: p.handler}\n}\n\nfunc (p priMetricHandler) WithTags(...metrics.Tag) metrics.Handler {\n\tpanic(\"not implemented\")\n}\n\nfunc (p priMetricHandler) Histogram(string, metrics.MetricUnit) metrics.HistogramIface {\n\tpanic(\"not implemented\")\n}\n\nfunc (p priMetricHandler) StartBatch(string) metrics.BatchHandler {\n\tpanic(\"not implemented\")\n}\n\nfunc (c priMetricsCounter) Record(i int64, tag ...metrics.Tag) {\n\tc.handler.Counter(c.name).Record(i, tag...)\n\tc.handler.Counter(withPriPrefix(c.name)).Record(i, tag...)\n}\n\nfunc (t priMetricsTimer) Record(duration time.Duration, tag ...metrics.Tag) {\n\tt.handler.Timer(t.name).Record(duration, tag...)\n\tt.handler.Timer(withPriPrefix(t.name)).Record(duration, tag...)","sourceCodeStart":49,"sourceCodeEnd":85,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/service/matching/pri_metrics_handler.go#L49-L85","documentation":"priMetricHandler wraps the matching service's metrics handler to dual-record priority metrics. WithTags is intentionally unimplemented: the wrapper expects tags to be applied via the underlying handler methods (Counter/Histogram/Gauge return recorders that accept tags per call), so a WithTags call indicates a misuse of the handler API.","triggerScenarios":"Any code calling WithTags on a priMetricHandler — e.g. passing the wrapper where a generic metrics.Handler is expected and generic instrumentation code invokes WithTags to attach routing/scheduling tags.","commonSituations":"Refactors that thread a metrics.Handler through shared code without knowing the pri/fair wrappers only support the subset of the interface; new metric emissions added inside priority-task-queue code paths.","solutions":["Do not call WithTags on priMetricHandler; pass tags per-record via the recorder methods (Counter(name).Record(v, tag...))","If tags are required at handler level, implement WithTags to return a tag-applying wrapper over p.handler instead of panicking","Use the embedded underlying handler (p.handler) when generic handler behavior is needed"],"exampleFix":"// before\nh := p.priHandler // priMetricHandler\nh.WithTags(metrics.StringTag(\"queue\", qName)).Counter(\"foo\").Record(1)\n\n// after\nh := p.handler // underlying metrics.Handler\nh.WithTags(metrics.StringTag(\"queue\", qName)).Counter(\"foo\").Record(1)","handlingStrategy":"validation","validationCode":"// Never call WithTags on the pri wrapper; resolve the base handler first\nif h, ok := handler.(metrics.Handler); ok && isPriMetricHandler(h) {\n\treturn fmt.Errorf(\"use underlying handler for WithTags\")\n}","typeGuard":null,"tryCatchPattern":"func safeWithTags(h metrics.Handler, tags ...metrics.Tag) (scoped metrics.Handler, err error) {\n\tdefer func() {\n\t\tif rec := recover(); rec != nil {\n\t\t\terr = fmt.Errorf(\"WithTags unsupported: %v\", rec)\n\t\t}\n\t}()\n\treturn h.WithTags(tags...), nil\n}","preventionTips":["Check the pri/fair handler contract before adding handler-level tagging in matching service code","Apply tags per Record call instead of via WithTags when instrumenting priority metrics","Keep a concrete list of which metrics.Handler methods the pri/fair wrappers support"],"tags":["go","panic","metrics","unimplemented"],"backgroundTag":"not-implemented-metrics-handler","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}