Merged
Conversation
dd987b7 to
e6c296a
Compare
Record cli.command, cli.error, and api.summary events. Move telemetry flush from PersistentPostRun to main.go so it fires on both success and error paths. Add stats RoundTripper for API call aggregation. Wrap collector, sender, and stats RT behind a unified Telemetry type.
e6c296a to
5245849
Compare
jmsanders
approved these changes
Mar 10, 2026
|
|
||
| "github.com/rwx-cloud/cli/internal/cli" | ||
| internalerrors "github.com/rwx-cloud/cli/internal/errors" | ||
| "github.com/spf13/pflag" |
Contributor
There was a problem hiding this comment.
Does this give us something that cobra doesn't expose?
Contributor
Author
There was a problem hiding this comment.
pflag is used by cobra, and we just need to import it to be able to use it in a type declaration.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cli.commandevent after every command execution (command name, flags, output format, duration, success)cli.errorevent on failure (command, error type classification, handled flag)StatsRoundTripperthat accumulates API call stats and emits an aggregatedapi.summaryevent at flush timePersistentPostRuntomain.goso it fires on both success and error paths (Cobra skips post-run hooks whenRunEreturns an error)TelemetrytypeTest plan
StatsRoundTripper(tracking, aggregation, telemetry endpoint exclusion, drain, transport errors, path ordering)/api/telemetryon command success and failure