Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
apache
skywalking-cli
提交
e9205c6e
S
skywalking-cli
项目概览
apache
/
skywalking-cli
通知
19
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skywalking-cli
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
e9205c6e
编写于
7月 10, 2020
作者:
G
Gao Hongtao
提交者:
GitHub
7月 10, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add check health command (#43)
上级
c7e2b3fa
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
100 addition
and
3 deletion
+100
-3
assets/graphqls/common/checkHealth.graphql
assets/graphqls/common/checkHealth.graphql
+23
-0
cmd/main.go
cmd/main.go
+2
-0
commands/common/common.go
commands/common/common.go
+36
-0
graphql/common/common.go
graphql/common/common.go
+38
-0
graphql/utils/constants.go
graphql/utils/constants.go
+0
-2
query-protocol
query-protocol
+1
-1
未找到文件。
assets/graphqls/common/checkHealth.graphql
0 → 100644
浏览文件 @
e9205c6e
# Licensed to Apache Software Foundation (ASF) under one or more contributor
# license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright
# ownership. Apache Software Foundation (ASF) licenses this file to you under
# the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
query
{
checkHealth
{
score
details
}
}
cmd/main.go
浏览文件 @
e9205c6e
...
...
@@ -21,6 +21,7 @@ import (
"io/ioutil"
"os"
"github.com/apache/skywalking-cli/commands/common"
"github.com/apache/skywalking-cli/commands/trace"
"github.com/apache/skywalking-cli/commands/metrics"
...
...
@@ -87,6 +88,7 @@ func main() {
service
.
Command
,
metrics
.
Command
,
trace
.
Command
,
common
.
Command
,
}
app
.
Before
=
interceptor
.
BeforeChain
([]
cli
.
BeforeFunc
{
...
...
commands/common/common.go
0 → 100644
浏览文件 @
e9205c6e
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package
common
import
(
"github.com/urfave/cli"
"github.com/apache/skywalking-cli/display"
"github.com/apache/skywalking-cli/display/displayable"
"github.com/apache/skywalking-cli/graphql/common"
)
var
Command
=
cli
.
Command
{
Name
:
"checkHealth"
,
Aliases
:
[]
string
{
"ch"
},
Usage
:
"Check the health status of OAP server"
,
Action
:
func
(
ctx
*
cli
.
Context
)
error
{
healthStatus
:=
common
.
CheckHealth
(
ctx
)
return
display
.
Display
(
ctx
,
&
displayable
.
Displayable
{
Data
:
healthStatus
})
},
}
graphql/common/common.go
0 → 100644
浏览文件 @
e9205c6e
// Licensed to Apache Software Foundation (ASF) under one or more contributor
// license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright
// ownership. Apache Software Foundation (ASF) licenses this file to you under
// the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package
common
import
(
"github.com/machinebox/graphql"
"github.com/urfave/cli"
"github.com/apache/skywalking-cli/assets"
"github.com/apache/skywalking-cli/graphql/client"
"github.com/apache/skywalking-cli/graphql/schema"
)
// CheckHealth intends to query the health status of OAP server
func
CheckHealth
(
ctx
*
cli
.
Context
)
schema
.
HealthStatus
{
var
response
map
[
string
]
schema
.
HealthStatus
request
:=
graphql
.
NewRequest
(
assets
.
Read
(
"graphqls/common/checkHealth.graphql"
))
client
.
ExecuteQueryOrFail
(
ctx
,
request
,
&
response
)
return
response
[
"checkHealth"
]
}
graphql/utils/constants.go
浏览文件 @
e9205c6e
...
...
@@ -29,7 +29,6 @@ var StepFormats = map[schema.Step]string{
schema
.
StepMinute
:
"2006-01-02 1504"
,
schema
.
StepHour
:
"2006-01-02 15"
,
schema
.
StepDay
:
"2006-01-02"
,
schema
.
StepMonth
:
"2006-01"
,
}
// StepDuration is a mapping from schema.Step to its time.Duration
...
...
@@ -38,5 +37,4 @@ var StepDuration = map[schema.Step]time.Duration{
schema
.
StepMinute
:
time
.
Minute
,
schema
.
StepHour
:
time
.
Hour
,
schema
.
StepDay
:
time
.
Hour
*
24
,
schema
.
StepMonth
:
time
.
Hour
*
24
*
30
,
}
query-protocol
@
563bb51c
Subproject commit
06373bf0d1204b6d3f410c0daf4c7f72529f28a0
Subproject commit
563bb51c71922f017911345d7cd5c62a7ac8995c
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录