| | | 1 | | namespace NexusLabs.Needlr.AgentFramework.Diagnostics; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Configuration options for pipeline-shape OpenTelemetry metrics emitted by |
| | | 5 | | /// <see cref="IPipelineMetrics"/>. Sibling of |
| | | 6 | | /// <see cref="AgentFrameworkMetricsOptions"/> — that type scopes the |
| | | 7 | | /// per-agent-run meter; this one scopes the pipeline-runner meter. |
| | | 8 | | /// </summary> |
| | | 9 | | /// <remarks> |
| | | 10 | | /// <para> |
| | | 11 | | /// Configure via the syringe: |
| | | 12 | | /// </para> |
| | | 13 | | /// <code> |
| | | 14 | | /// .UsingAgentFramework(af => af |
| | | 15 | | /// .ConfigurePipelineMetrics(o => |
| | | 16 | | /// { |
| | | 17 | | /// o.MeterName = "MyApp.Pipelines"; |
| | | 18 | | /// o.ActivitySourceName = "MyApp.Pipelines"; |
| | | 19 | | /// })) |
| | | 20 | | /// </code> |
| | | 21 | | /// <para> |
| | | 22 | | /// When unconfigured, <see cref="IPipelineMetrics"/> resolves to |
| | | 23 | | /// <see cref="NoOpPipelineMetrics"/> — observability is opt-in with zero overhead |
| | | 24 | | /// by default. Same posture as <see cref="AgentFrameworkMetricsOptions"/>. |
| | | 25 | | /// </para> |
| | | 26 | | /// </remarks> |
| | | 27 | | [DoNotAutoRegister] |
| | | 28 | | public sealed class PipelineMetricsOptions |
| | | 29 | | { |
| | | 30 | | /// <summary> |
| | | 31 | | /// The name used for the <see cref="System.Diagnostics.Metrics.Meter"/> that |
| | | 32 | | /// emits pipeline-shape counters and histograms (<c>pipeline.run.*</c>, |
| | | 33 | | /// <c>pipeline.stage.*</c>). Defaults to |
| | | 34 | | /// <c>"NexusLabs.Needlr.AgentFramework.Pipelines"</c>. |
| | | 35 | | /// </summary> |
| | 140 | 36 | | public string MeterName { get; set; } = "NexusLabs.Needlr.AgentFramework.Pipelines"; |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// The name used for the <see cref="System.Diagnostics.ActivitySource"/> that |
| | | 40 | | /// emits the parent <c>pipeline.run</c> span and child <c>pipeline.stage</c> |
| | | 41 | | /// spans. Defaults to <see cref="MeterName"/> when <see langword="null"/>. |
| | | 42 | | /// </summary> |
| | 45 | 43 | | public string? ActivitySourceName { get; set; } |
| | | 44 | | |
| | 34 | 45 | | internal string ResolvedActivitySourceName => ActivitySourceName ?? MeterName; |
| | | 46 | | } |