Class EgamiTracing
- Namespace
- Egami
- Assembly
- Egami.dll
Names the ActivitySource through which Egami times its loads, probes, saves and transcodes, for OpenTelemetry or any other ActivityListener. Nothing is started, timed or allocated while nobody listens to it.
public static class EgamiTracing
- Inheritance
-
EgamiTracing
- Inherited Members
Examples
// With OpenTelemetry, one line at startup: builder.Services.AddOpenTelemetry().WithTracing(t => t.AddSource(EgamiTracing.SourceName)).
// Without it, any ActivityListener hears the same activities. With neither, Egami starts none.
using ActivityListener listener = new()
{
ShouldListenTo = source => source.Name == EgamiTracing.SourceName,
Sample = (ref ActivityCreationOptions<ActivityContext> _) => ActivitySamplingResult.AllDataAndRecorded,
ActivityStopped = activity => spans.Enqueue($"{activity.OperationName} {activity.GetTagItem("egami.format")} {activity.Duration.TotalMilliseconds:F1} ms"),
};
ActivitySource.AddActivityListener(listener);
Remarks
The activities are Egami.Load, Egami.Probe, Egami.Save and Egami.Transcode, with the tags
egami.format, egami.width, egami.height, egami.frames, egami.images and egami.bytes
where they are known. A call that fails sets the activity's status to Error
and its error.type tag to the exception's type. The names and tags are never renamed once shipped, like the public API.
Fields
SourceName
The name of Egami's activity source, "Egami": pass it to OpenTelemetry's AddSource.
public const string SourceName = "Egami"