Summary
Extend IAuthKitPlugin with four additive observability hooks so plugins can contribute their own signal surface to the host: declared metrics (GetMetrics), OpenTelemetry sources (GetOpenTelemetrySources), logging configuration (ConfigureLogging), and tracing tags (GetTracingTags). All hooks are additive default interface implementations, so existing plugins compile and behave unchanged.
Goal
Let plugins participate in the host wide observability pipeline metrics, tracing, and logging without owning sinks, samplers, or pipelines. The host wires the sinks the plugin only declares what it emits.
Background
Today IAuthKitPlugin has no observability surface. Plugins emit traces, metrics, or custom loggers ad hoc via DI-registered services, so the host cannot discover which sources to connect or which tags to attach to its spans, and plugin log output does not flow through a coherent logging configuration. The contract gives the host the declarative signal surface it needs without dictating a vendor.
Fields
| ID |
Member |
Type |
Notes |
| H1 |
GetMetrics() |
IEnumerable<MetricDefinition> |
Metric descriptors (name, description, unit); host registers them. |
| H2 |
GetOpenTelemetrySources() |
IEnumerable<string> |
OpenTelemetry source/tracer names the host connects to its pipeline. |
| H3 |
ConfigureLogging |
void ConfigureLogging(ILoggingBuilder) |
Plugin registers filters/loggers on the host's logging builder. |
| H4 |
GetTracingTags() |
IReadOnlyDictionary<string,string> |
Plugin-provided tags attached to host activity spans. |
Proposed Contract
public interface IAuthKitPlugin
{
IEnumerable<MetricDefinition> GetMetrics() => [];
IEnumerable<string> GetOpenTelemetrySources() => [];
void ConfigureLogging(ILoggingBuilder builder) { }
IReadOnlyDictionary<string, string> GetTracingTags() => new Dictionary<string, string>();
}
MetricDefinition is new immutable record (name, optional description/unit) living in AuthKit.Plugins.Abstractions (MetricDefinition).
Decisions
- Host owns the sinks and tracer. The contract only declares what the plugin emits source name never implies a vendor or a bootstrap mechanism. No OpenTelemetry SDK dependency is mandated on the contract itself.
GetTracingTags contributes only tags, never span creation or parent context, so the plugin cannot interfere with the host's span lifecycle.
ConfigureLogging configures the host's ILoggingBuilder, not separate plugin pipeline ordering rules are defined by the host.
- Code status: none of these hooks exist in the current
IAuthKitPlugin this task adds all of them.
Validation
Acceptance Criteria
- Plugins declare metrics, OpenTelemetry sources, logging configuration, and tracing tags through the contract.
- The host wires the declared signals without plugin owned sinks or samplers.
- Default implementations keep existing plugins source compatible.
- No metric backend or vendor is chosen by the contract.
Non Goals
- No metric backend selection by the contract; the host wires the sink.
- No OpenTelemetry SDK dependency on the contract.
- No separate plugin log pipeline.
- No span creation by the plugin only tag contribution.
Summary
Extend
IAuthKitPluginwith four additive observability hooks so plugins can contribute their own signal surface to the host: declared metrics (GetMetrics), OpenTelemetry sources (GetOpenTelemetrySources), logging configuration (ConfigureLogging), and tracing tags (GetTracingTags). All hooks are additive default interface implementations, so existing plugins compile and behave unchanged.Goal
Let plugins participate in the host wide observability pipeline metrics, tracing, and logging without owning sinks, samplers, or pipelines. The host wires the sinks the plugin only declares what it emits.
Background
Today
IAuthKitPluginhas no observability surface. Plugins emit traces, metrics, or custom loggers ad hoc via DI-registered services, so the host cannot discover which sources to connect or which tags to attach to its spans, and plugin log output does not flow through a coherent logging configuration. The contract gives the host the declarative signal surface it needs without dictating a vendor.Fields
GetMetrics()IEnumerable<MetricDefinition>GetOpenTelemetrySources()IEnumerable<string>ConfigureLoggingvoid ConfigureLogging(ILoggingBuilder)GetTracingTags()IReadOnlyDictionary<string,string>Proposed Contract
MetricDefinitionis new immutable record (name, optionaldescription/unit) living inAuthKit.Plugins.Abstractions(MetricDefinition).Decisions
GetTracingTagscontributes only tags, never span creation or parent context, so the plugin cannot interfere with the host's span lifecycle.ConfigureLoggingconfigures the host'sILoggingBuilder, not separate plugin pipeline ordering rules are defined by the host.IAuthKitPluginthis task adds all of them.Validation
GetMetricsand exposes them at runtime.GetOpenTelemetrySourcesto its tracer.ConfigureLogging-registered filters/loggers take effect.GetTracingTagsvalues are attached to host spans.Acceptance Criteria
Non Goals