未验证 提交 c61eb516 编写于 作者: K kezhenxu94 提交者: GitHub

Make the thermodynamic command support entity id (#36)

上级 7024626b
......@@ -220,11 +220,12 @@ Ascii Graph, like coloring in terminal, so please use `json` or `yaml` instead.
<details>
<summary>metrics thermodynamic --name=thermodynamic name</summary>
<summary>metrics thermodynamic --name=thermodynamic name --ids=entity-ids</summary>
| option | description | default |
| :--- | :--- | :--- |
| `--name` | Metrics name, defined in [OAL](https://github.com/apache/skywalking/blob/master/oap-server/server-bootstrap/src/main/resources/official_analysis.oal), such as `service_sla`, etc. |
| `--ids` | IDs that are required by the metric type, such as service IDs for `service_heatmap` |
| `--start` | See [Common options](#common-options) | See [Common options](#common-options) |
| `--end` | See [Common options](#common-options) | See [Common options](#common-options) |
......
......@@ -39,9 +39,14 @@ var Command = cli.Command{
[]cli.Flag{
cli.StringFlag{
Name: "name",
Usage: "metrics `NAME`, which should be defined in OAL script",
Usage: "metrics `name`, which should be defined in OAL script",
Required: true,
},
cli.StringFlag{
Name: "id",
Usage: "metrics `id` if the metrics require one",
Required: false,
},
},
),
Before: interceptor.BeforeChain([]cli.BeforeFunc{
......@@ -54,6 +59,12 @@ var Command = cli.Command{
step := ctx.Generic("step")
metricsName := ctx.String("name")
var id *string = nil
if ctx.String("id") != "" {
idString := ctx.String("id")
id = &idString
}
duration := schema.Duration{
Start: start,
End: end,
......@@ -62,6 +73,7 @@ var Command = cli.Command{
metricsValues := metrics.Thermodynamic(ctx, schema.MetricCondition{
Name: metricsName,
ID: id,
}, duration)
return display.Display(ctx, &displayable.Displayable{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册