-
Notifications
You must be signed in to change notification settings - Fork 289
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
[ASP.NET] Update enrich callbacks #940
[ASP.NET] Update enrich callbacks #940
Conversation
Co-authored-by: Piotr Kiełkowicz <pkiekowicz@splunk.com>
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #940 +/- ##
==========================================
+ Coverage 69.40% 69.42% +0.02%
==========================================
Files 202 202
Lines 7668 7667 -1
==========================================
+ Hits 5322 5323 +1
+ Misses 2346 2344 -2
|
/// </remarks> | ||
public Action<Activity, string, object> Enrich { get; set; } | ||
public Action<Activity, HttpRequest> EnrichWithHttpRequest { get; set; } |
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.
Random idea. Since we are making this change...
Should we consider switching to HttpContext
or adding it to the signature?
Action<Activity, HttpContext>
or
Action<Activity, HttpContext, HttpRequest>
I seem to remember users asking for that way back. Off the top of my head the nice thing HttpContext
gives you is the items bag so you can easily push stuff into your telemetry.
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.
if we pass in the Context, we could get rid of request. And if we do this, do we also change ASP.NET Core to match this?
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.
if we pass in the Context, we could get rid of request.
Ya if you want to keep a single delegate we could probably get away with just Action<Activity, string, HttpContext, Exception?>
. We could also introduce a contract that is expandable like...
public class AspNetInstrumentationOptions
{
public AspNetEnrichAction Enrich {get; set;}
}
public delegate void AspNetInstrumentationEnrichAction(in AspNetEnrichArguments arguments);
public readonly struct AspNetInstrumentationEnrichArguments
{
public string EventName {get;}
public Activity Activity {get;}
public HttpContext HttpContext {get;}
public Exception? Exception {get;}
}
And if we do this, do we also change ASP.NET Core to match this?
We could. Less of an issue there though because the ASP.NET Core request & response objects have a property that link back to the HttpContext. I kind of like that design with a dedicated delegate + arguments struct it feels cleaner? 🤷
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Fixes #766
Changes
Enrich Before
Enrich with this change
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes