Skip to content

Fix Spring Loading Wrong Instrumentation Class

Jason Goodman requested to merge fix-spring-issue into master

What does this MR do?

I've been getting errors like the following recently while trying to run specs with spring:

Running via Spring preloader in process 67353                                                                          
                                                                                                                       
An error occurred while loading ./ee/spec/services/ee/merge_requests/create_pipeline_service_spec.rb.
Failure/Error: schema_definition.instrument(:field, Instrumentation.new)
                                                                                                                       
NoMethodError:                                
  undefined method `new' for Gitlab::Instrumentation:Module                                                            
# ./lib/gitlab/graphql/present.rb:18:in `use'  
# ./app/graphql/gitlab_schema.rb:15:in `<class:GitlabSchema>'
# ./app/graphql/gitlab_schema.rb:3:in `<main>' 
# ./spec/support/helpers/graphql_helpers.rb:397:in `<main>'                                                            
# ./spec/spec_helper.rb:47:in `block in <main>'
# ./spec/spec_helper.rb:47:in `each'                                                                                   
# ./spec/spec_helper.rb:47:in `<main>'
# ./ee/spec/services/ee/merge_requests/create_pipeline_service_spec.rb:3:in `<main>'                                                                                                                                                          
# -e:1:in `<main>'                                                                                                                                                                                                                            
/Users/jason/code/gdk/gitlab/spec/support/helpers/graphql_helpers.rb:4: warning: already initialized constant GraphqlHelpers::MutationDefinition
/Users/jason/code/gdk/gitlab/spec/support/helpers/graphql_helpers.rb:4: warning: previous definition of MutationDefinition was here
/Users/jason/code/gdk/gitlab/spec/support/helpers/graphql_helpers.rb:6: warning: already initialized constant GraphqlHelpers::NoData
/Users/jason/code/gdk/gitlab/spec/support/helpers/graphql_helpers.rb:6: warning: previous definition of NoData was here

An error occurred while loading ./ee/spec/services/ee/merge_requests/create_service_spec.rb.
Failure/Error: schema_definition.instrument(:field, Instrumentation.new)

This change seems to fix the issue.

It looks like !27735 (merged) introduced a new Gitlab::Instrumentation module that didn't exist before: !27735 (diffs).

I suppose that's why this has started happening now.

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Merge request reports