Using System.Diagnostics.Activity to collect data without logging #92643
Unanswered
marcin0klusek
asked this question in
Q&A
Replies: 1 comment
-
If you run System.Diagnostics.DiagnosticSource 6.0.0 on .NET Framework, and someone uses e.g. PerfView to enable the "Microsoft-Diagnostics-DiagnosticSource" ETW provider, then DiagnosticSourceEventSource will throw because it tries to use security-critical types and the assembly has AllowPartiallyTrustedCallersAttribute. This bug was filed as #79749 and fixed before System.Diagnostics.DiagnosticSource 8.0.0-rc.1.23419.4. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I would like to use System.Diagnostics.Activity to collect data that has transpired. In addition, I would like to collect business messages/payloads during an Azure function and send the collected data to our API when it is finished.
After checking the System.Diagnostics.DiagnosticSource package(v6.0.0), I use ActivitySource and ActivityListener to handle the start and end of an Activity. Saved objects in Activity.Baggage(activity.AddBaggage(...)) are logged in Azure Monitor / AppInsights in customDimensions, but I haven't found that Activity.Tags and Activity._customProperties are logged anywhere.
Regarding that, I have a few questions:
(1) What is the best practice to get information that Activity collects during its lifetime and add our custom features to save and handle sensitive data in Activity so that it won't be logged anywhere but can be collected in the ActivityStopped callback? Is it safe to use Activity._customProperties for that purpose?
(2) I used the System.Diagnostics.DiagnosticSource package in version 4.6.0 and it didn't add any object from Activity.Baggage into customDimension in AppInsights, but version 6.0.0 adds all objects from Activity.Baggage into customDimensions. Is it a bug that will be fixed, or should I assume that won't be changed in the future?
(3) Is there a way to disable sending objects from Activity.Baggage to AppInsights or to modify them before sending?
(4) Is there a way to add an object to customDimensions except for Activity.Baggage?
(5) I need to support .Net Framework 4.7.2, .Net Core 3.1 and .Net 5.0+. Is it safe to use the System.Diagnostics.DiagnosticSource 6.0 in a library with Target Framework .Net Standard 2.0? Do you have any plans to drop support for any of those frameworks?
In addition, I would like to catch events for HTTP, Blob, Service bus clients like sending request, uploading blob, etc. Is Activity able to collect such information on its own, or do I have to instrument it manually for example by using activity.AddEvent(...)?
Beta Was this translation helpful? Give feedback.
All reactions