@brizz/sdk 0.1.37 → 0.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -125
- package/dist/{chunk-OR3YPY4I.js → chunk-BGLKBQ6N.js} +1 -1
- package/dist/{chunk-2DSTZTDA.cjs → chunk-RNU3DOSR.cjs} +1 -1
- package/dist/index.cjs +2263 -13
- package/dist/index.js +2298 -48
- package/dist/{mcp-NC5OXRT4.cjs → mcp-64ZNSCIR.cjs} +53 -25
- package/dist/{mcp-7Y3O5QSS.js → mcp-HBOMHU67.js} +33 -5
- package/dist/types/cjs/eve.d.ts +2 -0
- package/dist/types/cjs/google-genai.d.ts +1 -0
- package/dist/types/cjs/index.d.ts +15 -0
- package/dist/types/cjs/internal/config.d.ts +19 -0
- package/dist/types/cjs/internal/constants.d.ts +3 -0
- package/dist/types/cjs/internal/dsn.d.ts +13 -0
- package/dist/types/cjs/internal/instrumentation/auto-init.d.ts +8 -0
- package/dist/types/cjs/internal/instrumentation/google-genai.d.ts +13 -0
- package/dist/types/cjs/internal/instrumentation/index.d.ts +2 -0
- package/dist/types/cjs/internal/instrumentation/mcp/index.d.ts +2 -0
- package/dist/types/cjs/internal/instrumentation/mcp/instrumentation.d.ts +15 -0
- package/dist/types/cjs/internal/instrumentation/mcp/patches/attributes.d.ts +9 -0
- package/dist/types/cjs/internal/instrumentation/mcp/patches/protocol.d.ts +2 -0
- package/dist/types/cjs/internal/instrumentation/mcp/schemas.d.ts +2 -0
- package/dist/types/cjs/internal/instrumentation/mcp/semantic-conventions.d.ts +37 -0
- package/dist/types/cjs/internal/instrumentation/mcp/session.d.ts +7 -0
- package/dist/types/cjs/internal/instrumentation/mcp/types.d.ts +47 -0
- package/dist/types/cjs/internal/instrumentation/mcp/version.d.ts +2 -0
- package/dist/types/cjs/internal/instrumentation/registry.d.ts +29 -0
- package/dist/types/cjs/internal/instrumentation/vercel-ai/interrupt.d.ts +11 -0
- package/dist/types/cjs/internal/log/index.d.ts +1 -0
- package/dist/types/cjs/internal/log/logging.d.ts +21 -0
- package/dist/types/cjs/internal/log/processors/log-processor.d.ts +16 -0
- package/dist/types/cjs/internal/logger.d.ts +23 -0
- package/dist/types/cjs/internal/masking/index.d.ts +3 -0
- package/dist/types/cjs/internal/masking/patterns.d.ts +2 -0
- package/dist/types/cjs/internal/masking/types.d.ts +32 -0
- package/dist/types/cjs/internal/masking/utils.d.ts +5 -0
- package/dist/types/cjs/internal/metric/index.d.ts +1 -0
- package/dist/types/cjs/internal/metric/metrics.d.ts +17 -0
- package/dist/types/cjs/internal/sdk.d.ts +42 -0
- package/dist/types/cjs/internal/semantic-conventions.d.ts +54 -0
- package/dist/types/cjs/internal/trace/exporters/eve-trace-exporter.d.ts +18 -0
- package/dist/types/cjs/internal/trace/exporters/span-exporter.d.ts +12 -0
- package/dist/types/cjs/internal/trace/index.d.ts +4 -0
- package/dist/types/cjs/internal/trace/processors/eve-session-processor.d.ts +2 -0
- package/dist/types/cjs/internal/trace/processors/span-processor.d.ts +18 -0
- package/dist/types/cjs/internal/trace/session.d.ts +136 -0
- package/dist/types/cjs/internal/trace/tracing.d.ts +17 -0
- package/dist/types/cjs/internal/version.d.ts +1 -0
- package/dist/types/cjs/package.json +3 -0
- package/dist/types/esm/eve.d.ts +2 -0
- package/dist/types/esm/google-genai.d.ts +1 -0
- package/dist/types/esm/index.d.ts +15 -0
- package/dist/types/esm/internal/config.d.ts +19 -0
- package/dist/types/esm/internal/constants.d.ts +3 -0
- package/dist/types/esm/internal/dsn.d.ts +13 -0
- package/dist/types/esm/internal/instrumentation/auto-init.d.ts +8 -0
- package/dist/types/esm/internal/instrumentation/google-genai.d.ts +13 -0
- package/dist/types/esm/internal/instrumentation/index.d.ts +2 -0
- package/dist/types/esm/internal/instrumentation/mcp/index.d.ts +2 -0
- package/dist/types/esm/internal/instrumentation/mcp/instrumentation.d.ts +15 -0
- package/dist/types/esm/internal/instrumentation/mcp/patches/attributes.d.ts +9 -0
- package/dist/types/esm/internal/instrumentation/mcp/patches/protocol.d.ts +2 -0
- package/dist/types/esm/internal/instrumentation/mcp/schemas.d.ts +2 -0
- package/dist/types/esm/internal/instrumentation/mcp/semantic-conventions.d.ts +37 -0
- package/dist/types/esm/internal/instrumentation/mcp/session.d.ts +7 -0
- package/dist/types/esm/internal/instrumentation/mcp/types.d.ts +47 -0
- package/dist/types/esm/internal/instrumentation/mcp/version.d.ts +2 -0
- package/dist/types/esm/internal/instrumentation/registry.d.ts +29 -0
- package/dist/types/esm/internal/instrumentation/vercel-ai/interrupt.d.ts +11 -0
- package/dist/types/esm/internal/log/index.d.ts +1 -0
- package/dist/types/esm/internal/log/logging.d.ts +21 -0
- package/dist/types/esm/internal/log/processors/log-processor.d.ts +16 -0
- package/dist/types/esm/internal/logger.d.ts +23 -0
- package/dist/types/esm/internal/masking/index.d.ts +3 -0
- package/dist/types/esm/internal/masking/patterns.d.ts +2 -0
- package/dist/types/esm/internal/masking/types.d.ts +32 -0
- package/dist/types/esm/internal/masking/utils.d.ts +5 -0
- package/dist/types/esm/internal/metric/index.d.ts +1 -0
- package/dist/types/esm/internal/metric/metrics.d.ts +17 -0
- package/dist/types/esm/internal/sdk.d.ts +42 -0
- package/dist/types/esm/internal/semantic-conventions.d.ts +54 -0
- package/dist/types/esm/internal/trace/exporters/eve-trace-exporter.d.ts +18 -0
- package/dist/types/esm/internal/trace/exporters/span-exporter.d.ts +12 -0
- package/dist/types/esm/internal/trace/index.d.ts +4 -0
- package/dist/types/esm/internal/trace/processors/eve-session-processor.d.ts +2 -0
- package/dist/types/esm/internal/trace/processors/span-processor.d.ts +18 -0
- package/dist/types/esm/internal/trace/session.d.ts +136 -0
- package/dist/types/esm/internal/trace/tracing.d.ts +17 -0
- package/dist/types/esm/internal/version.d.ts +1 -0
- package/package.json +57 -57
- package/dist/chunk-4Q2CRWI6.js +0 -2377
- package/dist/chunk-O5DVPC42.cjs +0 -2377
- package/dist/eve.d.cts +0 -19
- package/dist/eve.d.ts +0 -19
- package/dist/google-genai.d.cts +0 -7
- package/dist/google-genai.d.ts +0 -7
- package/dist/index.d.cts +0 -291
- package/dist/index.d.ts +0 -291
- package/dist/loader.mjs +0 -85
- package/dist/preload.cjs +0 -119
- package/dist/preload.d.cts +0 -2
- package/dist/preload.d.ts +0 -2
- package/dist/preload.js +0 -119
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Instrumentation } from '@opentelemetry/instrumentation';
|
|
2
|
+
import type { IMCPManualModules } from './mcp/types.js';
|
|
3
|
+
export interface IInstrumentModules {
|
|
4
|
+
openAI?: unknown;
|
|
5
|
+
anthropic?: unknown;
|
|
6
|
+
cohere?: unknown;
|
|
7
|
+
google_vertexai?: unknown;
|
|
8
|
+
google_genai?: unknown;
|
|
9
|
+
bedrock?: unknown;
|
|
10
|
+
pinecone?: unknown;
|
|
11
|
+
langchain?: {
|
|
12
|
+
callbackManagerModule?: unknown;
|
|
13
|
+
};
|
|
14
|
+
llamaindex?: unknown;
|
|
15
|
+
chromadb?: unknown;
|
|
16
|
+
qdrant?: unknown;
|
|
17
|
+
together?: unknown;
|
|
18
|
+
mcp?: IMCPManualModules;
|
|
19
|
+
}
|
|
20
|
+
export type { IMCPManualModules } from './mcp/types.js';
|
|
21
|
+
export declare class InstrumentationRegistry {
|
|
22
|
+
private static instance;
|
|
23
|
+
static getInstance(): InstrumentationRegistry;
|
|
24
|
+
private manualModules;
|
|
25
|
+
private loadInstrumentation;
|
|
26
|
+
private loadManualInstrumentations;
|
|
27
|
+
setManualModules(modules: IInstrumentModules): void;
|
|
28
|
+
getManualInstrumentations(): Instrumentation[];
|
|
29
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Context } from '@opentelemetry/api';
|
|
2
|
+
import type { Span as SdkSpan, SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import type { Telemetry } from 'ai';
|
|
4
|
+
export declare function createInterruptIntegration(): Telemetry;
|
|
5
|
+
export declare class InterruptPropagator implements SpanProcessor {
|
|
6
|
+
onStart(span: SdkSpan, _parentContext: Context): void;
|
|
7
|
+
onEnd(): void;
|
|
8
|
+
shutdown(): Promise<void>;
|
|
9
|
+
forceFlush(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare function _resetInterruptState(): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { LoggingModule, emitEvent, emitEventWithSessionId } from './logging.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { LogBody } from '@opentelemetry/api-logs';
|
|
2
|
+
import { SeverityNumber } from '@opentelemetry/api-logs';
|
|
3
|
+
import { LoggerProvider } from '@opentelemetry/sdk-logs';
|
|
4
|
+
import type { IResolvedBrizzConfig } from '../config.js';
|
|
5
|
+
export declare class LoggingModule {
|
|
6
|
+
private static instance;
|
|
7
|
+
static getInstance(): LoggingModule;
|
|
8
|
+
private logExporter;
|
|
9
|
+
private logProcessor;
|
|
10
|
+
private loggerProvider;
|
|
11
|
+
private initLogExporter;
|
|
12
|
+
private initLogProcessor;
|
|
13
|
+
private initLoggerProvider;
|
|
14
|
+
setup(config: IResolvedBrizzConfig): void;
|
|
15
|
+
emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
|
|
16
|
+
isInitialized(): boolean;
|
|
17
|
+
getLoggerProvider(): LoggerProvider | null;
|
|
18
|
+
shutdown(): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare function emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
|
|
21
|
+
export declare function emitEventWithSessionId(sessionId: string, name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { LogRecordExporter, SdkLogRecord } from '@opentelemetry/sdk-logs';
|
|
2
|
+
import { BatchLogRecordProcessor, SimpleLogRecordProcessor } from '@opentelemetry/sdk-logs';
|
|
3
|
+
import type { IResolvedBrizzConfig } from '../../config.js';
|
|
4
|
+
import type { IAttributesMaskingRule, ILogMaskingConfig } from '../../masking/types.js';
|
|
5
|
+
export declare const DEFAULT_LOG_MASKING_RULES: IAttributesMaskingRule[];
|
|
6
|
+
export declare class BrizzSimpleLogRecordProcessor extends SimpleLogRecordProcessor {
|
|
7
|
+
readonly config: IResolvedBrizzConfig;
|
|
8
|
+
constructor(exporter: LogRecordExporter, config: IResolvedBrizzConfig);
|
|
9
|
+
onEmit(logRecord: SdkLogRecord): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class BrizzBatchLogRecordProcessor extends BatchLogRecordProcessor {
|
|
12
|
+
readonly config: IResolvedBrizzConfig;
|
|
13
|
+
constructor(exporter: LogRecordExporter, config: IResolvedBrizzConfig);
|
|
14
|
+
onEmit(logRecord: SdkLogRecord): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function maskLog(logRecord: SdkLogRecord, config: ILogMaskingConfig): SdkLogRecord;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { DiagLogLevel } from '@opentelemetry/api';
|
|
2
|
+
export declare enum LogLevel {
|
|
3
|
+
NONE = 0,
|
|
4
|
+
ERROR = 1,
|
|
5
|
+
WARN = 2,
|
|
6
|
+
INFO = 3,
|
|
7
|
+
DEBUG = 4
|
|
8
|
+
}
|
|
9
|
+
export declare const DEFAULT_LOG_LEVEL = LogLevel.WARN;
|
|
10
|
+
export interface ILogger {
|
|
11
|
+
debug: (msg: string, ...meta: unknown[]) => void;
|
|
12
|
+
info: (msg: string, ...meta: unknown[]) => void;
|
|
13
|
+
warn: (msg: string, ...meta: unknown[]) => void;
|
|
14
|
+
error: (msg: string, ...meta: unknown[]) => void;
|
|
15
|
+
setLevel: (level: LogLevel) => void;
|
|
16
|
+
getLevel: () => LogLevel;
|
|
17
|
+
}
|
|
18
|
+
export declare const noopLogger: ILogger;
|
|
19
|
+
export declare function parseLogLevel(level?: string): LogLevel;
|
|
20
|
+
export declare const logger: ILogger;
|
|
21
|
+
export declare function setLogLevel(level: LogLevel | string): void;
|
|
22
|
+
export declare function getLogLevel(): LogLevel;
|
|
23
|
+
export declare function mapLogLevelToDiagLevel(logLevel: LogLevel): DiagLogLevel;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type { IPatternEntry, MaskingMode, IPatternBasedMaskingRule, ISpanMaskingConfig, IEventMaskingConfig, ILogMaskingConfig, MaskableValue, IMaskingConfig, IEventMaskingRule, IAttributesMaskingRule, } from './types.js';
|
|
2
|
+
export { DEFAULT_PII_PATTERNS } from './patterns.js';
|
|
3
|
+
export { maskValue, maskAttributes } from './utils.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type MaskingMode = 'partial' | 'full';
|
|
2
|
+
export interface IPatternBasedMaskingRule {
|
|
3
|
+
readonly patterns: readonly (IPatternEntry | string)[];
|
|
4
|
+
readonly mode?: MaskingMode;
|
|
5
|
+
}
|
|
6
|
+
export interface IPatternEntry {
|
|
7
|
+
readonly name?: string | undefined;
|
|
8
|
+
readonly pattern: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IAttributesMaskingRule extends IPatternBasedMaskingRule {
|
|
11
|
+
readonly patterns: readonly (IPatternEntry | string)[];
|
|
12
|
+
readonly attributePattern?: string;
|
|
13
|
+
readonly mode?: MaskingMode;
|
|
14
|
+
}
|
|
15
|
+
export interface IEventMaskingRule extends IAttributesMaskingRule {
|
|
16
|
+
readonly eventNamePattern?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface ISpanMaskingConfig {
|
|
19
|
+
readonly disableDefaultRules?: boolean;
|
|
20
|
+
readonly rules?: readonly IAttributesMaskingRule[];
|
|
21
|
+
}
|
|
22
|
+
export interface ILogMaskingConfig {
|
|
23
|
+
readonly disableDefaultRules?: boolean;
|
|
24
|
+
readonly maskBody?: boolean;
|
|
25
|
+
readonly rules?: readonly IAttributesMaskingRule[];
|
|
26
|
+
}
|
|
27
|
+
export type IEventMaskingConfig = ILogMaskingConfig;
|
|
28
|
+
export interface IMaskingConfig {
|
|
29
|
+
readonly spanMasking?: ISpanMaskingConfig;
|
|
30
|
+
readonly eventMasking?: IEventMaskingConfig;
|
|
31
|
+
}
|
|
32
|
+
export type MaskableValue = string | number | boolean | null | undefined | Record<string, unknown> | unknown[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IAttributesMaskingRule, IPatternBasedMaskingRule } from './types.js';
|
|
2
|
+
export declare function maskStringByPattern(value: string, pattern: RegExp, mode?: 'partial' | 'full'): string;
|
|
3
|
+
export declare function maskStringByPatternBasedRule(value: string, rule: IPatternBasedMaskingRule): string;
|
|
4
|
+
export declare function maskValue(value: unknown, rule: IPatternBasedMaskingRule): unknown;
|
|
5
|
+
export declare function maskAttributes(attributes: Record<string, unknown>, rules: readonly IAttributesMaskingRule[], outputOriginalValue?: boolean): Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MetricsModule, getMetricsExporter, getMetricsReader } from './metrics.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
2
|
+
import { type MetricReader } from '@opentelemetry/sdk-metrics';
|
|
3
|
+
import type { IResolvedBrizzConfig } from '../config.js';
|
|
4
|
+
export declare class MetricsModule {
|
|
5
|
+
private static instance;
|
|
6
|
+
static getInstance(): MetricsModule;
|
|
7
|
+
private metricsExporter;
|
|
8
|
+
private metricsReader;
|
|
9
|
+
private initMetricsExporter;
|
|
10
|
+
private initMetricsReader;
|
|
11
|
+
setup(config: IResolvedBrizzConfig): void;
|
|
12
|
+
getMetricsExporter(): OTLPMetricExporter;
|
|
13
|
+
getMetricsReader(): MetricReader;
|
|
14
|
+
shutdown(): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function getMetricsExporter(): OTLPMetricExporter;
|
|
17
|
+
export declare function getMetricsReader(): MetricReader;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AttributeValue } from '@opentelemetry/api';
|
|
2
|
+
import type { LogRecordExporter } from '@opentelemetry/sdk-logs';
|
|
3
|
+
import type { MetricReader } from '@opentelemetry/sdk-metrics';
|
|
4
|
+
import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
5
|
+
import { type IInstrumentModules } from './instrumentation/index.js';
|
|
6
|
+
import type { LogLevel } from './logger.js';
|
|
7
|
+
import { type IMaskingConfig } from './masking/index.js';
|
|
8
|
+
export interface IBrizzInitializeOptions {
|
|
9
|
+
appName?: string;
|
|
10
|
+
appVersion?: string;
|
|
11
|
+
baseUrl?: string;
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
dsn?: string;
|
|
14
|
+
headers?: Record<string, string>;
|
|
15
|
+
disableBatch?: boolean;
|
|
16
|
+
environment?: string;
|
|
17
|
+
masking?: boolean | IMaskingConfig;
|
|
18
|
+
logLevel?: LogLevel | string;
|
|
19
|
+
instrumentModules?: IInstrumentModules;
|
|
20
|
+
disableNodeSdk?: boolean;
|
|
21
|
+
customSpanExporter?: SpanExporter;
|
|
22
|
+
customLogExporter?: LogRecordExporter;
|
|
23
|
+
customMetricReader?: MetricReader;
|
|
24
|
+
disableSpanExporter?: boolean;
|
|
25
|
+
resourceAttributes?: Record<string, AttributeValue>;
|
|
26
|
+
beforeSendSpan?: (span: ReadableSpan) => boolean | Promise<boolean>;
|
|
27
|
+
}
|
|
28
|
+
export declare class _Brizz {
|
|
29
|
+
private static instance;
|
|
30
|
+
static getInstance(): _Brizz;
|
|
31
|
+
private _initialized;
|
|
32
|
+
private _tracerProvider;
|
|
33
|
+
private _meterProvider;
|
|
34
|
+
private setupInstrumentation;
|
|
35
|
+
private createAndStartProviders;
|
|
36
|
+
private initializeModules;
|
|
37
|
+
private detectModuleSystem;
|
|
38
|
+
private shutdownModules;
|
|
39
|
+
initialize(options: IBrizzInitializeOptions): void;
|
|
40
|
+
shutdown(): Promise<void>;
|
|
41
|
+
}
|
|
42
|
+
export declare const Brizz: _Brizz;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export declare const BRIZZ = "brizz";
|
|
2
|
+
export declare const PROPERTIES = "properties";
|
|
3
|
+
export declare const SESSION_ID = "session.id";
|
|
4
|
+
export declare const PROPERTIES_CONTEXT_KEY: symbol;
|
|
5
|
+
export declare const SESSION_OBJECT_CONTEXT_KEY: symbol;
|
|
6
|
+
export declare const SESSION_INPUT = "brizz.session.input";
|
|
7
|
+
export declare const SESSION_OUTPUT = "brizz.session.output";
|
|
8
|
+
export declare const SESSION_INPUT_CONTEXT = "brizz.session.input.context";
|
|
9
|
+
export declare const SESSION_OUTPUT_CONTEXT = "brizz.session.output.context";
|
|
10
|
+
export declare const SESSION_SPAN_NAME = "brizz.start_session";
|
|
11
|
+
export declare const MUTE_INPUT = "mute.input";
|
|
12
|
+
export declare const MUTE_OUTPUT = "mute.output";
|
|
13
|
+
export declare const MUTE_TOOLS = "mute.tools";
|
|
14
|
+
export declare const USER_ID = "user.id";
|
|
15
|
+
export declare const USER_EMAIL = "user.email";
|
|
16
|
+
export declare const USER_NAME = "user.name";
|
|
17
|
+
export declare const USER_ROLE = "user.role";
|
|
18
|
+
export declare const USER_PLAN = "user.plan";
|
|
19
|
+
export declare const ORGANIZATION_ID = "organization.id";
|
|
20
|
+
export declare const ORGANIZATION_NAME = "organization.name";
|
|
21
|
+
export declare const ORGANIZATION_PLAN = "organization.plan";
|
|
22
|
+
export declare const ORGANIZATION_DOMAIN = "organization.domain";
|
|
23
|
+
export declare const MESSAGE_ID = "message.id";
|
|
24
|
+
export declare const SESSION_TITLE_SPAN_NAME = "brizz.session_title";
|
|
25
|
+
export declare const SESSION_TITLE_GENERATION = "session.title_generation";
|
|
26
|
+
export declare const SESSION_TITLE = "brizz.session.title";
|
|
27
|
+
export declare const INTERRUPT_TOOLS = "brizz.internal.interrupt";
|
|
28
|
+
export declare const INTERNAL_EVENT_PREFIX = "brizz.internal.";
|
|
29
|
+
export declare const EXTERNAL_LINK_EVENT_NAME = "brizz.internal.external_link";
|
|
30
|
+
export declare const EXTERNAL_LINK_URL = "brizz.internal.external_link.url";
|
|
31
|
+
export declare const EXTERNAL_LINK_TITLE = "brizz.internal.external_link.title";
|
|
32
|
+
export declare const EXTERNAL_LINK_TYPE = "brizz.internal.external_link.type";
|
|
33
|
+
export declare const FEEDBACK_EVENT_NAME = "brizz.feedback";
|
|
34
|
+
export declare const FEEDBACK_TYPE = "brizz.feedback.type";
|
|
35
|
+
export declare const FEEDBACK_SCORE = "brizz.feedback.score";
|
|
36
|
+
export declare const FEEDBACK_REASON = "brizz.feedback.reason";
|
|
37
|
+
export declare const FEEDBACK_COMMENT = "brizz.feedback.comment";
|
|
38
|
+
export declare const FEEDBACK_SOURCE = "brizz.feedback.source";
|
|
39
|
+
export declare const FEEDBACK_ATTR_PREFIX = "brizz.feedback.";
|
|
40
|
+
export declare const FEEDBACK_TYPE_THUMBS_UP = "thumbs_up";
|
|
41
|
+
export declare const FEEDBACK_TYPE_THUMBS_DOWN = "thumbs_down";
|
|
42
|
+
export declare const METRIC_EVENT_NAME = "brizz.internal.metric";
|
|
43
|
+
export declare const METRIC_NAME = "brizz.internal.metric.name";
|
|
44
|
+
export declare const METRIC_VALUE = "brizz.internal.metric.value";
|
|
45
|
+
export declare const METRIC_UNIT = "brizz.internal.metric.unit";
|
|
46
|
+
export declare const METRIC_COMMENT = "brizz.internal.metric.comment";
|
|
47
|
+
export declare const METRIC_POLARITY = "brizz.internal.metric.polarity";
|
|
48
|
+
export declare const METRIC_MIN = "brizz.internal.metric.min";
|
|
49
|
+
export declare const METRIC_MAX = "brizz.internal.metric.max";
|
|
50
|
+
export declare const METRIC_TIMESTAMP = "brizz.internal.metric.timestamp";
|
|
51
|
+
export declare const METRIC_ATTRIBUTE_PREFIX = "brizz.internal.metric.attribute.";
|
|
52
|
+
export declare const RESERVED_METRIC_NAMES: Set<string>;
|
|
53
|
+
export declare const METRIC_POLARITY_POSITIVE = "positive";
|
|
54
|
+
export declare const METRIC_POLARITY_NEGATIVE = "negative";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SpanExporter, SpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
export interface ICreateEveTraceExporterOptions {
|
|
3
|
+
dsn?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface ICreateEveOtelConfigOptions extends ICreateEveTraceExporterOptions {
|
|
6
|
+
serviceName?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface IEveOtelConfig {
|
|
9
|
+
serviceName?: string;
|
|
10
|
+
traceExporter: SpanExporter;
|
|
11
|
+
spanProcessors: Array<SpanProcessor | 'auto'>;
|
|
12
|
+
}
|
|
13
|
+
export declare function resolveEveExporterConfig(options?: ICreateEveTraceExporterOptions): {
|
|
14
|
+
url: string;
|
|
15
|
+
headers: Record<string, string>;
|
|
16
|
+
};
|
|
17
|
+
export declare function createEveTraceExporter(options?: ICreateEveTraceExporterOptions): SpanExporter;
|
|
18
|
+
export declare function createEveOtelConfig(options?: ICreateEveOtelConfigOptions): IEveOtelConfig;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ExportResult } from '@opentelemetry/core';
|
|
2
|
+
import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import type { IResolvedBrizzConfig } from '../../config.js';
|
|
4
|
+
export declare class BrizzSpanExporter implements SpanExporter {
|
|
5
|
+
private readonly _delegate;
|
|
6
|
+
private readonly _brizzResource;
|
|
7
|
+
private readonly _beforeSendSpan?;
|
|
8
|
+
constructor(delegate: SpanExporter, config: IResolvedBrizzConfig);
|
|
9
|
+
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
10
|
+
shutdown(): Promise<void>;
|
|
11
|
+
forceFlush(): Promise<void>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { TracingModule, getSpanExporter, getSpanProcessor } from './tracing.js';
|
|
2
|
+
export { BrizzBatchSpanProcessor, BrizzSimpleSpanProcessor } from './processors/span-processor.js';
|
|
3
|
+
export { withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './session.js';
|
|
4
|
+
export type { IMuteOptions } from './session.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Context } from '@opentelemetry/api';
|
|
2
|
+
import { BatchSpanProcessor, type ReadableSpan, SimpleSpanProcessor, type Span, type SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import type { IResolvedBrizzConfig } from '../../config.js';
|
|
4
|
+
import type { IAttributesMaskingRule, ISpanMaskingConfig } from '../../masking/types.js';
|
|
5
|
+
export declare const DEFAULT_MASKING_RULES: IAttributesMaskingRule[];
|
|
6
|
+
export declare class BrizzSimpleSpanProcessor extends SimpleSpanProcessor {
|
|
7
|
+
readonly config: IResolvedBrizzConfig;
|
|
8
|
+
constructor(spanExporter: SpanExporter, config: IResolvedBrizzConfig);
|
|
9
|
+
onStart(span: Span, parentContext: Context): void;
|
|
10
|
+
onEnd(span: ReadableSpan): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class BrizzBatchSpanProcessor extends BatchSpanProcessor {
|
|
13
|
+
readonly config: IResolvedBrizzConfig;
|
|
14
|
+
constructor(spanExporter: SpanExporter, config: IResolvedBrizzConfig);
|
|
15
|
+
onStart(span: Span, parentContext: Context): void;
|
|
16
|
+
onEnd(span: ReadableSpan): void;
|
|
17
|
+
}
|
|
18
|
+
export declare function maskReadableSpan(span: ReadableSpan, config: ISpanMaskingConfig): void;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { Span, AttributeValue } from '@opentelemetry/api';
|
|
2
|
+
export declare function setCurrentSpanCustomProperties(properties: Record<string, AttributeValue>): void;
|
|
3
|
+
export declare function callWithProperties<A extends unknown[], F extends (...args: A) => ReturnType<F>>(properties: {
|
|
4
|
+
[name: string]: string;
|
|
5
|
+
}, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
6
|
+
export declare function withProperties<F extends (this: any, ...args: any[]) => any>(properties: {
|
|
7
|
+
[name: string]: string;
|
|
8
|
+
}, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
9
|
+
export declare function setUser(user: {
|
|
10
|
+
id: string;
|
|
11
|
+
email?: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
role?: string;
|
|
14
|
+
plan?: string;
|
|
15
|
+
traits?: Record<string, string>;
|
|
16
|
+
}): void;
|
|
17
|
+
export declare function setOrganization(org: {
|
|
18
|
+
id: string;
|
|
19
|
+
name?: string;
|
|
20
|
+
plan?: string;
|
|
21
|
+
domain?: string;
|
|
22
|
+
traits?: Record<string, string>;
|
|
23
|
+
}): void;
|
|
24
|
+
export declare function setMessageId(id: string): void;
|
|
25
|
+
export declare function setSessionId(id: string): void;
|
|
26
|
+
export declare function callWithUser<A extends unknown[], F extends (...args: A) => ReturnType<F>>(user: {
|
|
27
|
+
id: string;
|
|
28
|
+
email?: string;
|
|
29
|
+
name?: string;
|
|
30
|
+
role?: string;
|
|
31
|
+
plan?: string;
|
|
32
|
+
traits?: Record<string, string>;
|
|
33
|
+
}, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
34
|
+
export declare function withUser<F extends (this: any, ...args: any[]) => any>(user: {
|
|
35
|
+
id: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
role?: string;
|
|
39
|
+
plan?: string;
|
|
40
|
+
traits?: Record<string, string>;
|
|
41
|
+
}, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
42
|
+
export declare function callWithOrganization<A extends unknown[], F extends (...args: A) => ReturnType<F>>(org: {
|
|
43
|
+
id: string;
|
|
44
|
+
name?: string;
|
|
45
|
+
plan?: string;
|
|
46
|
+
domain?: string;
|
|
47
|
+
traits?: Record<string, string>;
|
|
48
|
+
}, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
49
|
+
export declare function withOrganization<F extends (this: any, ...args: any[]) => any>(org: {
|
|
50
|
+
id: string;
|
|
51
|
+
name?: string;
|
|
52
|
+
plan?: string;
|
|
53
|
+
domain?: string;
|
|
54
|
+
traits?: Record<string, string>;
|
|
55
|
+
}, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
56
|
+
export declare function callWithMessageId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(id: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
57
|
+
export declare function withMessageId<F extends (this: any, ...args: any[]) => any>(id: string, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
58
|
+
export interface IMuteOptions {
|
|
59
|
+
input?: boolean;
|
|
60
|
+
output?: boolean;
|
|
61
|
+
tools?: boolean;
|
|
62
|
+
}
|
|
63
|
+
export declare function callWithMute<A extends unknown[], F extends (...args: A) => ReturnType<F>>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
64
|
+
export declare function withMute<F extends (this: any, ...args: any[]) => any>(options: IMuteOptions, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
65
|
+
export declare function withSessionId<F extends (this: any, ...args: any[]) => any>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, extraProperties?: Record<string, string>): F;
|
|
66
|
+
export declare function callWithSessionId<A extends unknown[], F extends (...args: A) => ReturnType<F>>(sessionId: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
67
|
+
export declare class Session {
|
|
68
|
+
private readonly span;
|
|
69
|
+
private inputs;
|
|
70
|
+
private outputs;
|
|
71
|
+
private inputContexts;
|
|
72
|
+
private outputContexts;
|
|
73
|
+
readonly sessionId: string;
|
|
74
|
+
constructor(sessionId: string, span: Span);
|
|
75
|
+
setInput(text: string | null, context?: Record<string, AttributeValue>): void;
|
|
76
|
+
setOutput(text: string | null, context?: Record<string, AttributeValue>): void;
|
|
77
|
+
setTitle(title: string): void;
|
|
78
|
+
updateProperties(properties: Record<string, AttributeValue>): void;
|
|
79
|
+
setUser(user: {
|
|
80
|
+
id: string;
|
|
81
|
+
email?: string;
|
|
82
|
+
name?: string;
|
|
83
|
+
role?: string;
|
|
84
|
+
plan?: string;
|
|
85
|
+
traits?: Record<string, string>;
|
|
86
|
+
}): void;
|
|
87
|
+
setOrganization(org: {
|
|
88
|
+
id: string;
|
|
89
|
+
name?: string;
|
|
90
|
+
plan?: string;
|
|
91
|
+
domain?: string;
|
|
92
|
+
traits?: Record<string, string>;
|
|
93
|
+
}): void;
|
|
94
|
+
addExternalLink(url: string, options?: {
|
|
95
|
+
title?: string;
|
|
96
|
+
linkType?: string;
|
|
97
|
+
}): void;
|
|
98
|
+
}
|
|
99
|
+
export declare class SessionTitle {
|
|
100
|
+
private readonly span;
|
|
101
|
+
constructor(span: Span);
|
|
102
|
+
setTitle(title: string): void;
|
|
103
|
+
}
|
|
104
|
+
export declare function getActiveSession(): Session | undefined;
|
|
105
|
+
export declare function addExternalLink(url: string, options?: {
|
|
106
|
+
sessionId?: string;
|
|
107
|
+
title?: string;
|
|
108
|
+
linkType?: string;
|
|
109
|
+
}): void;
|
|
110
|
+
export declare function recordFeedback(type: string, options?: {
|
|
111
|
+
score?: number;
|
|
112
|
+
reason?: string;
|
|
113
|
+
comment?: string;
|
|
114
|
+
source?: string;
|
|
115
|
+
messageId?: string;
|
|
116
|
+
sessionId?: string;
|
|
117
|
+
attributes?: Record<string, string>;
|
|
118
|
+
}): void;
|
|
119
|
+
export declare function recordMetric(options: {
|
|
120
|
+
name: string;
|
|
121
|
+
value: number | boolean;
|
|
122
|
+
unit?: string;
|
|
123
|
+
comment?: string;
|
|
124
|
+
attributes?: Record<string, string>;
|
|
125
|
+
polarity?: 'positive' | 'negative';
|
|
126
|
+
minValue?: number;
|
|
127
|
+
maxValue?: number;
|
|
128
|
+
timestamp?: Date;
|
|
129
|
+
sessionId?: string;
|
|
130
|
+
}): void;
|
|
131
|
+
export declare function startSession<T>(sessionId: string, callback: (session: Session) => T, extraProperties?: Record<string, AttributeValue>, options?: {
|
|
132
|
+
mode?: 'default' | 'title';
|
|
133
|
+
}): T;
|
|
134
|
+
export declare function startSessionTitle<T>(callback: (title: SessionTitle) => T, options?: {
|
|
135
|
+
sessionId?: string;
|
|
136
|
+
}): T;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import type { SpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
3
|
+
import type { IResolvedBrizzConfig } from '../config.js';
|
|
4
|
+
export declare class TracingModule {
|
|
5
|
+
private static instance;
|
|
6
|
+
static getInstance(): TracingModule;
|
|
7
|
+
private spanExporter;
|
|
8
|
+
private spanProcessor;
|
|
9
|
+
private initSpanExporter;
|
|
10
|
+
private initSpanProcessor;
|
|
11
|
+
setup(config: IResolvedBrizzConfig): void;
|
|
12
|
+
getSpanExporter(): SpanExporter;
|
|
13
|
+
getSpanProcessor(): SpanProcessor;
|
|
14
|
+
shutdown(): Promise<void>;
|
|
15
|
+
}
|
|
16
|
+
export declare function getSpanExporter(): SpanExporter;
|
|
17
|
+
export declare function getSpanProcessor(): SpanProcessor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSDKVersion(): string;
|