Commit 67079fbc authored by GitLab Bot's avatar GitLab Bot

Automatic merge of gitlab-org/gitlab-ce master

parents 59366009 702f1826
...@@ -44,7 +44,6 @@ $note-form-margin-left: 72px; ...@@ -44,7 +44,6 @@ $note-form-margin-left: 72px;
border: 1px solid $border-color; border: 1px solid $border-color;
border-radius: $border-radius-default; border-radius: $border-radius-default;
margin: $gl-padding 0; margin: $gl-padding 0;
overflow: auto;
&.system-note, &.system-note,
&.note-form { &.note-form {
......
...@@ -5,6 +5,7 @@ class GitlabSchema < GraphQL::Schema ...@@ -5,6 +5,7 @@ class GitlabSchema < GraphQL::Schema
use Gitlab::Graphql::Authorize use Gitlab::Graphql::Authorize
use Gitlab::Graphql::Present use Gitlab::Graphql::Present
use Gitlab::Graphql::Connections use Gitlab::Graphql::Connections
use Gitlab::Graphql::Tracing
query(Types::QueryType) query(Types::QueryType)
......
---
title: Fixes missing border color in discussion card component
merge_request: 26242
author: Farhad Yasir
type: fixed
---
title: Added prometheus monitoring to GraphQL
merge_request:
author:
type: added
# 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
# frozen_string_literal: true
require 'spec_helper'
describe Gitlab::Graphql::Tracing 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
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')
GitlabSchema.execute(query, context: { tracers: [tracer] })
end
private
def expect_metric(platform_key, key)
expect(graphql_duration_seconds_histogram)
.to receive(:observe)
.with({ platform_key: platform_key, key: key }, be > 0.0)
end
end
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