Name the autocomplete Global Search SLI target
Names the autocomplete Global Search SLI target AUTOCOMPLETE_TARGET_S, and makes an un-derived target detectable. Still 5 seconds, so no SLI behaviour changes.
What does this MR do and why?
SearchController#autocomplete reports nil search type, level and scope, so it matched no branch of duration_target and took the 5s default by accident — indistinguishable from a chosen threshold, and an edit to DEFAULT_TARGET_S would have moved it silently.
| Before | After |
|---|---|
An unclaimed combination fell through to DEFAULT_TARGET_S in the derivation |
derived_duration_target returns nil; only duration_target falls back |
| A scope added later would inherit the 5 unnoticed | A spec fails if any registered combination derives no target |
The target is deliberately not re-tightened here; the collapsed section below says why.
Reviewer focus: the EE semantic override moves to derived_duration_target. That keeps semantic inside the every-label guard but puts the autocomplete endpoint_id check ahead of it — correct today, since autocomplete never reports the semantic type.
References
- Spec:
specs/global-search-request-sli/SPEC.md(merged7f927a31e3c5) — documents this fallthrough; its acceptance criterion 9 states the one-owner property the new spec asserts. - Related to #627960 — its Finding 1 measures autocomplete at 2.40% apdex failure against this 5s bar.
- !254016 adds the histogram a re-derived target needs.
Screenshots or screen recordings
Not applicable — no UI change. The only observable field is target_s on the Global Search Apdex SLI log line, unchanged at 5.
How to set up and validate locally
bundle exec rspec spec/lib/gitlab/metrics/global_search_slis_spec.rb ee/spec/lib/ee/gitlab/metrics/global_search_slis_spec.rb- Delete the
zoektbranch fromderived_duration_target; the every-combination example fails.
MR acceptance checklist
Evaluated against the MR acceptance checklist.
Mechanism, citations and verification (for agents / deep readers)
Mechanism
Three files, at head dcab60cd:
lib/gitlab/metrics/global_search_slis.rb— addsAUTOCOMPLETE_TARGET_SandAUTOCOMPLETE_ENDPOINT_ID;duration_targetreturns the autocomplete target whenendpoint_idmatches, otherwisederived_duration_target(...) || DEFAULT_TARGET_S. The branch chain moves intoderived_duration_target, whoseelsearm is deleted so an unclaimed combination yieldsnil.autocomplete_labelsuses the new constant, andDEFAULT_TARGET_Sgains a comment marking it the un-derived fallthrough.ee/lib/ee/gitlab/metrics/global_search_slis.rb— thesemanticoverride is re-pointed fromduration_targettoderived_duration_target.spec/lib/gitlab/metrics/global_search_slis_spec.rb— an autocomplete example passingadvanced/blobsdimensions, which resolve to 15.52 without the new branch, so it cannot pass on the old code; plus twoderived_duration_targetexamples, one asserting every combination inpossible_labelsderives a target (guarded against a vacuous pass on an empty list) and one asserting an unknown type derivesnil.
The target is not re-tightened because 93.3% of autocomplete's over-5s requests fall in a recurring 2-hourly cluster spike this endpoint does not cause, and per-scope duration percentiles do not exist yet — the histogram arrives with !254016. The Rack-side urgency :low (also 5s) is unchanged and out of scope.
Nil is the signal rather than the value on purpose: AUTOCOMPLETE_TARGET_S, DEFAULT_TARGET_S and the basic-scope target are all 5, so a value comparison cannot tell a chosen target from a fallthrough.
Verification
Pipeline 2856485209 on the merged result of head dcab60cd: success, including all 39 rspec-ee unit pg17 es9 shards. The two previous heads also went green.
What I did not verify
- Nothing was run locally for this description; it was re-derived from the MR diff and the CI result above, which is the only evidence quoted.
- The 93.3% spike-attribution figure is a
gprdmetrics measurement quoted from the linked error-budget work item, not a measurement of this branch. - No production behaviour was observed. The claim that
target_sstays at 5 rests on both constants being 5 in the diff, not on a deployed log line.