jaegertracing/jaeger · error

failed to search for Latest Probabilities: %w

Error message

failed to search for Latest Probabilities: %w

What it means

After resolving the latest sampling index, GetLatestProbabilities issues a Search against it; any error from the searcher is wrapped as 'failed to search for Latest Probabilities'. This indicates the Elasticsearch query itself failed at the transport or cluster level, not that results were empty (an empty result returns nil, nil).

Source

Thrown at internal/storage/v1/elasticsearch/samplingstore/storage.go:132

	val := dbmodel.ProbabilitiesAndQPS{
		Hostname:      hostname,
		Probabilities: probabilities,
		QPS:           qps,
	}
	return s.writeProbabilitiesAndQPS(writeIndexName, ts, val)
}

func (s *SamplingStore) GetLatestProbabilities() (model.ServiceOperationProbabilities, error) {
	ctx := context.Background()
	index, err := s.getLatestIndex(ctx)
	if err != nil {
		return nil, fmt.Errorf("failed to get latest index: %w", err)
	}
	searchResult, err := s.searcher.Search(ctx, []string{index}, esclient.SearchRequest{
		Size: s.maxDocCount,
	})
	if err != nil {
		return nil, fmt.Errorf("failed to search for Latest Probabilities: %w", err)
	}
	lengthOfSearchResult := len(searchResult.Hits.Hits)
	if lengthOfSearchResult == 0 {
		return nil, nil
	}

	var latestProbabilities dbmodel.TimeProbabilitiesAndQPS
	latestTime := time.Time{}
	for _, hit := range searchResult.Hits.Hits {
		var data dbmodel.TimeProbabilitiesAndQPS
		if err = json.Unmarshal(hit.Source, &data); err != nil {
			return nil, fmt.Errorf("unmarshalling documents failed: %w", err)
		}
		if data.Timestamp.After(latestTime) {
			latestTime = data.Timestamp
			latestProbabilities = data
		}
	}

View on GitHub (pinned to 806f444784)

Solutions

  1. Check ES cluster health and logs for the underlying request failure; the wrapped cause names it.
  2. Retry with backoff — transient network/timeout failures are common here.
  3. Verify the service account has read access to the sampling index.
  4. Reduce maxDocCount or tune ES timeouts if the search is timing out under load.
Defensive patterns

Strategy: retry

Try / catch

var probs model.ServiceOperationProbabilities
err := retry.Do(func() error {
  var e error
  probs, e = store.GetLatestProbabilities()
  return e
}, retry.Attempts(3), retry.Backoff(time.Second))

Prevention

When it happens

Trigger: Calling GetLatestProbabilities when the ES cluster is unreachable, times out, rejects credentials, or rejects the search request (e.g. index deleted between existence check and search, mapping/parse error).

Common situations: ES node restarts or network partition mid-request; query timeout because maxDocCount is large and the cluster is loaded; security/authorization changes revoking read access to the sampling index.

Related errors


AI-assisted analysis of jaegertracing/jaeger@806f444784 (2026-09-01). Data as JSON: /api/errors/f25897daf3dc3d67. Report an issue: GitHub.