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

Few agent telemetry improvements #29770

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 14 additions & 0 deletions cmd/agent/subcommands/diagnose/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,19 @@ This command print the security-agent metadata payload. This payload is used by
},
}

showAgentTelemetryCommand := &cobra.Command{
Use: "agent-telemetry",
Short: "Print agent telemetry payloads sent by the agent.",
Long: `.`,
RunE: func(_ *cobra.Command, _ []string) error {
return fxutil.OneShot(printPayload,
fx.Supply(payloadName("agent-telemetry")),
fx.Supply(command.GetDefaultCoreBundleParams(cliParams.GlobalParams)),
core.Bundle(),
)
},
}

showPayloadCommand.AddCommand(payloadV5Cmd)
showPayloadCommand.AddCommand(payloadGohaiCmd)
showPayloadCommand.AddCommand(payloadInventoriesAgentCmd)
Expand All @@ -276,6 +289,7 @@ This command print the security-agent metadata payload. This payload is used by
showPayloadCommand.AddCommand(payloadInventoriesPkgSigningCmd)
showPayloadCommand.AddCommand(payloadSystemProbeCmd)
showPayloadCommand.AddCommand(payloadSecurityAgentCmd)
showPayloadCommand.AddCommand(showAgentTelemetryCommand)
diagnoseCommand.AddCommand(showPayloadCommand)

return []*cobra.Command{diagnoseCommand}
Expand Down
10 changes: 10 additions & 0 deletions cmd/agent/subcommands/diagnose/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,13 @@ func TestShowMetadataSecurityAgentCommand(t *testing.T) {
require.Equal(t, false, secretParams.Enabled)
})
}

func TestShowAgentTelemetryCommand(t *testing.T) {
fxutil.TestOneShotSubcommand(t,
Commands(&command.GlobalParams{}),
[]string{"diagnose", "show-metadata", "agent-telemetry"},
printPayload,
func(payload payloadName) {
require.Equal(t, payloadName("agent-telemetry"), payload)
})
}
Loading
Loading