/** * BSB (Better-Service-Base) is an event-bus based microservice framework. * Copyright (C) 2016 - 2025 BetterCorp (PTY) Ltd * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Alternatively, you may obtain a commercial license for this program. * The commercial license allows you to use the Program in a closed-source manner, * including the right to create derivative works that are not subject to the terms * of the AGPL. * * To obtain a commercial license, please contact the copyright holders at * https://www.bettercorp.dev. The terms and conditions of the commercial license * will be provided upon request. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ import { BSBObservable, BSBObservableConstructor, BSBError } from "@bsb/base"; import { DTrace, LogMeta } from "@bsb/base"; import * as av from "anyvali"; export declare const Config: import("@bsb/base").BSBPluginConfigClass; axiom: av.ObjectSchema<{ token: av.StringSchema; dataset: av.StringSchema; orgId: av.OptionalSchema; url: av.OptionalSchema; }>; enabled: av.ObjectSchema<{ logs: av.BoolSchema; metrics: av.BoolSchema; traces: av.BoolSchema; }>; export: av.ObjectSchema<{ flushIntervalMs: av.Int32Schema; maxBatchSize: av.Int32Schema; }>; resourceAttributes: av.RecordSchema; }>>; /** * Axiom observable plugin for unified observability * * Exports logs and events to Axiom using official SDK * Exports traces via OTLP (Axiom supports OpenTelemetry) * Exports metrics as structured events */ export declare class Plugin extends BSBObservable> { static Config: import("@bsb/base").BSBPluginConfigClass; axiom: av.ObjectSchema<{ token: av.StringSchema; dataset: av.StringSchema; orgId: av.OptionalSchema; url: av.OptionalSchema; }>; enabled: av.ObjectSchema<{ logs: av.BoolSchema; metrics: av.BoolSchema; traces: av.BoolSchema; }>; export: av.ObjectSchema<{ flushIntervalMs: av.Int32Schema; maxBatchSize: av.Int32Schema; }>; resourceAttributes: av.RecordSchema; }>>; private logFormatter; private axiom; private tracerProvider; private tracer; private idGenerator; private isDisposed; private spans; private pendingLogs; private flushTimer; constructor(config: BSBObservableConstructor>); init(): Promise; run(): Promise; /** * Flush pending logs to Axiom */ private flushLogs; /** * Add log entry to batch */ private queueLog; info(trace: DTrace, pluginName: string, message: string, meta: LogMeta): void; warn(trace: DTrace, pluginName: string, message: string, meta: LogMeta): void; error(trace: DTrace, pluginName: string, message: string | BSBError, meta?: LogMeta): void; createCounter(timestamp: number, pluginName: string, name: string, description: string, help: string, labels?: string[]): void; incrementCounter(timestamp: number, pluginName: string, name: string, value: number, labels?: Record): void; createGauge(timestamp: number, pluginName: string, name: string, description: string, help: string, labels?: string[]): void; setGauge(timestamp: number, pluginName: string, name: string, value: number, labels?: Record): void; createHistogram(timestamp: number, pluginName: string, name: string, description: string, help: string, boundaries?: number[], labels?: string[]): void; observeHistogram(timestamp: number, pluginName: string, name: string, value: number, labels?: Record): void; /** * Check if a trace is internal (should not create spans) */ private isInternalTrace; spanStart(timestamp: number, trace: DTrace, pluginName: string, spanName: string, parentSpanId: string | null, attributes?: Record): void; spanEnd(timestamp: number, trace: DTrace, pluginName: string, attributes?: Record): void; spanError(timestamp: number, trace: DTrace, pluginName: string, error: Error, attributes?: Record): void; dispose(): Promise; }