Observability Instances
DefaultObservabilityInstancedefaultobservabilityinstance的直接链接
Default implementation of the ObservabilityInstance interface.
ConstructorConstructor的直接链接
new DefaultObservabilityInstance(config: ObservabilityInstanceConfig)
Creates a new DefaultObservabilityInstance with the specified configuration.
PropertiesProperties的直接链接
Inherits all properties and methods from BaseObservabilityInstance.
BaseObservabilityInstancebaseobservabilityinstance的直接链接
Base class for custom ObservabilityInstance implementations.
MethodsMethods的直接链接
getConfiggetconfig的直接链接
getConfig(): Readonly<ObservabilityInstanceConfig>
Returns the current observability configuration.
getExportersgetexporters的直接链接
getExporters(): readonly ObservabilityExporter[]
Returns all configured exporters.
getSpanOutputProcessorsgetspanoutputprocessors的直接链接
getSpanOutputProcessors(): readonly SpanOutputProcessor[]
Returns all configured span output processors.
getLoggergetlogger的直接链接
getLogger(): IMastraLogger
Returns the logger instance for exporters and other components.
startSpanstartspan的直接链接
startSpan<TType extends SpanType>(
options: StartSpanOptions<TType>
): Span<TType>
Start a new span of a specific SpanType. Creates the root span of a trace if no parent is provided.
shutdownshutdown的直接链接
async shutdown(): Promise<void>
Shuts down all exporters and processors, cleaning up resources.
Custom implementationCustom implementation的直接链接
To create a custom ObservabilityInstance implementation, extend BaseObservabilityInstance:
class CustomObservabilityInstance extends BaseObservabilityInstance {
constructor(config: ObservabilityInstanceConfig) {
super(config)
// Custom initialization
}
// Override methods as needed
startSpan<TType extends SpanType>(options: StartSpanOptions<TType>): Span<TType> {
// Custom span creation logic
return super.startSpan(options)
}
}
See alsoSee also的直接链接
DocumentationDocumentation的直接链接
- Tracing Overview: Concepts and usage guide
- Configuration Reference: Configuration options
- Interfaces Reference: Type definitions
- Spans Reference: Span lifecycle and methods
ExportersExporters的直接链接
- MastraStorageExporter: Storage persistence
- MastraPlatformExporter: Mastra platform integration
- ConsoleExporter: Debug output