Commit b94a17e0 authored by charlieablett's avatar charlieablett

Add GraphQL logging feature flag

parent 2a100641
...@@ -7,7 +7,7 @@ module Gitlab ...@@ -7,7 +7,7 @@ module Gitlab
# Called before initializing the analyzer. # Called before initializing the analyzer.
# Returns true to run this analyzer, or false to skip it. # Returns true to run this analyzer, or false to skip it.
def analyze?(query) def analyze?(query)
true # unless there's some reason why we wouldn't log? Feature.enabled?(:graphql_logging, default_enabled: true)
end end
# Called before the visit. # Called before the visit.
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
require 'spec_helper' require 'spec_helper'
describe Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer do describe Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer do
subject { described_class.new } subject { described_class.new }
let(:query_string) { "abc" } let(:query_string) { "abc" }
let(:provided_variables) { { a: 1, b: 2, c: 3 } } let(:provided_variables) { { a: 1, b: 2, c: 3 } }
...@@ -22,6 +21,24 @@ describe Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer do ...@@ -22,6 +21,24 @@ describe Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer do
allow(Gitlab::Metrics::System).to receive(:monotonic_time).and_return(now) allow(Gitlab::Metrics::System).to receive(:monotonic_time).and_return(now)
end end
describe '#analyze?' do
context 'feature flag disabled' do
before do
stub_feature_flags(graphql_logging: false)
end
specify do
expect(subject.analyze?(anything)).to be_falsey
end
end
context 'feature flag enabled by default' do
specify do
expect(subject.analyze?(anything)).to be_truthy
end
end
end
describe '#initial_value' do describe '#initial_value' do
it 'assembles a hash with initial values' do it 'assembles a hash with initial values' do
query = OpenStruct.new(query_string: query_string, provided_variables: provided_variables) query = OpenStruct.new(query_string: query_string, provided_variables: provided_variables)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment