Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
b47a3a40
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,发现更多精彩内容 >>
未验证
提交
b47a3a40
编写于
11月 16, 2018
作者:
P
Peter Leitzen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Extract query variables into own module
上级
fbbe5ccd
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
55 addition
and
5 deletion
+55
-5
changelogs/unreleased/7527-ci-variables-are-not-parameterized-for-alerting-rules-ce.yml
...variables-are-not-parameterized-for-alerting-rules-ce.yml
+5
-0
lib/gitlab/prometheus/queries/query_additional_metrics.rb
lib/gitlab/prometheus/queries/query_additional_metrics.rb
+2
-5
lib/gitlab/prometheus/query_variables.rb
lib/gitlab/prometheus/query_variables.rb
+15
-0
spec/lib/gitlab/prometheus/query_variables_spec.rb
spec/lib/gitlab/prometheus/query_variables_spec.rb
+33
-0
未找到文件。
changelogs/unreleased/7527-ci-variables-are-not-parameterized-for-alerting-rules-ce.yml
0 → 100644
浏览文件 @
b47a3a40
---
title
:
Extract into Gitlab::Prometheus::QueryVariables
merge_request
:
23335
author
:
type
:
other
lib/gitlab/prometheus/queries/query_additional_metrics.rb
浏览文件 @
b47a3a40
...
...
@@ -83,11 +83,8 @@ module Gitlab
end
def
common_query_context
(
environment
,
timeframe_start
:,
timeframe_end
:)
base_query_context
(
timeframe_start
,
timeframe_end
).
merge
({
ci_environment_slug:
environment
.
slug
,
kube_namespace:
environment
.
deployment_platform
&
.
actual_namespace
||
''
,
environment_filter:
%{container_name!="POD",environment="#{environment.slug}"}
})
base_query_context
(
timeframe_start
,
timeframe_end
)
.
merge
(
QueryVariables
.
call
(
environment
))
end
def
base_query_context
(
timeframe_start
,
timeframe_end
)
...
...
lib/gitlab/prometheus/query_variables.rb
0 → 100644
浏览文件 @
b47a3a40
# frozen_string_literal: true
module
Gitlab
module
Prometheus
module
QueryVariables
def
self
.
call
(
environment
)
{
ci_environment_slug:
environment
.
slug
,
kube_namespace:
environment
.
deployment_platform
&
.
actual_namespace
||
''
,
environment_filter:
%{container_name!="POD",environment="#{environment.slug}"}
}
end
end
end
end
spec/lib/gitlab/prometheus/query_variables_spec.rb
0 → 100644
浏览文件 @
b47a3a40
# frozen_string_literal: true
require
'spec_helper'
describe
Gitlab
::
Prometheus
::
QueryVariables
do
describe
'.call'
do
set
(
:environment
)
{
create
(
:environment
)
}
let
(
:slug
)
{
environment
.
slug
}
subject
{
described_class
.
call
(
environment
)
}
it
{
is_expected
.
to
include
(
ci_environment_slug:
slug
)
}
it
do
is_expected
.
to
include
(
environment_filter:
%{container_name!="POD",environment="#{slug}"}
)
end
context
'without deployment platform'
do
it
{
is_expected
.
to
include
(
kube_namespace:
''
)
}
end
context
'with deplyoment platform'
do
let
(
:kube_namespace
)
{
environment
.
deployment_platform
.
actual_namespace
}
before
do
create
(
:cluster
,
:provided_by_user
,
projects:
[
environment
.
project
])
end
it
{
is_expected
.
to
include
(
kube_namespace:
kube_namespace
)
}
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录