< Summary

Information
Class: AsiBackbone.OpenTelemetry.OpenTelemetryGovernanceEmitterOptions
Assembly: AsiBackbone.OpenTelemetry
File(s): /home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.OpenTelemetry/OpenTelemetryGovernanceEmitterOptions.cs
Line coverage
80%
Covered lines: 8
Uncovered lines: 2
Coverable lines: 10
Total lines: 54
Line coverage: 80%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_EmitActivityEvents()100%11100%
get_EmitMetrics()100%11100%
get_ProviderName()100%11100%
get_DefaultActivityName()100%11100%
get_BeforeEmitAsync()100%11100%
Validate()50%5460%

File(s)

/home/runner/work/AsiBackbone/AsiBackbone/src/AsiBackbone.OpenTelemetry/OpenTelemetryGovernanceEmitterOptions.cs

#LineLine coverage
 1using AsiBackbone.Core.Emissions;
 2
 3namespace AsiBackbone.OpenTelemetry;
 4
 5/// <summary>
 6/// Provides host-owned options for the OpenTelemetry governance emitter.
 7/// </summary>
 8public sealed class OpenTelemetryGovernanceEmitterOptions
 9{
 10    /// <summary>
 11    /// Gets or sets a value indicating whether activity events and activity tags should be emitted.
 12    /// </summary>
 1013    public bool EmitActivityEvents { get; set; } = true;
 14
 15    /// <summary>
 16    /// Gets or sets a value indicating whether low-cardinality counters and histograms should be emitted.
 17    /// </summary>
 1218    public bool EmitMetrics { get; set; } = true;
 19
 20    /// <summary>
 21    /// Gets or sets the provider name returned through provider-neutral emission results.
 22    /// </summary>
 2023    public string ProviderName { get; set; } = OpenTelemetryGovernanceInstrumentation.ProviderName;
 24
 25    /// <summary>
 26    /// Gets or sets the activity name used when the envelope does not include an operation name.
 27    /// </summary>
 1628    public string DefaultActivityName { get; set; } = OpenTelemetryGovernanceInstrumentation.DefaultActivityName;
 29
 30    /// <summary>
 31    /// Gets or sets an optional hook invoked before diagnostics are emitted.
 32    /// </summary>
 33    /// <remarks>
 34    /// This hook is intended for tests and host-owned validation seams. It should not emit protected content.
 35    /// </remarks>
 1036    public Func<GovernanceEmissionEnvelope, CancellationToken, ValueTask>? BeforeEmitAsync { get; set; }
 37
 38    /// <summary>
 39    /// Validates the configured options.
 40    /// </summary>
 41    /// <exception cref="InvalidOperationException">Thrown when an option value is invalid.</exception>
 42    public void Validate()
 43    {
 644        if (string.IsNullOrWhiteSpace(ProviderName))
 45        {
 046            throw new InvalidOperationException("OpenTelemetry governance provider name is required.");
 47        }
 48
 649        if (string.IsNullOrWhiteSpace(DefaultActivityName))
 50        {
 051            throw new InvalidOperationException("OpenTelemetry governance default activity name is required.");
 52        }
 653    }
 54}