ActivitySource
Copy
If telemetry is turned on for the Conversion Service a converter can create a new span and link it to the Conversion Service context or create its own ActivitySource.
Examples:
- Create a new span for a converter:
using Activity activity = Activity.Current?.Source.StartActivity(<converter_span_name>, <activity_kind>, string.Empty, <converter_span_tags>);
- Link a converter activity span to ConversionService context:
var activityLink = new ActivityLink(Activity.Current!.Context);
using Activity activity = Activity.Current?.Source.StartActivity(<conversion_span_name>, <activity_kind>, string.Empty, <converter_span_tags>, [activityLink]);
- Create a new nested span for a conversion stage:
using Activity activity = Activity.Current?.Source.StartActivity(<converter_nested_span_name>, <activity_kind>, string.Empty, <converter_nested_span_tags>);
- To point an additional conversion stage event:
activity?.AddEvent(new ActivityEvent(eventName, tags: new ActivityTagsCollection(<tags_collection>)));
- If conversion process failed:
activity?.SetStatus(ActivityStatusCode.Error, <ErrorMessage>);
- If conversion process succeeded:
activity?.SetStatus(ActivityStatusCode.Ok);