Skip to content

Commit 87c63a1

Browse files
authored
Fix current usage value of process CPU and sync CLI (#89)
1 parent 606d8eb commit 87c63a1

File tree

18 files changed

+46
-18
lines changed

18 files changed

+46
-18
lines changed

pkg/profiling/continuous/checker/process_cpu.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (r *ProcessCPUChecker) Init(config *base.ContinuousConfig) error {
4747
if err != nil {
4848
return 0, err
4949
}
50-
return percent * 100, nil
50+
return percent, nil
5151
}, v3.ContinuousProfilingTriggeredMonitorType_ProcessCPU)
5252
return nil
5353
}

test/e2e/base/env

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
SW_CTL_COMMIT=f3eed66ee2ff330e3218fdc995b6f9952901e37c
17-
SW_OAP_COMMIT=d88d887a32f791d0670e4e8d5c2fd615126234cf
16+
SW_CTL_COMMIT=6b2eb0011e38b630db6af7203db215806bd141ed
17+
SW_OAP_COMMIT=43668b7655ce4c5a95b87267be4c3b962d1eea38
1818
SW_KUBERNETES_COMMIT_SHA=0f3ec68e5a7e1608cec8688716b848ed15e971e5
1919

2020
SW_AGENT_GO_COMMIT=216f122d942cb683f48578d3014cc5ea83637582

test/e2e/cases/profiling/continuous/http_avg_response_time/expected/metrics-has-value-labeld.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
value:
1919
{{- contains .value }}
2020
- key: {{ notEmpty .key }}
21-
value: {{ ge .value 1 }}
21+
value:
22+
value: {{ ge .value.value 1 }}
23+
isemptyvalue: false
2224
{{- end }}
2325
{{- end }}

test/e2e/cases/profiling/continuous/http_avg_response_time/expected/query-policy.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
count: 1
2222
urilist:
2323
- /provider
24-
uriregex: null
24+
uriregex: null
25+
triggeredcount: {{ ge (index . 0).triggeredcount 1 }}
26+
lasttriggertimestamp: {{ ge (index . 0).lasttriggertimestamp 1 }}

test/e2e/cases/profiling/continuous/http_avg_response_time/expected/trigger-task.yml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
uripath: /provider
3434
threshold: 50000
3535
current: {{ ge (index .continuousprofilingcauses 0).uri.current 1 }}
36+
message: {{ notEmpty (index .continuousprofilingcauses 0).message }}
3637
targettype: NETWORK
3738
createtime: {{ ge .createtime 1 }}
3839
{{- end }}

test/e2e/cases/profiling/continuous/http_error_rate/expected/metrics-has-value-labeld.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
value:
1919
{{- contains .value }}
2020
- key: {{ notEmpty .key }}
21-
value: {{ ge .value 1 }}
21+
value:
22+
value: {{ ge .value.value 1 }}
23+
isemptyvalue: false
2224
{{- end }}
2325
{{- end }}

test/e2e/cases/profiling/continuous/http_error_rate/expected/query-policy.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
count: 1
2222
urilist:
2323
- /provider
24-
uriregex: null
24+
uriregex: null
25+
triggeredcount: {{ ge (index . 0).triggeredcount 1 }}
26+
lasttriggertimestamp: {{ ge (index . 0).lasttriggertimestamp 1 }}

test/e2e/cases/profiling/continuous/http_error_rate/expected/trigger-task.yml

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
uripath: /provider
3434
threshold: 1000
3535
current: {{ ge (index .continuousprofilingcauses 0).uri.current 1 }}
36+
message: {{ notEmpty (index .continuousprofilingcauses 0).message }}
3637
targettype: NETWORK
3738
createtime: {{ ge .createtime 1 }}
3839
{{- end }}

test/e2e/cases/profiling/continuous/process_cpu/expected/metrics-has-value.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515

1616
{{- contains . }}
1717
- key: {{ notEmpty .key }}
18-
value: {{ ge .value 1 }}
19-
{{- end }}
18+
value:
19+
value: {{ ge .value.value 1 }}
20+
isemptyvalue: false
21+
{{- end }}

test/e2e/cases/profiling/continuous/process_cpu/expected/query-policy.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020
period: 10
2121
count: 3
2222
urilist: []
23-
uriregex: null
23+
uriregex: null
24+
triggeredcount: {{ ge (index . 0).triggeredcount 1 }}
25+
lasttriggertimestamp: {{ ge (index . 0).lasttriggertimestamp 1 }}

test/e2e/cases/profiling/continuous/process_cpu/expected/trigger-task.yml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
threshold: 1000
3232
current: {{ ge (index .continuousprofilingcauses 0).singlevalue.current 1 }}
3333
uri: null
34+
message: {{ notEmpty (index .continuousprofilingcauses 0).message }}
3435
targettype: ON_CPU
3536
createtime: {{ ge .createtime 1 }}
3637
{{- end }}

test/e2e/cases/profiling/continuous/process_thread_count/expected/metrics-has-value.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515

1616
{{- contains . }}
1717
- key: {{ notEmpty .key }}
18-
value: {{ ge .value 1 }}
19-
{{- end }}
18+
value:
19+
value: {{ ge .value.value 1 }}
20+
isemptyvalue: false
21+
{{- end }}

test/e2e/cases/profiling/continuous/process_thread_count/expected/query-policy.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020
period: 10
2121
count: 3
2222
urilist: []
23-
uriregex: null
23+
uriregex: null
24+
triggeredcount: {{ ge (index . 0).triggeredcount 1 }}
25+
lasttriggertimestamp: {{ ge (index . 0).lasttriggertimestamp 1 }}

test/e2e/cases/profiling/continuous/process_thread_count/expected/trigger-task.yml

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
threshold: 500
3232
current: {{ ge (index .continuousprofilingcauses 0).singlevalue.current 1 }}
3333
uri: null
34+
message: {{ notEmpty (index .continuousprofilingcauses 0).message }}
3435
targettype: ON_CPU
3536
createtime: {{ ge .createtime 1 }}
3637
{{- end }}

test/e2e/cases/profiling/task/network/envoy/expected/metrics-has-value-label.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
value:
1919
{{- contains .value }}
2020
- key: {{ notEmpty .key }}
21-
value: {{ ge .value 1 }}
21+
value:
22+
value: {{ ge .value.value 1 }}
23+
isemptyvalue: false
2224
{{- end }}
2325
{{- end }}

test/e2e/cases/profiling/task/network/envoy/expected/metrics-has-value.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515

1616
{{- contains . }}
1717
- key: {{ notEmpty .key }}
18-
value: {{ ge .value 1 }}
18+
value:
19+
value: {{ ge .value.value 1 }}
20+
isemptyvalue: false
1921
{{- end }}

test/e2e/cases/profiling/task/network/expected/metrics-has-value-label.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
value:
1919
{{- contains .value }}
2020
- key: {{ notEmpty .key }}
21-
value: {{ ge .value 1 }}
21+
value:
22+
value: {{ ge .value.value 1 }}
23+
isemptyvalue: false
2224
{{- end }}
23-
{{- end }}
25+
{{- end }}

test/e2e/cases/profiling/task/network/expected/metrics-has-value.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,7 @@
1515

1616
{{- contains . }}
1717
- key: {{ notEmpty .key }}
18-
value: {{ ge .value 1 }}
18+
value:
19+
value: {{ ge .value.value 1 }}
20+
isemptyvalue: false
1921
{{- end }}

0 commit comments

Comments
 (0)