Skip to content

[improvement] Allow setting observable flag when wrapping with new trace - #163

Merged
bulldozer-bot[bot] merged 2 commits into
palantir:developfrom
yixunx:yx/set-observable-flag-when-wrapping
Jun 6, 2019
Merged

bulldozer-bot[bot] merged 2 commits into
palantir:developfrom
yixunx:yx/set-observable-flag-when-wrapping

Conversation

@yixunx

@yixunx yixunx commented May 29, 2019 •

Copy link
Copy Markdown
Contributor

Before this PR

Tracer.wrapWithNewTrace and Tracer.wrapWithAlternateTraceId always initializes the new trace with Observability.UNDECIDED, and there is no easy way to force a particular trace to be sampled.

After this PR

Added overloaded versions of wrapWithNewTrace and wrapWithAlternateTraceId that take an additional parameter to allow users to set whether the new trace should be observable.

This is useful to us because we have a service that makes requests to two separate backends, one of which is wrapped using wrapWithNewTrace so that it generates a separate trace, and we want the secondary trace to be sampled when the primary trace is sampled in order to compare the traces. This should become possible with this PR and #164.

@yixunx
yixunx requested a review from a team as a code owner May 29, 2019 19:51
@yixunx
yixunx force-pushed the yx/set-observable-flag-when-wrapping branch from d9a4b8f to a653194 Compare May 29, 2019 19:52
Comment thread tracing/src/main/java/com/palantir/tracing/Tracers.java
Comment thread tracing/src/main/java/com/palantir/tracing/Tracers.java Outdated
@yixunx
yixunx force-pushed the yx/set-observable-flag-when-wrapping branch from 56266f6 to 0319e5a Compare May 30, 2019 18:29
Comment thread tracing/src/main/java/com/palantir/tracing/Tracers.java Outdated
bulldozer-bot Bot pushed a commit that referenced this pull request Jun 4, 2019
…nal boolean (#166)

<!-- PR title should start with '[fix]', '[improvement]' or '[break]' if this PR would cause a patch, minor or major SemVer bump. Omit the prefix if this PR doesn't warrant a standalone release. -->

## Before this PR
<!-- Describe the problem you encountered with the current state of the world (or link to an issue) and why it's important to fix now. -->
`Tracer.initTrace` takes a slightly awkward approach to use an optional boolean to represent a tri-state (relevant discussion at #163 (comment))

## After this PR
<!-- Describe at a high-level why this approach is better. -->
Added a new version of `Tracer.initTrace` that takes an enum instead of an optional boolean for the observability parameter. The old method that takes an optional is deprecated.

<!-- Reference any existing GitHub issues, e.g. 'fixes #000' or 'relevant to #000' -->
@yixunx
yixunx force-pushed the yx/set-observable-flag-when-wrapping branch from fc25896 to ba8a6d5 Compare June 4, 2019 16:31
@yixunx

yixunx commented Jun 4, 2019

Copy link
Copy Markdown
Contributor Author

Rebased onto develop to pick up #166. This is ready for review again.

@ferozco

ferozco commented Jun 6, 2019

Copy link
Copy Markdown
Contributor

👍

@bulldozer-bot
bulldozer-bot Bot merged commit 4ff9db5 into palantir:develop Jun 6, 2019
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.

3 participants