Skip to content

Commit c61eb51

Browse files
authored
Make the thermodynamic command support entity id (#36)
1 parent 7024626 commit c61eb51

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -220,11 +220,12 @@ Ascii Graph, like coloring in terminal, so please use `json` or `yaml` instead.
220220

221221
<details>
222222

223-
<summary>metrics thermodynamic --name=thermodynamic name</summary>
223+
<summary>metrics thermodynamic --name=thermodynamic name --ids=entity-ids</summary>
224224

225225
| option | description | default |
226226
| :--- | :--- | :--- |
227227
| `--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. |
228+
| `--ids` | IDs that are required by the metric type, such as service IDs for `service_heatmap` |
228229
| `--start` | See [Common options](#common-options) | See [Common options](#common-options) |
229230
| `--end` | See [Common options](#common-options) | See [Common options](#common-options) |
230231

commands/metrics/thermodynamic/thermodynamic.go

+13-1
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,14 @@ var Command = cli.Command{
3939
[]cli.Flag{
4040
cli.StringFlag{
4141
Name: "name",
42-
Usage: "metrics `NAME`, which should be defined in OAL script",
42+
Usage: "metrics `name`, which should be defined in OAL script",
4343
Required: true,
4444
},
45+
cli.StringFlag{
46+
Name: "id",
47+
Usage: "metrics `id` if the metrics require one",
48+
Required: false,
49+
},
4550
},
4651
),
4752
Before: interceptor.BeforeChain([]cli.BeforeFunc{
@@ -54,6 +59,12 @@ var Command = cli.Command{
5459
step := ctx.Generic("step")
5560
metricsName := ctx.String("name")
5661

62+
var id *string = nil
63+
if ctx.String("id") != "" {
64+
idString := ctx.String("id")
65+
id = &idString
66+
}
67+
5768
duration := schema.Duration{
5869
Start: start,
5970
End: end,
@@ -62,6 +73,7 @@ var Command = cli.Command{
6273

6374
metricsValues := metrics.Thermodynamic(ctx, schema.MetricCondition{
6475
Name: metricsName,
76+
ID: id,
6577
}, duration)
6678

6779
return display.Display(ctx, &displayable.Displayable{

0 commit comments

Comments
 (0)