Closed
Description
The improvements up to part 2 have made things substantially more usable for the Activity API. This is a small proposed improvement to introduce a sensible default activity name.
Updated proposal based on feedback
ActivitySource.StartActivity
We currently require an activity name
to be provided as the only required argument in ActivitySource.StartActivity
overloads. For scenarios where the caller wants to match the activity with the calling method name, providing that as a default value would make calling code less repetitive.
API Proposal
public Activity? StartActivity([CallerMemberName] string name = "", ActivityKind kind = ActivityKind.Internal)
=> StartActivity(name, kind, default, null, null, null, default);
Additionally, for cases where users want to get the caller member name alongside other parameters, add the following overload too:
API Proposal
public System.Diagnostics.Activity StartActivity (System.Diagnostics.ActivityKind kind,
System.Diagnostics.ActivityContext parentContext = default,
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object>>? tags = default,
System.Collections.Generic.IEnumerable<System.Diagnostics.ActivityLink> links = default,
DateTimeOffset startTime = default,
[CallerMemberName] string name = "");