Class ObservabilityBridgeExtensions
Extension methods for registering Typhon Observability Bridge services with dependency injection.
public static class ObservabilityBridgeExtensions
- Inheritance
-
ObservabilityBridgeExtensions
- Inherited Members
Methods
AddTyphonEcsMetrics(IServiceCollection)
Registers EcsMetricsExporter so the ECS and spatial-partitioning instruments can be published on the Typhon.ECS meter.
public static IServiceCollection AddTyphonEcsMetrics(this IServiceCollection services)
Parameters
servicesIServiceCollectionThe service collection.
Returns
- IServiceCollection
The service collection for chaining.
Remarks
Deliberately separate from AddTyphonObservabilityBridge(IServiceCollection, Action<ObservabilityBridgeOptions>): that method's documented prerequisite is IResourceGraph, and folding a DatabaseEngine dependency into it would change its contract for every existing caller. Registration is lazy, so resolving it without an engine registered fails at resolution rather than at startup.
Registration alone publishes nothing. The instruments are created in the exporter's constructor, and this is a lazy singleton — a host that
calls this method and then scrapes sees no typhon.ecs.* series until something resolves
EcsMetricsExporter at least once. Resolve it during startup:
services.AddTyphonEcsMetrics();
// ...after the provider is built, before the first scrape:
_ = provider.GetRequiredService<EcsMetricsExporter>();
Every instrument is observable — the callbacks run when an OTel consumer polls, never on the tick path, so enabling this costs a running engine nothing until something scrapes it.
AddTyphonObservabilityBridge(IServiceCollection, Action<ObservabilityBridgeOptions>)
Adds the Typhon Observability Bridge to the service collection.
public static IServiceCollection AddTyphonObservabilityBridge(this IServiceCollection services, Action<ObservabilityBridgeOptions> configure = null)
Parameters
servicesIServiceCollectionThe service collection.
configureAction<ObservabilityBridgeOptions>Optional action to configure bridge options.
Returns
- IServiceCollection
The service collection for chaining.
Remarks
This method registers:
- ObservabilityBridgeOptions (singleton)
- ResourceMetricsExporter (singleton)
- ResourceHealthChecker as ITyphonHealthCheck (singleton)
- ResourceAlertGenerator (singleton)
- ResourceMetricsService (singleton)
Prerequisites: IResourceGraph must be registered in the service collection.
services.AddSingleton<IResourceGraph>(sp => ...);
services.AddTyphonObservabilityBridge(options =>
{
options.SnapshotInterval = TimeSpan.FromSeconds(10);
options.Thresholds["Storage/PageCache"] = new HealthThresholds(0.70, 0.90);
});