-
Notifications
You must be signed in to change notification settings - Fork 193
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
handle special cases for span frames min duration #1188
Merged
stuartnelson3
merged 4 commits into
elastic:master
from
stuartnelson3:special-handling-span-frames-min-duration
Jan 12, 2022
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
124f6e5
handle special cases for span frames min duration
stuartnelson3 0a01e02
Merge branch 'master' into special-handling-span-frames-min-duration
stuartnelson3 c981813
Update span_test.go
stuartnelson3 411b6d1
assert stacktrace is non-empty
stuartnelson3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,39 @@ func TestStartExitSpan(t *testing.T) { | |
assert.True(t, span.IsExitSpan()) | ||
} | ||
|
||
func TestFramesMinDurationSpecialCases(t *testing.T) { | ||
tracer := apmtest.NewRecordingTracer() | ||
|
||
// verify that no stacktraces are recorded | ||
tracer.SetSpanFramesMinDuration(0) | ||
tx := tracer.StartTransaction("name", "type") | ||
span := tx.StartSpan("span", "span", nil) | ||
span.End() | ||
tx.End() | ||
|
||
tracer.Flush(nil) | ||
tracer.Close() | ||
|
||
spans := tracer.Payloads().Spans | ||
require.Len(t, spans, 1) | ||
assert.Len(t, spans[0].Stacktrace, 0) | ||
|
||
// verify that stacktraces are always recorded | ||
tracer = apmtest.NewRecordingTracer() | ||
defer tracer.Close() | ||
tracer.SetSpanFramesMinDuration(-1) | ||
tx = tracer.StartTransaction("name", "type") | ||
span = tx.StartSpan("span2", "span2", nil) | ||
span.End() | ||
tx.End() | ||
|
||
tracer.Flush(nil) | ||
|
||
spans = tracer.Payloads().Spans | ||
require.Len(t, spans, 1) | ||
assert.Len(t, spans[0].Stacktrace, 4) | ||
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. Maybe just check it's non-empty? The Go runtime or testing package might add more frames in the future. |
||
} | ||
|
||
func TestCompressSpanNonSiblings(t *testing.T) { | ||
// Asserts that non sibling spans are not compressed. | ||
tracer := apmtest.NewRecordingTracer() | ||
|
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.
This could have been squished into a single conditional, and I'm happy to do so. This just seemed to be more easy to read.
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.
Looks good to me. Maybe we can revisit when we get to #1142