You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ke...@apache.org on 2020/03/14 14:13:43 UTC
[skywalking-cli] 01/01: Make the thermodynamic command support
entity id
This is an automated email from the ASF dual-hosted git repository.
kezhenxu94 pushed a commit to branch enhancement/thoermodynamic
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git
commit a79a970f1f8e6e59d046e0b4c32b941a4be00e65
Author: kezhenxu94 <ke...@163.com>
AuthorDate: Sat Mar 14 22:13:29 2020 +0800
Make the thermodynamic command support entity id
---
README.md | 3 ++-
commands/metrics/thermodynamic/thermodynamic.go | 14 +++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index 7e748b7..04cf11f 100644
--- a/README.md
+++ b/README.md
@@ -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_sla` |
| `--start` | See [Common options](#common-options) | See [Common options](#common-options) |
| `--end` | See [Common options](#common-options) | See [Common options](#common-options) |
diff --git a/commands/metrics/thermodynamic/thermodynamic.go b/commands/metrics/thermodynamic/thermodynamic.go
index 05c4ba4..096a921 100644
--- a/commands/metrics/thermodynamic/thermodynamic.go
+++ b/commands/metrics/thermodynamic/thermodynamic.go
@@ -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{