jaegertracing/jaeger · error
date_histogram aggregation not found in bucket %q
Error message
date_histogram aggregation not found in bucket %q
What it means
processOperationBucket extracts the nested date_histogram sub-aggregation (dateHistAggName) from each operation terms bucket. When the bucket does not contain that sub-aggregation, the per-operation metric cannot be assembled and this error is returned with the bucket's operation key for diagnosis.
Source
Thrown at internal/storage/metricstore/elasticsearch/to_domain.go:99
return metricsData, nil
}
func buildServiceLabels(serviceNames []string) []*metrics.Label {
labels := make([]*metrics.Label, len(serviceNames))
for i, name := range serviceNames {
labels[i] = &metrics.Label{Name: "service_name", Value: name}
}
return labels
}
func (t *Translator) processOperationBucket(bucket esclient.AggregationBucket, baseLabels []*metrics.Label) (*metrics.Metric, error) {
key := bucket.Key
// Extract nested date_histogram buckets
dateHistAgg, found := bucket.DateHistogram(dateHistAggName)
if !found {
return nil, fmt.Errorf("date_histogram aggregation not found in bucket %q", key)
}
// Combine base labels with operation label
labels := append(baseLabels, toDomainLabels(key)...)
return &metrics.Metric{
Labels: labels,
MetricPoints: toDomainMetricPoints(t.bucketsToPointsFunc(dateHistAgg.Buckets)),
}, nil
}
// toDomainLabels converts the bucket key to Jaeger metric labels.
func toDomainLabels(key string) []*metrics.Label {
return []*metrics.Label{
{
Name: "operation",
Value: key,
},View on GitHub (pinned to 806f444784)
Solutions
- Re-enable or fix the ES metrics rollup so every operation bucket includes the date_histogram sub-aggregation.
- Skip/exclude the offending operation or narrow the time range to complete data.
- Confirm dateHistAggName matches the sub-aggregation name used by the query builder.
Defensive patterns
Strategy: type-guard
Validate before calling
if _, found := bucket.DateHistogram(dateHistAggName); !found {
return nil, nil // caller skips this operation
} Type guard
func bucketHasDateHistogram(b esclient.AggregationBucket) bool {
_, found := b.DateHistogram(dateHistAggName)
return found
} Try / catch
m, err := t.processOperationBucket(bucket, labels)
if err != nil {
log.Printf("op %q has no histogram data: %v", bucket.Key, err)
continue
} Prevention
- Verify the rollup job writes the date_histogram sub-agg for every operation bucket.
- Pin query-builder and translator to the same dateHistAggName constant.
- Test translator against recorded ES responses from the target cluster version.
When it happens
Trigger: A terms bucket from a GroupByOperation query whose DateHistogram(dateHistAggName) lookup returns found=false — the sub-aggregation is absent from that bucket in the ES response.
Common situations: Buckets produced by an ES aggregation job configured without the histogram sub-agg; truncated/partial ES responses; querying different indices with differing mapping shapes.
Related errors
- failed to convert aggregations to metrics: %w
- %s aggregation not found
- failed to process bucket: %w
- invalid parameters
- could not find aggregation of traceIDs
AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01).
Data as JSON: /api/errors/4f595f56f644d46b.
Report an issue: GitHub.