Search API instrumentation scope mislabeled

Summary

Discovered while debugging gitlab-com/gl-infra/production#7671 (comment 1084086908)

Labels for some searches in the API do not have the appropriate instrumentation labels applied.

I think this affects projects and groups searches.

Click to see kibana logs

image

Steps to reproduce

What is the current bug behavior?

  • type: advanced (in kibana logs but it should be basic based on gitaly + elasticsearch call count)
  • scope: commits
  • level: global

What is the expected correct behavior?

  • type: basic
  • scope: commits
  • level: project

Possible fixes

search_service is called with additional_params when creating the @results variable but it is not memoized so when it's called during the metrics creation, the additional_params are not included

Edited by Terri Chu