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
9d4d4964
Commit
9d4d4964
authored
Apr 02, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
98a88e69
d4a4f68d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
1 deletion
+90
-1
app/graphql/gitlab_schema.rb
app/graphql/gitlab_schema.rb
+1
-0
app/serializers/diff_file_entity.rb
app/serializers/diff_file_entity.rb
+1
-1
changelogs/unreleased/fix-expand-full-file-on-image.yml
changelogs/unreleased/fix-expand-full-file-on-image.yml
+5
-0
changelogs/unreleased/graphql-prometheus.yml
changelogs/unreleased/graphql-prometheus.yml
+5
-0
lib/gitlab/graphql/tracing.rb
lib/gitlab/graphql/tracing.rb
+43
-0
spec/lib/gitlab/graphql/tracing_spec.rb
spec/lib/gitlab/graphql/tracing_spec.rb
+35
-0
No files found.
app/graphql/gitlab_schema.rb
View file @
9d4d4964
...
...
@@ -5,6 +5,7 @@ class GitlabSchema < GraphQL::Schema
use
Gitlab
::
Graphql
::
Authorize
use
Gitlab
::
Graphql
::
Present
use
Gitlab
::
Graphql
::
Connections
use
Gitlab
::
Graphql
::
Tracing
query
(
Types
::
QueryType
)
...
...
app/serializers/diff_file_entity.rb
View file @
9d4d4964
...
...
@@ -57,7 +57,7 @@ class DiffFileEntity < DiffFileBaseEntity
diff_file
.
diff_lines_for_serializer
end
expose
:is_fully_expanded
,
if:
->
(
diff_file
,
_
)
{
diff_file
.
text?
}
do
|
diff_file
|
expose
:is_fully_expanded
do
|
diff_file
|
diff_file
.
fully_expanded?
end
...
...
changelogs/unreleased/fix-expand-full-file-on-image.yml
0 → 100644
View file @
9d4d4964
---
title
:
Fixed expand full file button showing on images
merge_request
:
author
:
type
:
fixed
changelogs/unreleased/graphql-prometheus.yml
0 → 100644
View file @
9d4d4964
---
title
:
Added prometheus monitoring to GraphQL
merge_request
:
author
:
type
:
added
lib/gitlab/graphql/tracing.rb
0 → 100644
View file @
9d4d4964
# frozen_string_literal: true
module
Gitlab
module
Graphql
class
Tracing
<
GraphQL
::
Tracing
::
PlatformTracing
self
.
platform_keys
=
{
'lex'
=>
'graphql.lex'
,
'parse'
=>
'graphql.parse'
,
'validate'
=>
'graphql.validate'
,
'analyze_query'
=>
'graphql.analyze'
,
'analyze_multiplex'
=>
'graphql.analyze'
,
'execute_multiplex'
=>
'graphql.execute'
,
'execute_query'
=>
'graphql.execute'
,
'execute_query_lazy'
=>
'graphql.execute'
,
'execute_field'
=>
'graphql.execute'
,
'execute_field_lazy'
=>
'graphql.execute'
}
def
platform_field_key
(
type
,
field
)
"
#{
type
.
name
}
.
#{
field
.
name
}
"
end
def
platform_trace
(
platform_key
,
key
,
data
,
&
block
)
start
=
Gitlab
::
Metrics
::
System
.
monotonic_time
yield
ensure
duration
=
Gitlab
::
Metrics
::
System
.
monotonic_time
-
start
graphql_duration_seconds
.
observe
({
platform_key:
platform_key
,
key:
key
},
duration
)
end
private
def
graphql_duration_seconds
@graphql_duration_seconds
||=
Gitlab
::
Metrics
.
histogram
(
:graphql_duration_seconds
,
'GraphQL execution time'
)
end
end
end
end
spec/lib/gitlab/graphql/tracing_spec.rb
0 → 100644
View file @
9d4d4964
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
Graphql
::
Tracing
do
let!
(
:graphql_duration_seconds
)
{
double
(
'Gitlab::Metrics::NullMetric'
)
}
before
do
allow
(
Gitlab
::
Metrics
)
.
to
receive
(
:histogram
)
.
with
(
:graphql_duration_seconds
,
'GraphQL execution time'
)
.
and_return
(
graphql_duration_seconds
)
end
it
'updates graphql histogram with expected labels'
do
query
=
'query { users { id } }'
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'
)
GitlabSchema
.
execute
(
query
)
end
private
def
expect_metric
(
platform_key
,
key
)
expect
(
graphql_duration_seconds
)
.
to
receive
(
:observe
)
.
with
({
platform_key:
platform_key
,
key:
key
},
be
>
0.0
)
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