Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
b94a17e0
Commit
b94a17e0
authored
May 21, 2019
by
charlieablett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GraphQL logging feature flag
parent
2a100641
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
lib/gitlab/graphql/query_analyzers/logger_analyzer.rb
lib/gitlab/graphql/query_analyzers/logger_analyzer.rb
+1
-1
spec/lib/gitlab/graphql/query_analyzers/logger_analyzer_spec.rb
...ib/gitlab/graphql/query_analyzers/logger_analyzer_spec.rb
+18
-1
No files found.
lib/gitlab/graphql/query_analyzers/logger_analyzer.rb
View file @
b94a17e0
...
...
@@ -7,7 +7,7 @@ module Gitlab
# Called before initializing the analyzer.
# Returns true to run this analyzer, or false to skip it.
def
analyze?
(
query
)
true
# unless there's some reason why we wouldn't log?
Feature
.
enabled?
(
:graphql_logging
,
default_enabled:
true
)
end
# Called before the visit.
...
...
spec/lib/gitlab/graphql/query_analyzers/logger_analyzer_spec.rb
View file @
b94a17e0
...
...
@@ -3,7 +3,6 @@
require
'spec_helper'
describe
Gitlab
::
Graphql
::
QueryAnalyzers
::
LoggerAnalyzer
do
subject
{
described_class
.
new
}
let
(
:query_string
)
{
"abc"
}
let
(
:provided_variables
)
{
{
a:
1
,
b:
2
,
c:
3
}
}
...
...
@@ -22,6 +21,24 @@ describe Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer do
allow
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:monotonic_time
).
and_return
(
now
)
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
it
'assembles a hash with initial values'
do
query
=
OpenStruct
.
new
(
query_string:
query_string
,
provided_variables:
provided_variables
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment