Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
0c45e268
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
0c45e268
编写于
4月 02, 2019
作者:
J
Jan Provaznik
提交者:
Robert Speicher
4月 02, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Merge branch 'jprovazn-graphql-prometheus' into 'master'"
This reverts merge request !26569
上级
9f6ab1a5
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
0 addition
and
84 deletion
+0
-84
app/graphql/gitlab_schema.rb
app/graphql/gitlab_schema.rb
+0
-1
changelogs/unreleased/graphql-prometheus.yml
changelogs/unreleased/graphql-prometheus.yml
+0
-5
lib/gitlab/graphql/tracing.rb
lib/gitlab/graphql/tracing.rb
+0
-43
spec/lib/gitlab/graphql/tracing_spec.rb
spec/lib/gitlab/graphql/tracing_spec.rb
+0
-35
未找到文件。
app/graphql/gitlab_schema.rb
浏览文件 @
0c45e268
...
...
@@ -5,7 +5,6 @@ class GitlabSchema < GraphQL::Schema
use
Gitlab
::
Graphql
::
Authorize
use
Gitlab
::
Graphql
::
Present
use
Gitlab
::
Graphql
::
Connections
use
Gitlab
::
Graphql
::
Tracing
query
(
Types
::
QueryType
)
...
...
changelogs/unreleased/graphql-prometheus.yml
已删除
100644 → 0
浏览文件 @
9f6ab1a5
---
title
:
Added prometheus monitoring to GraphQL
merge_request
:
author
:
type
:
added
lib/gitlab/graphql/tracing.rb
已删除
100644 → 0
浏览文件 @
9f6ab1a5
# 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
已删除
100644 → 0
浏览文件 @
9f6ab1a5
# 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
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录