-
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
Instrumentation to store context object into Activity.CustomProperty #1128
Instrumentation to store context object into Activity.CustomProperty #1128
Conversation
if (!activity.IsAllDataRequested) | ||
{ | ||
return; | ||
} | ||
|
||
activity.SetCustomProperty(ExceptionCustomPropertyName, exception); |
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.
In HttpWebRequestActivitySource.netfx.cs
there is also Request & Response set, both before activity.IsAllDataRequested
check. Did you leave them alone on purpose?
I don't think that's necessarily a bad thing. I intentionally put them all outside of the check for anyone wanting to do advanced things. Something like... make a sampling decision based on the raw requests. Or maybe have their own ActivityListeners? Not saying we must do that, I just thought it was worth the perf 🤷
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 missed it. I prefer to keep everything inside AllDataRequested.
My general take is to follow what open telemetry spec suggests:
Samplers get a specific set of things - name, parentcontext, kind, initial attributes, links.
we don't want to provide more anything more, unless there is a strong reason to do it.
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.
btw - samplers dont get access to raw Actiivty itself, so even if someone want to make intelligent sampling decision, they wont be able to leverage this custom obj.
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.
Hah ok good point!
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.
Let's also get Request & Response in HttpWebRequestActivitySource.netfx.cs
. Otherwise looks good.
…/cijothomas/opentelemetry-dotnet into cijothomas/instrumentationfixes1
Codecov Report
@@ Coverage Diff @@
## master #1128 +/- ##
==========================================
+ Coverage 77.33% 77.34% +0.01%
==========================================
Files 220 220
Lines 6256 6260 +4
==========================================
+ Hits 4838 4842 +4
Misses 1418 1418
|
HttpClient, HttpWebRequest, Grpc, SqlClient, Asp.Net, Asp.NetCore instrumentations modified to
TODOS:
Expose the key string for these objects publicly. This makes it easier to consumers to use it.
Write example which demonstrate the usage.
Unrelated to this PR: Refactor the Instrumentation Tests. Some have basic tests, more tests. It should be reorged.
For significant contributions please make sure you have completed the following items: