newrelic-dotnet-agent
newrelic-dotnet-agent copied to clipboard
Add `ForceNewTransactionOnNewThread` property to Agent API `[Transaction]` attribute
Feature Description
Introduce a new property on our [Transaction] attribute to prefer tracking custom instrumented methods on new threads as new transactions when one already exists.
This follows up on the work done for #347 which introduced a configuration option to always prefer creating new transactions on new threads for custom instrumentation. One of the un-implemented stretch goals was to to add a ForceNewTransactionOnNewThread property to the Agent API [Transaction] attribute.
An implementation for this was completed on the ideas/force-new-transaction-attribute branch, but issues were identified with detecting the constructor parameters in the Attribute blob metadata in the profiler here. The current approach in main barely works for one constructor parameter, and my new implementation encountered issues when both parameters were passed to the [Transaction] attribute.
After discussing with @alanwest, we should re-use Microsoft's own implementation for deserializing attribute metadata in the profiler as shown here: https://github.com/dotnet/runtime/blob/main/src/coreclr/inc/caparser.h
Describe Alternatives
One option was to create an entirely different [ForceNewTransactionOnNewThreadTransaction] attribute, but I don't believe this follows existing patterns of code and feels messy.
Priority
Nice to Have