@brizz/sdk 0.2.1 → 0.2.2
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/CHANGELOG.md +6 -0
- package/dist/{chunk-KJSZPKSN.js → chunk-CNEZA3WB.js} +1 -1
- package/dist/{chunk-6OYS2GR3.js → chunk-DIOULRY4.js} +2 -1
- package/dist/{chunk-P5OONZTF.cjs → chunk-PUOXH4CD.cjs} +3 -2
- package/dist/{chunk-QXHGMS5A.cjs → chunk-STMZ73NM.cjs} +1 -1
- package/dist/google-genai-KDEYFHTK.cjs +12 -0
- package/dist/{google-genai-H6TMOKRX.js → google-genai-ZKKWSBVY.js} +3 -1
- package/dist/google-genai.cjs +2 -2
- package/dist/google-genai.js +1 -1
- package/dist/index.cjs +55 -23
- package/dist/index.js +44 -12
- package/dist/{mcp-6LNVYVJQ.cjs → mcp-E5TPIVFI.cjs} +11 -11
- package/dist/{mcp-YTBE75NP.js → mcp-SZSGMNBB.js} +1 -1
- package/dist/types/cjs/internal/instrumentation/google-genai.d.ts +1 -0
- package/dist/types/cjs/internal/masking/utils.d.ts +1 -1
- package/dist/types/esm/internal/instrumentation/google-genai.d.ts +1 -0
- package/dist/types/esm/internal/masking/utils.d.ts +1 -1
- package/package.json +21 -19
- package/dist/google-genai-6S5E7GZ4.cjs +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { InstrumentationNodeModuleDefinition } from "@opentelemetry/instrumentation";
|
|
10
10
|
import { GenAIInstrumentation } from "@traceloop/instrumentation-google-generativeai";
|
|
11
11
|
var MODULE_NAME = "@google/genai";
|
|
12
|
-
var SUPPORTED_VERSIONS = [">=1.0.0 <
|
|
12
|
+
var SUPPORTED_VERSIONS = [">=1.0.0 <4.0.0"];
|
|
13
13
|
var GoogleGenAIInstrumentation = class extends GenAIInstrumentation {
|
|
14
14
|
constructor(config) {
|
|
15
15
|
super(config);
|
|
@@ -65,6 +65,7 @@ function instrumentGoogleGenAI(module) {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export {
|
|
68
|
+
SUPPORTED_VERSIONS,
|
|
68
69
|
GoogleGenAIInstrumentation,
|
|
69
70
|
instrumentGoogleGenAI
|
|
70
71
|
};
|
|
@@ -9,7 +9,7 @@ var _chunkC5OT6GAQcjs = require('./chunk-C5OT6GAQ.cjs');
|
|
|
9
9
|
var _instrumentation = require('@opentelemetry/instrumentation');
|
|
10
10
|
var _instrumentationgooglegenerativeai = require('@traceloop/instrumentation-google-generativeai');
|
|
11
11
|
var MODULE_NAME = "@google/genai";
|
|
12
|
-
var SUPPORTED_VERSIONS = [">=1.0.0 <
|
|
12
|
+
var SUPPORTED_VERSIONS = [">=1.0.0 <4.0.0"];
|
|
13
13
|
var GoogleGenAIInstrumentation = class extends _instrumentationgooglegenerativeai.GenAIInstrumentation {
|
|
14
14
|
constructor(config) {
|
|
15
15
|
super(config);
|
|
@@ -67,4 +67,5 @@ function instrumentGoogleGenAI(module) {
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
exports.SUPPORTED_VERSIONS = SUPPORTED_VERSIONS; exports.GoogleGenAIInstrumentation = GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = instrumentGoogleGenAI;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkPUOXH4CDcjs = require('./chunk-PUOXH4CD.cjs');
|
|
6
|
+
require('./chunk-DC2MFO65.cjs');
|
|
7
|
+
require('./chunk-C5OT6GAQ.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
exports.GoogleGenAIInstrumentation = _chunkPUOXH4CDcjs.GoogleGenAIInstrumentation; exports.SUPPORTED_VERSIONS = _chunkPUOXH4CDcjs.SUPPORTED_VERSIONS; exports.instrumentGoogleGenAI = _chunkPUOXH4CDcjs.instrumentGoogleGenAI;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GoogleGenAIInstrumentation,
|
|
3
|
+
SUPPORTED_VERSIONS,
|
|
3
4
|
instrumentGoogleGenAI
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-DIOULRY4.js";
|
|
5
6
|
import "./chunk-TDPQDITP.js";
|
|
6
7
|
import "./chunk-CZDPIJTO.js";
|
|
7
8
|
export {
|
|
8
9
|
GoogleGenAIInstrumentation,
|
|
10
|
+
SUPPORTED_VERSIONS,
|
|
9
11
|
instrumentGoogleGenAI
|
|
10
12
|
};
|
package/dist/google-genai.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkPUOXH4CDcjs = require('./chunk-PUOXH4CD.cjs');
|
|
4
4
|
require('./chunk-DC2MFO65.cjs');
|
|
5
5
|
require('./chunk-C5OT6GAQ.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.instrumentGoogleGenAI =
|
|
8
|
+
exports.instrumentGoogleGenAI = _chunkPUOXH4CDcjs.instrumentGoogleGenAI;
|
package/dist/google-genai.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ var _chunkUF4GMVEYcjs = require('./chunk-UF4GMVEY.cjs');
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
var
|
|
46
|
+
var _chunkSTMZ73NMcjs = require('./chunk-STMZ73NM.cjs');
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -110,7 +110,7 @@ var _api = require('@opentelemetry/api');
|
|
|
110
110
|
|
|
111
111
|
// src/internal/instrumentation/langgraph/attributes.ts
|
|
112
112
|
var INSTRUMENTATION_NAME = "@brizz/sdk/langgraph";
|
|
113
|
-
var INSTRUMENTATION_VERSION =
|
|
113
|
+
var INSTRUMENTATION_VERSION = _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, );
|
|
114
114
|
var MODULE_NAME = "@langchain/langgraph";
|
|
115
115
|
var SUPPORTED_VERSIONS = [">=0.2.0 <2"];
|
|
116
116
|
function isSupportedVersion(version) {
|
|
@@ -481,7 +481,7 @@ var ATTR_ANSWERS = "typesafe.answers";
|
|
|
481
481
|
var PATCHED_FLAG2 = /* @__PURE__ */ Symbol.for("brizz.typesafe.patched");
|
|
482
482
|
var TypeSafeInstrumentation = class extends _instrumentation.InstrumentationBase {
|
|
483
483
|
constructor(config = {}) {
|
|
484
|
-
super(INSTRUMENTATION_NAME2,
|
|
484
|
+
super(INSTRUMENTATION_NAME2, _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ), config);
|
|
485
485
|
this.setTracerProvider(_chunkDC2MFO65cjs.brizzTracerProvider);
|
|
486
486
|
}
|
|
487
487
|
init() {
|
|
@@ -708,7 +708,7 @@ function loadGenAIInstrumentations() {
|
|
|
708
708
|
function loadMCPInstrumentation() {
|
|
709
709
|
void (async () => {
|
|
710
710
|
try {
|
|
711
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
711
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-E5TPIVFI.cjs")));
|
|
712
712
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
713
713
|
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp], tracerProvider: _chunkDC2MFO65cjs.brizzTracerProvider });
|
|
714
714
|
_chunkC5OT6GAQcjs.logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -761,7 +761,7 @@ function loadVertexAIInstrumentation() {
|
|
|
761
761
|
function loadGoogleGenAIInstrumentation() {
|
|
762
762
|
void (async () => {
|
|
763
763
|
try {
|
|
764
|
-
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-
|
|
764
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-KDEYFHTK.cjs")));
|
|
765
765
|
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
766
766
|
_instrumentation.registerInstrumentations.call(void 0, {
|
|
767
767
|
instrumentations: [googleGenAI],
|
|
@@ -1256,7 +1256,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1256
1256
|
const genaiModule = this.manualModules.google_genai;
|
|
1257
1257
|
void (async () => {
|
|
1258
1258
|
try {
|
|
1259
|
-
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-
|
|
1259
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-KDEYFHTK.cjs")));
|
|
1260
1260
|
const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1261
1261
|
genaiInst.manuallyInstrument(genaiModule);
|
|
1262
1262
|
_chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for Google GenAI");
|
|
@@ -1271,7 +1271,7 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
1271
1271
|
const mcpModules = this.manualModules.mcp;
|
|
1272
1272
|
void (async () => {
|
|
1273
1273
|
try {
|
|
1274
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
1274
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-E5TPIVFI.cjs")));
|
|
1275
1275
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1276
1276
|
instrumentation.manuallyInstrument(mcpModules);
|
|
1277
1277
|
_chunkC5OT6GAQcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1764,10 +1764,13 @@ function compilePatternEntries(patternEntries) {
|
|
|
1764
1764
|
var compiledPatternCache = /* @__PURE__ */ new WeakMap();
|
|
1765
1765
|
function getCompiledPatternsForRule(rule) {
|
|
1766
1766
|
const key = rule.patterns;
|
|
1767
|
-
|
|
1768
|
-
|
|
1767
|
+
const cached = compiledPatternCache.get(key);
|
|
1768
|
+
if (cached) {
|
|
1769
|
+
return cached;
|
|
1769
1770
|
}
|
|
1770
|
-
const
|
|
1771
|
+
const entries = convertPatternsToPatternEntries(rule.patterns);
|
|
1772
|
+
const pattern = compilePatternEntries(entries);
|
|
1773
|
+
const compiled = { pattern, custom: pattern && compileCustomEntries(entries) };
|
|
1771
1774
|
compiledPatternCache.set(key, compiled);
|
|
1772
1775
|
return compiled;
|
|
1773
1776
|
}
|
|
@@ -1817,11 +1820,40 @@ function executeRegexWithTimeout(pattern, value, timeoutMs = 100) {
|
|
|
1817
1820
|
}
|
|
1818
1821
|
return matches;
|
|
1819
1822
|
}
|
|
1820
|
-
|
|
1823
|
+
var BUILTIN_ENTRIES = new Set(DEFAULT_PII_PATTERNS);
|
|
1824
|
+
function compileCustomEntries(patternEntries) {
|
|
1825
|
+
const groups = patternEntries.filter((entry) => !BUILTIN_ENTRIES.has(entry)).flatMap((entry) => {
|
|
1826
|
+
try {
|
|
1827
|
+
return [getGroupedPattern(entry)];
|
|
1828
|
+
} catch (e6) {
|
|
1829
|
+
return [];
|
|
1830
|
+
}
|
|
1831
|
+
});
|
|
1832
|
+
return groups.length > 0 ? new RegExp(groups.join("|")) : null;
|
|
1833
|
+
}
|
|
1834
|
+
function isDecimalPart(value, match) {
|
|
1835
|
+
const start = match.index;
|
|
1836
|
+
const end = start + match[0].length;
|
|
1837
|
+
if (!/^[0-9]+$/.test(match[0])) {
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
const afterPoint = value.charAt(start - 1) === "." && /^[0-9]$/.test(value.charAt(start - 2));
|
|
1841
|
+
const beforePoint = value.charAt(end) === "." && /^[0-9]$/.test(value.charAt(end + 1));
|
|
1842
|
+
return afterPoint || beforePoint;
|
|
1843
|
+
}
|
|
1844
|
+
function overlapsAny(match, others) {
|
|
1845
|
+
const end = match.index + match[0].length;
|
|
1846
|
+
return others.some((other) => other.index < end && match.index < other.index + other[0].length);
|
|
1847
|
+
}
|
|
1848
|
+
function maskStringByPattern(value, pattern, mode = "full", custom = pattern) {
|
|
1821
1849
|
const matches = [];
|
|
1822
1850
|
try {
|
|
1823
1851
|
const regexMatches = executeRegexWithTimeout(pattern, value);
|
|
1852
|
+
const customMatches = custom && regexMatches.some((match) => isDecimalPart(value, match)) ? executeRegexWithTimeout(custom, value) : [];
|
|
1824
1853
|
for (const match of regexMatches) {
|
|
1854
|
+
if (isDecimalPart(value, match) && !overlapsAny(match, customMatches)) {
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1825
1857
|
matches.push({
|
|
1826
1858
|
start: match.index,
|
|
1827
1859
|
end: match.index + match[0].length,
|
|
@@ -1865,11 +1897,11 @@ function maskStringByPatternBasedRule(value, rule) {
|
|
|
1865
1897
|
if (!patternEntries || patternEntries.length === 0) {
|
|
1866
1898
|
return mode === "partial" && value ? value.at(0) + "*****" : "*****";
|
|
1867
1899
|
}
|
|
1868
|
-
const
|
|
1869
|
-
if (!
|
|
1900
|
+
const { pattern, custom } = getCompiledPatternsForRule(rule);
|
|
1901
|
+
if (!pattern) {
|
|
1870
1902
|
return value;
|
|
1871
1903
|
}
|
|
1872
|
-
return maskStringByPattern(value,
|
|
1904
|
+
return maskStringByPattern(value, pattern, mode, custom);
|
|
1873
1905
|
}
|
|
1874
1906
|
function maskValue(value, rule) {
|
|
1875
1907
|
if (typeof value === "string") {
|
|
@@ -2056,7 +2088,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
2056
2088
|
const resourceAttributes = {
|
|
2057
2089
|
...config.resourceAttributes,
|
|
2058
2090
|
"service.name": serviceName,
|
|
2059
|
-
[BRIZZ_SDK_VERSION]:
|
|
2091
|
+
[BRIZZ_SDK_VERSION]: _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ),
|
|
2060
2092
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2061
2093
|
};
|
|
2062
2094
|
if (config.environment) {
|
|
@@ -2437,7 +2469,7 @@ function createCollector(OpenTelemetry) {
|
|
|
2437
2469
|
providerMetadata: true
|
|
2438
2470
|
})
|
|
2439
2471
|
);
|
|
2440
|
-
} catch (
|
|
2472
|
+
} catch (e7) {
|
|
2441
2473
|
return void 0;
|
|
2442
2474
|
}
|
|
2443
2475
|
}
|
|
@@ -2466,7 +2498,7 @@ var BrizzSpanExporter = (_class4 = class {
|
|
|
2466
2498
|
const resourceAttrs = {
|
|
2467
2499
|
...config.resourceAttributes,
|
|
2468
2500
|
"service.name": config.appName,
|
|
2469
|
-
[BRIZZ_SDK_VERSION]:
|
|
2501
|
+
[BRIZZ_SDK_VERSION]: _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ),
|
|
2470
2502
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2471
2503
|
};
|
|
2472
2504
|
if (config.environment) {
|
|
@@ -2830,7 +2862,7 @@ function getSpanProcessor() {
|
|
|
2830
2862
|
// src/internal/trace/decision-call.ts
|
|
2831
2863
|
|
|
2832
2864
|
|
|
2833
|
-
var tracer = _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("@brizz/sdk/decision-call",
|
|
2865
|
+
var tracer = _chunkDC2MFO65cjs.brizzTracerProvider.getTracer("@brizz/sdk/decision-call", _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ));
|
|
2834
2866
|
function decisionCall(options, callback) {
|
|
2835
2867
|
const span = startDecisionSpan(options);
|
|
2836
2868
|
if (!span) {
|
|
@@ -3010,7 +3042,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
3010
3042
|
*/
|
|
3011
3043
|
setupInstrumentation(options) {
|
|
3012
3044
|
const registry = InstrumentationRegistry.getInstance();
|
|
3013
|
-
|
|
3045
|
+
_chunkSTMZ73NMcjs.configure.call(void 0, resolveMcpSessionTracking(options.mcpSessionTracking));
|
|
3014
3046
|
patchInstalledCallbackManager();
|
|
3015
3047
|
patchInstalledLangGraph();
|
|
3016
3048
|
patchInstalledTypeSafe();
|
|
@@ -3045,7 +3077,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
3045
3077
|
const resourceAttributes = {
|
|
3046
3078
|
...resolvedConfig.resourceAttributes,
|
|
3047
3079
|
"service.name": resolvedConfig.appName,
|
|
3048
|
-
[BRIZZ_SDK_VERSION]:
|
|
3080
|
+
[BRIZZ_SDK_VERSION]: _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, ),
|
|
3049
3081
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
3050
3082
|
};
|
|
3051
3083
|
if (resolvedConfig.environment) {
|
|
@@ -3155,19 +3187,19 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
3155
3187
|
try {
|
|
3156
3188
|
const tracingModule = TracingModule.getInstance();
|
|
3157
3189
|
await tracingModule.shutdown();
|
|
3158
|
-
} catch (
|
|
3190
|
+
} catch (e8) {
|
|
3159
3191
|
_chunkC5OT6GAQcjs.logger.debug("Tracing module already shut down or not initialized");
|
|
3160
3192
|
}
|
|
3161
3193
|
try {
|
|
3162
3194
|
const metricsModule = MetricsModule.getInstance();
|
|
3163
3195
|
metricsModule.shutdown();
|
|
3164
|
-
} catch (
|
|
3196
|
+
} catch (e9) {
|
|
3165
3197
|
_chunkC5OT6GAQcjs.logger.debug("Metrics module already shut down or not initialized");
|
|
3166
3198
|
}
|
|
3167
3199
|
try {
|
|
3168
3200
|
const loggingModule = LoggingModule.getInstance();
|
|
3169
3201
|
await loggingModule.shutdown();
|
|
3170
|
-
} catch (
|
|
3202
|
+
} catch (e10) {
|
|
3171
3203
|
_chunkC5OT6GAQcjs.logger.debug("Logging module already shut down or not initialized");
|
|
3172
3204
|
}
|
|
3173
3205
|
_chunkC5OT6GAQcjs.logger.info("All telemetry modules shut down successfully");
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
import {
|
|
44
44
|
configure,
|
|
45
45
|
getSDKVersion
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-CNEZA3WB.js";
|
|
47
47
|
import {
|
|
48
48
|
AI_SDK_OTEL_SCOPE,
|
|
49
49
|
APPROVALS,
|
|
@@ -708,7 +708,7 @@ function loadGenAIInstrumentations() {
|
|
|
708
708
|
function loadMCPInstrumentation() {
|
|
709
709
|
void (async () => {
|
|
710
710
|
try {
|
|
711
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
711
|
+
const { MCPInstrumentation } = await import("./mcp-SZSGMNBB.js");
|
|
712
712
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
713
713
|
registerInstrumentations({ instrumentations: [mcp], tracerProvider: brizzTracerProvider });
|
|
714
714
|
logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -761,7 +761,7 @@ function loadVertexAIInstrumentation() {
|
|
|
761
761
|
function loadGoogleGenAIInstrumentation() {
|
|
762
762
|
void (async () => {
|
|
763
763
|
try {
|
|
764
|
-
const { GoogleGenAIInstrumentation } = await import("./google-genai-
|
|
764
|
+
const { GoogleGenAIInstrumentation } = await import("./google-genai-ZKKWSBVY.js");
|
|
765
765
|
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
766
766
|
registerInstrumentations({
|
|
767
767
|
instrumentations: [googleGenAI],
|
|
@@ -1256,7 +1256,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
1256
1256
|
const genaiModule = this.manualModules.google_genai;
|
|
1257
1257
|
void (async () => {
|
|
1258
1258
|
try {
|
|
1259
|
-
const { GoogleGenAIInstrumentation } = await import("./google-genai-
|
|
1259
|
+
const { GoogleGenAIInstrumentation } = await import("./google-genai-ZKKWSBVY.js");
|
|
1260
1260
|
const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1261
1261
|
genaiInst.manuallyInstrument(genaiModule);
|
|
1262
1262
|
logger.debug("Manual instrumentation enabled for Google GenAI");
|
|
@@ -1271,7 +1271,7 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
1271
1271
|
const mcpModules = this.manualModules.mcp;
|
|
1272
1272
|
void (async () => {
|
|
1273
1273
|
try {
|
|
1274
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
1274
|
+
const { MCPInstrumentation } = await import("./mcp-SZSGMNBB.js");
|
|
1275
1275
|
const instrumentation = new MCPInstrumentation({ exceptionLogger: exceptionLogger2 });
|
|
1276
1276
|
instrumentation.manuallyInstrument(mcpModules);
|
|
1277
1277
|
logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -1764,10 +1764,13 @@ function compilePatternEntries(patternEntries) {
|
|
|
1764
1764
|
var compiledPatternCache = /* @__PURE__ */ new WeakMap();
|
|
1765
1765
|
function getCompiledPatternsForRule(rule) {
|
|
1766
1766
|
const key = rule.patterns;
|
|
1767
|
-
|
|
1768
|
-
|
|
1767
|
+
const cached = compiledPatternCache.get(key);
|
|
1768
|
+
if (cached) {
|
|
1769
|
+
return cached;
|
|
1769
1770
|
}
|
|
1770
|
-
const
|
|
1771
|
+
const entries = convertPatternsToPatternEntries(rule.patterns);
|
|
1772
|
+
const pattern = compilePatternEntries(entries);
|
|
1773
|
+
const compiled = { pattern, custom: pattern && compileCustomEntries(entries) };
|
|
1771
1774
|
compiledPatternCache.set(key, compiled);
|
|
1772
1775
|
return compiled;
|
|
1773
1776
|
}
|
|
@@ -1817,11 +1820,40 @@ function executeRegexWithTimeout(pattern, value, timeoutMs = 100) {
|
|
|
1817
1820
|
}
|
|
1818
1821
|
return matches;
|
|
1819
1822
|
}
|
|
1820
|
-
|
|
1823
|
+
var BUILTIN_ENTRIES = new Set(DEFAULT_PII_PATTERNS);
|
|
1824
|
+
function compileCustomEntries(patternEntries) {
|
|
1825
|
+
const groups = patternEntries.filter((entry) => !BUILTIN_ENTRIES.has(entry)).flatMap((entry) => {
|
|
1826
|
+
try {
|
|
1827
|
+
return [getGroupedPattern(entry)];
|
|
1828
|
+
} catch {
|
|
1829
|
+
return [];
|
|
1830
|
+
}
|
|
1831
|
+
});
|
|
1832
|
+
return groups.length > 0 ? new RegExp(groups.join("|")) : null;
|
|
1833
|
+
}
|
|
1834
|
+
function isDecimalPart(value, match) {
|
|
1835
|
+
const start = match.index;
|
|
1836
|
+
const end = start + match[0].length;
|
|
1837
|
+
if (!/^[0-9]+$/.test(match[0])) {
|
|
1838
|
+
return false;
|
|
1839
|
+
}
|
|
1840
|
+
const afterPoint = value.charAt(start - 1) === "." && /^[0-9]$/.test(value.charAt(start - 2));
|
|
1841
|
+
const beforePoint = value.charAt(end) === "." && /^[0-9]$/.test(value.charAt(end + 1));
|
|
1842
|
+
return afterPoint || beforePoint;
|
|
1843
|
+
}
|
|
1844
|
+
function overlapsAny(match, others) {
|
|
1845
|
+
const end = match.index + match[0].length;
|
|
1846
|
+
return others.some((other) => other.index < end && match.index < other.index + other[0].length);
|
|
1847
|
+
}
|
|
1848
|
+
function maskStringByPattern(value, pattern, mode = "full", custom = pattern) {
|
|
1821
1849
|
const matches = [];
|
|
1822
1850
|
try {
|
|
1823
1851
|
const regexMatches = executeRegexWithTimeout(pattern, value);
|
|
1852
|
+
const customMatches = custom && regexMatches.some((match) => isDecimalPart(value, match)) ? executeRegexWithTimeout(custom, value) : [];
|
|
1824
1853
|
for (const match of regexMatches) {
|
|
1854
|
+
if (isDecimalPart(value, match) && !overlapsAny(match, customMatches)) {
|
|
1855
|
+
continue;
|
|
1856
|
+
}
|
|
1825
1857
|
matches.push({
|
|
1826
1858
|
start: match.index,
|
|
1827
1859
|
end: match.index + match[0].length,
|
|
@@ -1865,11 +1897,11 @@ function maskStringByPatternBasedRule(value, rule) {
|
|
|
1865
1897
|
if (!patternEntries || patternEntries.length === 0) {
|
|
1866
1898
|
return mode === "partial" && value ? value.at(0) + "*****" : "*****";
|
|
1867
1899
|
}
|
|
1868
|
-
const
|
|
1869
|
-
if (!
|
|
1900
|
+
const { pattern, custom } = getCompiledPatternsForRule(rule);
|
|
1901
|
+
if (!pattern) {
|
|
1870
1902
|
return value;
|
|
1871
1903
|
}
|
|
1872
|
-
return maskStringByPattern(value,
|
|
1904
|
+
return maskStringByPattern(value, pattern, mode, custom);
|
|
1873
1905
|
}
|
|
1874
1906
|
function maskValue(value, rule) {
|
|
1875
1907
|
if (typeof value === "string") {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkSTMZ73NMcjs = require('./chunk-STMZ73NM.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
var _chunkIWSFMCHHcjs = require('./chunk-IWSFMCHH.cjs');
|
|
@@ -409,14 +409,14 @@ function wrapOnRequest(original, tracer) {
|
|
|
409
409
|
return original.apply(this, args);
|
|
410
410
|
}
|
|
411
411
|
const method = request.method;
|
|
412
|
-
if (method === METHOD_TOOLS_CALL &&
|
|
412
|
+
if (method === METHOD_TOOLS_CALL && _chunkSTMZ73NMcjs.isSessionToolCall.call(void 0, request)) {
|
|
413
413
|
return answerSessionToolCall(this, request, tracer, args, original);
|
|
414
414
|
}
|
|
415
415
|
const handler = _nullishCoalesce(handlers.get(method), () => ( this.fallbackRequestHandler));
|
|
416
416
|
if (!handler) {
|
|
417
417
|
return original.apply(this, args);
|
|
418
418
|
}
|
|
419
|
-
const tracking =
|
|
419
|
+
const tracking = _chunkSTMZ73NMcjs.isEnabled.call(void 0, ) && method === METHOD_TOOLS_CALL ? _chunkSTMZ73NMcjs.popTrackingArguments.call(void 0, request) : {};
|
|
420
420
|
const started = safeStartServerSpan(tracer, request, this, tracking);
|
|
421
421
|
if (!started) {
|
|
422
422
|
return original.apply(this, args);
|
|
@@ -426,9 +426,9 @@ function wrapOnRequest(original, tracer) {
|
|
|
426
426
|
if (method === METHOD_TOOLS_LIST) {
|
|
427
427
|
hooks.onResult = (result) => {
|
|
428
428
|
let advertised = result;
|
|
429
|
-
if (
|
|
429
|
+
if (_chunkSTMZ73NMcjs.isEnabled.call(void 0, )) {
|
|
430
430
|
try {
|
|
431
|
-
advertised =
|
|
431
|
+
advertised = _chunkSTMZ73NMcjs.patchListToolsResult.call(void 0, result);
|
|
432
432
|
} catch (error) {
|
|
433
433
|
_chunkC5OT6GAQcjs.logger.warn(
|
|
434
434
|
`Brizz MCP: failed to patch tools/list schemas: ${String(error)}`
|
|
@@ -439,7 +439,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
439
439
|
try {
|
|
440
440
|
emitSchemaSpansFromListResponse(
|
|
441
441
|
advertised,
|
|
442
|
-
|
|
442
|
+
_chunkSTMZ73NMcjs.resolveTransportSessionId.call(void 0, this),
|
|
443
443
|
tracer
|
|
444
444
|
);
|
|
445
445
|
} catch (error) {
|
|
@@ -452,7 +452,7 @@ function wrapOnRequest(original, tracer) {
|
|
|
452
452
|
}
|
|
453
453
|
if (method !== METHOD_TOOLS_CALL) {
|
|
454
454
|
hooks.onError = () => {
|
|
455
|
-
|
|
455
|
+
_chunkSTMZ73NMcjs.stampAndPropagateSession.call(void 0, span, _chunkSTMZ73NMcjs.resolveSessionId.call(void 0, this, spanCtx), spanCtx);
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
458
|
const wrappedHandler = (req, extra) => _api.context.with(
|
|
@@ -486,7 +486,7 @@ function answerSessionToolCall(protocol, request, tracer, args, original) {
|
|
|
486
486
|
if (!handlers) {
|
|
487
487
|
return original.apply(protocol, args);
|
|
488
488
|
}
|
|
489
|
-
const { id, result } =
|
|
489
|
+
const { id, result } = _chunkSTMZ73NMcjs.sessionToolResult.call(void 0, );
|
|
490
490
|
const started = safeStartServerSpan(tracer, request, protocol, { sessionId: id });
|
|
491
491
|
const handler = () => started ? _api.context.with(started.spanCtx, () => result) : result;
|
|
492
492
|
const hadEntry = handlers.has(METHOD_TOOLS_CALL);
|
|
@@ -576,8 +576,8 @@ function safeStartServerSpan(tracer, request, protocol, tracking = {}) {
|
|
|
576
576
|
parentCtx
|
|
577
577
|
);
|
|
578
578
|
applyServerRequestAttributes(span, request, protocol);
|
|
579
|
-
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => (
|
|
580
|
-
const { context: sessCtx } =
|
|
579
|
+
const resolved = request.method === METHOD_TOOLS_CALL ? _nullishCoalesce(tracking.sessionId, () => ( _chunkSTMZ73NMcjs.resolveSessionId.call(void 0, protocol, parentCtx))) : void 0;
|
|
580
|
+
const { context: sessCtx } = _chunkSTMZ73NMcjs.stampAndPropagateSession.call(void 0,
|
|
581
581
|
span,
|
|
582
582
|
resolved,
|
|
583
583
|
parentCtx,
|
|
@@ -633,7 +633,7 @@ function safeEnd(span) {
|
|
|
633
633
|
|
|
634
634
|
// src/internal/instrumentation/mcp/version.ts
|
|
635
635
|
var INSTRUMENTATION_NAME = "@brizz/sdk/mcp";
|
|
636
|
-
var INSTRUMENTATION_VERSION =
|
|
636
|
+
var INSTRUMENTATION_VERSION = _chunkSTMZ73NMcjs.getSDKVersion.call(void 0, );
|
|
637
637
|
|
|
638
638
|
// src/internal/instrumentation/mcp/instrumentation.ts
|
|
639
639
|
var PROTOCOL_MODULE_NAME = "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IAttributesMaskingRule, IPatternBasedMaskingRule } from './types.js';
|
|
2
|
-
export declare function maskStringByPattern(value: string, pattern: RegExp, mode?: 'partial' | 'full'): string;
|
|
2
|
+
export declare function maskStringByPattern(value: string, pattern: RegExp, mode?: 'partial' | 'full', custom?: RegExp | null): string;
|
|
3
3
|
export declare function maskStringByPatternBasedRule(value: string, rule: IPatternBasedMaskingRule): string;
|
|
4
4
|
export declare function maskValue(value: unknown, rule: IPatternBasedMaskingRule): unknown;
|
|
5
5
|
export declare function maskAttributes(attributes: Record<string, unknown>, rules: readonly IAttributesMaskingRule[], outputOriginalValue?: boolean): Record<string, unknown>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IAttributesMaskingRule, IPatternBasedMaskingRule } from './types.js';
|
|
2
|
-
export declare function maskStringByPattern(value: string, pattern: RegExp, mode?: 'partial' | 'full'): string;
|
|
2
|
+
export declare function maskStringByPattern(value: string, pattern: RegExp, mode?: 'partial' | 'full', custom?: RegExp | null): string;
|
|
3
3
|
export declare function maskStringByPatternBasedRule(value: string, rule: IPatternBasedMaskingRule): string;
|
|
4
4
|
export declare function maskValue(value: unknown, rule: IPatternBasedMaskingRule): unknown;
|
|
5
5
|
export declare function maskAttributes(attributes: Record<string, unknown>, rules: readonly IAttributesMaskingRule[], outputOriginalValue?: boolean): Record<string, unknown>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brizz/sdk",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenTelemetry-based observability SDK for AI applications",
|
|
6
6
|
"keywords": [
|
|
@@ -121,32 +121,34 @@
|
|
|
121
121
|
"registry": "https://registry.npmjs.org/"
|
|
122
122
|
},
|
|
123
123
|
"devDependencies": {
|
|
124
|
-
"@ai-sdk/anthropic": "^4.0.
|
|
125
|
-
"@ai-sdk/openai": "^4.0.
|
|
126
|
-
"@ai-sdk/otel": "^1.0.
|
|
124
|
+
"@ai-sdk/anthropic": "^4.0.105",
|
|
125
|
+
"@ai-sdk/openai": "^4.0.118",
|
|
126
|
+
"@ai-sdk/otel": "^1.0.173",
|
|
127
127
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
128
|
-
"@arizeai/openinference-instrumentation-mcp": "^0.2.
|
|
129
|
-
"@babel/core": "^8.1.
|
|
128
|
+
"@arizeai/openinference-instrumentation-mcp": "^0.2.39",
|
|
129
|
+
"@babel/core": "^8.1.2",
|
|
130
130
|
"@babel/preset-env": "^8.0.7",
|
|
131
131
|
"@babel/preset-typescript": "^8.0.7",
|
|
132
132
|
"@changesets/cli": "^3.0.3",
|
|
133
|
-
"@google/genai": "^
|
|
134
|
-
"@langchain/core": "^1.
|
|
135
|
-
"@langchain/langgraph": "^1.7.
|
|
133
|
+
"@google/genai": "^3.3.0",
|
|
134
|
+
"@langchain/core": "^1.4.1",
|
|
135
|
+
"@langchain/langgraph": "^1.7.4",
|
|
136
136
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
137
137
|
"@traceloop/instrumentation-google-generativeai": "^0.27.0",
|
|
138
138
|
"@traceloop/instrumentation-vertexai": "^0.27.0",
|
|
139
139
|
"@types/jest": "^30.0.0",
|
|
140
140
|
"@types/node": "^26.6.6",
|
|
141
|
+
"@types/semver": "^7.8.0",
|
|
141
142
|
"@typesafe-ai/sdk": "^0.7.0",
|
|
142
|
-
"ai": "^7.0.
|
|
143
|
+
"ai": "^7.0.173",
|
|
143
144
|
"babel-jest": "^30.5.2",
|
|
144
145
|
"babel-plugin-transform-import-meta": "^3.1.0",
|
|
145
146
|
"jest": "^30.5.2",
|
|
146
147
|
"jest-environment-jsdom": "^30.5.2",
|
|
147
|
-
"openai": "^7.
|
|
148
|
+
"openai": "^7.57.0",
|
|
148
149
|
"oxlint": "^1.93.0",
|
|
149
|
-
"prettier": "^3.
|
|
150
|
+
"prettier": "^3.10.1",
|
|
151
|
+
"semver": "^7.8.6",
|
|
150
152
|
"tsup": "^9.0.0",
|
|
151
153
|
"typescript": "^7.0.2",
|
|
152
154
|
"vitest": "^5.1.0",
|
|
@@ -197,16 +199,16 @@
|
|
|
197
199
|
}
|
|
198
200
|
},
|
|
199
201
|
"dependencies": {
|
|
200
|
-
"@arizeai/openinference-instrumentation-langchain": "^4.1
|
|
202
|
+
"@arizeai/openinference-instrumentation-langchain": "^4.2.1",
|
|
201
203
|
"@arizeai/openinference-instrumentation-openai": "^2.3.1",
|
|
202
204
|
"@opentelemetry/api": "^1.10.0",
|
|
203
205
|
"@opentelemetry/context-async-hooks": "^3.1.1",
|
|
204
206
|
"@opentelemetry/core": "^3.1.1",
|
|
205
|
-
"@opentelemetry/exporter-logs-otlp-http": "^0.301.
|
|
206
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.301.
|
|
207
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.301.
|
|
208
|
-
"@opentelemetry/exporter-trace-otlp-proto": "^0.301.
|
|
209
|
-
"@opentelemetry/instrumentation": "^0.301.
|
|
207
|
+
"@opentelemetry/exporter-logs-otlp-http": "^0.301.2",
|
|
208
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.301.2",
|
|
209
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.301.2",
|
|
210
|
+
"@opentelemetry/exporter-trace-otlp-proto": "^0.301.2",
|
|
211
|
+
"@opentelemetry/instrumentation": "^0.301.2",
|
|
210
212
|
"@opentelemetry/resources": "^3.1.1",
|
|
211
213
|
"@opentelemetry/sdk-logs": "^3.1.1",
|
|
212
214
|
"@opentelemetry/sdk-metrics": "^3.1.1",
|
|
@@ -228,7 +230,7 @@
|
|
|
228
230
|
"packageManager": "pnpm@10.17.0+sha512.fce8a3dd29a4ed2ec566fb53efbb04d8c44a0f05bc6f24a73046910fb9c3ce7afa35a0980500668fa3573345bd644644fa98338fa168235c80f4aa17aa17fbef",
|
|
229
231
|
"pnpm": {
|
|
230
232
|
"overrides": {
|
|
231
|
-
"@babel/core": "^8.1.
|
|
233
|
+
"@babel/core": "^8.1.2",
|
|
232
234
|
"@opentelemetry/core@<2.12.0": "^2.12.0"
|
|
233
235
|
},
|
|
234
236
|
"updateConfig": {
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var _chunkP5OONZTFcjs = require('./chunk-P5OONZTF.cjs');
|
|
5
|
-
require('./chunk-DC2MFO65.cjs');
|
|
6
|
-
require('./chunk-C5OT6GAQ.cjs');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.GoogleGenAIInstrumentation = _chunkP5OONZTFcjs.GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = _chunkP5OONZTFcjs.instrumentGoogleGenAI;
|