{"record":{"id":"aac8789650a5f147","repo":"apache/beam","slug":"failed-to-deduce-step-from-monitoringinfo-v","errorCode":null,"errorMessage":"failed to deduce Step from MonitoringInfo: %v","messagePattern":"failed to deduce Step from MonitoringInfo: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/metricsx/metricsx.go","lineNumber":156,"sourceCode":"\t\tdefault:\n\t\t\tlog.Println(\"unknown metric type\", minfo.GetUrn())\n\t\t}\n\t}\n\tif len(errs) > 0 {\n\t\tslog.Debug(\"errors during metrics processing\", \"count\", len(errs), \"errors\", errs)\n\t}\n\treturn counters, distributions, gauges, msecs, pcols\n}\n\nfunc extractKey(mi *pipepb.MonitoringInfo, pcolToTransform map[string]string) (metrics.StepKey, error) {\n\tlabels := newLabels(mi.GetLabels())\n\tstepName := labels.Transform()\n\n\tif v, ok := pcolToTransform[labels.PCollection()]; ok {\n\t\tstepName = v\n\t}\n\tif stepName == \"\" {\n\t\treturn metrics.StepKey{}, fmt.Errorf(\"failed to deduce Step from MonitoringInfo: %v\", mi)\n\t}\n\treturn metrics.StepKey{Step: stepName, Name: labels.Name(), Namespace: labels.Namespace()}, nil\n}\n\nfunc extractCounterValue(reader *bytes.Reader) (int64, error) {\n\tvalue, err := coder.DecodeVarInt(reader)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn value, nil\n}\n\nfunc extractMsecValue(reader *bytes.Reader) (time.Duration, error) {\n\tvalue, err := coder.DecodeVarInt(reader)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn time.Duration(value) * time.Millisecond, nil","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/metricsx/metricsx.go#L138-L174","documentation":"extractKey derives a metrics.StepKey from a MonitoringInfo: it uses the transform label, overridden by a PCollection-to-transform mapping. If the resulting step name is empty — no transform label and no PCollection match — the StepKey cannot be built and this error is returned identifying the MonitoringInfo.","triggerScenarios":"Processing monitoring data (via groupByType) whose labels lack a transform and whose PCollection ID is absent from pcolToTransform — e.g. monitoring infos from unknown/unmapped PCollections or hand-crafted metrics.","commonSituations":"Runner-emitted monitoring infos for synthetic/edge transforms, metrics for PCollections not registered in the mapping, or version skew where label URNs changed.","solutions":["Ensure the MonitoringInfo carries a valid transform (PTransform) label.","Populate pcolToTransform for every PCollection referenced by monitoring infos before calling extractKey.","Log/inspect the MonitoringInfo in the error message to identify which PCollection is unmapped.","Upgrade SDK/runner together to keep monitoring-info label URNs consistent."],"exampleFix":"// before\nkey, err := extractKey(mi, nil) // no PCollection mapping\n// after\nkey, err := extractKey(mi, map[string]string{\"pcoll-1\": \"step-Extract\"})","handlingStrategy":"validation","validationCode":"func hasStepIdentity(mi *monpb.MonitoringInfo, pcolToTransform map[string]string) bool {\n\treturn mi.GetLabels()[\"PTRANSFORM\"] != \"\" ||\n\t\tpcolToTransform[mi.GetLabels()[\"PCOLLECTION\"]] != \"\"\n}","typeGuard":null,"tryCatchPattern":"key, err := extractKey(mi, pcolToTransform)\nif err != nil {\n\tlog.Printf(\"skipping unmappable monitoring info: %v\", err)\n\tcontinue\n}","preventionTips":["Build the complete PCollection→transform map before metric extraction.","Drop or flag monitoring infos from unknown PCollections.","Keep runner and SDK label URNs version-aligned."],"tags":["metrics","monitoring","labels","beam","go"],"backgroundTag":"empty-required-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}