{"record":{"id":"944b3a09a9dfff7c","repo":"thanos-io/thanos","slug":"unsupported-exemplar-value-type-v","errorCode":null,"errorMessage":"unsupported exemplar value type: %v","messagePattern":"unsupported exemplar value type: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/receive/otlptranslator/helper.go","lineNumber":370,"sourceCode":"\tpromExemplars := make([]prompb.Exemplar, 0, pt.Exemplars().Len())\n\tfor i := 0; i < pt.Exemplars().Len(); i++ {\n\t\tif err := everyN.checkContext(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\texemplar := pt.Exemplars().At(i)\n\t\texemplarRunes := 0\n\n\t\tpromExemplar := prompb.Exemplar{\n\t\t\tTimestamp: timestamp.FromTime(exemplar.Timestamp().AsTime()),\n\t\t}\n\t\tswitch exemplar.ValueType() {\n\t\tcase pmetric.ExemplarValueTypeInt:\n\t\t\tpromExemplar.Value = float64(exemplar.IntValue())\n\t\tcase pmetric.ExemplarValueTypeDouble:\n\t\t\tpromExemplar.Value = exemplar.DoubleValue()\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unsupported exemplar value type: %v\", exemplar.ValueType())\n\t\t}\n\n\t\tif traceID := exemplar.TraceID(); !traceID.IsEmpty() {\n\t\t\tval := hex.EncodeToString(traceID[:])\n\t\t\texemplarRunes += utf8.RuneCountInString(traceIDKey) + utf8.RuneCountInString(val)\n\t\t\tpromLabel := labelpb.ZLabel{\n\t\t\t\tName:  traceIDKey,\n\t\t\t\tValue: val,\n\t\t\t}\n\t\t\tpromExemplar.Labels = append(promExemplar.Labels, promLabel)\n\t\t}\n\t\tif spanID := exemplar.SpanID(); !spanID.IsEmpty() {\n\t\t\tval := hex.EncodeToString(spanID[:])\n\t\t\texemplarRunes += utf8.RuneCountInString(spanIDKey) + utf8.RuneCountInString(val)\n\t\t\tpromLabel := labelpb.ZLabel{\n\t\t\t\tName:  spanIDKey,\n\t\t\t\tValue: val,\n\t\t\t}","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/otlptranslator/helper.go#L352-L388","documentation":"getPromExemplars converts OTLP exemplars to Prometheus exemplars. Exemplar values must be int or double; any other value type hits the default branch and returns this error, dropping exemplar conversion.","triggerScenarios":"An OTLP exemplar whose ValueType() is neither ExemplarValueTypeInt nor ExemplarValueTypeDouble — i.e. an unset/empty exemplar value, typically from a producer that created exemplars without setting a value or from a codec/protobuf mismatch.","commonSituations":"Custom OTLP exporters building exemplars manually and leaving the oneof value unset; corrupted or truncated protobuf from a broken collector pipeline; SDK version producing exemplar structs with zeroed value fields.","solutions":["Fix the producer (SDK/exporter) so every exemplar sets IntValue or DoubleValue","Check collector/SDK versions for known exemplar-encoding bugs and upgrade","Drop exemplars with unset values client-side before export","Validate with the newest proto definitions that the value oneof is populated"],"exampleFix":"// before: exemplar created without a value\nex := pmetric.NewExemplar()\nex.SetTimestamp(...)\n// after\nex := pmetric.NewExemplar()\nex.SetDoubleValue(latencySeconds)","handlingStrategy":"type-guard","validationCode":"for i := 0; i < exs.Len(); i++ {\n    ex := exs.At(i)\n    if ex.ValueType() != pmetric.ExemplarValueTypeInt && ex.ValueType() != pmetric.ExemplarValueTypeDouble {\n        return errors.New(\"exemplar without a value\")\n    }\n}","typeGuard":"func hasValue(ex pmetric.Exemplar) bool {\n    return ex.ValueType() == pmetric.ExemplarValueTypeInt || ex.ValueType() == pmetric.ExemplarValueTypeDouble\n}","tryCatchPattern":"exemplars, err := getPromExemplars(md.Exemplars(), ...)\nif err != nil {\n    if strings.Contains(err.Error(), \"unsupported exemplar value type\") {\n        log.Warnf(\"dropping exemplars: %v\", err)\n        return nil\n    }\n    return err\n}","preventionTips":["Verify exporter SDKs always set exemplar Int/Double value","Keep collector and SDK versions aligned on proto/oneof handling","Round-trip test exemplars through your pipeline"],"tags":["otlp","exemplars","translation"],"backgroundTag":"unsupported-value-type","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}