-
Notifications
You must be signed in to change notification settings - Fork 773
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
Support multiple spans (activities) within the same Trace for StackExchangeRedis #1153
Support multiple spans (activities) within the same Trace for StackExchangeRedis #1153
Conversation
- Use C# value tupples in cache keys and values to reduce heap allocations and ensure proper key comparison. - Value names in C# tupples to make code slightly easier to read.
|
@kellybirr Thanks! Could you sign the CLA, add tests for this bug/fix? |
CLA Signed. I can come up with a test, but that will likely require exposing internals to the test as the cached values never get exposed outside the class. Any thoughts? |
Fixing the code formatting issue being reported by code scanner.
Codecov Report
@@ Coverage Diff @@
## master #1153 +/- ##
==========================================
+ Coverage 78.85% 78.93% +0.07%
==========================================
Files 219 219
Lines 6329 6332 +3
==========================================
+ Hits 4991 4998 +7
+ Misses 1338 1334 -4
|
Can you validate that the activity received the Mock contains the expected values? Also, internals of StackEnchange instrumentation should already be visible to its tests. (https://github.com/open-telemetry/opentelemetry-dotnet/blob/master/src/OpenTelemetry.Instrumentation.StackExchangeRedis/AssemblyInfo.cs#L19) |
@kellybirr A couple of questions:
|
@CodeBlanch That's a really good point. I think we're going to be good with this as I've coded it. I did consider using a As to your specific questions.
Given these factors, the As for writing a benchmark. I'm not opposed to it. I'm also not familiar with the benchmarking framework you're using. I probably would not get it done quickly. |
@cijothomas I just added a unit test |
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.
LGTM! Thanks for the contribution & for taking the time to respond @kellybirr. I think we're good to merge. If you want to mess with a benchmark, feel free, they are actually pretty easy to do. I might do it when I have some free time just out of curiosity.
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.
LGTM.
High Level
Detailed Description
This fix enhances the StackExchangeRedis Instrumentation to support multiple child spans in the same trace so that systems using multiple child activities get proper nesting of Redis actions in their trace graphs.
The issue was the "cache" by "TraceId" that used the same profiler across and entire trace, ignoring the spans.
This update will also slightly reduce memory allocations resulting in an a tiny performance improvement.
This change will behave exactly like before, in code that only uses one span within the trace. It will also now behave as expected when used with multiple spans.
Before/After Screenshots (Jaeger)
BEFORE
AFTER
Full Repro Example
https://github.com/kellybirr/tracing-demo
The code and setup at the repro above reproduces the bug. It's even visible in the screenshot in the readme of that repo.
I've tested this fix with that code, it works as expected. That's how I got the "AFTER" screenshot included here.