neatlogs 1.1.21 → 1.1.22
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 +12 -9
- package/dist/ai-sdk.cjs +162 -24
- package/dist/ai-sdk.cjs.map +1 -1
- package/dist/ai-sdk.d.ts +13 -4
- package/dist/ai-sdk.mjs +152 -24
- package/dist/ai-sdk.mjs.map +1 -1
- package/dist/cli.cjs +12 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +12 -8
- package/dist/cli.mjs.map +1 -1
- package/dist/index.cjs +167 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +167 -35
- package/dist/index.mjs.map +1 -1
- package/dist/opencode-plugin.cjs +1 -1
- package/dist/opencode-plugin.cjs.map +1 -1
- package/dist/opencode-plugin.mjs +1 -1
- package/dist/opencode-plugin.mjs.map +1 -1
- package/package.json +13 -3
package/dist/index.cjs
CHANGED
|
@@ -8494,16 +8494,20 @@ var ObservableBatchLogRecordProcessor = class extends import_sdk_logs.BatchLogRe
|
|
|
8494
8494
|
// src/core/log.ts
|
|
8495
8495
|
var import_node_async_hooks5 = require("async_hooks");
|
|
8496
8496
|
var logger12 = getLogger();
|
|
8497
|
-
var
|
|
8498
|
-
var
|
|
8497
|
+
var LOG_RUNTIME_STATE_KEY = /* @__PURE__ */ Symbol.for("neatlogs.log_runtime_state");
|
|
8498
|
+
var neatlogsGlobal3 = globalThis;
|
|
8499
|
+
var logRuntimeState = neatlogsGlobal3[LOG_RUNTIME_STATE_KEY] ?? (neatlogsGlobal3[LOG_RUNTIME_STATE_KEY] = {
|
|
8500
|
+
otelLogger: null,
|
|
8501
|
+
debugMode: false
|
|
8502
|
+
});
|
|
8499
8503
|
var stdoutCaptureContext = new import_node_async_hooks5.AsyncLocalStorage();
|
|
8500
8504
|
function resolveOtelLogger() {
|
|
8501
8505
|
const client = getActiveClient();
|
|
8502
|
-
return client ? client.getLogger() :
|
|
8506
|
+
return client ? client.getLogger() : logRuntimeState.otelLogger;
|
|
8503
8507
|
}
|
|
8504
8508
|
function _setOtelLogger(otelLogger, debug) {
|
|
8505
|
-
|
|
8506
|
-
|
|
8509
|
+
logRuntimeState.otelLogger = otelLogger;
|
|
8510
|
+
logRuntimeState.debugMode = debug;
|
|
8507
8511
|
}
|
|
8508
8512
|
function log(msgTemplate, options) {
|
|
8509
8513
|
const { level = "info", ...variables } = options ?? {};
|
|
@@ -8511,7 +8515,7 @@ function log(msgTemplate, options) {
|
|
|
8511
8515
|
for (const [key, value] of Object.entries(variables)) {
|
|
8512
8516
|
rendered = rendered.replace(new RegExp(`\\{${key}\\}`, "g"), String(value));
|
|
8513
8517
|
}
|
|
8514
|
-
if (
|
|
8518
|
+
if (logRuntimeState.debugMode) {
|
|
8515
8519
|
console.log(`[neatlogs:log] ${rendered}`);
|
|
8516
8520
|
}
|
|
8517
8521
|
const otelLogger = resolveOtelLogger();
|
|
@@ -9376,7 +9380,7 @@ function _resetMastraCache() {
|
|
|
9376
9380
|
}
|
|
9377
9381
|
|
|
9378
9382
|
// src/version.ts
|
|
9379
|
-
var __version__ = "1.1.
|
|
9383
|
+
var __version__ = "1.1.22";
|
|
9380
9384
|
|
|
9381
9385
|
// src/core/deadline.ts
|
|
9382
9386
|
async function runByDeadline(operation, deadlineMs) {
|
|
@@ -9412,7 +9416,7 @@ var _logProvider = null;
|
|
|
9412
9416
|
var _spanProcessor = null;
|
|
9413
9417
|
var _transportSpanProcessors = [];
|
|
9414
9418
|
var _completionProcessor = null;
|
|
9415
|
-
var
|
|
9419
|
+
var _debugMode = false;
|
|
9416
9420
|
var _deliveryDiagnostics = new DeliveryDiagnostics();
|
|
9417
9421
|
var _initIdentity = null;
|
|
9418
9422
|
var _effectiveSampleRate = 1;
|
|
@@ -9704,7 +9708,7 @@ async function _performInit(options) {
|
|
|
9704
9708
|
if (options.debug) {
|
|
9705
9709
|
enableDebugLogging();
|
|
9706
9710
|
}
|
|
9707
|
-
|
|
9711
|
+
_debugMode = options.debug ?? false;
|
|
9708
9712
|
const resolvedWorkflowName = _resolveWorkflowName(options.workflowName);
|
|
9709
9713
|
const endpoint = resolveInitEndpoint(options.endpoint);
|
|
9710
9714
|
const baseUrl = resolveIngestBaseUrl(endpoint);
|
|
@@ -10090,7 +10094,7 @@ async function _performShutdown(terminationReason, timeoutMs) {
|
|
|
10090
10094
|
_spanProcessor = null;
|
|
10091
10095
|
_transportSpanProcessors = [];
|
|
10092
10096
|
_completionProcessor = null;
|
|
10093
|
-
|
|
10097
|
+
_debugMode = false;
|
|
10094
10098
|
_effectiveSampleRate = 1;
|
|
10095
10099
|
_exportEnabled = false;
|
|
10096
10100
|
_queueMaxSize = 2048;
|
|
@@ -10102,7 +10106,7 @@ async function _performShutdown(terminationReason, timeoutMs) {
|
|
|
10102
10106
|
return success;
|
|
10103
10107
|
}
|
|
10104
10108
|
function isDebugEnabled() {
|
|
10105
|
-
return
|
|
10109
|
+
return _debugMode;
|
|
10106
10110
|
}
|
|
10107
10111
|
function _doctorRuntimeSnapshot() {
|
|
10108
10112
|
return {
|
|
@@ -10682,10 +10686,104 @@ function setHeader(carrier, name, value) {
|
|
|
10682
10686
|
// src/ai-sdk.ts
|
|
10683
10687
|
var import_api13 = require("@opentelemetry/api");
|
|
10684
10688
|
var TRACER_NAME2 = "neatlogs.ai-sdk";
|
|
10689
|
+
var NEATLOGS_V7_INTEGRATION = /* @__PURE__ */ Symbol("neatlogs.ai-sdk.v7-integration");
|
|
10690
|
+
var LazyV7OpenTelemetryIntegration = class {
|
|
10691
|
+
constructor(tracer, metadata) {
|
|
10692
|
+
this.tracer = tracer;
|
|
10693
|
+
this.metadata = metadata;
|
|
10694
|
+
}
|
|
10695
|
+
tracer;
|
|
10696
|
+
metadata;
|
|
10697
|
+
[NEATLOGS_V7_INTEGRATION] = true;
|
|
10698
|
+
delegatePromise;
|
|
10699
|
+
getDelegate() {
|
|
10700
|
+
return this.delegatePromise ??= import("@ai-sdk/otel").then(
|
|
10701
|
+
({ OpenTelemetry }) => new OpenTelemetry({
|
|
10702
|
+
tracer: this.tracer,
|
|
10703
|
+
enrichSpan: () => this.metadata
|
|
10704
|
+
})
|
|
10705
|
+
).catch((error) => {
|
|
10706
|
+
const detail = error instanceof Error ? `: ${error.message}` : "";
|
|
10707
|
+
throw new Error(
|
|
10708
|
+
"Vercel AI SDK v7 telemetry requires the optional @ai-sdk/otel peer dependency" + detail
|
|
10709
|
+
);
|
|
10710
|
+
});
|
|
10711
|
+
}
|
|
10712
|
+
async notify(method, event) {
|
|
10713
|
+
const delegate = await this.getDelegate();
|
|
10714
|
+
const fn = delegate[method];
|
|
10715
|
+
if (typeof fn === "function") {
|
|
10716
|
+
await Reflect.apply(fn, delegate, [event]);
|
|
10717
|
+
}
|
|
10718
|
+
}
|
|
10719
|
+
onStart(event) {
|
|
10720
|
+
return this.notify("onStart", event);
|
|
10721
|
+
}
|
|
10722
|
+
onStepStart(event) {
|
|
10723
|
+
return this.notify("onStepStart", event);
|
|
10724
|
+
}
|
|
10725
|
+
onLanguageModelCallStart(event) {
|
|
10726
|
+
return this.notify("onLanguageModelCallStart", event);
|
|
10727
|
+
}
|
|
10728
|
+
onLanguageModelCallEnd(event) {
|
|
10729
|
+
return this.notify("onLanguageModelCallEnd", event);
|
|
10730
|
+
}
|
|
10731
|
+
onToolExecutionStart(event) {
|
|
10732
|
+
return this.notify("onToolExecutionStart", event);
|
|
10733
|
+
}
|
|
10734
|
+
onToolExecutionEnd(event) {
|
|
10735
|
+
return this.notify("onToolExecutionEnd", event);
|
|
10736
|
+
}
|
|
10737
|
+
onStepEnd(event) {
|
|
10738
|
+
return this.notify("onStepEnd", event);
|
|
10739
|
+
}
|
|
10740
|
+
onStepFinish(event) {
|
|
10741
|
+
return this.notify("onStepFinish", event);
|
|
10742
|
+
}
|
|
10743
|
+
onObjectStepStart(event) {
|
|
10744
|
+
return this.notify("onObjectStepStart", event);
|
|
10745
|
+
}
|
|
10746
|
+
onObjectStepEnd(event) {
|
|
10747
|
+
return this.notify("onObjectStepEnd", event);
|
|
10748
|
+
}
|
|
10749
|
+
onEmbedStart(event) {
|
|
10750
|
+
return this.notify("onEmbedStart", event);
|
|
10751
|
+
}
|
|
10752
|
+
onEmbedEnd(event) {
|
|
10753
|
+
return this.notify("onEmbedEnd", event);
|
|
10754
|
+
}
|
|
10755
|
+
onRerankStart(event) {
|
|
10756
|
+
return this.notify("onRerankStart", event);
|
|
10757
|
+
}
|
|
10758
|
+
onRerankEnd(event) {
|
|
10759
|
+
return this.notify("onRerankEnd", event);
|
|
10760
|
+
}
|
|
10761
|
+
onEnd(event) {
|
|
10762
|
+
return this.notify("onEnd", event);
|
|
10763
|
+
}
|
|
10764
|
+
onAbort(event) {
|
|
10765
|
+
return this.notify("onAbort", event);
|
|
10766
|
+
}
|
|
10767
|
+
onError(event) {
|
|
10768
|
+
return this.notify("onError", event);
|
|
10769
|
+
}
|
|
10770
|
+
async executeLanguageModelCall(options) {
|
|
10771
|
+
const delegate = await this.getDelegate();
|
|
10772
|
+
const fn = delegate.executeLanguageModelCall;
|
|
10773
|
+
return typeof fn === "function" ? Reflect.apply(fn, delegate, [options]) : options.execute();
|
|
10774
|
+
}
|
|
10775
|
+
async executeTool(options) {
|
|
10776
|
+
const delegate = await this.getDelegate();
|
|
10777
|
+
const fn = delegate.executeTool;
|
|
10778
|
+
return typeof fn === "function" ? Reflect.apply(fn, delegate, [options]) : options.execute();
|
|
10779
|
+
}
|
|
10780
|
+
};
|
|
10685
10781
|
function createAITelemetry(opts = {}) {
|
|
10686
10782
|
const userMeta = opts.metadata ?? {};
|
|
10687
10783
|
const neatlogsTracer = getRoutingNeatlogsTracer(TRACER_NAME2);
|
|
10688
10784
|
const callerTracer = opts.tracer;
|
|
10785
|
+
const tracer = callerTracer ? createMirroredTracer(callerTracer, neatlogsTracer) : neatlogsTracer;
|
|
10786
|
+
const metadata = callerTracer ? { ...userMeta } : { ...userMeta, neatlogsWrapped: true };
|
|
10689
10787
|
return {
|
|
10690
10788
|
isEnabled: true,
|
|
10691
10789
|
recordInputs: true,
|
|
@@ -10694,11 +10792,12 @@ function createAITelemetry(opts = {}) {
|
|
|
10694
10792
|
// internally, which would otherwise parent its native spans from the foreign
|
|
10695
10793
|
// global context AND push them onto it (so a co-tenant's next span inherits
|
|
10696
10794
|
// ours). The facade routes both through the private Neatlogs context.
|
|
10697
|
-
tracer
|
|
10795
|
+
tracer,
|
|
10698
10796
|
...opts.functionId !== void 0 ? { functionId: opts.functionId } : {},
|
|
10699
10797
|
// The marker is an implementation detail used only when Neatlogs owns the
|
|
10700
10798
|
// telemetry stream. Do not leak it into caller-owned providers.
|
|
10701
|
-
metadata
|
|
10799
|
+
metadata,
|
|
10800
|
+
integrations: [new LazyV7OpenTelemetryIntegration(tracer, metadata)]
|
|
10702
10801
|
};
|
|
10703
10802
|
}
|
|
10704
10803
|
function safeStringify2(value) {
|
|
@@ -10731,7 +10830,7 @@ function setOutputValue(span2, result) {
|
|
|
10731
10830
|
span2.setAttribute("output.value", text);
|
|
10732
10831
|
}
|
|
10733
10832
|
if (r.finishReason) {
|
|
10734
|
-
span2.setAttribute("
|
|
10833
|
+
span2.setAttribute("neatlogs.llm.finish_reason", String(r.finishReason));
|
|
10735
10834
|
}
|
|
10736
10835
|
return;
|
|
10737
10836
|
}
|
|
@@ -10740,7 +10839,7 @@ function setOutputValue(span2, result) {
|
|
|
10740
10839
|
span2.setAttribute("output.value", safeStringify2(r.object));
|
|
10741
10840
|
}
|
|
10742
10841
|
if (r.finishReason) {
|
|
10743
|
-
span2.setAttribute("
|
|
10842
|
+
span2.setAttribute("neatlogs.llm.finish_reason", String(r.finishReason));
|
|
10744
10843
|
}
|
|
10745
10844
|
return;
|
|
10746
10845
|
}
|
|
@@ -10760,7 +10859,7 @@ function setStreamOutputValue(span2, event) {
|
|
|
10760
10859
|
if (stringified) span2.setAttribute("output.value", stringified);
|
|
10761
10860
|
}
|
|
10762
10861
|
if (e.finishReason) {
|
|
10763
|
-
span2.setAttribute("
|
|
10862
|
+
span2.setAttribute("neatlogs.llm.finish_reason", String(e.finishReason));
|
|
10764
10863
|
}
|
|
10765
10864
|
}
|
|
10766
10865
|
var WRAPPED_FUNCTIONS = [
|
|
@@ -10780,6 +10879,8 @@ var wrappedExports = /* @__PURE__ */ new WeakSet();
|
|
|
10780
10879
|
var wrapperByOriginal = /* @__PURE__ */ new WeakMap();
|
|
10781
10880
|
function wrapAISDK(aiModule) {
|
|
10782
10881
|
const wrapped = { ...aiModule };
|
|
10882
|
+
const hasRegisterTelemetry = "registerTelemetry" in aiModule && typeof Reflect.get(aiModule, "registerTelemetry") === "function";
|
|
10883
|
+
const telemetryKey = hasRegisterTelemetry ? "telemetry" : "experimental_telemetry";
|
|
10783
10884
|
for (const name of WRAPPED_FUNCTIONS) {
|
|
10784
10885
|
const original = aiModule[name];
|
|
10785
10886
|
if (typeof original !== "function") continue;
|
|
@@ -10791,12 +10892,16 @@ function wrapAISDK(aiModule) {
|
|
|
10791
10892
|
if (name === "streamText" || name === "streamObject") {
|
|
10792
10893
|
wrapped[name] = cacheWrapper(
|
|
10793
10894
|
original,
|
|
10794
|
-
createStreamWrapper(name, original)
|
|
10895
|
+
createStreamWrapper(name, original, telemetryKey)
|
|
10795
10896
|
);
|
|
10796
10897
|
} else {
|
|
10797
10898
|
wrapped[name] = cacheWrapper(
|
|
10798
10899
|
original,
|
|
10799
|
-
createAsyncWrapper(
|
|
10900
|
+
createAsyncWrapper(
|
|
10901
|
+
name,
|
|
10902
|
+
original,
|
|
10903
|
+
telemetryKey
|
|
10904
|
+
)
|
|
10800
10905
|
);
|
|
10801
10906
|
}
|
|
10802
10907
|
}
|
|
@@ -10806,7 +10911,7 @@ function wrapAISDK(aiModule) {
|
|
|
10806
10911
|
const existing = getExistingWrapper(original);
|
|
10807
10912
|
wrapped[name] = existing ?? cacheWrapper(
|
|
10808
10913
|
original,
|
|
10809
|
-
createAgentConstructorWrapper(original)
|
|
10914
|
+
createAgentConstructorWrapper(original, telemetryKey)
|
|
10810
10915
|
);
|
|
10811
10916
|
}
|
|
10812
10917
|
return wrapped;
|
|
@@ -10820,26 +10925,30 @@ function cacheWrapper(original, wrapped) {
|
|
|
10820
10925
|
wrappedExports.add(wrapped);
|
|
10821
10926
|
return wrapped;
|
|
10822
10927
|
}
|
|
10823
|
-
function createAgentConstructorWrapper(original) {
|
|
10928
|
+
function createAgentConstructorWrapper(original, telemetryKey) {
|
|
10824
10929
|
return new Proxy(original, {
|
|
10825
10930
|
construct(target, args, newTarget) {
|
|
10826
10931
|
if (args.length === 0 || typeof args[0] !== "object" || args[0] === null) {
|
|
10827
10932
|
return Reflect.construct(target, args, newTarget);
|
|
10828
10933
|
}
|
|
10829
|
-
const settings = mergeAgentSettings(args[0]);
|
|
10934
|
+
const settings = mergeAgentSettings(args[0], telemetryKey);
|
|
10830
10935
|
return Reflect.construct(target, [settings, ...args.slice(1)], newTarget);
|
|
10831
10936
|
}
|
|
10832
10937
|
});
|
|
10833
10938
|
}
|
|
10834
|
-
function mergeAgentSettings(settings) {
|
|
10835
|
-
const merged = mergeTelemetry(settings);
|
|
10939
|
+
function mergeAgentSettings(settings, telemetryKey) {
|
|
10940
|
+
const merged = mergeTelemetry(settings, telemetryKey);
|
|
10836
10941
|
const userPrepareCall = settings.prepareCall;
|
|
10837
10942
|
if (typeof userPrepareCall !== "function") return merged;
|
|
10838
10943
|
return {
|
|
10839
10944
|
...merged,
|
|
10840
10945
|
prepareCall: async function wrappedPrepareCall(...args) {
|
|
10841
10946
|
const prepared = await Reflect.apply(userPrepareCall, this, args);
|
|
10842
|
-
return prepared == null ? prepared : mergeTelemetry(
|
|
10947
|
+
return prepared == null ? prepared : mergeTelemetry(
|
|
10948
|
+
prepared,
|
|
10949
|
+
telemetryKey,
|
|
10950
|
+
settings.telemetry ?? settings.experimental_telemetry
|
|
10951
|
+
);
|
|
10843
10952
|
}
|
|
10844
10953
|
};
|
|
10845
10954
|
}
|
|
@@ -10851,7 +10960,7 @@ function rootSpanKind(name) {
|
|
|
10851
10960
|
function getParentContext() {
|
|
10852
10961
|
return getNeatlogsParentContext();
|
|
10853
10962
|
}
|
|
10854
|
-
function createAsyncWrapper(name, original) {
|
|
10963
|
+
function createAsyncWrapper(name, original, telemetryKey) {
|
|
10855
10964
|
return async function wrappedAsyncFn(opts) {
|
|
10856
10965
|
const tracer = getNeatlogsTracer(TRACER_NAME2);
|
|
10857
10966
|
const parentContext = getParentContext();
|
|
@@ -10871,7 +10980,7 @@ function createAsyncWrapper(name, original) {
|
|
|
10871
10980
|
if (name === "rerank" && opts?.query) {
|
|
10872
10981
|
span2.setAttribute("ai.rerank.query", String(opts.query));
|
|
10873
10982
|
}
|
|
10874
|
-
const merged = mergeTelemetry(opts);
|
|
10983
|
+
const merged = mergeTelemetry(opts, telemetryKey);
|
|
10875
10984
|
const result = await original(merged);
|
|
10876
10985
|
if (!isEmbedOrRerank) {
|
|
10877
10986
|
setOutputValue(span2, result);
|
|
@@ -10888,7 +10997,7 @@ function createAsyncWrapper(name, original) {
|
|
|
10888
10997
|
);
|
|
10889
10998
|
};
|
|
10890
10999
|
}
|
|
10891
|
-
function createStreamWrapper(name, original) {
|
|
11000
|
+
function createStreamWrapper(name, original, telemetryKey) {
|
|
10892
11001
|
return function wrappedStreamFn(opts) {
|
|
10893
11002
|
const tracer = getNeatlogsTracer(TRACER_NAME2);
|
|
10894
11003
|
const parentContext = getParentContext();
|
|
@@ -10908,7 +11017,7 @@ function createStreamWrapper(name, original) {
|
|
|
10908
11017
|
};
|
|
10909
11018
|
try {
|
|
10910
11019
|
setInputValue(span2, opts);
|
|
10911
|
-
const merged = mergeTelemetry(opts);
|
|
11020
|
+
const merged = mergeTelemetry(opts, telemetryKey);
|
|
10912
11021
|
const userOnFinish = opts?.onFinish;
|
|
10913
11022
|
const userOnError = opts?.onError;
|
|
10914
11023
|
const wrappedOpts = {
|
|
@@ -11033,25 +11142,47 @@ function createMirroredTracer(primary, secondary) {
|
|
|
11033
11142
|
})
|
|
11034
11143
|
};
|
|
11035
11144
|
}
|
|
11036
|
-
function
|
|
11145
|
+
function isNeatlogsV7Integration(integration) {
|
|
11146
|
+
return typeof integration === "object" && integration !== null && NEATLOGS_V7_INTEGRATION in integration;
|
|
11147
|
+
}
|
|
11148
|
+
function mergeTelemetry(opts, telemetryKey, fallbackTelemetry) {
|
|
11149
|
+
const legacyTelemetry = opts?.experimental_telemetry ?? {};
|
|
11150
|
+
const v7Telemetry = opts?.telemetry ?? {};
|
|
11151
|
+
const preferredTelemetry = telemetryKey === "telemetry" ? { ...legacyTelemetry, ...v7Telemetry } : { ...v7Telemetry, ...legacyTelemetry };
|
|
11037
11152
|
const requestedTelemetry = {
|
|
11038
11153
|
...fallbackTelemetry,
|
|
11039
|
-
...
|
|
11154
|
+
...preferredTelemetry,
|
|
11040
11155
|
metadata: {
|
|
11041
11156
|
...fallbackTelemetry?.metadata,
|
|
11042
|
-
...
|
|
11157
|
+
...legacyTelemetry.metadata,
|
|
11158
|
+
...v7Telemetry.metadata
|
|
11043
11159
|
}
|
|
11044
11160
|
};
|
|
11045
|
-
const
|
|
11161
|
+
const existingNeatlogsIntegration = Array.isArray(
|
|
11162
|
+
requestedTelemetry.integrations
|
|
11163
|
+
) ? requestedTelemetry.integrations.find(isNeatlogsV7Integration) : void 0;
|
|
11164
|
+
const baseTelemetry = existingNeatlogsIntegration ? {
|
|
11165
|
+
isEnabled: true,
|
|
11166
|
+
recordInputs: true,
|
|
11167
|
+
recordOutputs: true,
|
|
11168
|
+
tracer: requestedTelemetry.tracer,
|
|
11169
|
+
...requestedTelemetry.functionId !== void 0 ? { functionId: requestedTelemetry.functionId } : {},
|
|
11170
|
+
metadata: requestedTelemetry.metadata,
|
|
11171
|
+
integrations: [existingNeatlogsIntegration]
|
|
11172
|
+
} : createAITelemetry({
|
|
11046
11173
|
functionId: requestedTelemetry.functionId,
|
|
11047
11174
|
metadata: requestedTelemetry.metadata,
|
|
11048
11175
|
tracer: requestedTelemetry.tracer
|
|
11049
11176
|
});
|
|
11050
11177
|
const callerTracer = requestedTelemetry.tracer;
|
|
11051
11178
|
const hasCallerTracer = callerTracer !== void 0;
|
|
11179
|
+
const requestedIntegrations = Array.isArray(requestedTelemetry.integrations) ? requestedTelemetry.integrations.filter(
|
|
11180
|
+
(integration) => !isNeatlogsV7Integration(integration)
|
|
11181
|
+
) : [];
|
|
11182
|
+
const { telemetry: _telemetry, experimental_telemetry: _legacy, ...rest } = opts ?? {};
|
|
11052
11183
|
return {
|
|
11053
|
-
...
|
|
11054
|
-
|
|
11184
|
+
...rest,
|
|
11185
|
+
[telemetryKey]: {
|
|
11055
11186
|
...baseTelemetry,
|
|
11056
11187
|
...requestedTelemetry,
|
|
11057
11188
|
isEnabled: true,
|
|
@@ -11061,7 +11192,8 @@ function mergeTelemetry(opts, fallbackTelemetry) {
|
|
|
11061
11192
|
// Do not add Neatlogs-only marker metadata to a caller-owned telemetry
|
|
11062
11193
|
// pipeline such as Laminar. Both providers receive the same AI SDK span
|
|
11063
11194
|
// data, while their providers, parent contexts, and exporters stay separate.
|
|
11064
|
-
metadata: hasCallerTracer ? requestedTelemetry.metadata : baseTelemetry.metadata
|
|
11195
|
+
metadata: hasCallerTracer ? requestedTelemetry.metadata : baseTelemetry.metadata,
|
|
11196
|
+
integrations: [...baseTelemetry.integrations, ...requestedIntegrations]
|
|
11065
11197
|
}
|
|
11066
11198
|
};
|
|
11067
11199
|
}
|