Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
nightingale
提交
034b7a64
N
nightingale
项目概览
DiDi
/
nightingale
10 个月 前同步成功
通知
46
Star
7053
Fork
1161
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
nightingale
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
034b7a64
编写于
7月 19, 2021
作者:
ning1875
提交者:
GitHub
7月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: rename instance_query to instant_query
上级
407f9ca6
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
16 deletion
+10
-16
backend/datasource.go
backend/datasource.go
+1
-1
backend/prome/query.go
backend/prome/query.go
+1
-1
http/router.go
http/router.go
+4
-10
http/router_ts_data.go
http/router_ts_data.go
+3
-3
vos/query.go
vos/query.go
+1
-1
未找到文件。
backend/datasource.go
浏览文件 @
034b7a64
...
...
@@ -20,7 +20,7 @@ type DataSource interface {
PushEndpoint
QueryData
(
inputs
vos
.
DataQueryParam
)
[]
*
vos
.
DataQueryResp
// 查询一段时间
QueryDataInstan
ce
(
ql
string
)
[]
*
vos
.
DataQueryInstanceResp
// 查询一个时间点数据 等同于prometheus instance
_query
QueryDataInstan
t
(
ql
string
)
[]
*
vos
.
DataQueryInstanceResp
// 查询一个时间点数据 等同于prometheus instant
_query
QueryTagKeys
(
recv
vos
.
CommonTagQueryParam
)
*
vos
.
TagKeyQueryResp
// 获取标签的names
QueryTagValues
(
recv
vos
.
CommonTagQueryParam
)
*
vos
.
TagValueQueryResp
// 根据一个label_name获取 values
QueryTagPairs
(
recv
vos
.
CommonTagQueryParam
)
*
vos
.
TagPairQueryResp
// 根据匹配拿到所有 series 上面三个使用统一的结构体
...
...
backend/prome/query.go
浏览文件 @
034b7a64
...
...
@@ -616,7 +616,7 @@ func (pd *PromeDataSource) QueryTagPairs(recv vos.CommonTagQueryParam) *vos.TagP
return
respD
}
func
(
pd
*
PromeDataSource
)
QueryDataInstan
ce
(
ql
string
)
[]
*
vos
.
DataQueryInstanceResp
{
func
(
pd
*
PromeDataSource
)
QueryDataInstan
t
(
ql
string
)
[]
*
vos
.
DataQueryInstanceResp
{
respD
:=
make
([]
*
vos
.
DataQueryInstanceResp
,
0
)
pv
:=
pd
.
QueryVector
(
ql
)
if
pv
==
nil
{
...
...
http/router.go
浏览文件 @
034b7a64
...
...
@@ -42,10 +42,12 @@ func configRoutes(r *gin.Engine) {
// 开源版本,为了支持图表分享功能,允许匿名查询数据
guest
.
POST
(
"/query"
,
GetData
)
guest
.
POST
(
"/instant-query"
,
GetDataInstant
)
guest
.
POST
(
"/tag-pairs"
,
GetTagPairs
)
guest
.
POST
(
"/tag-keys"
,
GetTagKeys
)
guest
.
POST
(
"/tag-values"
,
GetTagValues
)
guest
.
POST
(
"/tag-metrics"
,
GetMetrics
)
guest
.
GET
(
"/check-promql"
,
checkPromeQl
)
}
// for brower, expose location in nginx.conf
...
...
@@ -170,13 +172,6 @@ func configRoutes(r *gin.Engine) {
pages
.
GET
(
"/status"
,
Status
)
pages
.
POST
(
"/query"
,
GetData
)
pages
.
POST
(
"/query_instance"
,
GetDataInstance
)
pages
.
POST
(
"/tag-keys"
,
GetTagKeys
)
pages
.
POST
(
"/tag-values"
,
GetTagValues
)
pages
.
POST
(
"/tag-metrics"
,
GetMetrics
)
pages
.
POST
(
"/tag-pairs"
,
GetTagPairs
)
}
// for thirdparty, do not expose location in nginx.conf
...
...
@@ -296,13 +291,12 @@ func configRoutes(r *gin.Engine) {
v1
.
GET
(
"/status"
,
Status
)
v1
.
POST
(
"/query"
,
GetData
)
v1
.
POST
(
"/query_instance"
,
GetDataInstance
)
v1
.
GET
(
"/check-promql"
,
checkPromeQl
)
v1
.
POST
(
"/instant-query"
,
GetDataInstant
)
v1
.
POST
(
"/tag-keys"
,
GetTagKeys
)
v1
.
POST
(
"/tag-values"
,
GetTagValues
)
v1
.
POST
(
"/tag-metrics"
,
GetMetrics
)
v1
.
POST
(
"/tag-pairs"
,
GetTagPairs
)
v1
.
GET
(
"/check-promql"
,
checkPromeQl
)
}
push
:=
r
.
Group
(
"/v1/n9e/series"
)
.
Use
(
gzip
.
Gzip
(
gzip
.
DefaultCompression
))
...
...
http/router_ts_data.go
浏览文件 @
034b7a64
...
...
@@ -206,7 +206,7 @@ func GetData(c *gin.Context) {
renderData
(
c
,
resp
,
nil
)
}
func
GetDataInstan
ce
(
c
*
gin
.
Context
)
{
func
GetDataInstan
t
(
c
*
gin
.
Context
)
{
dataSource
,
err
:=
backend
.
GetDataSourceFor
(
""
)
if
err
!=
nil
{
logger
.
Warningf
(
"could not find datasource"
)
...
...
@@ -214,8 +214,8 @@ func GetDataInstance(c *gin.Context) {
return
}
var
input
vos
.
DataQueryInstan
ce
Param
var
input
vos
.
DataQueryInstan
t
Param
dangerous
(
c
.
ShouldBindJSON
(
&
input
))
resp
:=
dataSource
.
QueryDataInstan
ce
(
input
.
PromeQl
)
resp
:=
dataSource
.
QueryDataInstan
t
(
input
.
PromeQl
)
renderData
(
c
,
resp
,
nil
)
}
vos/query.go
浏览文件 @
034b7a64
...
...
@@ -33,7 +33,7 @@ type DataQueryParam struct {
End
int64
`json:"end"`
}
type
DataQueryInstan
ce
Param
struct
{
type
DataQueryInstan
t
Param
struct
{
PromeQl
string
`json:"prome_ql"`
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录