File tree Expand file tree Collapse file tree 4 files changed +16
-10
lines changed
Expand file tree Collapse file tree 4 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ require (
6767 github.com/redis/go-redis/v9 v9.6.1
6868 github.com/robfig/cron/v3 v3.0.1
6969 github.com/segmentio/kafka-go v0.4.47
70- github.com/shirou/gopsutil v3.21.11+incompatible
70+ github.com/shirou/gopsutil/v3 v3.24.5
7171 github.com/sijms/go-ora/v2 v2.8.19
7272 github.com/sirupsen/logrus v1.9.3
7373 github.com/snowflakedb/gosnowflake v1.11.1
@@ -308,7 +308,6 @@ require (
308308 github.com/russross/blackfriday/v2 v2.1.0 // indirect
309309 github.com/segmentio/asm v1.2.0 // indirect
310310 github.com/segmentio/encoding v0.4.0 // indirect
311- github.com/shirou/gopsutil/v3 v3.24.5 // indirect
312311 github.com/shoenig/go-m1cpu v0.1.6 // indirect
313312 github.com/shopspring/decimal v1.4.0 // indirect
314313 github.com/spaolacci/murmur3 v1.1.0 // indirect
Original file line number Diff line number Diff line change @@ -1372,8 +1372,6 @@ github.com/segmentio/encoding v0.4.0 h1:MEBYvRqiUB2nfR2criEXWqwdY6HJOUrCn5hboVOV
13721372github.com/segmentio/encoding v0.4.0 /go.mod h1:/d03Cd8PoaDeceuhUUUQWjU0KhWjrmYrWPgtJHYZSnI =
13731373github.com/segmentio/kafka-go v0.4.47 h1:IqziR4pA3vrZq7YdRxaT3w1/5fvIH5qpCwstUanQQB0 =
13741374github.com/segmentio/kafka-go v0.4.47 /go.mod h1:HjF6XbOKh0Pjlkr5GVZxt6CsjjwnmhVOfURM5KMd8qg =
1375- github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI =
1376- github.com/shirou/gopsutil v3.21.11+incompatible /go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA =
13771375github.com/shirou/gopsutil/v3 v3.24.5 h1:i0t8kL+kQTvpAYToeuiVk3TgDeKOFioZO3Ztz/iZ9pI =
13781376github.com/shirou/gopsutil/v3 v3.24.5 /go.mod h1:bsoOS1aStSs9ErQ1WWfxllSeS1K5D+U30r2NfcubMVk =
13791377github.com/shoenig/go-m1cpu v0.1.6 h1:nxdKQNcEB6vzgA2E2bvzKIYRuNj7XNJ4S/aRSwKzFtM =
Original file line number Diff line number Diff line change 1- // Copyright 2023 EMQ Technologies Co., Ltd.
1+ // Copyright 2023-2025 EMQ Technologies Co., Ltd.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
@@ -18,21 +18,30 @@ import (
1818 "fmt"
1919 "os"
2020
21- "github.com/shirou/gopsutil/process"
21+ "github.com/shirou/gopsutil/v3/ process"
2222
2323 "github.com/lf-edge/ekuiper/v2/internal/conf"
24+ "github.com/lf-edge/ekuiper/v2/pkg/infra"
2425)
2526
2627type Metrics struct {
2728 kp * process.Process
2829}
2930
3031func NewMetrics () * Metrics {
31- kProcess , err := process .NewProcess (int32 (os .Getpid ()))
32+ var (
33+ kp * process.Process
34+ e error
35+ )
36+ // Maybe panic in android, so add to safe run.
37+ err := infra .SafeRun (func () error {
38+ kp , e = process .NewProcess (int32 (os .Getpid ()))
39+ return e
40+ })
3241 if err != nil {
3342 conf .Log .Warnf ("Can not initialize process for ekuiperd : %v" , err )
3443 }
35- return & Metrics {kp : kProcess }
44+ return & Metrics {kp : kp }
3645}
3746
3847func (m * Metrics ) GetCpuUsage () string {
Original file line number Diff line number Diff line change 1- // Copyright 2023 EMQ Technologies Co., Ltd.
1+ // Copyright 2023-2025 EMQ Technologies Co., Ltd.
22//
33// Licensed under the Apache License, Version 2.0 (the "License");
44// you may not use this file except in compliance with the License.
1515package memory
1616
1717import (
18- "github.com/shirou/gopsutil/mem"
18+ "github.com/shirou/gopsutil/v3/ mem"
1919
2020 "github.com/lf-edge/ekuiper/v2/internal/conf"
2121 "github.com/lf-edge/ekuiper/v2/pkg/cgroup"
You can’t perform that action at this time.
0 commit comments