{"record":{"id":"367ea66b36175ed6","repo":"jaegertracing/jaeger","slug":"failed-to-search-for-throughputs-w","errorCode":null,"errorMessage":"failed to search for throughputs: %w","messagePattern":"failed to search for throughputs: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/v1/elasticsearch/samplingstore/storage.go","lineNumber":93,"sourceCode":"\t\t\t\tTimestamp:  ts,\n\t\t\t\tThroughput: eachThroughput,\n\t\t\t},\n\t\t})\n\t}\n\t// context.Background: sampling writes are not request-scoped, and the async\n\t// indexer this uses ignores the context anyway (see BulkIndexer.WriteBatch).\n\treturn s.batchWriter.WriteBatch(context.Background(), items)\n}\n\nfunc (s *SamplingStore) GetThroughput(start, end time.Time) ([]*model.Throughput, error) {\n\tctx := context.Background()\n\treadIndices := s.rotation.ReadTargets(start, end)\n\tsearchResult, err := s.searcher.Search(ctx, readIndices, esclient.SearchRequest{\n\t\tSize:  s.maxDocCount,\n\t\tQuery: buildTSQuery(start, end),\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to search for throughputs: %w\", err)\n\t}\n\toutput := make([]dbmodel.TimeThroughput, len(searchResult.Hits.Hits))\n\tfor i, hit := range searchResult.Hits.Hits {\n\t\tif err := json.Unmarshal(hit.Source, &output[i]); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"unmarshalling documents failed: %w\", err)\n\t\t}\n\t}\n\toutThroughputs := make([]dbmodel.Throughput, len(output))\n\tfor i, out := range output {\n\t\toutThroughputs[i] = out.Throughput\n\t}\n\treturn dbmodel.ToThroughputs(outThroughputs), nil\n}\n\nfunc (s *SamplingStore) InsertProbabilitiesAndQPS(hostname string,\n\tprobabilities model.ServiceOperationProbabilities,\n\tqps model.ServiceOperationQPS,\n) error {","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/jaegertracing/jaeger/blob/806f4447841ecdb60519f408b004a599d515f437/internal/storage/v1/elasticsearch/samplingstore/storage.go#L75-L111","documentation":"GetThroughput in the Elasticsearch sampling store executes a search over the rotated throughput indices using buildTSQuery; if the ES search call itself fails (connection error, HTTP error, invalid query), the error is wrapped with 'failed to search for throughputs' before being returned to the remote sampling client.","triggerScenarios":"Calling GetThroughput when the Elasticsearch search request fails: ES unreachable, authentication rejected, index missing/aliases wrong, or the SearchRequest rejected by the cluster (e.g. query parse error).","commonSituations":"ES cluster down or misconfigured (server URLs, credentials); sampling data indices never created because the sampling data stream was never enabled; index rotation misalignment with the requested [start,end] window.","solutions":["Check connectivity/credentials to Elasticsearch (URLs, auth, TLS) used by the Jaeger ES storage config.","Verify throughput indices exist for the requested time window (rotation settings match start/end).","Look at the wrapped ES error / ES server logs for the rejection reason (query parse, shard failures).","Retry once ES is healthy; transient 503s during rolling restarts surface here."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"tp, err := store.GetThroughput(ctx, start, end)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to search for throughputs\") {\n        // ES search failed: check wrapped cause; retry after cluster recovers\n    }\n    return err\n}","preventionTips":["Verify ES connectivity and auth before enabling remote sampling.","Ensure sampling throughput indices/aliases exist for the query window.","Match index rotation settings with the requested start/end times.","Alert on ES cluster health to catch 503 windows early."],"tags":["elasticsearch","sampling","search","network"],"backgroundTag":"search-request-failed","analyzedSha":"806f4447841ecdb60519f408b004a599d515f437","analyzedAt":"2026-09-01T02:39:22.140Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}