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:
@@ -1,25 +1,37 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Microsoft.Agents.AI.Workflows.Checkpointing;
|
||||
|
||||
namespace Microsoft.Agents.AI.Workflows.Execution;
|
||||
|
||||
internal sealed class MessageEnvelope(object message, ExecutorIdentity source, TypeId? declaredType = null, string? targetId = null)
|
||||
internal sealed class MessageEnvelope(
|
||||
object message,
|
||||
ExecutorIdentity source,
|
||||
TypeId? declaredType = null,
|
||||
string? targetId = null,
|
||||
Dictionary<string, string>? traceContext = null)
|
||||
{
|
||||
public TypeId MessageType => declaredType ?? new(message.GetType());
|
||||
public object Message => message;
|
||||
public ExecutorIdentity Source => source;
|
||||
public string? TargetId => targetId;
|
||||
|
||||
public Dictionary<string, string>? TraceContext => traceContext;
|
||||
|
||||
[MemberNotNullWhen(false, nameof(SourceId))]
|
||||
public bool IsExternal => this.Source == ExecutorIdentity.None;
|
||||
|
||||
public string? SourceId => this.Source.Id;
|
||||
|
||||
internal MessageEnvelope(object message, ExecutorIdentity source, Type declaredType, string? targetId = null)
|
||||
: this(message, source, new TypeId(declaredType), targetId)
|
||||
internal MessageEnvelope(
|
||||
object message,
|
||||
ExecutorIdentity source,
|
||||
Type declaredType,
|
||||
string? targetId = null,
|
||||
Dictionary<string, string>? traceContext = null) : this(message, source, new TypeId(declaredType), targetId, traceContext)
|
||||
{
|
||||
if (!declaredType.IsInstanceOfType(message))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user