Skip to content

Commit 080fd1a

Browse files
committed
v3.0.9
1. Security Updates: Upgraded stdlib and x/net modules to address Go module vulnerabilities. 2. Process Management: Resolved an issue that caused duplicate processes during M3 execution. 3. Platform Support: Implemented automatic app log discovery for macOS systems. 4. Codebase Improvements: Refactored logic related to hd-sub and heap management for improved maintainability. Added support for extended agent runtime duration.
1 parent 7d1a3a0 commit 080fd1a

File tree

10 files changed

+407
-259
lines changed

10 files changed

+407
-259
lines changed

go.mod

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module yc-agent
22

3-
go 1.23.6
3+
go 1.23.8
44

55
require (
66
github.com/bmatcuk/doublestar/v4 v4.7.1
@@ -65,11 +65,11 @@ require (
6565
github.com/x448/float16 v0.8.4 // indirect
6666
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
6767
github.com/yusufpapurcu/wmi v1.2.4 // indirect
68-
golang.org/x/net v0.33.0 // indirect
68+
golang.org/x/net v0.38.0 // indirect
6969
golang.org/x/oauth2 v0.23.0 // indirect
70-
golang.org/x/sys v0.28.0 // indirect
71-
golang.org/x/term v0.27.0 // indirect
72-
golang.org/x/text v0.21.0 // indirect
70+
golang.org/x/sys v0.31.0 // indirect
71+
golang.org/x/term v0.30.0 // indirect
72+
golang.org/x/text v0.23.0 // indirect
7373
golang.org/x/time v0.7.0 // indirect
7474
google.golang.org/protobuf v1.35.1 // indirect
7575
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect

go.sum

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,6 @@ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
175175
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
176176
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
177177
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
178-
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
179-
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
180178
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
181179
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
182180
github.com/thlib/go-timezone-local v0.0.3 h1:ie5XtZWG5lQ4+1MtC5KZ/FeWlOKzW2nPoUnXYUbV/1s=
@@ -212,8 +210,8 @@ golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwY
212210
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
213211
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
214212
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
215-
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
216-
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
213+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
214+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
217215
golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs=
218216
golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI=
219217
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -240,22 +238,22 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
240238
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
241239
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
242240
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
243-
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
244-
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
241+
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
242+
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
245243
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
246244
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
247245
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
248246
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
249247
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
250-
golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q=
251-
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
248+
golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y=
249+
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
252250
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
253251
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
254252
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
255253
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
256254
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
257-
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
258-
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
255+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
256+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
259257
golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ=
260258
golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
261259
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

internal/capture/app_logs_auto_discovery.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var logPatterns = []*regexp.Regexp{
2222
//
2323
// If the runtime is not Linux, it returns an empty slice with no error.
2424
func DiscoverOpenedLogFilesByProcess(pid int) ([]string, error) {
25-
if runtime.GOOS != "linux" {
25+
if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
2626
return []string{}, nil
2727
}
2828

internal/capture/app_logs_auto_discovery_darwin.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package capture
33
import (
44
"bufio"
55
"bytes"
6+
"fmt"
67
"strconv"
78
"strings"
89

@@ -12,7 +13,7 @@ import (
1213
func GetOpenedFilesByProcess(pid int) ([]string, error) {
1314
openedFiles := []string{}
1415
pidStr := strconv.Itoa(pid)
15-
output, err := executils.CommandCombinedOutput(executils.Command{"lsof", "-a", "-Fn", "-p", pidStr, "-R", "/"})
16+
output, err := executils.CommandCombinedOutput(executils.Command{"lsof", "-Fn", "-p", pidStr})
1617

1718
if err != nil {
1819
return openedFiles, err
@@ -25,10 +26,17 @@ func GetOpenedFilesByProcess(pid int) ([]string, error) {
2526
continue
2627
}
2728

28-
cut, _ := strings.CutPrefix(line, "n")
29+
path := strings.TrimPrefix(line, "n")
30+
if path == "" {
31+
continue
32+
}
33+
34+
openedFiles = append(openedFiles, path)
35+
}
2936

30-
openedFiles = append(openedFiles, cut)
37+
if err := s.Err(); err != nil {
38+
return openedFiles, fmt.Errorf("scanner error reading lsof output: %w", err)
3139
}
3240

33-
return openedFiles, err
41+
return openedFiles, nil
3442
}

internal/capture/executils/const.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import (
1414
//
1515
// ------------------------------------------------------------------------------
1616
var (
17-
SCRIPT_VERSION = "yc_agent_3.0.6"
17+
SCRIPT_VERSION = "yc_agent_3.0.9"
1818
SCRIPT_SPAN = 120 // How long the whole script should take. Default=240
1919
JAVACORE_INTERVAL = 30 // How often javacores should be taken. Default=30
2020
TOP_INTERVAL = 60 // How often top data should be taken. Default=60

0 commit comments

Comments
 (0)