Add --trace flag to CLI commands #406
No reviewers
Labels
No labels
P0
P1
P2
P3
badger
frostfs-adm
frostfs-cli
frostfs-ir
frostfs-lens
frostfs-node
good first issue
triage
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-node#406
Loading…
Reference in a new issue
No description provided.
Delete branch "fyrchik/frostfs-node:tracing-cli"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The task proved to be more difficult than I initially thought, I am not yet satisfied with the solution, thus WIP.
Ideally, we would like automatically have
--trace
flag for all commands which use--rpc-endpoint
(or--endpoint
for a control service) flag.This is not completely feasible:
So the current solution is to have 2 functions: start and print trace. Their inner logic depends on whether --trace flag was provided.
If a command has tracing enabled, it MUST register these handlers in Pre/Post run functions.
May be it is better to defer in every function which prints trace: this way we can have more fine-graineg control.
Another option is to cover on a case-by-case basis, but I see this flag useful and "polished" only if done simultaneously for all commands, you don't always new what you want to trace.
@ -0,0 +17,4 @@
type spanKey struct{}
// StartClientCommandSpan stops tracing span for the command and prints trace ID on the standard output.
func StopClientCommandSpan(cmd *cobra.Command, opts ...trace.SpanEndOption) {
opts ...trace.SpanEndOption
is unused arg. I think it can be deleted.Fixed.
func ExitOnErr(cmd *cobra.Command, errFmt string, err error)
is called in the most of commands to exit with error. So you can place here trace id printing.d8de1fc8d9
to48394ab285
48394ab285
tod72bace127
WIP: Add --trace flag to CLI commandsto Add --trace flag to CLI commands@ -121,2 +121,4 @@
v1.22.0 // Published accidentally.
)
replace git.frostfs.info/TrueCloudLab/frostfs-api-go/v2 => ../api-go
drop
Fixed
@ -0,0 +16,4 @@
type spanKey struct{}
// StartClientCommandSpan stops tracing span for the command and prints trace ID on the standard output.
StartClientCommandSpan -> StopClientCommandSpan
Fixed
d72bace127
to6c02959fd2