@brizz/sdk 0.1.36 → 0.1.39
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-6OGRVH77.js → chunk-JBNWC4YN.js} +1 -1
- package/dist/{chunk-PXIW2K27.cjs → chunk-NMDPWJMU.cjs} +1 -1
- package/dist/index.cjs +2264 -15
- package/dist/index.js +2299 -50
- package/dist/{mcp-HAUJ3G4Q.cjs → mcp-3N3DAQGD.cjs} +2 -2
- package/dist/{mcp-ZCRMQV5L.js → mcp-EWOGAW4J.js} +1 -1
- 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 +6 -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 +135 -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 +6 -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 +135 -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 +58 -58
- package/dist/chunk-CQDWK43A.cjs +0 -2368
- package/dist/chunk-YNCBWOHM.js +0 -2368
- 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNMDPWJMUcjs = require('./chunk-NMDPWJMU.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
@@ -570,7 +570,7 @@ function safeEnd(span) {
|
|
|
570
570
|
|
|
571
571
|
// src/internal/instrumentation/mcp/version.ts
|
|
572
572
|
var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
|
|
573
|
-
var INSTRUMENTATION_VERSION =
|
|
573
|
+
var INSTRUMENTATION_VERSION = _chunkNMDPWJMUcjs.getSDKVersion.call(void 0, );
|
|
574
574
|
|
|
575
575
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
576
576
|
var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
@@ -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, 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,6 @@
|
|
|
1
|
+
import type { Context, Span } from '@opentelemetry/api';
|
|
2
|
+
export interface ISessionAttachResult {
|
|
3
|
+
context: Context;
|
|
4
|
+
sessionId: string | null;
|
|
5
|
+
}
|
|
6
|
+
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
|
+
}
|
|
@@ -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, 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;
|