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

WIP: ActiveSpanHolder demo diff #4

Merged
merged 6 commits into from
Apr 4, 2017
Merged

WIP: ActiveSpanHolder demo diff #4

merged 6 commits into from
Apr 4, 2017

Conversation

bhs
Copy link
Owner

@bhs bhs commented Mar 28, 2017

This is just a demo showing how ActiveSpanHolder can be implemented on top of MDC.

private final ThreadLocal<MDCContinuation> tlsSnapshot = new ThreadLocal<MDCContinuation>();

class MDCContinuation extends Continuation {
private final Map<String, String> mdcContext;

Choose a reason for hiding this comment

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

The mdcContext is never read from.
What is your intention of getting the copy?
I have issues with propagating an entire MDC from thread to thread, since there is no knowing which entries are actually 'functionally' transferable and which aren't.

Copy link
Owner Author

Choose a reason for hiding this comment

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

@sjoerdtalsma this was just a bug introduced by a rebase or something... I am now setting the MDC context during activate(), and also added a "test" (sic) to the MDCDemo.java which works as intended. Good catch, though!

@sjoerdtalsma
Copy link

sjoerdtalsma commented Mar 29, 2017

What if some MDC keys are actually meant for the parent thread and not to be propagated?
e.g. things like threadName etc

@bhs
Copy link
Owner Author

bhs commented Mar 29, 2017

@sjoerdtalsma

What if some MDC keys are actually meant for the parent thread and not to be propagated?
e.g. things like threadName etc

The stated purpose of MDC is to propagate along with the transaction, so IMO that's not a concern... I suppose if such support were needed, though, an MDCActiveSpanHolder could include a set of keys to not-propagate as a config parameter (and none of this needs to be in OT-Java core, thankfully).

@bhs bhs merged commit 55794c6 into bhs/ash_core Apr 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants