@morsehq-dev/sdk 0.5.0-rc.5 → 0.5.0-rc.6
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/dist/anthropic/index.cjs +11 -11
- package/dist/anthropic/index.js +4 -4
- package/dist/anthropic-agent-sdk/index.cjs +40 -40
- package/dist/anthropic-agent-sdk/index.js +6 -6
- package/dist/browser/anthropic/index.cjs +11 -11
- package/dist/browser/anthropic/index.js +4 -4
- package/dist/browser/anthropic-agent-sdk/index.cjs +40 -40
- package/dist/browser/anthropic-agent-sdk/index.js +6 -6
- package/dist/browser/{chunk-EH326H6U.js → chunk-2LZCQD3J.js} +3 -3
- package/dist/browser/{chunk-EH326H6U.js.map → chunk-2LZCQD3J.js.map} +1 -1
- package/dist/browser/{chunk-QAFFDJFK.cjs → chunk-6YPVIGD2.cjs} +6 -6
- package/dist/browser/{chunk-QAFFDJFK.cjs.map → chunk-6YPVIGD2.cjs.map} +1 -1
- package/dist/browser/{chunk-WGWPCVYB.cjs → chunk-DQ4JWHYH.cjs} +18 -18
- package/dist/browser/{chunk-WGWPCVYB.cjs.map → chunk-DQ4JWHYH.cjs.map} +1 -1
- package/dist/browser/{chunk-CI7M2GHD.js → chunk-FDWPKINR.js} +4 -4
- package/dist/browser/{chunk-CI7M2GHD.js.map → chunk-FDWPKINR.js.map} +1 -1
- package/dist/browser/{chunk-64YI3IZS.js → chunk-IXCAR4UA.js} +3 -3
- package/dist/browser/{chunk-64YI3IZS.js.map → chunk-IXCAR4UA.js.map} +1 -1
- package/dist/browser/{chunk-MIB3EOC4.js → chunk-JNF26SQM.js} +5 -5
- package/dist/browser/{chunk-MIB3EOC4.js.map → chunk-JNF26SQM.js.map} +1 -1
- package/dist/browser/{chunk-V7AUPQIJ.js → chunk-MIHCAKQ2.js} +22 -14
- package/dist/browser/chunk-MIHCAKQ2.js.map +1 -0
- package/dist/browser/{chunk-WR2SQLKP.cjs → chunk-NK6D2G5O.cjs} +7 -7
- package/dist/browser/{chunk-WR2SQLKP.cjs.map → chunk-NK6D2G5O.cjs.map} +1 -1
- package/dist/browser/{chunk-GLL57K7P.js → chunk-PHE4P3DN.js} +3 -3
- package/dist/browser/{chunk-GLL57K7P.js.map → chunk-PHE4P3DN.js.map} +1 -1
- package/dist/{chunk-SJ625SQS.cjs → browser/chunk-PNUCUOUA.cjs} +15 -15
- package/dist/browser/{chunk-ZVVUZRG7.cjs.map → chunk-PNUCUOUA.cjs.map} +1 -1
- package/dist/browser/{chunk-47GVOQB4.cjs → chunk-TGN4FEKB.cjs} +12 -12
- package/dist/browser/{chunk-47GVOQB4.cjs.map → chunk-TGN4FEKB.cjs.map} +1 -1
- package/dist/{chunk-MNV4HASC.js → browser/chunk-TIZ5QRK2.js} +4 -4
- package/dist/browser/{chunk-UL5TNXQL.js.map → chunk-TIZ5QRK2.js.map} +1 -1
- package/dist/browser/{chunk-IHIS62VS.cjs → chunk-WG45SF7N.cjs} +22 -14
- package/dist/browser/chunk-WG45SF7N.cjs.map +1 -0
- package/dist/browser/{chunk-26Q2QD5J.cjs → chunk-ZAISDHUV.cjs} +5 -5
- package/dist/browser/{chunk-26Q2QD5J.cjs.map → chunk-ZAISDHUV.cjs.map} +1 -1
- package/dist/browser/index.cjs +91 -91
- package/dist/browser/index.js +8 -8
- package/dist/browser/integrations/pino.cjs +4 -4
- package/dist/browser/integrations/pino.js +3 -3
- package/dist/browser/langchain/index.cjs +17 -17
- package/dist/browser/langchain/index.js +2 -2
- package/dist/browser/langgraph/index.cjs +27 -27
- package/dist/browser/langgraph/index.js +5 -5
- package/dist/browser/openai/index.cjs +11 -11
- package/dist/browser/openai/index.js +2 -2
- package/dist/browser/openai-agents/index.cjs +34 -34
- package/dist/browser/openai-agents/index.js +4 -4
- package/dist/browser/vercel-ai/index.cjs +14 -14
- package/dist/browser/vercel-ai/index.js +3 -3
- package/dist/{chunk-QZDUGEIR.js → chunk-2GWOF5JM.js} +3 -3
- package/dist/{chunk-QZDUGEIR.js.map → chunk-2GWOF5JM.js.map} +1 -1
- package/dist/{chunk-DPW4W7H7.cjs → chunk-4QY5O46P.cjs} +18 -18
- package/dist/{chunk-DPW4W7H7.cjs.map → chunk-4QY5O46P.cjs.map} +1 -1
- package/dist/{chunk-ELVBOJWY.js → chunk-5YJXFU5U.js} +22 -14
- package/dist/chunk-5YJXFU5U.js.map +1 -0
- package/dist/{chunk-Z5MFR7UE.cjs → chunk-AT3YR5SP.cjs} +5 -5
- package/dist/{chunk-Z5MFR7UE.cjs.map → chunk-AT3YR5SP.cjs.map} +1 -1
- package/dist/{chunk-DGBQ3UI6.cjs → chunk-B3WEUUUK.cjs} +7 -7
- package/dist/{chunk-DGBQ3UI6.cjs.map → chunk-B3WEUUUK.cjs.map} +1 -1
- package/dist/{chunk-7I4ILCLY.js → chunk-DK3RX7RS.js} +4 -4
- package/dist/{chunk-7I4ILCLY.js.map → chunk-DK3RX7RS.js.map} +1 -1
- package/dist/{chunk-I3P5CHBV.cjs → chunk-K4FHTOBB.cjs} +12 -12
- package/dist/{chunk-I3P5CHBV.cjs.map → chunk-K4FHTOBB.cjs.map} +1 -1
- package/dist/{browser/chunk-UL5TNXQL.js → chunk-LEDIWC2M.js} +4 -4
- package/dist/{chunk-MNV4HASC.js.map → chunk-LEDIWC2M.js.map} +1 -1
- package/dist/{chunk-YKPZQPEW.js → chunk-QTATKDEI.js} +3 -3
- package/dist/{chunk-YKPZQPEW.js.map → chunk-QTATKDEI.js.map} +1 -1
- package/dist/{chunk-HONYN2OI.js → chunk-T5UFHQLZ.js} +3 -3
- package/dist/{chunk-HONYN2OI.js.map → chunk-T5UFHQLZ.js.map} +1 -1
- package/dist/{chunk-RRE2LX2A.cjs → chunk-TEWSIQ6E.cjs} +6 -6
- package/dist/{chunk-RRE2LX2A.cjs.map → chunk-TEWSIQ6E.cjs.map} +1 -1
- package/dist/{chunk-DQ4T2MJE.cjs → chunk-UV5FUVNK.cjs} +22 -14
- package/dist/chunk-UV5FUVNK.cjs.map +1 -0
- package/dist/{chunk-NR36TJMT.js → chunk-Z2AYPTB2.js} +5 -5
- package/dist/{chunk-NR36TJMT.js.map → chunk-Z2AYPTB2.js.map} +1 -1
- package/dist/{browser/chunk-ZVVUZRG7.cjs → chunk-ZFZTJXIO.cjs} +15 -15
- package/dist/{chunk-SJ625SQS.cjs.map → chunk-ZFZTJXIO.cjs.map} +1 -1
- package/dist/index.cjs +98 -98
- package/dist/index.js +9 -9
- package/dist/integrations/pino.cjs +4 -4
- package/dist/integrations/pino.js +3 -3
- package/dist/langchain/index.cjs +17 -17
- package/dist/langchain/index.js +2 -2
- package/dist/langgraph/index.cjs +27 -27
- package/dist/langgraph/index.js +5 -5
- package/dist/openai/index.cjs +11 -11
- package/dist/openai/index.js +2 -2
- package/dist/openai-agents/index.cjs +34 -34
- package/dist/openai-agents/index.js +4 -4
- package/dist/vercel-ai/index.cjs +14 -14
- package/dist/vercel-ai/index.js +3 -3
- package/package.json +1 -1
- package/dist/browser/chunk-IHIS62VS.cjs.map +0 -1
- package/dist/browser/chunk-V7AUPQIJ.js.map +0 -1
- package/dist/chunk-DQ4T2MJE.cjs.map +0 -1
- package/dist/chunk-ELVBOJWY.js.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
var
|
|
3
|
+
var chunk4QY5O46P_cjs = require('./chunk-4QY5O46P.cjs');
|
|
4
|
+
var chunkK4FHTOBB_cjs = require('./chunk-K4FHTOBB.cjs');
|
|
5
|
+
require('./chunk-AT3YR5SP.cjs');
|
|
6
|
+
var chunkTEWSIQ6E_cjs = require('./chunk-TEWSIQ6E.cjs');
|
|
7
7
|
require('./chunk-KBWPNIH4.cjs');
|
|
8
8
|
require('./chunk-HICEJ4LV.cjs');
|
|
9
|
-
var
|
|
9
|
+
var chunkUV5FUVNK_cjs = require('./chunk-UV5FUVNK.cjs');
|
|
10
10
|
var module$1 = require('module');
|
|
11
11
|
var instrumentationPg = require('@opentelemetry/instrumentation-pg');
|
|
12
12
|
var instrumentationMysql2 = require('@opentelemetry/instrumentation-mysql2');
|
|
@@ -14,10 +14,10 @@ var instrumentation = require('@opentelemetry/instrumentation');
|
|
|
14
14
|
var api = require('@opentelemetry/api');
|
|
15
15
|
|
|
16
16
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
17
|
-
|
|
17
|
+
chunkUV5FUVNK_cjs.init_env();
|
|
18
18
|
var FULL_INSTALL_TARGETS = {
|
|
19
19
|
"@anthropic-ai/sdk": {
|
|
20
|
-
install: (mod) =>
|
|
20
|
+
install: (mod) => chunk4QY5O46P_cjs.instrumentAnthropic({ anthropicModule: mod })
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
var DETECT_ONLY_TARGETS = {
|
|
@@ -96,7 +96,7 @@ function uninstallLazyHook() {
|
|
|
96
96
|
originalRequire = null;
|
|
97
97
|
}
|
|
98
98
|
async function installAdapters() {
|
|
99
|
-
if (
|
|
99
|
+
if (chunkUV5FUVNK_cjs.isAutoDetectDisabled()) return;
|
|
100
100
|
const nodeRequire = getNodeRequire();
|
|
101
101
|
if (!nodeRequire) return;
|
|
102
102
|
const installPromises = [];
|
|
@@ -134,11 +134,11 @@ function _resetForTesting3() {
|
|
|
134
134
|
}
|
|
135
135
|
|
|
136
136
|
// src/index.ts
|
|
137
|
-
|
|
137
|
+
chunkUV5FUVNK_cjs.init_env();
|
|
138
138
|
|
|
139
139
|
// src/_internal/db-capture.ts
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
chunkUV5FUVNK_cjs.init_env();
|
|
141
|
+
chunkUV5FUVNK_cjs.init_otel_provider();
|
|
142
142
|
var SEMCONV_DB_SYSTEM_NAME = "db.system.name";
|
|
143
143
|
var SEMCONV_DB_QUERY_TEXT = "db.query.text";
|
|
144
144
|
var DB_SYSTEM_NAME_SQLITE = "sqlite";
|
|
@@ -252,7 +252,7 @@ function registerDbInstrumentation() {
|
|
|
252
252
|
disableDbCapture();
|
|
253
253
|
try {
|
|
254
254
|
const instrumentations = buildDbInstrumentations();
|
|
255
|
-
const off =
|
|
255
|
+
const off = chunkUV5FUVNK_cjs.getEngine().registerInstrumentations(instrumentations);
|
|
256
256
|
if (off === null) return false;
|
|
257
257
|
unregister = off;
|
|
258
258
|
registeredInstrumentations = instrumentations;
|
|
@@ -274,18 +274,18 @@ function disableDbCapture() {
|
|
|
274
274
|
registeredInstrumentations = null;
|
|
275
275
|
}
|
|
276
276
|
function maybeEnableDbCaptureFromEnv() {
|
|
277
|
-
if (
|
|
277
|
+
if (chunkUV5FUVNK_cjs.isDbCaptureEnabled()) {
|
|
278
278
|
registerDbInstrumentation();
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
// src/index.ts
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
chunkUV5FUVNK_cjs.init_otel_provider();
|
|
284
|
+
chunkUV5FUVNK_cjs.init_redaction();
|
|
285
285
|
|
|
286
286
|
// src/_internal/transport.ts
|
|
287
|
-
|
|
288
|
-
var SDK_VERSION = "0.5.0-rc.
|
|
287
|
+
chunkUV5FUVNK_cjs.init_diagnostics();
|
|
288
|
+
var SDK_VERSION = "0.5.0-rc.6" ;
|
|
289
289
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
290
290
|
function parseRetryAfter(value) {
|
|
291
291
|
if (!value) return null;
|
|
@@ -390,11 +390,11 @@ var BatchTransport = class {
|
|
|
390
390
|
/** Enqueue an event. Non-blocking. Returns false if the queue is full. */
|
|
391
391
|
track(event) {
|
|
392
392
|
if (this.closed) {
|
|
393
|
-
|
|
393
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_SHUTDOWN_DROP, "trace");
|
|
394
394
|
return false;
|
|
395
395
|
}
|
|
396
396
|
if (this.queue.length >= this.maxQueueSize) {
|
|
397
|
-
|
|
397
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_QUEUE_FULL, "trace");
|
|
398
398
|
return false;
|
|
399
399
|
}
|
|
400
400
|
this.queue.push(event);
|
|
@@ -481,12 +481,12 @@ var BatchTransport = class {
|
|
|
481
481
|
body: JSON.stringify(payload),
|
|
482
482
|
signal: controller.signal
|
|
483
483
|
});
|
|
484
|
-
|
|
484
|
+
chunkUV5FUVNK_cjs.setLevel(resp.headers.get("X-Morse-Diagnostics"));
|
|
485
485
|
const droppedCount = countPayloadEntries(payload);
|
|
486
486
|
const droppedCategory = categoryOf(payload);
|
|
487
487
|
if (resp.status === 429) {
|
|
488
488
|
await recordQuotaState(resp);
|
|
489
|
-
|
|
489
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_QUOTA_REJECTED, droppedCategory, droppedCount);
|
|
490
490
|
}
|
|
491
491
|
if (!resp.ok) {
|
|
492
492
|
let bodySnippet = "";
|
|
@@ -496,9 +496,9 @@ var BatchTransport = class {
|
|
|
496
496
|
} catch {
|
|
497
497
|
}
|
|
498
498
|
if (resp.status !== 429) {
|
|
499
|
-
|
|
499
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_RETRY_EXHAUSTED, droppedCategory, droppedCount);
|
|
500
500
|
}
|
|
501
|
-
|
|
501
|
+
chunkUV5FUVNK_cjs.report(new Error(`morse: batch POST returned ${resp.status} ${bodySnippet}`), {
|
|
502
502
|
fingerprint: "morse.transport.post.non_2xx",
|
|
503
503
|
extra: {
|
|
504
504
|
endpoint_host: hostnameOf(url),
|
|
@@ -507,8 +507,8 @@ var BatchTransport = class {
|
|
|
507
507
|
});
|
|
508
508
|
}
|
|
509
509
|
} catch (err) {
|
|
510
|
-
|
|
511
|
-
|
|
510
|
+
chunkUV5FUVNK_cjs.recordDrop(chunkUV5FUVNK_cjs.REASON_RETRY_EXHAUSTED, categoryOf(payload), countPayloadEntries(payload));
|
|
511
|
+
chunkUV5FUVNK_cjs.report(err, {
|
|
512
512
|
fingerprint: "morse.transport.post.network",
|
|
513
513
|
extra: {
|
|
514
514
|
endpoint_host: hostnameOf(url),
|
|
@@ -552,10 +552,10 @@ function categoryOf(payload) {
|
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
// src/index.ts
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
555
|
+
chunkUV5FUVNK_cjs.init_tracing();
|
|
556
|
+
chunkUV5FUVNK_cjs.init_diagnostics();
|
|
557
|
+
chunkUV5FUVNK_cjs.init_spans();
|
|
558
|
+
chunkUV5FUVNK_cjs.init_propagation();
|
|
559
559
|
var version = SDK_VERSION;
|
|
560
560
|
var singleton = null;
|
|
561
561
|
var transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -575,9 +575,9 @@ function logDestinationOnce(endpoint) {
|
|
|
575
575
|
}
|
|
576
576
|
function resolveEndpoint(explicit) {
|
|
577
577
|
if (explicit && explicit.length > 0) return explicit;
|
|
578
|
-
const fromEnv =
|
|
578
|
+
const fromEnv = chunkUV5FUVNK_cjs.getEndpoint();
|
|
579
579
|
if (fromEnv) return fromEnv;
|
|
580
|
-
return
|
|
580
|
+
return chunkUV5FUVNK_cjs.DEFAULT_ENDPOINT;
|
|
581
581
|
}
|
|
582
582
|
var OTLP_TRACES_PATH = "/api/v1/otlp/v1/traces";
|
|
583
583
|
function deriveOtlpEndpoint(tracesEndpoint) {
|
|
@@ -592,10 +592,10 @@ function deriveOtlpEndpoint(tracesEndpoint) {
|
|
|
592
592
|
}
|
|
593
593
|
}
|
|
594
594
|
function buildSingleton(opts, redaction) {
|
|
595
|
-
if (
|
|
595
|
+
if (chunkUV5FUVNK_cjs.isDisabled()) {
|
|
596
596
|
return null;
|
|
597
597
|
}
|
|
598
|
-
const apiKey = opts.apiKey ??
|
|
598
|
+
const apiKey = opts.apiKey ?? chunkUV5FUVNK_cjs.getApiKey();
|
|
599
599
|
if (!apiKey) {
|
|
600
600
|
if (!noApiKeyWarningEmitted) {
|
|
601
601
|
logger2(
|
|
@@ -607,24 +607,24 @@ function buildSingleton(opts, redaction) {
|
|
|
607
607
|
return null;
|
|
608
608
|
}
|
|
609
609
|
const endpoint = resolveEndpoint(opts.endpoint);
|
|
610
|
-
const flushIntervalSeconds = opts.flushIntervalSeconds ??
|
|
610
|
+
const flushIntervalSeconds = opts.flushIntervalSeconds ?? chunkUV5FUVNK_cjs.getFlushIntervalSeconds();
|
|
611
611
|
const transport = transportFactory({ apiKey, endpoint, flushIntervalSeconds });
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
const explicitSource =
|
|
616
|
-
const resolvedSource = explicitSource ??
|
|
617
|
-
|
|
612
|
+
chunkUV5FUVNK_cjs.setTransport(transport);
|
|
613
|
+
chunkUV5FUVNK_cjs.setRedactionConfig(redaction);
|
|
614
|
+
chunkUV5FUVNK_cjs.setDiagnosticsClientConfig({ apiKey, endpoint });
|
|
615
|
+
const explicitSource = chunkUV5FUVNK_cjs.isValidInternalSource(opts.source) ? opts.source : void 0;
|
|
616
|
+
const resolvedSource = explicitSource ?? chunkUV5FUVNK_cjs.getInternalSource() ?? null;
|
|
617
|
+
chunkUV5FUVNK_cjs.setSource(resolvedSource);
|
|
618
618
|
logDestinationOnce(endpoint);
|
|
619
619
|
try {
|
|
620
|
-
|
|
620
|
+
chunkUV5FUVNK_cjs.getEngine().configure({
|
|
621
621
|
endpoint: deriveOtlpEndpoint(endpoint),
|
|
622
622
|
apiKey,
|
|
623
|
-
sampleRate:
|
|
623
|
+
sampleRate: chunkUV5FUVNK_cjs.getSampleRate(),
|
|
624
624
|
scheduleDelayMillis: flushIntervalSeconds * 1e3,
|
|
625
|
-
maxQueueSize:
|
|
626
|
-
maxExportBatchSize:
|
|
627
|
-
maxFieldBytes:
|
|
625
|
+
maxQueueSize: chunkUV5FUVNK_cjs.getMaxQueueSize(),
|
|
626
|
+
maxExportBatchSize: chunkUV5FUVNK_cjs.getMaxBatchSize(),
|
|
627
|
+
maxFieldBytes: chunkUV5FUVNK_cjs.getMaxFieldBytes(),
|
|
628
628
|
// 10s (not the exporter's un-overridden 30s ceiling): a genuine
|
|
629
629
|
// network blip still gets several retries with backoff; a fully dead
|
|
630
630
|
// endpoint fails within a bounded, shutdown-friendly window instead
|
|
@@ -633,32 +633,32 @@ function buildSingleton(opts, redaction) {
|
|
|
633
633
|
redactionConfig: redaction
|
|
634
634
|
});
|
|
635
635
|
} catch (err) {
|
|
636
|
-
|
|
636
|
+
chunkUV5FUVNK_cjs.report(err, { fingerprint: "morse.otel_provider.configure" });
|
|
637
637
|
}
|
|
638
638
|
void installAdapters().catch(() => {
|
|
639
639
|
});
|
|
640
640
|
try {
|
|
641
641
|
maybeEnableDbCaptureFromEnv();
|
|
642
642
|
} catch (err) {
|
|
643
|
-
|
|
643
|
+
chunkUV5FUVNK_cjs.report(err, { fingerprint: "morse.db_capture.register" });
|
|
644
644
|
}
|
|
645
645
|
return { apiKey, endpoint, transport, redaction };
|
|
646
646
|
}
|
|
647
647
|
function ensureInitialized() {
|
|
648
|
-
if (
|
|
648
|
+
if (chunkUV5FUVNK_cjs.isDisabled()) return null;
|
|
649
649
|
if (singleton !== null) return singleton;
|
|
650
|
-
singleton = buildSingleton({},
|
|
650
|
+
singleton = buildSingleton({}, chunkUV5FUVNK_cjs.buildRedactionConfig());
|
|
651
651
|
return singleton;
|
|
652
652
|
}
|
|
653
|
-
|
|
653
|
+
chunkK4FHTOBB_cjs._setEnsureInitialized(() => {
|
|
654
654
|
ensureInitialized();
|
|
655
655
|
});
|
|
656
656
|
function init(options = {}) {
|
|
657
|
-
if (
|
|
657
|
+
if (chunkUV5FUVNK_cjs.isDisabled()) {
|
|
658
658
|
logger2("info", "morse: MORSE_DISABLED=1 \u2014 SDK is a no-op");
|
|
659
659
|
return;
|
|
660
660
|
}
|
|
661
|
-
const redaction =
|
|
661
|
+
const redaction = chunkUV5FUVNK_cjs.buildRedactionConfig(options.redaction);
|
|
662
662
|
try {
|
|
663
663
|
if (singleton !== null) {
|
|
664
664
|
void singleton.transport.shutdown();
|
|
@@ -666,10 +666,10 @@ function init(options = {}) {
|
|
|
666
666
|
}
|
|
667
667
|
singleton = buildSingleton(options, redaction);
|
|
668
668
|
} catch (err) {
|
|
669
|
-
|
|
669
|
+
chunkUV5FUVNK_cjs.report(err, { fingerprint: "morse.init" });
|
|
670
670
|
}
|
|
671
671
|
}
|
|
672
|
-
var track =
|
|
672
|
+
var track = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
673
673
|
(options) => {
|
|
674
674
|
const state = ensureInitialized();
|
|
675
675
|
if (!state) return;
|
|
@@ -677,33 +677,33 @@ var track = chunkRRE2LX2A_cjs.absorbErrorsSync(
|
|
|
677
677
|
agent_id: options.agentId,
|
|
678
678
|
...options.runData
|
|
679
679
|
};
|
|
680
|
-
const redacted =
|
|
680
|
+
const redacted = chunkUV5FUVNK_cjs.redactValue(payload, state.redaction);
|
|
681
681
|
state.transport.track(redacted);
|
|
682
682
|
},
|
|
683
683
|
{ fingerprint: "morse.track" }
|
|
684
684
|
);
|
|
685
|
-
var batchTrack =
|
|
685
|
+
var batchTrack = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
686
686
|
(runs) => {
|
|
687
687
|
const state = ensureInitialized();
|
|
688
688
|
if (!state) return;
|
|
689
689
|
for (const run2 of runs) {
|
|
690
|
-
const redacted =
|
|
690
|
+
const redacted = chunkUV5FUVNK_cjs.redactValue(run2, state.redaction);
|
|
691
691
|
state.transport.track(redacted);
|
|
692
692
|
}
|
|
693
693
|
},
|
|
694
694
|
{ fingerprint: "morse.batch_track" }
|
|
695
695
|
);
|
|
696
|
-
var record =
|
|
696
|
+
var record = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
697
697
|
(rec) => {
|
|
698
698
|
const state = ensureInitialized();
|
|
699
699
|
if (!state) return;
|
|
700
|
-
const traceId =
|
|
701
|
-
const now =
|
|
700
|
+
const traceId = chunkUV5FUVNK_cjs.generateTraceId();
|
|
701
|
+
const now = chunkUV5FUVNK_cjs.nowIso();
|
|
702
702
|
const resolvedStatus = rec.errorMessage ? "failed" : rec.status ?? "completed";
|
|
703
703
|
const span2 = {
|
|
704
704
|
trace_id: traceId,
|
|
705
|
-
span_id:
|
|
706
|
-
type:
|
|
705
|
+
span_id: chunkUV5FUVNK_cjs.generateSpanId(),
|
|
706
|
+
type: chunkUV5FUVNK_cjs.SpanType.AGENT,
|
|
707
707
|
name: rec.agent,
|
|
708
708
|
started_at: now,
|
|
709
709
|
ended_at: now,
|
|
@@ -728,58 +728,58 @@ var record = chunkRRE2LX2A_cjs.absorbErrorsSync(
|
|
|
728
728
|
success: rec.success,
|
|
729
729
|
outcome: rec.outcome
|
|
730
730
|
};
|
|
731
|
-
const entry =
|
|
732
|
-
const redacted =
|
|
733
|
-
|
|
731
|
+
const entry = chunkUV5FUVNK_cjs.buildTraceEntry(traceFields, [span2]);
|
|
732
|
+
const redacted = chunkUV5FUVNK_cjs.redactValue(entry, state.redaction);
|
|
733
|
+
chunkUV5FUVNK_cjs.sendTrace(redacted);
|
|
734
734
|
},
|
|
735
735
|
{ fingerprint: "morse.record" }
|
|
736
736
|
);
|
|
737
737
|
function run(nameOrOpts, fn) {
|
|
738
738
|
const opts = typeof nameOrOpts === "string" ? { agentName: nameOrOpts } : nameOrOpts;
|
|
739
739
|
ensureInitialized();
|
|
740
|
-
return
|
|
740
|
+
return chunkUV5FUVNK_cjs.runSync(opts, fn);
|
|
741
741
|
}
|
|
742
742
|
function runTraced(options, fn) {
|
|
743
743
|
ensureInitialized();
|
|
744
|
-
return
|
|
744
|
+
return chunkUV5FUVNK_cjs.runAsync(options, fn);
|
|
745
745
|
}
|
|
746
746
|
function setContext2(dims) {
|
|
747
|
-
|
|
747
|
+
chunkUV5FUVNK_cjs.setContext(dims);
|
|
748
748
|
}
|
|
749
749
|
function startSpan2(options) {
|
|
750
|
-
return
|
|
750
|
+
return chunkUV5FUVNK_cjs.startSpan(options);
|
|
751
751
|
}
|
|
752
752
|
function span(options, fn) {
|
|
753
|
-
return
|
|
753
|
+
return chunkUV5FUVNK_cjs.spanSync(options, fn);
|
|
754
754
|
}
|
|
755
755
|
function spanAsync2(options, fn) {
|
|
756
|
-
return
|
|
756
|
+
return chunkUV5FUVNK_cjs.spanAsync(options, fn);
|
|
757
757
|
}
|
|
758
|
-
var flush =
|
|
758
|
+
var flush = chunkTEWSIQ6E_cjs.absorbErrorsAsync(
|
|
759
759
|
async () => {
|
|
760
760
|
if (singleton !== null) {
|
|
761
761
|
await singleton.transport.flush();
|
|
762
|
-
await
|
|
762
|
+
await chunkUV5FUVNK_cjs.getEngine().flush();
|
|
763
763
|
}
|
|
764
764
|
},
|
|
765
765
|
{ fingerprint: "morse.flush" }
|
|
766
766
|
);
|
|
767
|
-
var quotaState2 =
|
|
767
|
+
var quotaState2 = chunkTEWSIQ6E_cjs.absorbErrorsSync(
|
|
768
768
|
() => {
|
|
769
769
|
if (singleton === null) return null;
|
|
770
770
|
return getQuotaState();
|
|
771
771
|
},
|
|
772
772
|
{ fingerprint: "morse.quota_state" }
|
|
773
773
|
);
|
|
774
|
-
var shutdown =
|
|
774
|
+
var shutdown = chunkTEWSIQ6E_cjs.absorbErrorsAsync(
|
|
775
775
|
async () => {
|
|
776
776
|
if (singleton !== null) {
|
|
777
777
|
await singleton.transport.shutdown();
|
|
778
|
-
await
|
|
779
|
-
|
|
780
|
-
await
|
|
778
|
+
await chunkUV5FUVNK_cjs.getEngine().flush();
|
|
779
|
+
chunkUV5FUVNK_cjs.getEngine().shutdown();
|
|
780
|
+
await chunkUV5FUVNK_cjs.flushOnce();
|
|
781
781
|
singleton = null;
|
|
782
|
-
|
|
782
|
+
chunkUV5FUVNK_cjs.setTransport(null);
|
|
783
783
|
}
|
|
784
784
|
},
|
|
785
785
|
{ fingerprint: "morse.shutdown" }
|
|
@@ -788,14 +788,14 @@ function _resetForTesting4() {
|
|
|
788
788
|
if (singleton !== null) {
|
|
789
789
|
void singleton.transport.shutdown();
|
|
790
790
|
singleton = null;
|
|
791
|
-
|
|
791
|
+
chunkUV5FUVNK_cjs.setTransport(null);
|
|
792
792
|
}
|
|
793
|
-
|
|
793
|
+
chunkUV5FUVNK_cjs.getEngine().resetForTesting();
|
|
794
794
|
noApiKeyWarningEmitted = false;
|
|
795
795
|
lastLoggedEndpoint = null;
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
796
|
+
chunkUV5FUVNK_cjs.setSource(null);
|
|
797
|
+
chunkUV5FUVNK_cjs._resetForTesting2();
|
|
798
|
+
chunkUV5FUVNK_cjs._resetForTesting();
|
|
799
799
|
_resetForTesting3();
|
|
800
800
|
_resetQuotaStateForTesting();
|
|
801
801
|
transportFactory = (opts) => new BatchTransport(opts);
|
|
@@ -804,59 +804,59 @@ function _setTransportFactoryForTesting(factory) {
|
|
|
804
804
|
transportFactory = factory;
|
|
805
805
|
}
|
|
806
806
|
function _getLastTraceForTesting() {
|
|
807
|
-
return
|
|
807
|
+
return chunkUV5FUVNK_cjs.getLastTrace();
|
|
808
808
|
}
|
|
809
809
|
function _getActiveTraceStateForTesting() {
|
|
810
|
-
return
|
|
810
|
+
return chunkUV5FUVNK_cjs.getActiveTraceState();
|
|
811
811
|
}
|
|
812
812
|
|
|
813
813
|
Object.defineProperty(exports, "MAX_SEGMENT_CONTENT_BYTES", {
|
|
814
814
|
enumerable: true,
|
|
815
|
-
get: function () { return
|
|
815
|
+
get: function () { return chunk4QY5O46P_cjs.MAX_SEGMENT_CONTENT_BYTES; }
|
|
816
816
|
});
|
|
817
817
|
Object.defineProperty(exports, "extractAnthropicSegments", {
|
|
818
818
|
enumerable: true,
|
|
819
|
-
get: function () { return
|
|
819
|
+
get: function () { return chunk4QY5O46P_cjs.extractAnthropicSegments; }
|
|
820
820
|
});
|
|
821
821
|
Object.defineProperty(exports, "instrumentAnthropic", {
|
|
822
822
|
enumerable: true,
|
|
823
|
-
get: function () { return
|
|
823
|
+
get: function () { return chunk4QY5O46P_cjs.instrumentAnthropic; }
|
|
824
824
|
});
|
|
825
825
|
Object.defineProperty(exports, "isAnthropicWrapped", {
|
|
826
826
|
enumerable: true,
|
|
827
|
-
get: function () { return
|
|
827
|
+
get: function () { return chunk4QY5O46P_cjs.isAnthropicWrapped; }
|
|
828
828
|
});
|
|
829
829
|
Object.defineProperty(exports, "uninstallAnthropic", {
|
|
830
830
|
enumerable: true,
|
|
831
|
-
get: function () { return
|
|
831
|
+
get: function () { return chunk4QY5O46P_cjs.uninstallAnthropic; }
|
|
832
832
|
});
|
|
833
833
|
Object.defineProperty(exports, "wrapAnthropic", {
|
|
834
834
|
enumerable: true,
|
|
835
|
-
get: function () { return
|
|
835
|
+
get: function () { return chunk4QY5O46P_cjs.wrapAnthropic; }
|
|
836
836
|
});
|
|
837
837
|
Object.defineProperty(exports, "log", {
|
|
838
838
|
enumerable: true,
|
|
839
|
-
get: function () { return
|
|
839
|
+
get: function () { return chunkK4FHTOBB_cjs.log; }
|
|
840
840
|
});
|
|
841
841
|
Object.defineProperty(exports, "W3C_TRACEPARENT_HEADER", {
|
|
842
842
|
enumerable: true,
|
|
843
|
-
get: function () { return
|
|
843
|
+
get: function () { return chunkUV5FUVNK_cjs.W3C_TRACEPARENT_HEADER; }
|
|
844
844
|
});
|
|
845
845
|
Object.defineProperty(exports, "extractTraceparent", {
|
|
846
846
|
enumerable: true,
|
|
847
|
-
get: function () { return
|
|
847
|
+
get: function () { return chunkUV5FUVNK_cjs.extractTraceparent; }
|
|
848
848
|
});
|
|
849
849
|
Object.defineProperty(exports, "formatTraceparent", {
|
|
850
850
|
enumerable: true,
|
|
851
|
-
get: function () { return
|
|
851
|
+
get: function () { return chunkUV5FUVNK_cjs.formatTraceparent; }
|
|
852
852
|
});
|
|
853
853
|
Object.defineProperty(exports, "injectIntoRequestInit", {
|
|
854
854
|
enumerable: true,
|
|
855
|
-
get: function () { return
|
|
855
|
+
get: function () { return chunkUV5FUVNK_cjs.injectIntoRequestInit; }
|
|
856
856
|
});
|
|
857
857
|
Object.defineProperty(exports, "injectTraceparent", {
|
|
858
858
|
enumerable: true,
|
|
859
|
-
get: function () { return
|
|
859
|
+
get: function () { return chunkUV5FUVNK_cjs.injectTraceparent; }
|
|
860
860
|
});
|
|
861
861
|
exports._getActiveTraceStateForTesting = _getActiveTraceStateForTesting;
|
|
862
862
|
exports._getLastTraceForTesting = _getLastTraceForTesting;
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { instrumentAnthropic } from './chunk-
|
|
2
|
-
export { MAX_SEGMENT_CONTENT_BYTES, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from './chunk-
|
|
3
|
-
import { _setEnsureInitialized } from './chunk-
|
|
4
|
-
export { log } from './chunk-
|
|
5
|
-
import './chunk-
|
|
6
|
-
import { absorbErrorsSync, absorbErrorsAsync } from './chunk-
|
|
1
|
+
import { instrumentAnthropic } from './chunk-Z2AYPTB2.js';
|
|
2
|
+
export { MAX_SEGMENT_CONTENT_BYTES, extractAnthropicSegments, instrumentAnthropic, isAnthropicWrapped, uninstallAnthropic, wrapAnthropic } from './chunk-Z2AYPTB2.js';
|
|
3
|
+
import { _setEnsureInitialized } from './chunk-DK3RX7RS.js';
|
|
4
|
+
export { log } from './chunk-DK3RX7RS.js';
|
|
5
|
+
import './chunk-2GWOF5JM.js';
|
|
6
|
+
import { absorbErrorsSync, absorbErrorsAsync } from './chunk-QTATKDEI.js';
|
|
7
7
|
import './chunk-XTKMUJWI.js';
|
|
8
8
|
import './chunk-4JPZV2VZ.js';
|
|
9
|
-
import { init_env, init_otel_provider, init_redaction, init_diagnostics, init_tracing, init_spans, init_propagation, redactValue, generateTraceId, nowIso, SpanType, generateSpanId, buildTraceEntry, sendTrace, isDisabled, buildRedactionConfig, getApiKey, getFlushIntervalSeconds, setTransport, setRedactionConfig, setDiagnosticsClientConfig, isValidInternalSource, getInternalSource, setSource, getEngine, getMaxFieldBytes, getMaxBatchSize, getMaxQueueSize, getSampleRate, report, getEndpoint, DEFAULT_ENDPOINT, isAutoDetectDisabled, isDbCaptureEnabled, recordDrop, REASON_SHUTDOWN_DROP, REASON_QUEUE_FULL, setLevel, REASON_QUOTA_REJECTED, REASON_RETRY_EXHAUSTED, runSync, runAsync, setContext, startSpan, spanSync, spanAsync, flushOnce, _resetForTesting2, _resetForTesting, getLastTrace, getActiveTraceState } from './chunk-
|
|
10
|
-
export { W3C_TRACEPARENT_HEADER, extractTraceparent, formatTraceparent, injectIntoRequestInit, injectTraceparent } from './chunk-
|
|
9
|
+
import { init_env, init_otel_provider, init_redaction, init_diagnostics, init_tracing, init_spans, init_propagation, redactValue, generateTraceId, nowIso, SpanType, generateSpanId, buildTraceEntry, sendTrace, isDisabled, buildRedactionConfig, getApiKey, getFlushIntervalSeconds, setTransport, setRedactionConfig, setDiagnosticsClientConfig, isValidInternalSource, getInternalSource, setSource, getEngine, getMaxFieldBytes, getMaxBatchSize, getMaxQueueSize, getSampleRate, report, getEndpoint, DEFAULT_ENDPOINT, isAutoDetectDisabled, isDbCaptureEnabled, recordDrop, REASON_SHUTDOWN_DROP, REASON_QUEUE_FULL, setLevel, REASON_QUOTA_REJECTED, REASON_RETRY_EXHAUSTED, runSync, runAsync, setContext, startSpan, spanSync, spanAsync, flushOnce, _resetForTesting2, _resetForTesting, getLastTrace, getActiveTraceState } from './chunk-5YJXFU5U.js';
|
|
10
|
+
export { W3C_TRACEPARENT_HEADER, extractTraceparent, formatTraceparent, injectIntoRequestInit, injectTraceparent } from './chunk-5YJXFU5U.js';
|
|
11
11
|
import { createRequire, Module } from 'module';
|
|
12
12
|
import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';
|
|
13
13
|
import { MySQL2Instrumentation } from '@opentelemetry/instrumentation-mysql2';
|
|
@@ -285,7 +285,7 @@ init_redaction();
|
|
|
285
285
|
|
|
286
286
|
// src/_internal/transport.ts
|
|
287
287
|
init_diagnostics();
|
|
288
|
-
var SDK_VERSION = "0.5.0-rc.
|
|
288
|
+
var SDK_VERSION = "0.5.0-rc.6" ;
|
|
289
289
|
var RETRY_AFTER_CAP_SECONDS = 30;
|
|
290
290
|
function parseRetryAfter(value) {
|
|
291
291
|
if (!value) return null;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
5
|
-
require('../chunk-
|
|
3
|
+
var chunkK4FHTOBB_cjs = require('../chunk-K4FHTOBB.cjs');
|
|
4
|
+
require('../chunk-TEWSIQ6E.cjs');
|
|
5
|
+
require('../chunk-UV5FUVNK.cjs');
|
|
6
6
|
var stream = require('stream');
|
|
7
7
|
|
|
8
8
|
function pinoLevelToSeverity(level) {
|
|
@@ -36,7 +36,7 @@ function forwardPinoRecord(record) {
|
|
|
36
36
|
const msg = typeof record.msg === "string" ? record.msg : "";
|
|
37
37
|
const serviceName = typeof record.name === "string" && record.name.length > 0 ? record.name : void 0;
|
|
38
38
|
const attributes = pickAttributes(record);
|
|
39
|
-
|
|
39
|
+
chunkK4FHTOBB_cjs.log(msg, {
|
|
40
40
|
severity,
|
|
41
41
|
attributes,
|
|
42
42
|
...serviceName ? { serviceName } : {}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { log } from '../chunk-
|
|
2
|
-
import '../chunk-
|
|
3
|
-
import '../chunk-
|
|
1
|
+
import { log } from '../chunk-DK3RX7RS.js';
|
|
2
|
+
import '../chunk-QTATKDEI.js';
|
|
3
|
+
import '../chunk-5YJXFU5U.js';
|
|
4
4
|
import { Writable } from 'stream';
|
|
5
5
|
|
|
6
6
|
function pinoLevelToSeverity(level) {
|