Skip to content

Commit 23debb3

Browse files
authored
Add isEmptyValue field in metrics related commands (#180)
1 parent f3eed66 commit 23debb3

17 files changed

Lines changed: 85 additions & 42 deletions

File tree

.github/workflows/command-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
strategy:
3232
matrix:
3333
oap:
34-
- e5950cc06279a83c64089f94613b06ec0ef0d911
34+
- 6fa89c79917cb10dbf48591c46abee3b513a2bab
3535
steps:
3636
- uses: actions/checkout@v2
3737
- name: Check for go file changes

.github/workflows/golangci-lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ jobs:
4747
if: steps.changes.outputs.src == 'true'
4848
uses: golangci/golangci-lint-action@v3
4949
with:
50-
version: latest
50+
version: v1.50.0
5151
args: --timeout 5m

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Release Notes.
3939
* Add components in topology related sub-commands. @mrproliu in https://github.com/apache/skywalking-cli/pull/175
4040
* Add the sub-command `metrics nullable` for query the nullable metrics value. @mrproliu in https://github.com/apache/skywalking-cli/pull/176
4141
* Adapt the sub-command `profiling trace` for adapt the new trace profiling protocol. @mrproliu in https://github.com/apache/skywalking-cli/pull/177
42+
* Add `isEmptyValue` field in metrics related sub-commands. @mrproliu in https://github.com/apache/skywalking-cli/pull/180
4243

4344
0.10.0
4445
------------------

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ deps:
5858
@$(GO_GET) -v -t -d ./...
5959

6060
$(GO_LINT):
61-
@$(GO_LINT) version > /dev/null 2>&1 || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
61+
@$(GO_LINT) version > /dev/null 2>&1 || curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GO_PATH)/bin v1.50.0
6262
$(LICENSE_EYE):
6363
@$(LICENSE_EYE) --version > /dev/null 2>&1 || go install github.com/apache/skywalking-eyes/cmd/license-eye@d38fe05
6464

assets/graphqls/metrics/LabeledMetricsValues.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ query ($condition: MetricsCondition!, $labels: [String!]!, $duration: Duration!)
2121
values {
2222
values {
2323
value
24+
isEmptyValue
2425
}
2526
}
2627
}

assets/graphqls/metrics/MetricsValues.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ query ($condition: MetricsCondition!, $duration: Duration!) {
2121
values {
2222
values {
2323
value
24+
isEmptyValue
2425
}
2526
}
2627
}

assets/graphqls/metrics/NullableMetricsValue.graphql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
query ($condition: MetricsCondition!, $duration: Duration!) {
1919
result: readNullableMetricsValue(condition: $condition, duration: $duration) {
2020
value
21+
isEmptyValue
2122
}
2223
}

internal/commands/metrics/single/nullable-metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,6 @@ $ swctl metrics nullable --name endpoint_cpm --service-name business-zone::proje
8080
return err
8181
}
8282

83-
return display.Display(ctx, &displayable.Displayable{Data: metricsValue.Value})
83+
return display.Display(ctx, &displayable.Displayable{Data: metricsValue})
8484
},
8585
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Licensed to Apache Software Foundation (ASF) under one or more contributor
2+
// license agreements. See the NOTICE file distributed with
3+
// this work for additional information regarding copyright
4+
// ownership. Apache Software Foundation (ASF) licenses this file to you under
5+
// the Apache License, Version 2.0 (the "License"); you may
6+
// not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
18+
package displayable
19+
20+
type MetricValue struct {
21+
Value float64
22+
IsEmptyValue bool
23+
}

pkg/display/graph/graph.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import (
3838

3939
type (
4040
Thermodynamic = api.HeatMap
41-
LinearMetrics = map[string]float64
41+
LinearMetrics = map[string]*d.MetricValue
4242
MultiLinearMetrics = map[string]LinearMetrics
4343
Trace = api.Trace
4444
TraceBrief = api.TraceBrief

0 commit comments

Comments
 (0)