@brizz/sdk 0.1.34 → 0.1.35
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 +32 -0
- package/dist/{chunk-3LR22M4E.cjs → chunk-D27LNW3M.cjs} +51 -36
- package/dist/{chunk-64STNQKL.js → chunk-GSKXPOLQ.js} +1 -1
- package/dist/{chunk-VU5YDLUD.cjs → chunk-HZOBDXDS.cjs} +1 -1
- package/dist/chunk-KFETJN5M.cjs +63 -0
- package/dist/{chunk-F3O3MTQ4.js → chunk-KP3KG66W.js} +17 -2
- package/dist/chunk-TEY6FAVZ.js +63 -0
- package/dist/google-genai-LMEZ62FB.cjs +10 -0
- package/dist/google-genai-T7I4FFIP.js +10 -0
- package/dist/google-genai.cjs +8 -0
- package/dist/google-genai.d.cts +7 -0
- package/dist/google-genai.d.ts +7 -0
- package/dist/google-genai.js +8 -0
- package/dist/index.cjs +19 -4
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -3
- package/dist/{mcp-ZP6AY3FE.js → mcp-EJNZYON6.js} +1 -1
- package/dist/{mcp-WCMY6ED6.cjs → mcp-KAYXU4AU.cjs} +2 -2
- package/dist/preload.cjs +5 -5
- package/dist/preload.js +2 -2
- package/package.json +17 -1
package/README.md
CHANGED
|
@@ -201,6 +201,7 @@ pulled in when you need them. Install the matching package(s) to enable them:
|
|
|
201
201
|
| To trace | Install |
|
|
202
202
|
| --- | --- |
|
|
203
203
|
| **Vercel AI SDK v7+** (`ai@7`) — required for span capture | `npm install @ai-sdk/otel` |
|
|
204
|
+
| **Google GenAI / Gemini** (`@google/genai`) — see [Gemini](#google-genai-gemini) | `npm install @traceloop/instrumentation-google-generativeai` |
|
|
204
205
|
| **Google Vertex AI** (`@google-cloud/vertexai`) | `npm install @traceloop/instrumentation-vertexai` |
|
|
205
206
|
| **MCP** (Model Context Protocol) | `npm install @arizeai/openinference-instrumentation-mcp @modelcontextprotocol/sdk` |
|
|
206
207
|
|
|
@@ -284,6 +285,37 @@ registerOTel({
|
|
|
284
285
|
`@brizz/sdk/eve` is a standalone, side-effect-free export: it does not initialize the full SDK, so
|
|
285
286
|
it won't duplicate the spans eve already emits.
|
|
286
287
|
|
|
288
|
+
### Google GenAI (Gemini)
|
|
289
|
+
|
|
290
|
+
[`@google/genai`](https://www.npmjs.com/package/@google/genai) is Google's unified SDK for Gemini
|
|
291
|
+
(both the Gemini Developer API and Vertex AI). Install the peer dependency, then build your client
|
|
292
|
+
from the class `instrumentGoogleGenAI` returns:
|
|
293
|
+
|
|
294
|
+
```typescript
|
|
295
|
+
import { Brizz } from '@brizz/sdk';
|
|
296
|
+
import { instrumentGoogleGenAI } from '@brizz/sdk/google-genai';
|
|
297
|
+
import * as genai from '@google/genai';
|
|
298
|
+
|
|
299
|
+
Brizz.initialize({ appName: 'my-app' });
|
|
300
|
+
|
|
301
|
+
// Call after Brizz.initialize(). The returned class is instrumented — build the client from it.
|
|
302
|
+
const GoogleGenAI = instrumentGoogleGenAI(genai);
|
|
303
|
+
const ai = new GoogleGenAI({ vertexai: true, project, location });
|
|
304
|
+
|
|
305
|
+
const response = await ai.models.generateContent({
|
|
306
|
+
model: 'gemini-2.5-flash',
|
|
307
|
+
contents: 'Hello, world!',
|
|
308
|
+
});
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
This traces `generateContent` / `generateContentStream` — messages, tool calls, token usage, and
|
|
312
|
+
cost — with no per-call instrumentation.
|
|
313
|
+
|
|
314
|
+
Unlike the other integrations, `@google/genai` is **not** wired through `instrumentModules`.
|
|
315
|
+
It's an ESM-only package, and a Node ES module namespace is read-only, so it can't be patched in
|
|
316
|
+
place — `instrumentGoogleGenAI` returns an instrumented `GoogleGenAI` class instead. Construct
|
|
317
|
+
your client from that class and you're done.
|
|
318
|
+
|
|
287
319
|
## PII Masking
|
|
288
320
|
|
|
289
321
|
Optional masking for span attributes.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkUNLNNKZ7cjs = require('./chunk-UNLNNKZ7.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkHZOBDXDScjs = require('./chunk-HZOBDXDS.cjs');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -170,11 +170,26 @@ var InstrumentationRegistry = (_class = class _InstrumentationRegistry {construc
|
|
|
170
170
|
}
|
|
171
171
|
})();
|
|
172
172
|
}
|
|
173
|
-
if (_optionalChain([this, 'access', _25 => _25.manualModules, 'optionalAccess', _26 => _26.
|
|
173
|
+
if (_optionalChain([this, 'access', _25 => _25.manualModules, 'optionalAccess', _26 => _26.google_genai])) {
|
|
174
|
+
const genaiModule = this.manualModules.google_genai;
|
|
175
|
+
void (async () => {
|
|
176
|
+
try {
|
|
177
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-LMEZ62FB.cjs")));
|
|
178
|
+
const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
179
|
+
genaiInst.manuallyInstrument(genaiModule);
|
|
180
|
+
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for Google GenAI");
|
|
181
|
+
} catch (error) {
|
|
182
|
+
_chunkWC573FCIcjs.logger.error(
|
|
183
|
+
`Failed to apply Google GenAI instrumentation. Ensure @traceloop/instrumentation-google-generativeai is installed; on a read-only ESM module namespace use instrumentGoogleGenAI from @brizz/sdk/google-genai instead: ${String(error)}`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
})();
|
|
187
|
+
}
|
|
188
|
+
if (_optionalChain([this, 'access', _27 => _27.manualModules, 'optionalAccess', _28 => _28.mcp])) {
|
|
174
189
|
const mcpModules = this.manualModules.mcp;
|
|
175
190
|
void (async () => {
|
|
176
191
|
try {
|
|
177
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
192
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-KAYXU4AU.cjs")));
|
|
178
193
|
const instrumentation = new MCPInstrumentation({ exceptionLogger });
|
|
179
194
|
instrumentation.manuallyInstrument(mcpModules);
|
|
180
195
|
_chunkWC573FCIcjs.logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -661,7 +676,7 @@ var BrizzSimpleLogRecordProcessor = class extends _sdklogs.SimpleLogRecordProces
|
|
|
661
676
|
this.config = config;
|
|
662
677
|
}
|
|
663
678
|
onEmit(logRecord) {
|
|
664
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
679
|
+
const maskingConfig = _optionalChain([this, 'access', _29 => _29.config, 'access', _30 => _30.masking, 'optionalAccess', _31 => _31.eventMasking]);
|
|
665
680
|
if (maskingConfig) {
|
|
666
681
|
maskLog(logRecord, maskingConfig);
|
|
667
682
|
}
|
|
@@ -681,7 +696,7 @@ var BrizzBatchLogRecordProcessor = class extends _sdklogs.BatchLogRecordProcesso
|
|
|
681
696
|
this.config = config;
|
|
682
697
|
}
|
|
683
698
|
onEmit(logRecord) {
|
|
684
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
699
|
+
const maskingConfig = _optionalChain([this, 'access', _32 => _32.config, 'access', _33 => _33.masking, 'optionalAccess', _34 => _34.eventMasking]);
|
|
685
700
|
if (maskingConfig) {
|
|
686
701
|
maskLog(logRecord, maskingConfig);
|
|
687
702
|
}
|
|
@@ -784,7 +799,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
784
799
|
}
|
|
785
800
|
_chunkWC573FCIcjs.logger.debug("Initializing log processor", {
|
|
786
801
|
disableBatch: config.disableBatch,
|
|
787
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
802
|
+
hasMasking: !!_optionalChain([config, 'access', _35 => _35.masking, 'optionalAccess', _36 => _36.eventMasking])
|
|
788
803
|
});
|
|
789
804
|
this.logProcessor = config.disableBatch ? new BrizzSimpleLogRecordProcessor(this.logExporter, config) : new BrizzBatchLogRecordProcessor(this.logExporter, config);
|
|
790
805
|
_chunkWC573FCIcjs.logger.debug("Log processor initialized successfully");
|
|
@@ -806,7 +821,7 @@ var LoggingModule = (_class2 = class _LoggingModule {constructor() { _class2.pro
|
|
|
806
821
|
const resourceAttributes = {
|
|
807
822
|
...config.resourceAttributes,
|
|
808
823
|
"service.name": config.appName,
|
|
809
|
-
[BRIZZ_SDK_VERSION]:
|
|
824
|
+
[BRIZZ_SDK_VERSION]: _chunkHZOBDXDScjs.getSDKVersion.call(void 0, ),
|
|
810
825
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
811
826
|
};
|
|
812
827
|
if (config.environment) {
|
|
@@ -947,8 +962,8 @@ function withProperties(properties, fn, thisArg) {
|
|
|
947
962
|
function propagatePropertiesImperatively(properties) {
|
|
948
963
|
try {
|
|
949
964
|
const manager = _api.context;
|
|
950
|
-
const mgr = _optionalChain([manager, 'access',
|
|
951
|
-
const store = _optionalChain([mgr, 'optionalAccess',
|
|
965
|
+
const mgr = _optionalChain([manager, 'access', _37 => _37._getContextManager, 'optionalCall', _38 => _38()]);
|
|
966
|
+
const store = _optionalChain([mgr, 'optionalAccess', _39 => _39._asyncLocalStorage]);
|
|
952
967
|
if (!store || typeof store.enterWith !== "function") {
|
|
953
968
|
return;
|
|
954
969
|
}
|
|
@@ -1224,7 +1239,7 @@ var Session = (_class3 = class {
|
|
|
1224
1239
|
* (free-form category, defaults to `'generic'`)
|
|
1225
1240
|
*/
|
|
1226
1241
|
addExternalLink(url, options) {
|
|
1227
|
-
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1242
|
+
emitExternalLink(this.sessionId, url, _optionalChain([options, 'optionalAccess', _40 => _40.title]), _optionalChain([options, 'optionalAccess', _41 => _41.linkType]));
|
|
1228
1243
|
}
|
|
1229
1244
|
}, _class3);
|
|
1230
1245
|
var SessionTitle = class {
|
|
@@ -1250,11 +1265,11 @@ function resolveSessionIdFromContext() {
|
|
|
1250
1265
|
return active.sessionId;
|
|
1251
1266
|
}
|
|
1252
1267
|
const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
1253
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1268
|
+
return _optionalChain([props, 'optionalAccess', _42 => _42[_chunkNEF2O7HFcjs.SESSION_ID]]);
|
|
1254
1269
|
}
|
|
1255
1270
|
function resolveMessageIdFromContext() {
|
|
1256
1271
|
const props = _api.context.active().getValue(_chunkNEF2O7HFcjs.PROPERTIES_CONTEXT_KEY);
|
|
1257
|
-
return _optionalChain([props, 'optionalAccess',
|
|
1272
|
+
return _optionalChain([props, 'optionalAccess', _43 => _43[_chunkNEF2O7HFcjs.MESSAGE_ID]]);
|
|
1258
1273
|
}
|
|
1259
1274
|
function emitExternalLink(sessionId, url, title, linkType) {
|
|
1260
1275
|
try {
|
|
@@ -1268,30 +1283,30 @@ function emitExternalLink(sessionId, url, title, linkType) {
|
|
|
1268
1283
|
}
|
|
1269
1284
|
}
|
|
1270
1285
|
function addExternalLink(url, options) {
|
|
1271
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1286
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _44 => _44.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1272
1287
|
if (!sessionId) {
|
|
1273
1288
|
_chunkWC573FCIcjs.logger.warn(
|
|
1274
1289
|
"addExternalLink called without a resolvable session id; link dropped. Pass options.sessionId or call inside a startSession/callWithSessionId scope."
|
|
1275
1290
|
);
|
|
1276
1291
|
return;
|
|
1277
1292
|
}
|
|
1278
|
-
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess',
|
|
1293
|
+
emitExternalLink(sessionId, url, _optionalChain([options, 'optionalAccess', _45 => _45.title]), _optionalChain([options, 'optionalAccess', _46 => _46.linkType]));
|
|
1279
1294
|
}
|
|
1280
1295
|
function recordFeedback(type, options) {
|
|
1281
1296
|
const eventAttributes = { [_chunkNEF2O7HFcjs.FEEDBACK_TYPE]: type };
|
|
1282
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1297
|
+
if (_optionalChain([options, 'optionalAccess', _47 => _47.score]) !== void 0) {
|
|
1283
1298
|
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SCORE] = options.score;
|
|
1284
1299
|
}
|
|
1285
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1300
|
+
if (_optionalChain([options, 'optionalAccess', _48 => _48.reason]) !== void 0) {
|
|
1286
1301
|
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_REASON] = options.reason;
|
|
1287
1302
|
}
|
|
1288
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1303
|
+
if (_optionalChain([options, 'optionalAccess', _49 => _49.comment]) !== void 0) {
|
|
1289
1304
|
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_COMMENT] = options.comment;
|
|
1290
1305
|
}
|
|
1291
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1306
|
+
if (_optionalChain([options, 'optionalAccess', _50 => _50.source]) !== void 0) {
|
|
1292
1307
|
eventAttributes[_chunkNEF2O7HFcjs.FEEDBACK_SOURCE] = options.source;
|
|
1293
1308
|
}
|
|
1294
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1309
|
+
if (_optionalChain([options, 'optionalAccess', _51 => _51.attributes])) {
|
|
1295
1310
|
for (const [key, value] of Object.entries(options.attributes)) {
|
|
1296
1311
|
const k = `${_chunkNEF2O7HFcjs.FEEDBACK_ATTR_PREFIX}${key}`;
|
|
1297
1312
|
if (eventAttributes[k] === void 0) {
|
|
@@ -1299,8 +1314,8 @@ function recordFeedback(type, options) {
|
|
|
1299
1314
|
}
|
|
1300
1315
|
}
|
|
1301
1316
|
}
|
|
1302
|
-
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1303
|
-
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1317
|
+
const messageId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _52 => _52.messageId]), () => ( resolveMessageIdFromContext()));
|
|
1318
|
+
const sessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _53 => _53.sessionId]), () => ( resolveSessionIdFromContext()));
|
|
1304
1319
|
if (messageId === void 0 && sessionId === void 0) {
|
|
1305
1320
|
_chunkWC573FCIcjs.logger.warn(
|
|
1306
1321
|
"recordFeedback called with no resolvable message id or session id; the feedback cannot be attributed to a message or conversation. Pass options.messageId / options.sessionId or call inside a startSession/callWithMessageId scope."
|
|
@@ -1331,7 +1346,7 @@ function recordMetric(options) {
|
|
|
1331
1346
|
try {
|
|
1332
1347
|
recordMetricImpl(options);
|
|
1333
1348
|
} catch (error) {
|
|
1334
|
-
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess',
|
|
1349
|
+
_chunkWC573FCIcjs.logger.warn(`recordMetric(${JSON.stringify(_optionalChain([options, 'optionalAccess', _54 => _54.name]))}) failed; metric dropped.`, error);
|
|
1335
1350
|
}
|
|
1336
1351
|
}
|
|
1337
1352
|
function recordMetricImpl(options) {
|
|
@@ -1446,7 +1461,7 @@ function recordMetricImpl(options) {
|
|
|
1446
1461
|
}
|
|
1447
1462
|
}
|
|
1448
1463
|
function startSession(sessionId, callback, extraProperties, options) {
|
|
1449
|
-
const isTitle = _optionalChain([options, 'optionalAccess',
|
|
1464
|
+
const isTitle = _optionalChain([options, 'optionalAccess', _55 => _55.mode]) === "title";
|
|
1450
1465
|
const spanName = isTitle ? _chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME : _chunkNEF2O7HFcjs.SESSION_SPAN_NAME;
|
|
1451
1466
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1452
1467
|
return tracer.startActiveSpan(spanName, (span) => {
|
|
@@ -1495,7 +1510,7 @@ function startSession(sessionId, callback, extraProperties, options) {
|
|
|
1495
1510
|
});
|
|
1496
1511
|
}
|
|
1497
1512
|
function startSessionTitle(callback, options) {
|
|
1498
|
-
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1513
|
+
const resolvedSessionId = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _56 => _56.sessionId]), () => ( _optionalChain([getActiveSession, 'call', _57 => _57(), 'optionalAccess', _58 => _58.sessionId])));
|
|
1499
1514
|
const tracer = _api.trace.getTracer("@brizz/sdk");
|
|
1500
1515
|
return tracer.startActiveSpan(_chunkNEF2O7HFcjs.SESSION_TITLE_SPAN_NAME, (span) => {
|
|
1501
1516
|
if (resolvedSessionId) {
|
|
@@ -1649,7 +1664,7 @@ var BrizzSpanExporter = class {
|
|
|
1649
1664
|
const resourceAttrs = {
|
|
1650
1665
|
...config.resourceAttributes,
|
|
1651
1666
|
"service.name": config.appName,
|
|
1652
|
-
[BRIZZ_SDK_VERSION]:
|
|
1667
|
+
[BRIZZ_SDK_VERSION]: _chunkHZOBDXDScjs.getSDKVersion.call(void 0, ),
|
|
1653
1668
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
1654
1669
|
};
|
|
1655
1670
|
if (config.environment) {
|
|
@@ -1701,7 +1716,7 @@ var BrizzSpanExporter = class {
|
|
|
1701
1716
|
return this._delegate.shutdown();
|
|
1702
1717
|
}
|
|
1703
1718
|
async forceFlush() {
|
|
1704
|
-
return _optionalChain([this, 'access',
|
|
1719
|
+
return _optionalChain([this, 'access', _59 => _59._delegate, 'access', _60 => _60.forceFlush, 'optionalCall', _61 => _61()]);
|
|
1705
1720
|
}
|
|
1706
1721
|
};
|
|
1707
1722
|
|
|
@@ -1736,7 +1751,7 @@ var BrizzSimpleSpanProcessor = class extends _sdktracebase.SimpleSpanProcessor {
|
|
|
1736
1751
|
super.onStart(span, parentContext);
|
|
1737
1752
|
}
|
|
1738
1753
|
onEnd(span) {
|
|
1739
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
1754
|
+
const maskingConfig = _optionalChain([this, 'access', _62 => _62.config, 'access', _63 => _63.masking, 'optionalAccess', _64 => _64.spanMasking]);
|
|
1740
1755
|
if (maskingConfig) {
|
|
1741
1756
|
maskReadableSpan(span, maskingConfig);
|
|
1742
1757
|
}
|
|
@@ -1754,7 +1769,7 @@ var BrizzBatchSpanProcessor = class extends _sdktracebase.BatchSpanProcessor {
|
|
|
1754
1769
|
super.onStart(span, parentContext);
|
|
1755
1770
|
}
|
|
1756
1771
|
onEnd(span) {
|
|
1757
|
-
const maskingConfig = _optionalChain([this, 'access',
|
|
1772
|
+
const maskingConfig = _optionalChain([this, 'access', _65 => _65.config, 'access', _66 => _66.masking, 'optionalAccess', _67 => _67.spanMasking]);
|
|
1758
1773
|
if (maskingConfig) {
|
|
1759
1774
|
maskReadableSpan(span, maskingConfig);
|
|
1760
1775
|
}
|
|
@@ -1834,7 +1849,7 @@ var TracingModule = (_class5 = class _TracingModule {constructor() { _class5.pro
|
|
|
1834
1849
|
}
|
|
1835
1850
|
_chunkWC573FCIcjs.logger.debug("Initializing span processor", {
|
|
1836
1851
|
disableBatch: config.disableBatch,
|
|
1837
|
-
hasMasking: !!_optionalChain([config, 'access',
|
|
1852
|
+
hasMasking: !!_optionalChain([config, 'access', _68 => _68.masking, 'optionalAccess', _69 => _69.spanMasking])
|
|
1838
1853
|
});
|
|
1839
1854
|
const spanProcessor = config.disableBatch ? new BrizzSimpleSpanProcessor(this.spanExporter, config) : new BrizzBatchSpanProcessor(this.spanExporter, config);
|
|
1840
1855
|
_chunkWC573FCIcjs.logger.debug("Span processor initialized successfully");
|
|
@@ -1914,7 +1929,7 @@ var _sdktracenode = require('@opentelemetry/sdk-trace-node');
|
|
|
1914
1929
|
|
|
1915
1930
|
// src/internal/config.ts
|
|
1916
1931
|
function resolveConfig(options) {
|
|
1917
|
-
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access',
|
|
1932
|
+
const envLogLevel = process.env["BRIZZ_LOG_LEVEL"] || _optionalChain([options, 'access', _70 => _70.logLevel, 'optionalAccess', _71 => _71.toString, 'call', _72 => _72()]) || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
|
|
1918
1933
|
let resolvedLogLevel;
|
|
1919
1934
|
if (envLogLevel) {
|
|
1920
1935
|
resolvedLogLevel = _chunkWC573FCIcjs.parseLogLevel.call(void 0, envLogLevel);
|
|
@@ -2085,7 +2100,7 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
2085
2100
|
const resourceAttributes = {
|
|
2086
2101
|
...resolvedConfig.resourceAttributes,
|
|
2087
2102
|
"service.name": resolvedConfig.appName,
|
|
2088
|
-
[BRIZZ_SDK_VERSION]:
|
|
2103
|
+
[BRIZZ_SDK_VERSION]: _chunkHZOBDXDScjs.getSDKVersion.call(void 0, ),
|
|
2089
2104
|
[BRIZZ_SDK_LANGUAGE]: SDK_LANGUAGE
|
|
2090
2105
|
};
|
|
2091
2106
|
if (resolvedConfig.environment) {
|
|
@@ -2233,10 +2248,10 @@ var _Brizz = (_class6 = class __Brizz {constructor() { _class6.prototype.__init1
|
|
|
2233
2248
|
}
|
|
2234
2249
|
try {
|
|
2235
2250
|
await this.shutdownModules();
|
|
2236
|
-
await _optionalChain([this, 'access',
|
|
2237
|
-
await _optionalChain([this, 'access',
|
|
2238
|
-
await _optionalChain([this, 'access',
|
|
2239
|
-
await _optionalChain([this, 'access',
|
|
2251
|
+
await _optionalChain([this, 'access', _73 => _73._tracerProvider, 'optionalAccess', _74 => _74.forceFlush, 'call', _75 => _75()]);
|
|
2252
|
+
await _optionalChain([this, 'access', _76 => _76._tracerProvider, 'optionalAccess', _77 => _77.shutdown, 'call', _78 => _78()]);
|
|
2253
|
+
await _optionalChain([this, 'access', _79 => _79._meterProvider, 'optionalAccess', _80 => _80.forceFlush, 'call', _81 => _81()]);
|
|
2254
|
+
await _optionalChain([this, 'access', _82 => _82._meterProvider, 'optionalAccess', _83 => _83.shutdown, 'call', _84 => _84()]);
|
|
2240
2255
|
this._initialized = false;
|
|
2241
2256
|
this._tracerProvider = null;
|
|
2242
2257
|
this._meterProvider = null;
|
|
@@ -2265,7 +2280,7 @@ function detectRuntime() {
|
|
|
2265
2280
|
const supportsLoaderAPI = (_nullishCoalesce(major, () => ( 0))) >= 21 || (_nullishCoalesce(major, () => ( 0))) === 20 && (_nullishCoalesce(minor, () => ( 0))) >= 6 || (_nullishCoalesce(major, () => ( 0))) === 18 && (_nullishCoalesce(minor, () => ( 0))) >= 19;
|
|
2266
2281
|
const supportsRegister = (
|
|
2267
2282
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2268
|
-
!!_optionalChain([process, 'access',
|
|
2283
|
+
!!_optionalChain([process, 'access', _85 => _85.features, 'optionalAccess', _86 => _86.typescript]) || !!_optionalChain([globalThis, 'access', _87 => _87.module, 'optionalAccess', _88 => _88.register])
|
|
2269
2284
|
);
|
|
2270
2285
|
_chunkWC573FCIcjs.logger.debug("Runtime detection results:", {
|
|
2271
2286
|
nodeVersion: `${_nullishCoalesce(major, () => ( 0))}.${_nullishCoalesce(minor, () => ( 0))}`,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkWC573FCIcjs = require('./chunk-WC573FCI.cjs');
|
|
4
|
+
|
|
5
|
+
// src/internal/instrumentation/google-genai.ts
|
|
6
|
+
var _instrumentation = require('@opentelemetry/instrumentation');
|
|
7
|
+
var _instrumentationgooglegenerativeai = require('@traceloop/instrumentation-google-generativeai');
|
|
8
|
+
var MODULE_NAME = "@google/genai";
|
|
9
|
+
var SUPPORTED_VERSIONS = [">=1.0.0 <3.0.0"];
|
|
10
|
+
var GoogleGenAIInstrumentation = class extends _instrumentationgooglegenerativeai.GenAIInstrumentation {
|
|
11
|
+
/**
|
|
12
|
+
* Replace — not extend — upstream's module definition. Upstream returns a
|
|
13
|
+
* single definition for `@google/genai`; registering ours alongside it would
|
|
14
|
+
* patch the same module twice on v1.
|
|
15
|
+
*/
|
|
16
|
+
init() {
|
|
17
|
+
return new (0, _instrumentation.InstrumentationNodeModuleDefinition)(
|
|
18
|
+
MODULE_NAME,
|
|
19
|
+
SUPPORTED_VERSIONS,
|
|
20
|
+
(module) => {
|
|
21
|
+
this.manuallyInstrument(module);
|
|
22
|
+
return module;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Brand the class we patched so de-duplication survives bundlers that minify
|
|
28
|
+
* upstream's runtime class name. Every patch path (module-load hook, registry
|
|
29
|
+
* `instrumentModules`, `instrumentGoogleGenAI`) funnels through here.
|
|
30
|
+
*/
|
|
31
|
+
manuallyInstrument(module) {
|
|
32
|
+
const original = module.GoogleGenAI;
|
|
33
|
+
super.manuallyInstrument(module);
|
|
34
|
+
if (module.GoogleGenAI !== original) {
|
|
35
|
+
module.GoogleGenAI[PATCHED_MARKER] = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var PATCHED_CLASS_NAME = "PatchedGoogleGenAI";
|
|
40
|
+
var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.googleGenAI.patched");
|
|
41
|
+
function instrumentGoogleGenAI(module) {
|
|
42
|
+
const original = module.GoogleGenAI;
|
|
43
|
+
const branded = original[PATCHED_MARKER] === true;
|
|
44
|
+
if (branded || original.name === PATCHED_CLASS_NAME) {
|
|
45
|
+
return original;
|
|
46
|
+
}
|
|
47
|
+
const holder = { GoogleGenAI: original };
|
|
48
|
+
const instrumentation = new GoogleGenAIInstrumentation({
|
|
49
|
+
exceptionLogger: (error) => {
|
|
50
|
+
_chunkWC573FCIcjs.logger.error(`Exception in Google GenAI instrumentation: ${String(error)}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
instrumentation.manuallyInstrument(holder);
|
|
54
|
+
if (holder.GoogleGenAI === original) {
|
|
55
|
+
_chunkWC573FCIcjs.logger.warn("Google GenAI instrumentation did not patch the client; calls will not be traced");
|
|
56
|
+
}
|
|
57
|
+
return holder.GoogleGenAI;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
exports.GoogleGenAIInstrumentation = GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = instrumentGoogleGenAI;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-7SUF4VVI.js";
|
|
5
5
|
import {
|
|
6
6
|
getSDKVersion
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GSKXPOLQ.js";
|
|
8
8
|
import {
|
|
9
9
|
DEFAULT_LOG_LEVEL,
|
|
10
10
|
logger,
|
|
@@ -170,11 +170,26 @@ var InstrumentationRegistry = class _InstrumentationRegistry {
|
|
|
170
170
|
}
|
|
171
171
|
})();
|
|
172
172
|
}
|
|
173
|
+
if (this.manualModules?.google_genai) {
|
|
174
|
+
const genaiModule = this.manualModules.google_genai;
|
|
175
|
+
void (async () => {
|
|
176
|
+
try {
|
|
177
|
+
const { GoogleGenAIInstrumentation } = await import("./google-genai-T7I4FFIP.js");
|
|
178
|
+
const genaiInst = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
179
|
+
genaiInst.manuallyInstrument(genaiModule);
|
|
180
|
+
logger.debug("Manual instrumentation enabled for Google GenAI");
|
|
181
|
+
} catch (error) {
|
|
182
|
+
logger.error(
|
|
183
|
+
`Failed to apply Google GenAI instrumentation. Ensure @traceloop/instrumentation-google-generativeai is installed; on a read-only ESM module namespace use instrumentGoogleGenAI from @brizz/sdk/google-genai instead: ${String(error)}`
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
})();
|
|
187
|
+
}
|
|
173
188
|
if (this.manualModules?.mcp) {
|
|
174
189
|
const mcpModules = this.manualModules.mcp;
|
|
175
190
|
void (async () => {
|
|
176
191
|
try {
|
|
177
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
192
|
+
const { MCPInstrumentation } = await import("./mcp-EJNZYON6.js");
|
|
178
193
|
const instrumentation = new MCPInstrumentation({ exceptionLogger });
|
|
179
194
|
instrumentation.manuallyInstrument(mcpModules);
|
|
180
195
|
logger.debug("Manual instrumentation enabled for MCP");
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import {
|
|
2
|
+
logger
|
|
3
|
+
} from "./chunk-Y4HNUX3Q.js";
|
|
4
|
+
|
|
5
|
+
// src/internal/instrumentation/google-genai.ts
|
|
6
|
+
import { InstrumentationNodeModuleDefinition } from "@opentelemetry/instrumentation";
|
|
7
|
+
import { GenAIInstrumentation } from "@traceloop/instrumentation-google-generativeai";
|
|
8
|
+
var MODULE_NAME = "@google/genai";
|
|
9
|
+
var SUPPORTED_VERSIONS = [">=1.0.0 <3.0.0"];
|
|
10
|
+
var GoogleGenAIInstrumentation = class extends GenAIInstrumentation {
|
|
11
|
+
/**
|
|
12
|
+
* Replace — not extend — upstream's module definition. Upstream returns a
|
|
13
|
+
* single definition for `@google/genai`; registering ours alongside it would
|
|
14
|
+
* patch the same module twice on v1.
|
|
15
|
+
*/
|
|
16
|
+
init() {
|
|
17
|
+
return new InstrumentationNodeModuleDefinition(
|
|
18
|
+
MODULE_NAME,
|
|
19
|
+
SUPPORTED_VERSIONS,
|
|
20
|
+
(module) => {
|
|
21
|
+
this.manuallyInstrument(module);
|
|
22
|
+
return module;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Brand the class we patched so de-duplication survives bundlers that minify
|
|
28
|
+
* upstream's runtime class name. Every patch path (module-load hook, registry
|
|
29
|
+
* `instrumentModules`, `instrumentGoogleGenAI`) funnels through here.
|
|
30
|
+
*/
|
|
31
|
+
manuallyInstrument(module) {
|
|
32
|
+
const original = module.GoogleGenAI;
|
|
33
|
+
super.manuallyInstrument(module);
|
|
34
|
+
if (module.GoogleGenAI !== original) {
|
|
35
|
+
module.GoogleGenAI[PATCHED_MARKER] = true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var PATCHED_CLASS_NAME = "PatchedGoogleGenAI";
|
|
40
|
+
var PATCHED_MARKER = /* @__PURE__ */ Symbol.for("brizz.googleGenAI.patched");
|
|
41
|
+
function instrumentGoogleGenAI(module) {
|
|
42
|
+
const original = module.GoogleGenAI;
|
|
43
|
+
const branded = original[PATCHED_MARKER] === true;
|
|
44
|
+
if (branded || original.name === PATCHED_CLASS_NAME) {
|
|
45
|
+
return original;
|
|
46
|
+
}
|
|
47
|
+
const holder = { GoogleGenAI: original };
|
|
48
|
+
const instrumentation = new GoogleGenAIInstrumentation({
|
|
49
|
+
exceptionLogger: (error) => {
|
|
50
|
+
logger.error(`Exception in Google GenAI instrumentation: ${String(error)}`);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
instrumentation.manuallyInstrument(holder);
|
|
54
|
+
if (holder.GoogleGenAI === original) {
|
|
55
|
+
logger.warn("Google GenAI instrumentation did not patch the client; calls will not be traced");
|
|
56
|
+
}
|
|
57
|
+
return holder.GoogleGenAI;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
GoogleGenAIInstrumentation,
|
|
62
|
+
instrumentGoogleGenAI
|
|
63
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkKFETJN5Mcjs = require('./chunk-KFETJN5M.cjs');
|
|
5
|
+
require('./chunk-WC573FCI.cjs');
|
|
6
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.GoogleGenAIInstrumentation = _chunkKFETJN5Mcjs.GoogleGenAIInstrumentation; exports.instrumentGoogleGenAI = _chunkKFETJN5Mcjs.instrumentGoogleGenAI;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkKFETJN5Mcjs = require('./chunk-KFETJN5M.cjs');
|
|
4
|
+
require('./chunk-WC573FCI.cjs');
|
|
5
|
+
require('./chunk-OBGZSXTJ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.instrumentGoogleGenAI = _chunkKFETJN5Mcjs.instrumentGoogleGenAI;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GenAIInstrumentation } from '@traceloop/instrumentation-google-generativeai';
|
|
2
|
+
|
|
3
|
+
type GoogleGenAIModule = Parameters<GenAIInstrumentation['manuallyInstrument']>[0];
|
|
4
|
+
type GoogleGenAIClass = GoogleGenAIModule['GoogleGenAI'];
|
|
5
|
+
declare function instrumentGoogleGenAI(module: GoogleGenAIModule): GoogleGenAIClass;
|
|
6
|
+
|
|
7
|
+
export { instrumentGoogleGenAI };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { GenAIInstrumentation } from '@traceloop/instrumentation-google-generativeai';
|
|
2
|
+
|
|
3
|
+
type GoogleGenAIModule = Parameters<GenAIInstrumentation['manuallyInstrument']>[0];
|
|
4
|
+
type GoogleGenAIClass = GoogleGenAIModule['GoogleGenAI'];
|
|
5
|
+
declare function instrumentGoogleGenAI(module: GoogleGenAIModule): GoogleGenAIClass;
|
|
6
|
+
|
|
7
|
+
export { instrumentGoogleGenAI };
|
package/dist/index.cjs
CHANGED
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkD27LNW3Mcjs = require('./chunk-D27LNW3M.cjs');
|
|
38
38
|
require('./chunk-UNLNNKZ7.cjs');
|
|
39
|
-
require('./chunk-
|
|
39
|
+
require('./chunk-HZOBDXDS.cjs');
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
|
|
@@ -94,7 +94,7 @@ function loadGenAIInstrumentations() {
|
|
|
94
94
|
function loadMCPInstrumentation() {
|
|
95
95
|
void (async () => {
|
|
96
96
|
try {
|
|
97
|
-
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-
|
|
97
|
+
const { MCPInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./mcp-KAYXU4AU.cjs")));
|
|
98
98
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
99
99
|
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [mcp] });
|
|
100
100
|
_chunkWC573FCIcjs.logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -119,6 +119,20 @@ function loadVertexAIInstrumentation() {
|
|
|
119
119
|
}
|
|
120
120
|
})();
|
|
121
121
|
}
|
|
122
|
+
function loadGoogleGenAIInstrumentation() {
|
|
123
|
+
void (async () => {
|
|
124
|
+
try {
|
|
125
|
+
const { GoogleGenAIInstrumentation } = await Promise.resolve().then(() => _interopRequireWildcard(require("./google-genai-LMEZ62FB.cjs")));
|
|
126
|
+
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
127
|
+
_instrumentation.registerInstrumentations.call(void 0, { instrumentations: [googleGenAI] });
|
|
128
|
+
_chunkWC573FCIcjs.logger.debug("Auto-loaded Google GenAI instrumentation");
|
|
129
|
+
} catch (error) {
|
|
130
|
+
_chunkWC573FCIcjs.logger.debug(
|
|
131
|
+
`Google GenAI instrumentation not loaded (install @traceloop/instrumentation-google-generativeai if you want Gemini support): ${String(error)}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
}
|
|
122
136
|
function selectTelemetryRegister(ai) {
|
|
123
137
|
const register = _nullishCoalesce(ai.registerTelemetry, () => ( ai.registerTelemetryIntegration));
|
|
124
138
|
return typeof register === "function" ? register : void 0;
|
|
@@ -169,6 +183,7 @@ function autoInitializeInstrumentations() {
|
|
|
169
183
|
const genAIInstrumentations = loadGenAIInstrumentations();
|
|
170
184
|
loadMCPInstrumentation();
|
|
171
185
|
loadVertexAIInstrumentation();
|
|
186
|
+
loadGoogleGenAIInstrumentation();
|
|
172
187
|
loadVercelAITelemetry();
|
|
173
188
|
_chunkWC573FCIcjs.logger.info(
|
|
174
189
|
`Auto-initialization complete: ${genAIInstrumentations.length} GenAI instrumentations`
|
|
@@ -228,4 +243,4 @@ var init_exports = {};
|
|
|
228
243
|
|
|
229
244
|
|
|
230
245
|
|
|
231
|
-
exports.Brizz =
|
|
246
|
+
exports.Brizz = _chunkD27LNW3Mcjs.Brizz; exports.DEFAULT_PII_PATTERNS = _chunkD27LNW3Mcjs.DEFAULT_PII_PATTERNS; exports.LogLevel = _chunkWC573FCIcjs.LogLevel; exports.Session = _chunkD27LNW3Mcjs.Session; exports.SessionTitle = _chunkD27LNW3Mcjs.SessionTitle; exports.SeverityNumber = _apilogs.SeverityNumber; exports.addExternalLink = _chunkD27LNW3Mcjs.addExternalLink; exports.callWithMessageId = _chunkD27LNW3Mcjs.callWithMessageId; exports.callWithMute = _chunkD27LNW3Mcjs.callWithMute; exports.callWithOrganization = _chunkD27LNW3Mcjs.callWithOrganization; exports.callWithProperties = _chunkD27LNW3Mcjs.callWithProperties; exports.callWithSessionId = _chunkD27LNW3Mcjs.callWithSessionId; exports.callWithUser = _chunkD27LNW3Mcjs.callWithUser; exports.detectRuntime = _chunkD27LNW3Mcjs.detectRuntime; exports.emitEvent = _chunkD27LNW3Mcjs.emitEvent; exports.emitEventWithSessionId = _chunkD27LNW3Mcjs.emitEventWithSessionId; exports.getActiveSession = _chunkD27LNW3Mcjs.getActiveSession; exports.getLogLevel = _chunkWC573FCIcjs.getLogLevel; exports.getMetricsExporter = _chunkD27LNW3Mcjs.getMetricsExporter; exports.getMetricsReader = _chunkD27LNW3Mcjs.getMetricsReader; exports.getSpanExporter = _chunkD27LNW3Mcjs.getSpanExporter; exports.getSpanProcessor = _chunkD27LNW3Mcjs.getSpanProcessor; exports.init = init_exports; exports.logger = _chunkWC573FCIcjs.logger; exports.maskAttributes = _chunkD27LNW3Mcjs.maskAttributes; exports.maskValue = _chunkD27LNW3Mcjs.maskValue; exports.recordFeedback = _chunkD27LNW3Mcjs.recordFeedback; exports.recordMetric = _chunkD27LNW3Mcjs.recordMetric; exports.setCurrentSpanCustomProperties = _chunkD27LNW3Mcjs.setCurrentSpanCustomProperties; exports.setLogLevel = _chunkWC573FCIcjs.setLogLevel; exports.setMessageId = _chunkD27LNW3Mcjs.setMessageId; exports.setOrganization = _chunkD27LNW3Mcjs.setOrganization; exports.setUser = _chunkD27LNW3Mcjs.setUser; exports.startSession = _chunkD27LNW3Mcjs.startSession; exports.startSessionTitle = _chunkD27LNW3Mcjs.startSessionTitle; exports.withMessageId = _chunkD27LNW3Mcjs.withMessageId; exports.withMute = _chunkD27LNW3Mcjs.withMute; exports.withOrganization = _chunkD27LNW3Mcjs.withOrganization; exports.withProperties = _chunkD27LNW3Mcjs.withProperties; exports.withSessionId = _chunkD27LNW3Mcjs.withSessionId; exports.withUser = _chunkD27LNW3Mcjs.withUser;
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -34,9 +34,9 @@ import {
|
|
|
34
34
|
withProperties,
|
|
35
35
|
withSessionId,
|
|
36
36
|
withUser
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-KP3KG66W.js";
|
|
38
38
|
import "./chunk-7SUF4VVI.js";
|
|
39
|
-
import "./chunk-
|
|
39
|
+
import "./chunk-GSKXPOLQ.js";
|
|
40
40
|
import {
|
|
41
41
|
LogLevel,
|
|
42
42
|
getLogLevel,
|
|
@@ -94,7 +94,7 @@ function loadGenAIInstrumentations() {
|
|
|
94
94
|
function loadMCPInstrumentation() {
|
|
95
95
|
void (async () => {
|
|
96
96
|
try {
|
|
97
|
-
const { MCPInstrumentation } = await import("./mcp-
|
|
97
|
+
const { MCPInstrumentation } = await import("./mcp-EJNZYON6.js");
|
|
98
98
|
const mcp = new MCPInstrumentation({ exceptionLogger });
|
|
99
99
|
registerInstrumentations({ instrumentations: [mcp] });
|
|
100
100
|
logger.debug("Auto-loaded MCP instrumentation");
|
|
@@ -119,6 +119,20 @@ function loadVertexAIInstrumentation() {
|
|
|
119
119
|
}
|
|
120
120
|
})();
|
|
121
121
|
}
|
|
122
|
+
function loadGoogleGenAIInstrumentation() {
|
|
123
|
+
void (async () => {
|
|
124
|
+
try {
|
|
125
|
+
const { GoogleGenAIInstrumentation } = await import("./google-genai-T7I4FFIP.js");
|
|
126
|
+
const googleGenAI = new GoogleGenAIInstrumentation({ exceptionLogger });
|
|
127
|
+
registerInstrumentations({ instrumentations: [googleGenAI] });
|
|
128
|
+
logger.debug("Auto-loaded Google GenAI instrumentation");
|
|
129
|
+
} catch (error) {
|
|
130
|
+
logger.debug(
|
|
131
|
+
`Google GenAI instrumentation not loaded (install @traceloop/instrumentation-google-generativeai if you want Gemini support): ${String(error)}`
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
})();
|
|
135
|
+
}
|
|
122
136
|
function selectTelemetryRegister(ai) {
|
|
123
137
|
const register = ai.registerTelemetry ?? ai.registerTelemetryIntegration;
|
|
124
138
|
return typeof register === "function" ? register : void 0;
|
|
@@ -169,6 +183,7 @@ function autoInitializeInstrumentations() {
|
|
|
169
183
|
const genAIInstrumentations = loadGenAIInstrumentations();
|
|
170
184
|
loadMCPInstrumentation();
|
|
171
185
|
loadVertexAIInstrumentation();
|
|
186
|
+
loadGoogleGenAIInstrumentation();
|
|
172
187
|
loadVercelAITelemetry();
|
|
173
188
|
logger.info(
|
|
174
189
|
`Auto-initialization complete: ${genAIInstrumentations.length} GenAI instrumentations`
|
|
@@ -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 _chunkHZOBDXDScjs = require('./chunk-HZOBDXDS.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 = _chunkHZOBDXDScjs.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";
|
package/dist/preload.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkD27LNW3Mcjs = require('./chunk-D27LNW3M.cjs');
|
|
5
5
|
require('./chunk-UNLNNKZ7.cjs');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-HZOBDXDS.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -96,16 +96,16 @@ if (globalThis[LOADER_REGISTERED_KEY] !== true) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// src/preload.ts
|
|
99
|
-
var runtime =
|
|
99
|
+
var runtime = _chunkD27LNW3Mcjs.detectRuntime.call(void 0, );
|
|
100
100
|
if (runtime.isESM && runtime.supportsLoaderAPI) {
|
|
101
101
|
maybeRegisterESMLoader();
|
|
102
102
|
}
|
|
103
103
|
try {
|
|
104
104
|
const logLevel = process.env["BRIZZ_LOG_LEVEL"] || _chunkWC573FCIcjs.DEFAULT_LOG_LEVEL.toString();
|
|
105
105
|
if (process.env["BRIZZ_DSN"]) {
|
|
106
|
-
|
|
106
|
+
_chunkD27LNW3Mcjs.Brizz.initialize({ logLevel, disableNodeSdk: false });
|
|
107
107
|
} else {
|
|
108
|
-
|
|
108
|
+
_chunkD27LNW3Mcjs.Brizz.initialize({
|
|
109
109
|
apiKey: process.env["BRIZZ_API_KEY"],
|
|
110
110
|
baseUrl: process.env["BRIZZ_BASE_URL"],
|
|
111
111
|
appName: process.env["BRIZZ_APP_NAME"] || process.env["OTEL_SERVICE_NAME"],
|
package/dist/preload.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brizz/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.35",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenTelemetry-based observability SDK for AI applications",
|
|
6
6
|
"keywords": [
|
|
@@ -79,6 +79,16 @@
|
|
|
79
79
|
"default": "./dist/eve.cjs"
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
+
"./google-genai": {
|
|
83
|
+
"import": {
|
|
84
|
+
"types": "./dist/google-genai.d.ts",
|
|
85
|
+
"default": "./dist/google-genai.js"
|
|
86
|
+
},
|
|
87
|
+
"require": {
|
|
88
|
+
"types": "./dist/google-genai.d.cts",
|
|
89
|
+
"default": "./dist/google-genai.cjs"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
82
92
|
"./preload": {
|
|
83
93
|
"import": "./dist/preload.js",
|
|
84
94
|
"require": "./dist/preload.cjs"
|
|
@@ -103,7 +113,9 @@
|
|
|
103
113
|
"@changesets/changelog-github": "^0.7.0",
|
|
104
114
|
"@changesets/cli": "^2.30.0",
|
|
105
115
|
"@eslint/js": "^10.0.1",
|
|
116
|
+
"@google/genai": "^2.11.0",
|
|
106
117
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
118
|
+
"@traceloop/instrumentation-google-generativeai": "^0.27.0",
|
|
107
119
|
"@traceloop/instrumentation-vertexai": "^0.27.0",
|
|
108
120
|
"@types/jest": "^30.0.0",
|
|
109
121
|
"@types/node": "^26.1.1",
|
|
@@ -131,6 +143,7 @@
|
|
|
131
143
|
"@arizeai/openinference-instrumentation-mcp": "^0.2.19",
|
|
132
144
|
"@langchain/core": "^0.3.0 || ^1.0.0",
|
|
133
145
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
146
|
+
"@traceloop/instrumentation-google-generativeai": "^0.27.0",
|
|
134
147
|
"@traceloop/instrumentation-vertexai": "^0.27.0",
|
|
135
148
|
"ai": "*",
|
|
136
149
|
"typescript": ">=5.0.0"
|
|
@@ -148,6 +161,9 @@
|
|
|
148
161
|
"@modelcontextprotocol/sdk": {
|
|
149
162
|
"optional": true
|
|
150
163
|
},
|
|
164
|
+
"@traceloop/instrumentation-google-generativeai": {
|
|
165
|
+
"optional": true
|
|
166
|
+
},
|
|
151
167
|
"@traceloop/instrumentation-vertexai": {
|
|
152
168
|
"optional": true
|
|
153
169
|
},
|