-
Notifications
You must be signed in to change notification settings - Fork 278
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
Fix mixing log/span decoration probes #7246
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,8 @@ public class SpanDecorationProbeInstrumentationTest extends ProbeInstrumentation | |
private static final ProbeId PROBE_ID = new ProbeId("beae1807-f3b0-4ea8-a74f-826790c5e6f8", 0); | ||
private static final ProbeId PROBE_ID1 = new ProbeId("beae1807-f3b0-4ea8-a74f-826790c5e6f6", 0); | ||
private static final ProbeId PROBE_ID2 = new ProbeId("beae1807-f3b0-4ea8-a74f-826790c5e6f7", 0); | ||
private static final ProbeId PROBE_ID3 = new ProbeId("beae1807-f3b0-4ea8-a74f-826790c5e6f8", 0); | ||
private static final ProbeId PROBE_ID4 = new ProbeId("beae1807-f3b0-4ea8-a74f-826790c5e6f9", 0); | ||
|
||
private TestTraceInterceptor traceInterceptor = new TestTraceInterceptor(); | ||
|
||
|
@@ -312,38 +314,49 @@ public void nullActiveSpan() throws IOException, URISyntaxException { | |
@Test | ||
public void mixedWithLogProbes() throws IOException, URISyntaxException { | ||
final String CLASS_NAME = "com.datadog.debugger.CapturedSnapshot20"; | ||
SpanDecorationProbe.Decoration decoration = createDecoration("tag1", "{intLocal}"); | ||
SpanDecorationProbe spanDecoProbe = | ||
SpanDecorationProbe.Decoration decoration1 = createDecoration("tag1", "{intLocal}"); | ||
SpanDecorationProbe.Decoration decoration2 = createDecoration("tag2", "{arg}"); | ||
SpanDecorationProbe spanDecoProbe1 = | ||
createProbeBuilder( | ||
PROBE_ID, ACTIVE, singletonList(decoration), CLASS_NAME, "process", null, null) | ||
PROBE_ID1, ACTIVE, singletonList(decoration1), CLASS_NAME, "process", null, null) | ||
.evaluateAt(MethodLocation.EXIT) | ||
.build(); | ||
SpanDecorationProbe spanDecoProbe2 = | ||
createProbeBuilder( | ||
PROBE_ID2, ACTIVE, singletonList(decoration2), CLASS_NAME, "process", null, null) | ||
.evaluateAt(MethodLocation.ENTRY) | ||
.build(); | ||
LogProbe logProbe1 = | ||
LogProbe.builder() | ||
.probeId(PROBE_ID1) | ||
.probeId(PROBE_ID3) | ||
.where(CLASS_NAME, "process") | ||
.captureSnapshot(true) | ||
.capture(1, 50, 50, 10) | ||
.build(); | ||
LogProbe logProbe2 = | ||
LogProbe.builder() | ||
.probeId(PROBE_ID2) | ||
.probeId(PROBE_ID4) | ||
.where(CLASS_NAME, "process") | ||
.captureSnapshot(true) | ||
.capture(5, 200, 200, 30) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we want to test that we merge the sampling and captures limit correctly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added test |
||
.build(); | ||
Configuration configuration = | ||
Configuration.builder() | ||
.setService(SERVICE_NAME) | ||
.add(logProbe1) | ||
.add(logProbe2) | ||
.add(spanDecoProbe) | ||
.add(spanDecoProbe1) | ||
.add(spanDecoProbe2) | ||
.build(); | ||
installSpanDecorationProbes(CLASS_NAME, configuration); | ||
Class<?> testClass = compileAndLoadClass(CLASS_NAME); | ||
int result = Reflect.on(testClass).call("main", "1").get(); | ||
assertEquals(84, result); | ||
MutableSpan span = traceInterceptor.getFirstSpan(); | ||
assertEquals("84", span.getTags().get("tag1")); | ||
assertEquals(PROBE_ID.getId(), span.getTags().get("_dd.di.tag1.probe_id")); | ||
assertEquals(PROBE_ID1.getId(), span.getTags().get("_dd.di.tag1.probe_id")); | ||
assertEquals("1", span.getTags().get("tag2")); | ||
assertEquals(PROBE_ID2.getId(), span.getTags().get("_dd.di.tag2.probe_id")); | ||
List<Snapshot> snapshots = mockSink.getSnapshots(); | ||
assertEquals(2, snapshots.size()); | ||
CapturedContext.CapturedValue intLocal = | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why we overwrite EXIT with default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there should be a priority here.. if there are two probes one with DEFAULT and one with ENTRY.. the order of us going over the probe would have determine which one wins.
Does this even matter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT
==ENTRY
from the beginning.The fact that by default, UI put
EXIT
is independent of what we are doing here.