Class ProtoTraceWriterExtensions

Namespace
ProtoTest.Core
Assembly
ProtoTest.Core.dll

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

trace IProtoTraceWriter
kind string
name string
source string
action Func<ProtoTraceOperation, ValueTask>
phase ProtoTracePhase
attributes IReadOnlyDictionary<string, string>
parentId string
entityKind string
entityId string

Returns

ValueTask

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

trace IProtoTraceWriter
kind string
name string
source string
action Func<ValueTask>
phase ProtoTracePhase
attributes IReadOnlyDictionary<string, string>
parentId string
entityKind string
entityId string

Returns

ValueTask

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

trace IProtoTraceWriter
kind string
name string
source string
action Func<ProtoTraceOperation, ValueTask<TResult>>
phase ProtoTracePhase
attributes IReadOnlyDictionary<string, string>
parentId string
entityKind string
entityId string

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

trace IProtoTraceWriter
kind string
name string
source string
action Func<ValueTask<TResult>>
phase ProtoTracePhase
attributes IReadOnlyDictionary<string, string>
parentId string
entityKind string
entityId string

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

trace IProtoTraceWriter
kind string
name string
source string

Returns

ProtoTraceScope