-
Notifications
You must be signed in to change notification settings - Fork 273
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
Add Additional Standard Tags in AddAspNetCoreInstrumentation #1786
Comments
This is something which requires some discussion/design. |
Is it even possible to obtain properties of the user this way? I'm just trying to do the same thing and the identity comes always empty, as if at the point where the |
I'm finding the same thing -- just commented over here about it: RehanSaeed/rehansaeed.github.io#607 (comment) TL;DR The "OnStartActivity" callback is way too early to successfully resolve an authenticated User principal. Authentication middleware hasn't executed yet. Would love to have some guidance from the experts here about how to enrich telemetry data with "enduser" values. This seems like a common use-case -- something I'd expect to be a solved problem in the AspNetCore Instrumentation library. The specification recommends propagating "enduser" values via the Baggage mechanism. To accomplish that today, it seems I'd need to write some custom middleware that runs immediately after Authentication -- to copy the authenticated User ("enduser") data into Baggage -- and then add processors like this sample one to enrich telemetry data from Baggage. Is that the recommendation here? |
Ideally all the "optional" but relevant conventions are available but maybe flagged by default? That way there isn't a bunch of people writing redundant code, but they can still control the perf aspects. |
A rather janky solution for this might be an |
If you use jwt in the authorization, you can directly read the claims which usually has the information you need, example: |
Any updates?! |
Asp.Net Core is considering adding native instrumentation, with capability to enrich/filter etc. There probably isn't much to do in this repo as instrumentation is getting native from asp.net core itself. (Though we may need to do something for older versions of asp.net core) |
Since we have the stable instrumentation for AspNetCore with the required attributes, I'm not sure whether there is anything that we should be doing with this ticket? @cijothomas would you say this is safe to close in that case? |
Not really.. Instrumentation is probably only doing all the required attributes. What about the optional/opt-in ones? Most likely native instrumentation would offer some capability, but for pre .NET 9 versions, this repo is the only place to offer some ways to get the non-required attributes. |
Feature Request
Is your feature request related to a problem?
There are several tags specified by the open telemetry specification that are not logged by default in
AddAspNetCoreInstrumentation
. It would be nice if we could add an option to log them too.Describe the solution you'd like:
I currently use the following code to log them:
Describe alternatives you've considered.
Currently using the
Enrich
method to add additional tags but would be nice if these were built in as they are defined by the specification.The text was updated successfully, but these errors were encountered: