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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e2ceb392
Commit
e2ceb392
authored
Feb 24, 2021
by
Mario Sebastián Celi Calderón
Committed by
Markus Koller
Feb 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove graphql_logging feature flag code [RUN ALL RSPEC] [RUN AS-IF-FOSS]
parent
310c30ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
48 deletions
+25
-48
changelogs/unreleased/35579-remove-graphql_logging-feature-flag.yml
.../unreleased/35579-remove-graphql_logging-feature-flag.yml
+5
-0
config/feature_flags/development/graphql_logging.yml
config/feature_flags/development/graphql_logging.yml
+0
-8
lib/gitlab/graphql/query_analyzers/logger_analyzer.rb
lib/gitlab/graphql/query_analyzers/logger_analyzer.rb
+0
-4
spec/lib/gitlab/graphql/query_analyzers/logger_analyzer_spec.rb
...ib/gitlab/graphql/query_analyzers/logger_analyzer_spec.rb
+20
-36
No files found.
changelogs/unreleased/35579-remove-graphql_logging-feature-flag.yml
0 → 100644
View file @
e2ceb392
---
title
:
Remove graphql_logging feature flag
merge_request
:
54984
author
:
type
:
other
config/feature_flags/development/graphql_logging.yml
deleted
100644 → 0
View file @
310c30ad
---
name
:
graphql_logging
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/27885
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/35579
milestone
:
'
12.0'
type
:
development
group
:
group::project management
default_enabled
:
true
lib/gitlab/graphql/query_analyzers/logger_analyzer.rb
View file @
e2ceb392
...
...
@@ -9,10 +9,6 @@ module Gitlab
FIELD_USAGE_ANALYZER
=
GraphQL
::
Analysis
::
FieldUsage
.
new
{
|
query
,
used_fields
,
used_deprecated_fields
|
[
used_fields
,
used_deprecated_fields
]
}
ALL_ANALYZERS
=
[
COMPLEXITY_ANALYZER
,
DEPTH_ANALYZER
,
FIELD_USAGE_ANALYZER
].
freeze
def
analyze?
(
query
)
Feature
.
enabled?
(
:graphql_logging
,
default_enabled:
true
)
end
def
initial_value
(
query
)
variables
=
process_variables
(
query
.
provided_variables
)
default_initial_values
(
query
).
merge
({
...
...
spec/lib/gitlab/graphql/query_analyzers/logger_analyzer_spec.rb
View file @
e2ceb392
...
...
@@ -5,42 +5,6 @@ require 'spec_helper'
RSpec
.
describe
Gitlab
::
Graphql
::
QueryAnalyzers
::
LoggerAnalyzer
do
subject
{
described_class
.
new
}
describe
'#analyze?'
do
context
'feature flag disabled'
do
before
do
stub_feature_flags
(
graphql_logging:
false
)
end
it
'disables the analyzer'
do
expect
(
subject
.
analyze?
(
anything
)).
to
be_falsey
end
end
context
'feature flag enabled by default'
do
let
(
:monotonic_time_before
)
{
42
}
let
(
:monotonic_time_after
)
{
500
}
let
(
:monotonic_time_duration
)
{
monotonic_time_after
-
monotonic_time_before
}
it
'enables the analyzer'
do
expect
(
subject
.
analyze?
(
anything
)).
to
be_truthy
end
it
'returns a duration in seconds'
do
allow
(
GraphQL
::
Analysis
).
to
receive
(
:analyze_query
).
and_return
([
4
,
2
,
[[],
[]]])
allow
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:monotonic_time
).
and_return
(
monotonic_time_before
,
monotonic_time_after
)
allow
(
Gitlab
::
GraphqlLogger
).
to
receive
(
:info
)
expected_duration
=
monotonic_time_duration
memo
=
subject
.
initial_value
(
spy
(
'query'
))
subject
.
final_value
(
memo
)
expect
(
memo
).
to
have_key
(
:duration_s
)
expect
(
memo
[
:duration_s
]).
to
eq
(
expected_duration
)
end
end
end
describe
'#initial_value'
do
it
'filters out sensitive variables'
do
doc
=
GraphQL
.
parse
<<-
GRAPHQL
...
...
@@ -58,4 +22,24 @@ RSpec.describe Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer do
expect
(
subject
.
initial_value
(
query
)[
:variables
]).
to
eq
(
'{:body=>"[FILTERED]"}'
)
end
end
describe
'#final_value'
do
let
(
:monotonic_time_before
)
{
42
}
let
(
:monotonic_time_after
)
{
500
}
let
(
:monotonic_time_duration
)
{
monotonic_time_after
-
monotonic_time_before
}
it
'returns a duration in seconds'
do
allow
(
GraphQL
::
Analysis
).
to
receive
(
:analyze_query
).
and_return
([
4
,
2
,
[[],
[]]])
allow
(
Gitlab
::
Metrics
::
System
).
to
receive
(
:monotonic_time
).
and_return
(
monotonic_time_before
,
monotonic_time_after
)
allow
(
Gitlab
::
GraphqlLogger
).
to
receive
(
:info
)
expected_duration
=
monotonic_time_duration
memo
=
subject
.
initial_value
(
spy
(
'query'
))
subject
.
final_value
(
memo
)
expect
(
memo
).
to
have_key
(
:duration_s
)
expect
(
memo
[
:duration_s
]).
to
eq
(
expected_duration
)
end
end
end
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