Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add agent diagnostics action #1703

Merged
merged 40 commits into from
Jan 31, 2023
Merged
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
eddcfa9
Add agent diagnostics action
michel-laterman Oct 25, 2022
b70f7c3
Merge remote-tracking branch 'origin/main' into diagnostics-action
michel-laterman Nov 16, 2022
e9b59a2
Fix PR and use control client instead of coord in handler
michel-laterman Nov 16, 2022
ba94a2b
Change AckEvent construction from fleet acker to an action method
michel-laterman Nov 17, 2022
ef7038a
Fix linter and tests
michel-laterman Nov 17, 2022
5e2792a
Fix linter
michel-laterman Nov 21, 2022
8fa1bdc
Merge branch 'main' into diagnostics-action
michel-laterman Dec 12, 2022
267cb6c
Fix merge
michel-laterman Dec 12, 2022
ee1f787
Merge remote-tracking branch 'origin/main' into diagnostics-action
michel-laterman Dec 12, 2022
3a949f3
Fix tests
michel-laterman Dec 12, 2022
b316427
remove duplication when creating an ackevent for an action
michel-laterman Dec 12, 2022
427c7ab
Merge branch 'main' into diagnostics-action
michel-laterman Dec 15, 2022
b185b91
Merge remote-tracking branch 'origin/main' into diagnostics-action
michel-laterman Jan 3, 2023
cffeca6
Retry upload for non-context errors
michel-laterman Jan 4, 2023
5c404f0
Merge remote-tracking branch 'origin/main' into diagnostics-action
michel-laterman Jan 5, 2023
9e6cdb8
Fix linter
michel-laterman Jan 5, 2023
d46ce20
Merge remote-tracking branch 'origin/main' into diagnostics-action
michel-laterman Jan 23, 2023
4318754
review feedback, fix diagnostics acks
michel-laterman Jan 23, 2023
1a1a9d9
Add JSON deserialization, fix yaml
michel-laterman Jan 24, 2023
55797c3
Add debug messages to handler
michel-laterman Jan 25, 2023
3fa3e1b
Fix uploader implementation and handler bug
michel-laterman Jan 25, 2023
abe952e
Review feedback
michel-laterman Jan 25, 2023
aea2b95
Fix linter
michel-laterman Jan 25, 2023
db52a04
Change diag ack to use upload_id add dates to diag directories
michel-laterman Jan 26, 2023
214fb22
Add rate limiter to diagnostics action handler
michel-laterman Jan 27, 2023
78ba518
update config
michel-laterman Jan 27, 2023
2693ce2
Add changelog fragment, fix linter
michel-laterman Jan 27, 2023
b29e75f
changed file_id to upload_id, updated changelog
juliaElastic Jan 27, 2023
abd31a8
updated diagnostics file name
juliaElastic Jan 27, 2023
383a576
Revert hooks changes, move log collection to ZipArchive
michel-laterman Jan 28, 2023
a2c8631
Merge remote-tracking branch 'origin/main' into diagnostics-action
michel-laterman Jan 28, 2023
4546751
Cleanup and yaml redaction fix
michel-laterman Jan 28, 2023
3776773
handler and redact fixes
michel-laterman Jan 28, 2023
3f868d2
fixed storing action_id correctly in files index
juliaElastic Jan 30, 2023
3adfdaa
commit the ack
michel-laterman Jan 30, 2023
8d96c53
Diagnostics handler will use temp file
michel-laterman Jan 31, 2023
cc1cd33
Change to async handler, add panic recover
michel-laterman Jan 31, 2023
f97d6d7
fix linter
michel-laterman Jan 31, 2023
cfa3e96
Update internal/pkg/agent/application/actions/handlers/handler_action…
michel-laterman Jan 31, 2023
09293ff
build error out of recovered item
michel-laterman Jan 31, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix linter
  • Loading branch information
michel-laterman committed Jan 31, 2023
commit f97d6d7f2bfb39a9356c984782e0eb7637e4b403
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (h *Diagnostics) Handle(ctx context.Context, a fleetapi.Action, ack acker.A
// collectDiag will attempt to assemble a diagnostics bundle and upload it with the file upload APIs on fleet-server.
//
// The bundle is assembled on disk, however if it encounters any errors an in-memory-buffer is used.
func (h *Diagnostics) collectDiag(ctx context.Context, action *fleeetapi.ActioNDiagnostics, ack acker.Acker) {
func (h *Diagnostics) collectDiag(ctx context.Context, action *fleetapi.ActioNDiagnostics, ack acker.Acker) {
michel-laterman marked this conversation as resolved.
Show resolved Hide resolved
ts := time.Now().UTC()
defer func() {
if err := recover(); err != nil {
Expand Down Expand Up @@ -114,7 +114,7 @@ func (h *Diagnostics) collectDiag(ctx context.Context, action *fleeetapi.ActioND
err := diagnostics.ZipArchive(&wBuf, &b, aDiag, uDiag)
if err != nil {
action.Err = err
return fmt.Errorf("error creating diagnostics bundle: %w", err)
return
}
r = &b
s = int64(b.Len())
Expand All @@ -132,7 +132,7 @@ func (h *Diagnostics) collectDiag(ctx context.Context, action *fleeetapi.ActioND
if err != nil {
return
}
h.log.Debugf("Diagnostics action '%+v' complete.", a)
h.log.Debugf("Diagnostics action '%+v' complete.", action)
}

// runHooks runs the agent diagnostics hooks.
Expand Down