{"record":{"id":"8543d603765c207f","repo":"thanos-io/thanos","slug":"empty-data-points-s-is-dropped","errorCode":null,"errorMessage":"empty data points. %s is dropped","messagePattern":"empty data points\\. (.+?) is dropped","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/receive/otlptranslator/metrics_to_prw.go","lineNumber":104,"sourceCode":"\t\t\t\t\terrs.Add(fmt.Errorf(\"invalid temporality for metric %q\", metric.Name()))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tpromName := BuildCompliantName(metric, settings.Namespace, settings.AddMetricSuffixes, settings.AllowUTF8)\n\t\t\t\tc.metadata = append(c.metadata, prompb.MetricMetadata{\n\t\t\t\t\tType:             otelMetricTypeToPromMetricType(metric),\n\t\t\t\t\tMetricFamilyName: promName,\n\t\t\t\t\tHelp:             metric.Description(),\n\t\t\t\t\tUnit:             metric.Unit(),\n\t\t\t\t})\n\n\t\t\t\t// handle individual metrics based on type\n\t\t\t\t//exhaustive:enforce\n\t\t\t\tswitch metric.Type() {\n\t\t\t\tcase pmetric.MetricTypeGauge:\n\t\t\t\t\tdataPoints := metric.Gauge().DataPoints()\n\t\t\t\t\tif dataPoints.Len() == 0 {\n\t\t\t\t\t\terrs.Add(fmt.Errorf(\"empty data points. %s is dropped\", metric.Name()))\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif err := c.addGaugeNumberDataPoints(ctx, dataPoints, resource, settings, promName); err != nil {\n\t\t\t\t\t\terrs.Add(err)\n\t\t\t\t\t\tif errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tcase pmetric.MetricTypeSum:\n\t\t\t\t\tdataPoints := metric.Sum().DataPoints()\n\t\t\t\t\tif dataPoints.Len() == 0 {\n\t\t\t\t\t\terrs.Add(fmt.Errorf(\"empty data points. %s is dropped\", metric.Name()))\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tif err := c.addSumNumberDataPoints(ctx, dataPoints, resource, metric, settings, promName); err != nil {\n\t\t\t\t\t\terrs.Add(err)\n\t\t\t\t\t\tif errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {\n\t\t\t\t\t\t\treturn","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/receive/otlptranslator/metrics_to_prw.go#L86-L122","documentation":"For gauge metrics, FromMetrics checks that the data point slice is non-empty before conversion. An OTLP gauge with zero data points contributes nothing to remote write, so this error is recorded as an annotation and the metric is dropped (not a hard failure of the whole batch).","triggerScenarios":"An OTLP MetricSummary of type Gauge whose Gauge().DataPoints() length is 0 — exporters sending metric envelopes with no data points (e.g. no-samples windows), from AddMetrics on a payload containing empty gauges.","commonSituations":"Exporters that emit metric descriptors every scrape even with zero samples; filter/transform processors in the collector removing all points but leaving the metric; SDKs emitting gauge shells when no measurement was recorded.","solutions":["Fix the exporter/collector to not emit gauges with empty data point lists","Configure processors (filter, transform) to drop empty metrics entirely rather than stripping points","Ensure the SDK actually records the gauge before export","Treat as informational: the metric is dropped and conversion continues"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"for _, m := range ms {\n    if m.Type() == pmetric.MetricTypeGauge && m.Gauge().DataPoints().Len() == 0 {\n        log.Warnf(\"gauge %q has no data points; it will be dropped\", m.Name())\n    }\n}","typeGuard":"func gaugeHasPoints(m pmetric.Metric) bool {\n    return m.Type() != pmetric.MetricTypeGauge || m.Gauge().DataPoints().Len() > 0\n}","tryCatchPattern":"_, err := translator.FromMetrics(ctx, md, settings)\nif err != nil {\n    var annots annotations.Annotations\n    if errors.As(err, &annots) {\n        for _, a := range annots {\n            if strings.Contains(a.Error(), \"empty data points\") {\n                log.Warnf(\"dropped empty metric: %v\", a)\n            }\n        }\n    }\n}","preventionTips":["Configure filter/transform processors to drop empty metrics wholesale","Fix exporters that emit descriptor-only metrics on empty scrapes","Only export instruments that were actually recorded in the interval"],"tags":["otlp","gauge","empty-data"],"backgroundTag":"empty-api-response","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"}