Skip to content

Conversation

@OStevan
Copy link
Contributor

@OStevan OStevan commented Oct 14, 2021

Before this PR

Based on comments from #782 I extracted a CommonTraceState which contains the requestId and traceId. I'm not sure about the following changes:

  1. Should the getTraceId and getRequestId be removed completely?
  2. Making the CommonTraceState serializable introduced the nullable field for reqeustId and I'm not sure if the getter which wraps this nullable can be changed with something smarter.

@OStevan OStevan added help wanted Extra attention is needed no changelog labels Oct 14, 2021
@OStevan OStevan requested a review from carterkozak October 14, 2021 12:13
@policy-bot policy-bot bot requested a review from tetigi October 14, 2021 12:13
Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

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

Generally looks great, thanks for putting it together! I've noted a few nits, once those are cleaned up, this should be good to merge :-)

Comment on lines 120 to 121
.traceId(trace.getCommonTraceState().getTraceId())
.requestId(trace.getCommonTraceState().getRequestId())
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably keep around the getTraceId() and getRequetId() methods on Trace for conveience/readability. Not sure it buys us anything to deprecate the method. JIT gives us a budget for bytecode that can be inlined and optimized, so smaller methods (reusing common accessors) are more likely to be optimized in hot paths.

? new SampledDetachedSpan(operation, type, traceId, requestId, parentSpanId)
: new UnsampledDetachedSpan(traceId, requestId, parentSpanId);
? new SampledDetachedSpan(operation, type, CommonTraceState.of(traceId, requestId), parentSpanId)
: new UnsampledDetachedSpan(CommonTraceState.of(traceId, requestId), parentSpanId);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Might as well extract state creation above, and pass the reference to either the sampled or unsampled implementation.

@OStevan OStevan requested a review from carterkozak October 19, 2021 08:54
Co-authored-by: Carter Kozak <[email protected]>
Copy link
Contributor

@carterkozak carterkozak left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@bulldozer-bot bulldozer-bot bot merged commit c3dd860 into develop Oct 19, 2021
@bulldozer-bot bulldozer-bot bot deleted the osteavan/refactor-tracing branch October 19, 2021 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants