@gain-theory/observability
v0.0.2
Published
Unified observability helpers for Gain Theory services.
Keywords
Readme
observability
Unified observability helpers for Gain Theory services.
What it exports
LoggerAdapterModulefor Nest logger wiringSystemLoggerfor injected and static logginggetTracerfor OpenTelemetry bootstrappingTraceSpanfor method-level tracing
Basic usage
import { getTracer, SystemLogger } from '@gain-theory/observability';
const tracer = getTracer({
exporterUrl: process.env['OTEL_EXPORTER_URL'],
serviceName: 'my-service',
});
async function bootstrap() {
tracer.start();
SystemLogger.log('Service booting');
}Nest logger module
import { LoggerAdapterModule } from '@gain-theory/observability';
@Module({
imports: [LoggerAdapterModule.register({ name: 'my-service' })],
})
export class AppModule {}Customization
getTracer keeps the current defaults for traces, logs, HTTP hooks, and instrumentations, while allowing callers to:
- disable or configure traces, logs, and metrics independently
- add extra instrumentations or disable default ones
- override the propagator and resource attributes
- provide a custom logger driver for
LoggerAdapterModule - configure a custom static logger through
SystemLogger.configureStaticLogger(...)
