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:18:31 UTC

[skywalking-cli] branch master updated: Make the thermodynamic command support entity id (#36)

This is an automated email from the ASF dual-hosted git repository.

kezhenxu94 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new c61eb51  Make the thermodynamic command support entity id (#36)
c61eb51 is described below

commit c61eb516be224fa10520bead5507fd69de7ba01f
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Sat Mar 14 22:18:20 2020 +0800

    Make the thermodynamic command support entity id (#36)
---
 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..f5e4268 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_heatmap` |
 | `--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{