SOLR-18682: Continue the caller's trace in Overseer Collection API commands #5405
Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).
<!-- Assessed commit e2614604b681ef5d6811e7085ab9e6c64200665b -->
other than this javadoc, this method doesn't evoke "Overseer"-ness. The following methods you add don't even do that. Maybe it should just be where the caller is instead of trying to have TraceUtils cross-cut everything.
CC @stillalex as I believe you did it this way intentionally.
is it really so bad to leave the trace context there?
I suppose SpanKind.CLIENT would only make sense for Overseer processing, but not for disabled Overseer
hmm; the indentation style is different, which isn't good for diff'ing
thanks
Thanks @dsmiley, good point. I moved the message helpers into TraceAwareCommand, next to where they're used, so TraceUtils only gains the parent arg.
Thanks @dsmiley, you're right. Only MODIFYCOLLECTION and CREATEALIAS use every message key, and the handler already skips injecting for both, so I removed the strip.
Thanks @dsmiley. With the Overseer disabled, the command runs under the caller's span, so this span is only started on the Overseer path. I kept the kind unchanged since this PR only changes the parent.
Thanks @dsmiley. This is the verifier's regenerated output. ReloadCollectionCmd moved from its own root to a child of the request span, which re-indents that subtree. Hiding whitespace shows the 11-line change.
Your explanation helps justify my concern about TraceUtils. It's not apparent from the code here that what you said is true! If tracing was inlined into the call-sites, then a reader could deduce what you said much more easily.
On the other hand, the method could be named with "Overseer" in it and then it'd assuage my concern. Let's do that.
dsmiley
sarkaramrit1993
🤖 Generated with Claude
Description
SOLR-18682: with the Overseer, a traced Collection API request and its command land in unrelated traces, because the ZK queue message carries no trace context. Distributed mode already links them.
Solution
_trace.*keys.TraceAwareCommandparents the command span on it.ModifyCollectionCmdwaits for each in state, routedCreateAliasCmdwrites them toaliases.json. Other commands only copy prefixed keys (property.,router.,collection.).Out of scope: traces for those two commands and Config Set API messages.
Tests
TestDistributedTracing: one trace for create and delete (fails on main), no span for an unsampled caller, a routed alias stores no trace context.testV2Api.jsononly re-nests the core reload spans.