Class ProtoTraceWriterExtensions
Reduces the start/await/succeed-or-fail boilerplate repeated across ProtoTest integrations.
public static class ProtoTraceWriterExtensions
- Inheritance
-
ProtoTraceWriterExtensions
- Inherited Members
Methods
ExecuteAsync(IProtoTraceWriter, string, string, string, Func<ProtoTraceOperation, ValueTask>, ProtoTracePhase, IReadOnlyDictionary<string, string?>?, string?, string?, string?)
Wraps action in a traced operation and passes it the live handle so it can
attach attributes mid-flight, marking the operation succeeded, cancelled, or failed.
The handle must not outlive action.
public static ValueTask ExecuteAsync(this IProtoTraceWriter trace, string kind, string name, string source, Func<ProtoTraceOperation, ValueTask> action, ProtoTracePhase phase = ProtoTracePhase.Execution, IReadOnlyDictionary<string, string?>? attributes = null, string? parentId = null, string? entityKind = null, string? entityId = null)
Parameters
traceIProtoTraceWriterkindstringnamestringsourcestringactionFunc<ProtoTraceOperation, ValueTask>phaseProtoTracePhaseattributesIReadOnlyDictionary<string, string>parentIdstringentityKindstringentityIdstring
Returns
ExecuteAsync(IProtoTraceWriter, string, string, string, Func<ValueTask>, ProtoTracePhase, IReadOnlyDictionary<string, string?>?, string?, string?, string?)
Wraps action in a traced operation, marking it succeeded, cancelled, or failed.
public static ValueTask ExecuteAsync(this IProtoTraceWriter trace, string kind, string name, string source, Func<ValueTask> action, ProtoTracePhase phase = ProtoTracePhase.Execution, IReadOnlyDictionary<string, string?>? attributes = null, string? parentId = null, string? entityKind = null, string? entityId = null)
Parameters
traceIProtoTraceWriterkindstringnamestringsourcestringactionFunc<ValueTask>phaseProtoTracePhaseattributesIReadOnlyDictionary<string, string>parentIdstringentityKindstringentityIdstring
Returns
ExecuteAsync<TResult>(IProtoTraceWriter, string, string, string, Func<ProtoTraceOperation, ValueTask<TResult>>, ProtoTracePhase, IReadOnlyDictionary<string, string?>?, string?, string?, string?)
Wraps action in a traced operation, passing it the live handle and returning
its result on success. The handle must not outlive action.
public static ValueTask<TResult> ExecuteAsync<TResult>(this IProtoTraceWriter trace, string kind, string name, string source, Func<ProtoTraceOperation, ValueTask<TResult>> action, ProtoTracePhase phase = ProtoTracePhase.Execution, IReadOnlyDictionary<string, string?>? attributes = null, string? parentId = null, string? entityKind = null, string? entityId = null)
Parameters
traceIProtoTraceWriterkindstringnamestringsourcestringactionFunc<ProtoTraceOperation, ValueTask<TResult>>phaseProtoTracePhaseattributesIReadOnlyDictionary<string, string>parentIdstringentityKindstringentityIdstring
Returns
- ValueTask<TResult>
Type Parameters
TResult
ExecuteAsync<TResult>(IProtoTraceWriter, string, string, string, Func<ValueTask<TResult>>, ProtoTracePhase, IReadOnlyDictionary<string, string?>?, string?, string?, string?)
Wraps action in a traced operation, returning its result on success.
public static ValueTask<TResult> ExecuteAsync<TResult>(this IProtoTraceWriter trace, string kind, string name, string source, Func<ValueTask<TResult>> action, ProtoTracePhase phase = ProtoTracePhase.Execution, IReadOnlyDictionary<string, string?>? attributes = null, string? parentId = null, string? entityKind = null, string? entityId = null)
Parameters
traceIProtoTraceWriterkindstringnamestringsourcestringactionFunc<ValueTask<TResult>>phaseProtoTracePhaseattributesIReadOnlyDictionary<string, string>parentIdstringentityKindstringentityIdstring
Returns
- ValueTask<TResult>
Type Parameters
TResult
Operation(IProtoTraceWriter, string, string, string)
Starts a fluent ProtoTraceScope for a traced operation. Chain During,
Parent and With, then finish with RunAsync or Begin.
public static ProtoTraceScope Operation(this IProtoTraceWriter trace, string kind, string name, string source)
Parameters
traceIProtoTraceWriterkindstringnamestringsourcestring