@brizz/sdk 0.1.40 → 0.1.42
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 +25 -0
- package/dist/{chunk-EC3MYSRM.js → chunk-7FQQHF5U.js} +1 -1
- package/dist/{chunk-77UGZGMP.cjs → chunk-FORVS4QW.cjs} +5 -1
- package/dist/{chunk-RNU3DOSR.cjs → chunk-K3NPYISB.cjs} +1 -1
- package/dist/{chunk-BGLKBQ6N.js → chunk-KVOGOKOB.js} +1 -1
- package/dist/{chunk-EVRCHF74.cjs → chunk-QUV5HYJ2.cjs} +4 -4
- package/dist/{chunk-WII4R5RE.js → chunk-Y7NMZAQT.js} +4 -0
- package/dist/index.cjs +350 -229
- package/dist/index.js +205 -84
- package/dist/interrupt-3NXOTY4N.cjs +12 -0
- package/dist/{interrupt-YJVZK4VC.js → interrupt-ERCX5RXR.js} +2 -2
- package/dist/{mcp-HBOMHU67.js → mcp-5BFXKN63.js} +50 -34
- package/dist/{mcp-64ZNSCIR.cjs → mcp-GVGTOWHP.cjs} +61 -45
- package/dist/types/cjs/index.d.ts +1 -1
- package/dist/types/cjs/internal/instrumentation/mcp/session.d.ts +1 -0
- package/dist/types/cjs/internal/log/logging.d.ts +5 -5
- package/dist/types/cjs/internal/semantic-conventions.d.ts +2 -0
- package/dist/types/cjs/internal/trace/exporters/span-exporter.d.ts +11 -2
- package/dist/types/cjs/internal/trace/index.d.ts +1 -1
- package/dist/types/cjs/internal/trace/session.d.ts +4 -0
- package/dist/types/esm/index.d.ts +1 -1
- package/dist/types/esm/internal/instrumentation/mcp/session.d.ts +1 -0
- package/dist/types/esm/internal/log/logging.d.ts +5 -5
- package/dist/types/esm/internal/semantic-conventions.d.ts +2 -0
- package/dist/types/esm/internal/trace/exporters/span-exporter.d.ts +11 -2
- package/dist/types/esm/internal/trace/index.d.ts +1 -1
- package/dist/types/esm/internal/trace/session.d.ts +4 -0
- package/package.json +13 -13
- package/dist/interrupt-DM3AWSBX.cjs +0 -12
|
@@ -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 _chunkK3NPYISBcjs = require('./chunk-K3NPYISB.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
@@ -8,7 +8,7 @@ var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkFORVS4QWcjs = require('./chunk-FORVS4QW.cjs');
|
|
12
12
|
require('./chunk-OBGZSXTJ.cjs');
|
|
13
13
|
|
|
14
14
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
@@ -77,9 +77,6 @@ function safeStringify(value) {
|
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
function emitSchemaSpansFromListResponse(result, transportSessionId, tracer) {
|
|
80
|
-
if (!transportSessionId) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
80
|
const tools = extractTools(result);
|
|
84
81
|
if (tools === void 0) {
|
|
85
82
|
return;
|
|
@@ -112,7 +109,9 @@ function stampSchemaAttributes(span, toolName, transportSessionId, tool) {
|
|
|
112
109
|
const outputSchema = tool.outputSchema !== void 0 && tool.outputSchema !== null ? truncateSchemaAttr(safeStringify(tool.outputSchema)) : "";
|
|
113
110
|
span.setAttribute(RPC_SYSTEM, RPC_SYSTEM_MCP);
|
|
114
111
|
span.setAttribute(MCP_COMPONENT_TYPE, MCP_COMPONENT_TOOL_SCHEMA);
|
|
115
|
-
|
|
112
|
+
if (transportSessionId) {
|
|
113
|
+
span.setAttribute(MCP_SESSION_ID, transportSessionId);
|
|
114
|
+
}
|
|
116
115
|
span.setAttribute(MCP_TOOL_NAME, toolName);
|
|
117
116
|
span.setAttribute(MCP_TOOL_SCHEMA_PARAMETERS, parameters);
|
|
118
117
|
span.setAttribute(MCP_TOOL_SCHEMA_OUTPUT, outputSchema);
|
|
@@ -142,24 +141,32 @@ function generateSessionId() {
|
|
|
142
141
|
}
|
|
143
142
|
return id;
|
|
144
143
|
}
|
|
144
|
+
function isSessionCarrier(value) {
|
|
145
|
+
return typeof value === "object" && value !== null;
|
|
146
|
+
}
|
|
147
|
+
function resolveTransportSessionId(protocol) {
|
|
148
|
+
if (!isSessionCarrier(protocol)) {
|
|
149
|
+
return void 0;
|
|
150
|
+
}
|
|
151
|
+
return _nullishCoalesce(protocol.sessionId, () => ( _optionalChain([protocol, 'access', _ => _._transport, 'optionalAccess', _2 => _2.sessionId])));
|
|
152
|
+
}
|
|
145
153
|
function resolveSessionId(protocol, baseContext) {
|
|
146
|
-
if (
|
|
154
|
+
if (!isSessionCarrier(protocol)) {
|
|
147
155
|
return void 0;
|
|
148
156
|
}
|
|
149
|
-
const
|
|
150
|
-
const fromTransport = _nullishCoalesce(carrier.sessionId, () => ( _optionalChain([carrier, 'access', _ => _._transport, 'optionalAccess', _2 => _2.sessionId])));
|
|
157
|
+
const fromTransport = resolveTransportSessionId(protocol);
|
|
151
158
|
if (fromTransport) {
|
|
152
159
|
return fromTransport;
|
|
153
160
|
}
|
|
154
161
|
try {
|
|
155
|
-
const bound = baseContext.getValue(
|
|
156
|
-
if (_optionalChain([bound, 'optionalAccess', _3 => _3[
|
|
162
|
+
const bound = baseContext.getValue(_chunkFORVS4QWcjs.PROPERTIES_CONTEXT_KEY);
|
|
163
|
+
if (_optionalChain([bound, 'optionalAccess', _3 => _3[_chunkFORVS4QWcjs.SESSION_ID]])) {
|
|
157
164
|
return void 0;
|
|
158
165
|
}
|
|
159
166
|
} catch (e2) {
|
|
160
167
|
}
|
|
161
|
-
|
|
162
|
-
return
|
|
168
|
+
protocol[FALLBACK_SESSION_ID] ??= generateSessionId();
|
|
169
|
+
return protocol[FALLBACK_SESSION_ID];
|
|
163
170
|
}
|
|
164
171
|
function stampAndPropagateSession(span, sessionId, baseContext = _api.context.active()) {
|
|
165
172
|
if (!sessionId) {
|
|
@@ -167,7 +174,7 @@ function stampAndPropagateSession(span, sessionId, baseContext = _api.context.ac
|
|
|
167
174
|
}
|
|
168
175
|
if (span.isRecording()) {
|
|
169
176
|
try {
|
|
170
|
-
span.setAttribute(`${
|
|
177
|
+
span.setAttribute(`${_chunkFORVS4QWcjs.BRIZZ}.${_chunkFORVS4QWcjs.SESSION_ID}`, sessionId);
|
|
171
178
|
} catch (error) {
|
|
172
179
|
_chunkWC573FCIcjs.logger.warn(
|
|
173
180
|
`Brizz MCP: failed to stamp session id on span: ${String(error)}`
|
|
@@ -175,10 +182,10 @@ function stampAndPropagateSession(span, sessionId, baseContext = _api.context.ac
|
|
|
175
182
|
}
|
|
176
183
|
}
|
|
177
184
|
try {
|
|
178
|
-
const prev = baseContext.getValue(
|
|
179
|
-
const merged = prev ? { ...prev, [
|
|
185
|
+
const prev = baseContext.getValue(_chunkFORVS4QWcjs.PROPERTIES_CONTEXT_KEY);
|
|
186
|
+
const merged = prev ? { ...prev, [_chunkFORVS4QWcjs.SESSION_ID]: sessionId } : { [_chunkFORVS4QWcjs.SESSION_ID]: sessionId };
|
|
180
187
|
return {
|
|
181
|
-
context: baseContext.setValue(
|
|
188
|
+
context: baseContext.setValue(_chunkFORVS4QWcjs.PROPERTIES_CONTEXT_KEY, merged),
|
|
182
189
|
sessionId
|
|
183
190
|
};
|
|
184
191
|
} catch (error) {
|
|
@@ -449,19 +456,30 @@ function wrapOnRequest(original, tracer) {
|
|
|
449
456
|
return original.apply(this, args);
|
|
450
457
|
}
|
|
451
458
|
const { span, spanCtx } = started;
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
459
|
+
const hooks = {};
|
|
460
|
+
if (method === METHOD_TOOLS_LIST) {
|
|
461
|
+
hooks.onResult = (result) => {
|
|
462
|
+
try {
|
|
463
|
+
emitSchemaSpansFromListResponse(
|
|
464
|
+
result,
|
|
465
|
+
resolveTransportSessionId(this),
|
|
466
|
+
tracer
|
|
467
|
+
);
|
|
468
|
+
} catch (error) {
|
|
469
|
+
_chunkWC573FCIcjs.logger.warn(
|
|
470
|
+
`Brizz MCP: failed to emit tools/list schema spans: ${String(error)}`
|
|
471
|
+
);
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
if (method !== METHOD_TOOLS_CALL) {
|
|
476
|
+
hooks.onError = () => {
|
|
477
|
+
stampAndPropagateSession(span, resolveSessionId(this, spanCtx), spanCtx);
|
|
478
|
+
};
|
|
479
|
+
}
|
|
462
480
|
const wrappedHandler = (req, extra) => _api.context.with(
|
|
463
481
|
spanCtx,
|
|
464
|
-
() => executeHandler(span, method, handler, req, extra,
|
|
482
|
+
() => executeHandler(span, method, handler, req, extra, hooks)
|
|
465
483
|
);
|
|
466
484
|
const hadEntry = handlers.has(method);
|
|
467
485
|
const prev = handlers.get(method);
|
|
@@ -485,41 +503,39 @@ function wrapOnRequest(original, tracer) {
|
|
|
485
503
|
}
|
|
486
504
|
};
|
|
487
505
|
}
|
|
488
|
-
function executeAroundSpan(span, method, run,
|
|
506
|
+
function executeAroundSpan(span, method, run, hooks) {
|
|
489
507
|
let result;
|
|
490
508
|
try {
|
|
491
509
|
result = run();
|
|
492
510
|
} catch (error) {
|
|
493
511
|
safeApplyErrorAttributes(span, error);
|
|
512
|
+
_optionalChain([hooks, 'optionalAccess', _19 => _19.onError, 'optionalCall', _20 => _20()]);
|
|
494
513
|
safeEnd(span);
|
|
495
514
|
throw error;
|
|
496
515
|
}
|
|
497
516
|
if (!isThenable(result)) {
|
|
498
517
|
safeApplyResultAttributes(span, method, result);
|
|
499
|
-
|
|
500
|
-
postResult(result);
|
|
501
|
-
}
|
|
518
|
+
_optionalChain([hooks, 'optionalAccess', _21 => _21.onResult, 'optionalCall', _22 => _22(result)]);
|
|
502
519
|
safeEnd(span);
|
|
503
520
|
return result;
|
|
504
521
|
}
|
|
505
522
|
return result.then(
|
|
506
523
|
(value) => {
|
|
507
524
|
safeApplyResultAttributes(span, method, value);
|
|
508
|
-
|
|
509
|
-
postResult(value);
|
|
510
|
-
}
|
|
525
|
+
_optionalChain([hooks, 'optionalAccess', _23 => _23.onResult, 'optionalCall', _24 => _24(value)]);
|
|
511
526
|
safeEnd(span);
|
|
512
527
|
return value;
|
|
513
528
|
},
|
|
514
529
|
(error) => {
|
|
515
530
|
safeApplyErrorAttributes(span, error);
|
|
531
|
+
_optionalChain([hooks, 'optionalAccess', _25 => _25.onError, 'optionalCall', _26 => _26()]);
|
|
516
532
|
safeEnd(span);
|
|
517
533
|
throw error;
|
|
518
534
|
}
|
|
519
535
|
);
|
|
520
536
|
}
|
|
521
|
-
function executeHandler(span, method, handler, req, extra,
|
|
522
|
-
return executeAroundSpan(span, method, () => handler(req, extra),
|
|
537
|
+
function executeHandler(span, method, handler, req, extra, hooks) {
|
|
538
|
+
return executeAroundSpan(span, method, () => handler(req, extra), hooks);
|
|
523
539
|
}
|
|
524
540
|
function safeStartClientSpan(tracer, request, protocol) {
|
|
525
541
|
try {
|
|
@@ -528,7 +544,7 @@ function safeStartClientSpan(tracer, request, protocol) {
|
|
|
528
544
|
applyClientRequestAttributes(
|
|
529
545
|
span,
|
|
530
546
|
request,
|
|
531
|
-
_optionalChain([protocol, 'access',
|
|
547
|
+
_optionalChain([protocol, 'access', _27 => _27._transport, 'optionalAccess', _28 => _28.constructor, 'optionalAccess', _29 => _29.name])
|
|
532
548
|
);
|
|
533
549
|
return span;
|
|
534
550
|
} catch (error) {
|
|
@@ -546,9 +562,9 @@ function safeStartServerSpan(tracer, request, protocol) {
|
|
|
546
562
|
parentCtx
|
|
547
563
|
);
|
|
548
564
|
applyServerRequestAttributes(span, request, protocol);
|
|
549
|
-
const resolved = resolveSessionId(protocol, parentCtx);
|
|
550
|
-
const { context: sessCtx
|
|
551
|
-
return { span, spanCtx: _api.trace.setSpan(sessCtx, span)
|
|
565
|
+
const resolved = request.method === METHOD_TOOLS_CALL ? resolveSessionId(protocol, parentCtx) : void 0;
|
|
566
|
+
const { context: sessCtx } = stampAndPropagateSession(span, resolved, parentCtx);
|
|
567
|
+
return { span, spanCtx: _api.trace.setSpan(sessCtx, span) };
|
|
552
568
|
} catch (error) {
|
|
553
569
|
_chunkWC573FCIcjs.logger.debug(`Brizz MCP: failed to open SERVER span: ${String(error)}`);
|
|
554
570
|
return null;
|
|
@@ -556,7 +572,7 @@ function safeStartServerSpan(tracer, request, protocol) {
|
|
|
556
572
|
}
|
|
557
573
|
function extractParentContext(request) {
|
|
558
574
|
try {
|
|
559
|
-
const meta = _optionalChain([request, 'access',
|
|
575
|
+
const meta = _optionalChain([request, 'access', _30 => _30.params, 'optionalAccess', _31 => _31._meta]);
|
|
560
576
|
if (meta && typeof meta === "object") {
|
|
561
577
|
return _api.propagation.extract(_api.context.active(), meta);
|
|
562
578
|
}
|
|
@@ -598,7 +614,7 @@ function safeEnd(span) {
|
|
|
598
614
|
|
|
599
615
|
// src/internal/instrumentation/mcp/version.ts
|
|
600
616
|
var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
|
|
601
|
-
var INSTRUMENTATION_VERSION =
|
|
617
|
+
var INSTRUMENTATION_VERSION = _chunkK3NPYISBcjs.getSDKVersion.call(void 0, );
|
|
602
618
|
|
|
603
619
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
604
620
|
var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
@@ -616,7 +632,7 @@ var MCPInstrumentation = class extends _openinferenceinstrumentationmcp.MCPInstr
|
|
|
616
632
|
*/
|
|
617
633
|
|
|
618
634
|
constructor(_config) {
|
|
619
|
-
super({ instrumentationConfig: _optionalChain([_config, 'optionalAccess',
|
|
635
|
+
super({ instrumentationConfig: _optionalChain([_config, 'optionalAccess', _32 => _32.instrumentationConfig]) });
|
|
620
636
|
this.brizzTracer = _api.trace.getTracer(INSTRUMENTATION_NAME, INSTRUMENTATION_VERSION);
|
|
621
637
|
}
|
|
622
638
|
/**
|
|
@@ -626,7 +642,7 @@ var MCPInstrumentation = class extends _openinferenceinstrumentationmcp.MCPInstr
|
|
|
626
642
|
* calls `patchProtocolPrototype`.
|
|
627
643
|
*/
|
|
628
644
|
patchProtocolModule(module) {
|
|
629
|
-
const proto = _optionalChain([module, 'optionalAccess',
|
|
645
|
+
const proto = _optionalChain([module, 'optionalAccess', _33 => _33.Protocol, 'optionalAccess', _34 => _34.prototype]);
|
|
630
646
|
if (!proto) {
|
|
631
647
|
_chunkWC573FCIcjs.logger.debug(
|
|
632
648
|
"Brizz MCP: module does not expose Protocol.prototype \u2014 skipping protocol patches"
|
|
@@ -2,7 +2,7 @@ import './internal/instrumentation/auto-init.js';
|
|
|
2
2
|
export { Brizz, type IBrizzInitializeOptions } from './internal/sdk.js';
|
|
3
3
|
export { type IInstrumentModules, type IMCPManualModules, } from './internal/instrumentation/index.js';
|
|
4
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';
|
|
5
|
+
export { getSpanExporter, getSpanProcessor, withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './internal/trace/index.js';
|
|
6
6
|
export type { IMuteOptions } from './internal/trace/index.js';
|
|
7
7
|
export { getMetricsExporter, getMetricsReader } from './internal/metric/index.js';
|
|
8
8
|
export type { IMaskingConfig, ISpanMaskingConfig, ILogMaskingConfig, IEventMaskingConfig, IEventMaskingRule, MaskingMode, IAttributesMaskingRule, } from './internal/masking/index.js';
|
|
@@ -3,5 +3,6 @@ export interface ISessionAttachResult {
|
|
|
3
3
|
context: Context;
|
|
4
4
|
sessionId: string | null;
|
|
5
5
|
}
|
|
6
|
+
export declare function resolveTransportSessionId(protocol: unknown): string | undefined;
|
|
6
7
|
export declare function resolveSessionId(protocol: unknown, baseContext: Context): string | undefined;
|
|
7
8
|
export declare function stampAndPropagateSession(span: Span, sessionId: string | null | undefined, baseContext?: Context): ISessionAttachResult;
|
|
@@ -5,12 +5,12 @@ import type { IResolvedBrizzConfig } from '../config.js';
|
|
|
5
5
|
export declare class LoggingModule {
|
|
6
6
|
private static instance;
|
|
7
7
|
static getInstance(): LoggingModule;
|
|
8
|
-
private
|
|
9
|
-
private logProcessor;
|
|
8
|
+
private config;
|
|
10
9
|
private loggerProvider;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
10
|
+
private readonly scopedProviders;
|
|
11
|
+
private createLogExporter;
|
|
12
|
+
private createLoggerProvider;
|
|
13
|
+
private activeLoggerProvider;
|
|
14
14
|
setup(config: IResolvedBrizzConfig): void;
|
|
15
15
|
emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
|
|
16
16
|
isInitialized(): boolean;
|
|
@@ -21,6 +21,8 @@ export declare const ORGANIZATION_NAME = "organization.name";
|
|
|
21
21
|
export declare const ORGANIZATION_PLAN = "organization.plan";
|
|
22
22
|
export declare const ORGANIZATION_DOMAIN = "organization.domain";
|
|
23
23
|
export declare const MESSAGE_ID = "message.id";
|
|
24
|
+
export declare const SERVICE_NAME = "service.name";
|
|
25
|
+
export declare const SERVICE_NAME_ATTRIBUTE = "brizz.service.name";
|
|
24
26
|
export declare const SESSION_TITLE_SPAN_NAME = "brizz.session_title";
|
|
25
27
|
export declare const SESSION_TITLE_GENERATION = "session.title_generation";
|
|
26
28
|
export declare const SESSION_TITLE = "brizz.session.title";
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { ExportResult } from '@opentelemetry/core';
|
|
2
2
|
import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
3
3
|
import type { IResolvedBrizzConfig } from '../../config.js';
|
|
4
|
+
export type SpanExporterFactory = (serviceName: string) => SpanExporter;
|
|
4
5
|
export declare class BrizzSpanExporter implements SpanExporter {
|
|
5
6
|
private readonly _delegate;
|
|
6
|
-
private readonly
|
|
7
|
+
private readonly _delegateFactory?;
|
|
8
|
+
private readonly _defaultServiceName;
|
|
9
|
+
private readonly _resourceAttrs;
|
|
10
|
+
private readonly _resources;
|
|
11
|
+
private readonly _delegates;
|
|
7
12
|
private readonly _beforeSendSpan?;
|
|
8
|
-
constructor(delegate: SpanExporter, config: IResolvedBrizzConfig);
|
|
13
|
+
constructor(delegate: SpanExporter, config: IResolvedBrizzConfig, factory?: SpanExporterFactory);
|
|
14
|
+
private _serviceNameOf;
|
|
15
|
+
private _resourceFor;
|
|
16
|
+
private _delegateFor;
|
|
9
17
|
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
18
|
+
private _exportGroups;
|
|
10
19
|
shutdown(): Promise<void>;
|
|
11
20
|
forceFlush(): Promise<void>;
|
|
12
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TracingModule, getSpanExporter, getSpanProcessor } from './tracing.js';
|
|
2
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';
|
|
3
|
+
export { withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './session.js';
|
|
4
4
|
export type { IMuteOptions } from './session.js';
|
|
@@ -23,6 +23,10 @@ export declare function setOrganization(org: {
|
|
|
23
23
|
}): void;
|
|
24
24
|
export declare function setMessageId(id: string): void;
|
|
25
25
|
export declare function setSessionId(id: string): void;
|
|
26
|
+
export declare function setServiceName(name: string): void;
|
|
27
|
+
export declare function callWithServiceName<A extends unknown[], F extends (...args: A) => ReturnType<F>>(name: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
28
|
+
export declare function withServiceName<F extends (this: any, ...args: any[]) => any>(name: string, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
29
|
+
export declare function resolveServiceNameFromContext(): string | undefined;
|
|
26
30
|
export declare function callWithUser<A extends unknown[], F extends (...args: A) => ReturnType<F>>(user: {
|
|
27
31
|
id: string;
|
|
28
32
|
email?: string;
|
|
@@ -2,7 +2,7 @@ import './internal/instrumentation/auto-init.js';
|
|
|
2
2
|
export { Brizz, type IBrizzInitializeOptions } from './internal/sdk.js';
|
|
3
3
|
export { type IInstrumentModules, type IMCPManualModules, } from './internal/instrumentation/index.js';
|
|
4
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';
|
|
5
|
+
export { getSpanExporter, getSpanProcessor, withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './internal/trace/index.js';
|
|
6
6
|
export type { IMuteOptions } from './internal/trace/index.js';
|
|
7
7
|
export { getMetricsExporter, getMetricsReader } from './internal/metric/index.js';
|
|
8
8
|
export type { IMaskingConfig, ISpanMaskingConfig, ILogMaskingConfig, IEventMaskingConfig, IEventMaskingRule, MaskingMode, IAttributesMaskingRule, } from './internal/masking/index.js';
|
|
@@ -3,5 +3,6 @@ export interface ISessionAttachResult {
|
|
|
3
3
|
context: Context;
|
|
4
4
|
sessionId: string | null;
|
|
5
5
|
}
|
|
6
|
+
export declare function resolveTransportSessionId(protocol: unknown): string | undefined;
|
|
6
7
|
export declare function resolveSessionId(protocol: unknown, baseContext: Context): string | undefined;
|
|
7
8
|
export declare function stampAndPropagateSession(span: Span, sessionId: string | null | undefined, baseContext?: Context): ISessionAttachResult;
|
|
@@ -5,12 +5,12 @@ import type { IResolvedBrizzConfig } from '../config.js';
|
|
|
5
5
|
export declare class LoggingModule {
|
|
6
6
|
private static instance;
|
|
7
7
|
static getInstance(): LoggingModule;
|
|
8
|
-
private
|
|
9
|
-
private logProcessor;
|
|
8
|
+
private config;
|
|
10
9
|
private loggerProvider;
|
|
11
|
-
private
|
|
12
|
-
private
|
|
13
|
-
private
|
|
10
|
+
private readonly scopedProviders;
|
|
11
|
+
private createLogExporter;
|
|
12
|
+
private createLoggerProvider;
|
|
13
|
+
private activeLoggerProvider;
|
|
14
14
|
setup(config: IResolvedBrizzConfig): void;
|
|
15
15
|
emitEvent(name: string, attributes?: Record<string, string | number | boolean>, body?: LogBody, severityNumber?: SeverityNumber): void;
|
|
16
16
|
isInitialized(): boolean;
|
|
@@ -21,6 +21,8 @@ export declare const ORGANIZATION_NAME = "organization.name";
|
|
|
21
21
|
export declare const ORGANIZATION_PLAN = "organization.plan";
|
|
22
22
|
export declare const ORGANIZATION_DOMAIN = "organization.domain";
|
|
23
23
|
export declare const MESSAGE_ID = "message.id";
|
|
24
|
+
export declare const SERVICE_NAME = "service.name";
|
|
25
|
+
export declare const SERVICE_NAME_ATTRIBUTE = "brizz.service.name";
|
|
24
26
|
export declare const SESSION_TITLE_SPAN_NAME = "brizz.session_title";
|
|
25
27
|
export declare const SESSION_TITLE_GENERATION = "session.title_generation";
|
|
26
28
|
export declare const SESSION_TITLE = "brizz.session.title";
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import type { ExportResult } from '@opentelemetry/core';
|
|
2
2
|
import type { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
|
|
3
3
|
import type { IResolvedBrizzConfig } from '../../config.js';
|
|
4
|
+
export type SpanExporterFactory = (serviceName: string) => SpanExporter;
|
|
4
5
|
export declare class BrizzSpanExporter implements SpanExporter {
|
|
5
6
|
private readonly _delegate;
|
|
6
|
-
private readonly
|
|
7
|
+
private readonly _delegateFactory?;
|
|
8
|
+
private readonly _defaultServiceName;
|
|
9
|
+
private readonly _resourceAttrs;
|
|
10
|
+
private readonly _resources;
|
|
11
|
+
private readonly _delegates;
|
|
7
12
|
private readonly _beforeSendSpan?;
|
|
8
|
-
constructor(delegate: SpanExporter, config: IResolvedBrizzConfig);
|
|
13
|
+
constructor(delegate: SpanExporter, config: IResolvedBrizzConfig, factory?: SpanExporterFactory);
|
|
14
|
+
private _serviceNameOf;
|
|
15
|
+
private _resourceFor;
|
|
16
|
+
private _delegateFor;
|
|
9
17
|
export(spans: ReadableSpan[], resultCallback: (result: ExportResult) => void): void;
|
|
18
|
+
private _exportGroups;
|
|
10
19
|
shutdown(): Promise<void>;
|
|
11
20
|
forceFlush(): Promise<void>;
|
|
12
21
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { TracingModule, getSpanExporter, getSpanProcessor } from './tracing.js';
|
|
2
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';
|
|
3
|
+
export { withSessionId, callWithSessionId, withProperties, callWithProperties, withMute, callWithMute, setCurrentSpanCustomProperties, setUser, setOrganization, setMessageId, setSessionId, setServiceName, withServiceName, callWithServiceName, withUser, callWithUser, withOrganization, callWithOrganization, withMessageId, callWithMessageId, Session, SessionTitle, startSession, startSessionTitle, getActiveSession, addExternalLink, recordFeedback, recordMetric, } from './session.js';
|
|
4
4
|
export type { IMuteOptions } from './session.js';
|
|
@@ -23,6 +23,10 @@ export declare function setOrganization(org: {
|
|
|
23
23
|
}): void;
|
|
24
24
|
export declare function setMessageId(id: string): void;
|
|
25
25
|
export declare function setSessionId(id: string): void;
|
|
26
|
+
export declare function setServiceName(name: string): void;
|
|
27
|
+
export declare function callWithServiceName<A extends unknown[], F extends (...args: A) => ReturnType<F>>(name: string, fn: F, thisArg?: ThisParameterType<F>, ...args: A): ReturnType<F>;
|
|
28
|
+
export declare function withServiceName<F extends (this: any, ...args: any[]) => any>(name: string, fn: F, thisArg?: ThisParameterType<F>): F;
|
|
29
|
+
export declare function resolveServiceNameFromContext(): string | undefined;
|
|
26
30
|
export declare function callWithUser<A extends unknown[], F extends (...args: A) => ReturnType<F>>(user: {
|
|
27
31
|
id: string;
|
|
28
32
|
email?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brizz/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenTelemetry-based observability SDK for AI applications",
|
|
6
6
|
"keywords": [
|
|
@@ -101,28 +101,28 @@
|
|
|
101
101
|
"registry": "https://registry.npmjs.org/"
|
|
102
102
|
},
|
|
103
103
|
"devDependencies": {
|
|
104
|
-
"@ai-sdk/anthropic": "^4.0.
|
|
105
|
-
"@ai-sdk/openai": "^4.0.
|
|
106
|
-
"@ai-sdk/otel": "^1.0.
|
|
104
|
+
"@ai-sdk/anthropic": "^4.0.39",
|
|
105
|
+
"@ai-sdk/openai": "^4.0.42",
|
|
106
|
+
"@ai-sdk/otel": "^1.0.66",
|
|
107
107
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
108
|
-
"@arizeai/openinference-instrumentation-mcp": "^0.2.
|
|
108
|
+
"@arizeai/openinference-instrumentation-mcp": "^0.2.24",
|
|
109
109
|
"@babel/core": "^8.0.1",
|
|
110
110
|
"@babel/preset-env": "^8.0.2",
|
|
111
111
|
"@babel/preset-typescript": "^8.0.1",
|
|
112
|
-
"@changesets/changelog-github": "^0.
|
|
113
|
-
"@changesets/cli": "^
|
|
114
|
-
"@google/genai": "^2.
|
|
112
|
+
"@changesets/changelog-github": "^1.0.0",
|
|
113
|
+
"@changesets/cli": "^3.0.0",
|
|
114
|
+
"@google/genai": "^2.17.1",
|
|
115
115
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
116
116
|
"@traceloop/instrumentation-google-generativeai": "^0.27.0",
|
|
117
117
|
"@traceloop/instrumentation-vertexai": "^0.27.0",
|
|
118
118
|
"@types/jest": "^30.0.0",
|
|
119
|
-
"@types/node": "^26.
|
|
120
|
-
"ai": "^7.0.
|
|
119
|
+
"@types/node": "^26.2.0",
|
|
120
|
+
"ai": "^7.0.66",
|
|
121
121
|
"babel-jest": "^30.4.1",
|
|
122
122
|
"jest": "^30.4.2",
|
|
123
123
|
"jest-environment-jsdom": "^30.4.1",
|
|
124
|
-
"openai": "^7.
|
|
125
|
-
"oxlint": "^1.
|
|
124
|
+
"openai": "^7.4.0",
|
|
125
|
+
"oxlint": "^1.78.0",
|
|
126
126
|
"prettier": "^3.9.6",
|
|
127
127
|
"tsup": "^8.5.1",
|
|
128
128
|
"typescript": "^7.0.2",
|
|
@@ -166,7 +166,7 @@
|
|
|
166
166
|
}
|
|
167
167
|
},
|
|
168
168
|
"dependencies": {
|
|
169
|
-
"@arizeai/openinference-instrumentation-langchain": "^4.0.
|
|
169
|
+
"@arizeai/openinference-instrumentation-langchain": "^4.0.18",
|
|
170
170
|
"@arizeai/openinference-instrumentation-openai": "^2.3.1",
|
|
171
171
|
"@opentelemetry/api": "^1.9.0",
|
|
172
172
|
"@opentelemetry/api-logs": "^0.221.0",
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkEVRCHF74cjs = require('./chunk-EVRCHF74.cjs');
|
|
6
|
-
require('./chunk-77UGZGMP.cjs');
|
|
7
|
-
require('./chunk-OBGZSXTJ.cjs');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
exports.InterruptPropagator = _chunkEVRCHF74cjs.InterruptPropagator; exports._resetInterruptState = _chunkEVRCHF74cjs._resetInterruptState; exports.createInterruptIntegration = _chunkEVRCHF74cjs.createInterruptIntegration;
|