mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: Workflow observability (#959)
* Add basic Workflow telemetry * Add sample * Add source propagation for executor spans * Fix tests and address comments * Fix formatting * Fix declarative unit tests * Address comments * Remove Microsoft.Extensions.AI.Agents.EnableTelemetry * Formatting * Formatting * Formatting * fix solution * Address comments * Add workflow json definition for serialization * Formmating * Address comments
This commit is contained in:
@@ -149,6 +149,8 @@ public class SpecializedExecutorSmokeTests
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public IReadOnlyDictionary<string, string>? TraceContext => null;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -9,7 +9,10 @@ namespace Microsoft.Agents.AI.Workflows.UnitTests;
|
||||
|
||||
public class TestRunContext : IRunnerContext
|
||||
{
|
||||
private sealed class BoundContext(string executorId, TestRunContext runnerContext) : IWorkflowContext
|
||||
private sealed class BoundContext(
|
||||
string executorId,
|
||||
TestRunContext runnerContext,
|
||||
IReadOnlyDictionary<string, string>? traceContext) : IWorkflowContext
|
||||
{
|
||||
public ValueTask AddEventAsync(WorkflowEvent workflowEvent)
|
||||
=> runnerContext.AddEventAsync(workflowEvent);
|
||||
@@ -34,6 +37,8 @@ public class TestRunContext : IRunnerContext
|
||||
|
||||
public ValueTask SendMessageAsync(object message, string? targetId = null)
|
||||
=> runnerContext.SendMessageAsync(executorId, message, targetId);
|
||||
|
||||
public IReadOnlyDictionary<string, string>? TraceContext => traceContext;
|
||||
}
|
||||
|
||||
public List<WorkflowEvent> Events { get; } = [];
|
||||
@@ -44,7 +49,8 @@ public class TestRunContext : IRunnerContext
|
||||
return default;
|
||||
}
|
||||
|
||||
public IWorkflowContext Bind(string executorId) => new BoundContext(executorId, this);
|
||||
public IWorkflowContext Bind(string executorId, Dictionary<string, string>? traceContext = null)
|
||||
=> new BoundContext(executorId, this, traceContext);
|
||||
|
||||
public List<ExternalRequest> ExternalRequests { get; } = [];
|
||||
public ValueTask PostAsync(ExternalRequest request)
|
||||
|
||||
Reference in New Issue
Block a user