Skip to content

SOLR-18682: Continue the caller's trace in Overseer Collection API commands - #5405

Open
sarkaramrit1993 wants to merge 1 commit into
apache:mainfrom
sarkaramrit1993:overseer-trace-continue
Open

sarkaramrit1993 wants to merge 1 commit into
apache:mainfrom
sarkaramrit1993:overseer-trace-continue

Conversation

@sarkaramrit1993

Copy link
Copy Markdown
Contributor

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

  • The Overseer message carries the caller's trace context as _trace.* keys. TraceAwareCommand parents the command span on it and strips the keys before the command runs.
  • MODIFYCOLLECTION and CREATEALIAS are skipped. An older Overseer mid-upgrade passes the keys through: ModifyCollectionCmd waits for them in state, routed CreateAliasCmd writes them to aliases.json.

Out of scope: traces for those two commands, Config Set API messages, and checking MIGRATE, REINDEXCOLLECTION, DELETESHARD, RENAME and RESTORE against an older Overseer.

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.json only re-nests the core reload spans. TraceAwareCommandTest: the command never sees _trace.* keys.

@github-actions

Copy link
Copy Markdown

Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).

  • ✅ Jira issue in title: already present
  • ⚠️ Changelog — differs from the entry (suggest type: changed; PR has type: fixed): The change modifies the behavior of existing Collection API commands in distributed mode by continuing the caller's trace context instead of starting a new one, which is an improvement to existing behavior rather than a new opt-in feature or bug fix.​
  • ✅ Reference Guide update: not needed
  • ✅ Upgrade notes: not needed
  • ✅ Tests: included

@dsmiley dsmiley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks

}
};

/** Adds the current trace context to a Collection API message for the Overseer. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

}

/** Returns the message without the keys added by {@link #injectTraceContext(Map)}. */
public static ZkNodeProps removeTraceContext(ZkNodeProps message) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it really so bad to leave the trace context there?

String name, String collection, boolean isAsync) {
String name, String collection, boolean isAsync, Context parent) {
Tracer tracer = getGlobalTracer();
SpanKind kind = isAsync ? SpanKind.PRODUCER : SpanKind.CLIENT;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose SpanKind.CLIENT would only make sense for Overseer processing, but not for disabled Overseer

"http.url":"http://NORMALIZED/solr/admin/cores",
"http.params":"action=RELOAD"}]},
{
"spans":[{

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm; the indentation style is different, which isn't good for diff'ing

@dsmiley
dsmiley requested a review from stillalex November 28, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants