@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,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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { instrumentGoogleGenAI } from './internal/instrumentation/google-genai.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import './internal/instrumentation/auto-init.js';
|
|
2
|
+
export { Brizz, type IBrizzInitializeOptions } from './internal/sdk.js';
|
|
3
|
+
export { type IInstrumentModules, type IMCPManualModules, } from './internal/instrumentation/index.js';
|
|
4
|
+
export { emitEvent, emitEventWithSessionId } from './internal/log/index.js';
|
|
5
|
+
export { getSpanExporter, getSpanProcessor, 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 './internal/trace/index.js';
|
|
6
|
+
export type { IMuteOptions } from './internal/trace/index.js';
|
|
7
|
+
export { getMetricsExporter, getMetricsReader } from './internal/metric/index.js';
|
|
8
|
+
export type { IMaskingConfig, ISpanMaskingConfig, ILogMaskingConfig, IEventMaskingConfig, IEventMaskingRule, MaskingMode, IAttributesMaskingRule, } from './internal/masking/index.js';
|
|
9
|
+
export { DEFAULT_PII_PATTERNS } from './internal/masking/patterns.js';
|
|
10
|
+
export { maskValue, maskAttributes } from './internal/masking/utils.js';
|
|
11
|
+
export { LogLevel, logger, setLogLevel, getLogLevel } from './internal/logger.js';
|
|
12
|
+
export type { ILogger } from './internal/logger.js';
|
|
13
|
+
export { SeverityNumber } from '@opentelemetry/api-logs';
|
|
14
|
+
export type { AttributeValue } from '@opentelemetry/api';
|
|
15
|
+
export type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AttributeValue } from '@opentelemetry/api';
|
|
2
|
+
import type { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
3
|
+
import type { IBrizzInitializeOptions } from '../index.js';
|
|
4
|
+
import type { LogLevel } from './logger.js';
|
|
5
|
+
import type { IMaskingConfig } from './masking/index.js';
|
|
6
|
+
export interface IResolvedBrizzConfig extends Omit<IBrizzInitializeOptions, 'masking'> {
|
|
7
|
+
appName: string;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
headers: Record<string, string>;
|
|
10
|
+
disableBatch: boolean;
|
|
11
|
+
environment?: string;
|
|
12
|
+
apiKey?: string;
|
|
13
|
+
logLevel: LogLevel;
|
|
14
|
+
masking?: IMaskingConfig;
|
|
15
|
+
resourceAttributes?: Record<string, AttributeValue>;
|
|
16
|
+
beforeSendSpan?: (span: ReadableSpan) => boolean | Promise<boolean>;
|
|
17
|
+
}
|
|
18
|
+
export declare function resolveConfig(options: IBrizzInitializeOptions): IResolvedBrizzConfig;
|
|
19
|
+
export declare function processEnvironmentConfig(options: IBrizzInitializeOptions): IResolvedBrizzConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const PLACEHOLDER_SERVICE = "<service-name>";
|
|
2
|
+
export declare const SERVICE_NAME_HEADER = "X-Brizz-Service-Name";
|
|
3
|
+
export interface IParsedDSN {
|
|
4
|
+
scheme: 'http' | 'https';
|
|
5
|
+
host: string;
|
|
6
|
+
bearer: string;
|
|
7
|
+
service: string;
|
|
8
|
+
baseUrl: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IParseDSNOptions {
|
|
11
|
+
allowPlaceholderService?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseDSN(dsn: string, options?: IParseDSNOptions): IParsedDSN | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type TelemetryRegister = (...integrations: unknown[]) => void;
|
|
2
|
+
interface AISdkTelemetryModule {
|
|
3
|
+
registerTelemetry?: TelemetryRegister;
|
|
4
|
+
registerTelemetryIntegration?: TelemetryRegister;
|
|
5
|
+
}
|
|
6
|
+
export declare function selectTelemetryRegister(ai: AISdkTelemetryModule): TelemetryRegister | undefined;
|
|
7
|
+
export declare const autoInstrumentationsLoaded: boolean;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Instrumentation } from '@opentelemetry/instrumentation';
|
|
2
|
+
interface GoogleGenAIModule {
|
|
3
|
+
GoogleGenAI: new (...args: never[]) => object;
|
|
4
|
+
}
|
|
5
|
+
interface GoogleGenAIInstrumentationConfig {
|
|
6
|
+
exceptionLogger?: (error: Error) => void;
|
|
7
|
+
}
|
|
8
|
+
interface GoogleGenAIInstrumentationLike extends Instrumentation {
|
|
9
|
+
manuallyInstrument(module: GoogleGenAIModule): void;
|
|
10
|
+
}
|
|
11
|
+
export declare const GoogleGenAIInstrumentation: new (config?: GoogleGenAIInstrumentationConfig) => GoogleGenAIInstrumentationLike;
|
|
12
|
+
export declare function instrumentGoogleGenAI<T extends GoogleGenAIModule>(module: T): T['GoogleGenAI'];
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MCPInstrumentation as BaseMCPInstrumentation } from '@arizeai/openinference-instrumentation-mcp';
|
|
2
|
+
import type { Instrumentation, InstrumentationConfig } from '@opentelemetry/instrumentation';
|
|
3
|
+
import type { IMCPManualModules } from './types.js';
|
|
4
|
+
export declare class MCPInstrumentation extends BaseMCPInstrumentation {
|
|
5
|
+
private readonly brizzTracer;
|
|
6
|
+
constructor(_config?: {
|
|
7
|
+
exceptionLogger?: (error: Error) => void;
|
|
8
|
+
instrumentationConfig?: InstrumentationConfig;
|
|
9
|
+
});
|
|
10
|
+
private patchProtocolModule;
|
|
11
|
+
private unpatchProtocolModule;
|
|
12
|
+
protected init(): ReturnType<BaseMCPInstrumentation['init']>;
|
|
13
|
+
manuallyInstrument(modules: IMCPManualModules): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function isMCPInstrumentation(value: unknown): value is Instrumentation;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Span } from '@opentelemetry/api';
|
|
2
|
+
import type { IJsonRpcRequest, IProtocolLike } from '../types.js';
|
|
3
|
+
export declare function deriveSpanName(method: string, params?: Record<string, unknown>): string;
|
|
4
|
+
export declare function applyBaseAttributes(span: Span, request: IJsonRpcRequest): void;
|
|
5
|
+
export declare function applyClientRequestAttributes(span: Span, request: IJsonRpcRequest, transportName?: string): void;
|
|
6
|
+
export declare function applyServerRequestAttributes(span: Span, request: IJsonRpcRequest, protocol: IProtocolLike): void;
|
|
7
|
+
export declare function applyResultAttributes(span: Span, method: string, result: unknown): void;
|
|
8
|
+
export declare function applyErrorAttributes(span: Span, err: unknown): void;
|
|
9
|
+
export declare function serializeForAttribute(value: unknown): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export declare const MCP_TOOL_NAME = "mcp.tool.name";
|
|
2
|
+
export declare const MCP_TOOL_ARGUMENTS = "mcp.tool.arguments";
|
|
3
|
+
export declare const MCP_TOOL_RESULT = "mcp.tool.result";
|
|
4
|
+
export declare const MCP_COMPONENT_TYPE = "mcp.component.type";
|
|
5
|
+
export declare const MCP_COMPONENT_TOOL = "tool";
|
|
6
|
+
export declare const MCP_COMPONENT_TOOL_SCHEMA = "tool_schema";
|
|
7
|
+
export declare const MCP_TOOL_SCHEMA_PARAMETERS = "mcp.tool.schema.parameters";
|
|
8
|
+
export declare const MCP_TOOL_SCHEMA_OUTPUT = "mcp.tool.schema.output";
|
|
9
|
+
export declare const MCP_TOOL_DESCRIPTION = "mcp.tool.description";
|
|
10
|
+
export declare const SPAN_NAME_TOOL_REGISTER = "mcp.tool.register";
|
|
11
|
+
export declare const MCP_METHOD_NAME = "mcp.method.name";
|
|
12
|
+
export declare const MCP_REQUEST_ID = "mcp.request.id";
|
|
13
|
+
export declare const MCP_SESSION_ID = "mcp.session.id";
|
|
14
|
+
export declare const MCP_PROTOCOL_VERSION = "mcp.protocol.version";
|
|
15
|
+
export declare const MCP_RESOURCE_URI = "mcp.resource.uri";
|
|
16
|
+
export declare const MCP_NOTIFICATION_METHOD = "mcp.notification.method";
|
|
17
|
+
export declare const RPC_SYSTEM = "rpc.system";
|
|
18
|
+
export declare const RPC_SYSTEM_MCP = "mcp";
|
|
19
|
+
export declare const RPC_RESPONSE_STATUS_CODE = "rpc.response.status_code";
|
|
20
|
+
export declare const GEN_AI_TOOL_NAME = "gen_ai.tool.name";
|
|
21
|
+
export declare const GEN_AI_PROMPT_NAME = "gen_ai.prompt.name";
|
|
22
|
+
export declare const GEN_AI_OPERATION_NAME = "gen_ai.operation.name";
|
|
23
|
+
export declare const GEN_AI_OPERATION_EXECUTE_TOOL = "execute_tool";
|
|
24
|
+
export declare const NETWORK_TRANSPORT = "network.transport";
|
|
25
|
+
export declare const ERROR_TYPE = "error.type";
|
|
26
|
+
export declare const ERROR_TYPE_TOOL = "tool_error";
|
|
27
|
+
export declare const ERROR_TYPE_TIMEOUT = "timeout";
|
|
28
|
+
export declare const ERROR_TYPE_CANCELLED = "cancelled";
|
|
29
|
+
export declare const JSONRPC_REQUEST_ID = "jsonrpc.request.id";
|
|
30
|
+
export declare const SPAN_NAME_TOOLS_CALL = "tools/call";
|
|
31
|
+
export declare const MAX_ATTRIBUTE_LENGTH: number;
|
|
32
|
+
export declare const TRUNCATION_SUFFIX = "\u2026(truncated)";
|
|
33
|
+
export declare const METHOD_TOOLS_CALL = "tools/call";
|
|
34
|
+
export declare const METHOD_TOOLS_LIST = "tools/list";
|
|
35
|
+
export declare const METHOD_RESOURCES_READ = "resources/read";
|
|
36
|
+
export declare const METHOD_PROMPTS_GET = "prompts/get";
|
|
37
|
+
export declare const METHOD_INITIALIZE = "initialize";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context, Span } from '@opentelemetry/api';
|
|
2
|
+
export interface ISessionAttachResult {
|
|
3
|
+
context: Context;
|
|
4
|
+
sessionId: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveSessionId(protocol: unknown, baseContext: Context): string | undefined;
|
|
7
|
+
export declare function stampAndPropagateSession(span: Span, sessionId: string | null | undefined, baseContext?: Context): ISessionAttachResult;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface IJsonRpcRequest {
|
|
2
|
+
method: string;
|
|
3
|
+
params?: IMessageParams;
|
|
4
|
+
id?: string | number;
|
|
5
|
+
}
|
|
6
|
+
export interface IMessageParams {
|
|
7
|
+
_meta?: IMessageMeta;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface IMessageMeta {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface IJsonRpcResponse {
|
|
14
|
+
jsonrpc: '2.0';
|
|
15
|
+
id?: string | number;
|
|
16
|
+
result?: unknown;
|
|
17
|
+
error?: {
|
|
18
|
+
code?: number;
|
|
19
|
+
message?: string;
|
|
20
|
+
data?: unknown;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export interface IProtocolLike {
|
|
24
|
+
sessionId?: string;
|
|
25
|
+
_transport?: ITransportLike;
|
|
26
|
+
_requestHandlers?: Map<string, RequestHandler>;
|
|
27
|
+
fallbackRequestHandler?: RequestHandler;
|
|
28
|
+
}
|
|
29
|
+
export interface ITransportLike {
|
|
30
|
+
sessionId?: string;
|
|
31
|
+
constructor?: {
|
|
32
|
+
name?: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export type RequestHandler = (request: unknown, extra: unknown) => unknown;
|
|
36
|
+
export interface IMCPManualModules {
|
|
37
|
+
clientSSEModule?: unknown;
|
|
38
|
+
serverSSEModule?: unknown;
|
|
39
|
+
clientStdioModule?: unknown;
|
|
40
|
+
serverStdioModule?: unknown;
|
|
41
|
+
clientStreamableHTTPModule?: unknown;
|
|
42
|
+
serverStreamableHTTPModule?: unknown;
|
|
43
|
+
protocolModule?: unknown;
|
|
44
|
+
}
|
|
45
|
+
export interface IMCPInstrumentationConfig {
|
|
46
|
+
captureNotifications?: boolean;
|
|
47
|
+
}
|