Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/lib/gitlab/graphql/generic_tracing_spec.rb')
-rw-r--r--spec/lib/gitlab/graphql/generic_tracing_spec.rb50
1 files changed, 36 insertions, 14 deletions
diff --git a/spec/lib/gitlab/graphql/generic_tracing_spec.rb b/spec/lib/gitlab/graphql/generic_tracing_spec.rb
index cd116225ecd..04fe7760f62 100644
--- a/spec/lib/gitlab/graphql/generic_tracing_spec.rb
+++ b/spec/lib/gitlab/graphql/generic_tracing_spec.rb
@@ -2,25 +2,47 @@
require 'spec_helper'
-RSpec.describe Gitlab::Graphql::GenericTracing do
+RSpec.describe Gitlab::Graphql::GenericTracing, feature_category: :application_performance do
let(:graphql_duration_seconds_histogram) { double('Gitlab::Metrics::NullMetric') }
- it 'updates graphql histogram with expected labels' do
- query = 'query { users { id } }'
- tracer = described_class.new
+ context 'when graphql_generic_tracing_metrics_deactivate is disabled' do
+ before do
+ stub_feature_flags(graphql_generic_tracing_metrics_deactivate: false)
+ end
+
+ it 'updates graphql histogram with expected labels' do
+ query = 'query { users { id } }'
+ tracer = described_class.new
+
+ allow(tracer)
+ .to receive(:graphql_duration_seconds)
+ .and_return(graphql_duration_seconds_histogram)
+
+ expect_metric('graphql.lex', 'lex')
+ expect_metric('graphql.parse', 'parse')
+ expect_metric('graphql.validate', 'validate')
+ expect_metric('graphql.analyze', 'analyze_multiplex')
+ expect_metric('graphql.execute', 'execute_query_lazy')
+ expect_metric('graphql.execute', 'execute_multiplex')
- allow(tracer)
- .to receive(:graphql_duration_seconds)
- .and_return(graphql_duration_seconds_histogram)
+ GitlabSchema.execute(query, context: { tracers: [tracer] })
+ end
+ end
+
+ context 'when graphql_generic_tracing_metrics_deactivate is enabled' do
+ it 'does not updates graphql histogram with expected labels' do
+ query = 'query { users { id } }'
+ tracer = described_class.new
- expect_metric('graphql.lex', 'lex')
- expect_metric('graphql.parse', 'parse')
- expect_metric('graphql.validate', 'validate')
- expect_metric('graphql.analyze', 'analyze_multiplex')
- expect_metric('graphql.execute', 'execute_query_lazy')
- expect_metric('graphql.execute', 'execute_multiplex')
+ allow(tracer)
+ .to receive(:graphql_duration_seconds)
+ .and_return(graphql_duration_seconds_histogram)
- GitlabSchema.execute(query, context: { tracers: [tracer] })
+ GitlabSchema.execute(query, context: { tracers: [tracer] })
+
+ expect(graphql_duration_seconds_histogram)
+ .not_to receive(:observe)
+ end
end
context "when labkit tracing is enabled" do