Class ResourceMetricsExporter
Exports Typhon resource metrics to OpenTelemetry via Meter.
public sealed class ResourceMetricsExporter : IDisposable
- Inheritance
-
ResourceMetricsExporter
- Implements
- Inherited Members
Remarks
The exporter uses the "observable" pattern: OTel callbacks read from a cached snapshot rather than pushing metrics. This design has zero overhead when no OTel consumer is listening.
Usage pattern:
- Create exporter with IResourceGraph and options
- Periodically call UpdateSnapshot() (via ResourceMetricsService)
- OTel exporters (Prometheus, OTLP) automatically read from callbacks
var exporter = new ResourceMetricsExporter(resourceGraph, options);
// Periodic update
exporter.UpdateSnapshot();
// OTel callbacks automatically return latest values
Constructors
ResourceMetricsExporter(IResourceGraph, ObservabilityBridgeOptions)
Creates a new ResourceMetricsExporter.
public ResourceMetricsExporter(IResourceGraph resourceGraph, ObservabilityBridgeOptions options)
Parameters
resourceGraphIResourceGraphThe resource graph to export metrics from.
optionsObservabilityBridgeOptionsConfiguration options.
Fields
MeterName
The Meter name used for all Typhon resource metrics.
public const string MeterName = "Typhon.Resources"
Field Value
MeterVersion
The Meter version.
public const string MeterVersion = "1.0.0"
Field Value
Properties
CurrentSnapshot
The most recent snapshot. Used by health checks and alert generators.
public ResourceSnapshot CurrentSnapshot { get; }
Property Value
Meter
The OTel Meter used by this exporter.
public Meter Meter { get; }
Property Value
Methods
Dispose()
Disposes the meter and all instruments.
public void Dispose()
UpdateSnapshot()
Update the cached snapshot from the resource graph. Called periodically by ResourceMetricsService.
public ResourceSnapshot UpdateSnapshot()
Returns
- ResourceSnapshot
The new snapshot.