@rasputin-ai/sveltekit 0.13.1 → 0.15.0
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/runtime/node.d.ts.map +1 -1
- package/dist/runtime/node.js +28 -7
- package/dist/sdk-meta.d.ts +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/runtime/node.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/runtime/node.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAkB7D,OAAO,KAAK,EACX,aAAa,EAKb,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,CAAC;AA4N3D;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,wBAAwB,GAAG,aAAa,CAAC"}
|
package/dist/runtime/node.js
CHANGED
|
@@ -7,17 +7,20 @@ import {
|
|
|
7
7
|
} from "@rasputin-ai/core";
|
|
8
8
|
import {
|
|
9
9
|
bindAdaptiveRecorder,
|
|
10
|
+
bindExecutionMetrics,
|
|
10
11
|
bindFunctionMetrics,
|
|
12
|
+
createDynamicDurationSampleBuckets,
|
|
11
13
|
inertErrorObservation,
|
|
12
14
|
installAutomaticExecutionRuntime,
|
|
13
15
|
installGlobalHandlers,
|
|
16
|
+
releaseExecutionMetricsBindings,
|
|
14
17
|
releaseFunctionMetricsBindings,
|
|
15
18
|
scheduleInstrumentationManifestUpload
|
|
16
19
|
} from "@rasputin-ai/node/internal";
|
|
17
20
|
|
|
18
21
|
// src/sdk-meta.ts
|
|
19
22
|
var SDK_NAME = "@rasputin-ai/sveltekit";
|
|
20
|
-
var SDK_VERSION = "0.
|
|
23
|
+
var SDK_VERSION = "0.15.0";
|
|
21
24
|
|
|
22
25
|
// src/runtime/node.ts
|
|
23
26
|
var inertScope = () => ({
|
|
@@ -48,7 +51,7 @@ var publicScope = (runtime, request) => {
|
|
|
48
51
|
return inertScope();
|
|
49
52
|
}
|
|
50
53
|
};
|
|
51
|
-
var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers, policy, metrics) => {
|
|
54
|
+
var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers, policy, metrics, executionMetrics) => {
|
|
52
55
|
const uninstallRuntime = installRuntime ? installAutomaticExecutionRuntime(runtime) : () => {
|
|
53
56
|
};
|
|
54
57
|
const manifestUpload = scheduleInstrumentationManifestUpload({
|
|
@@ -64,6 +67,7 @@ var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers,
|
|
|
64
67
|
const startedAt = Date.now();
|
|
65
68
|
await policy?.close();
|
|
66
69
|
await releaseFunctionMetricsBindings(metrics);
|
|
70
|
+
await releaseExecutionMetricsBindings(executionMetrics);
|
|
67
71
|
await client.close();
|
|
68
72
|
await manifestUpload.wait(Math.max(0, 2e3 - (Date.now() - startedAt)));
|
|
69
73
|
};
|
|
@@ -81,11 +85,13 @@ var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers,
|
|
|
81
85
|
if (timeoutMs === void 0) {
|
|
82
86
|
await policy?.flush();
|
|
83
87
|
await metrics?.exporter.flush();
|
|
88
|
+
await executionMetrics?.exporter.flush();
|
|
84
89
|
await manifestUpload.wait();
|
|
85
90
|
return;
|
|
86
91
|
}
|
|
87
92
|
await policy?.flush(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
88
93
|
await metrics?.exporter.flush(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
94
|
+
await executionMetrics?.exporter.flush(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
89
95
|
await manifestUpload.wait(Math.max(0, timeoutMs - (Date.now() - startedAt)));
|
|
90
96
|
},
|
|
91
97
|
close: shutdown
|
|
@@ -96,6 +102,7 @@ var bindClient = (client, runtime, installRuntime, manifest, uninstallHandlers,
|
|
|
96
102
|
var createBoundRuntime = (options, hooks, capture) => {
|
|
97
103
|
const enabled = capture && isClientEnabled(options);
|
|
98
104
|
const recorderEnabled = enabled && options.executionRecorder?.enabled !== false;
|
|
105
|
+
const durationSampling = options.dynamicDurationSampling === true;
|
|
99
106
|
const activation = resolveClientActivation({
|
|
100
107
|
enabled: options.enabled === false || !capture ? false : options.enabled,
|
|
101
108
|
dsn: options.dsn,
|
|
@@ -105,14 +112,25 @@ var createBoundRuntime = (options, hooks, capture) => {
|
|
|
105
112
|
environment: options.environment
|
|
106
113
|
});
|
|
107
114
|
const metrics = activation.enabled ? bindFunctionMetrics({
|
|
108
|
-
options: options.functionMetrics,
|
|
109
115
|
clientEnabled: true,
|
|
110
116
|
environment: activation.environment,
|
|
111
117
|
release: activation.release,
|
|
112
118
|
ingestToken: activation.ingestToken,
|
|
113
119
|
apiUrl: activation.apiUrl,
|
|
114
|
-
fetch: hooks.fetch
|
|
120
|
+
fetch: hooks.fetch,
|
|
121
|
+
sampledMeasurementFormat: durationSampling
|
|
122
|
+
}) : void 0;
|
|
123
|
+
const executionMetrics = activation.enabled ? bindExecutionMetrics({
|
|
124
|
+
clientEnabled: true,
|
|
125
|
+
environment: activation.environment,
|
|
126
|
+
release: activation.release,
|
|
127
|
+
ingestToken: activation.ingestToken,
|
|
128
|
+
apiUrl: activation.apiUrl,
|
|
129
|
+
fetch: hooks.fetch,
|
|
130
|
+
sampledMeasurementFormat: durationSampling
|
|
115
131
|
}) : void 0;
|
|
132
|
+
const observeExecutions = recorderEnabled || Boolean(metrics) || Boolean(executionMetrics);
|
|
133
|
+
const durationSampler = durationSampling && observeExecutions ? createDynamicDurationSampleBuckets({ nowMs: () => Date.now() }) : void 0;
|
|
116
134
|
const { runtime, policy } = bindAdaptiveRecorder({
|
|
117
135
|
executionRecorder: options.executionRecorder,
|
|
118
136
|
recorderEnabled,
|
|
@@ -126,7 +144,9 @@ var createBoundRuntime = (options, hooks, capture) => {
|
|
|
126
144
|
sdkName: SDK_NAME,
|
|
127
145
|
sdkVersion: SDK_VERSION,
|
|
128
146
|
scrubPII: options.scrubPII,
|
|
129
|
-
functionMetrics: metrics?.collector
|
|
147
|
+
functionMetrics: metrics?.collector,
|
|
148
|
+
executionMetrics: executionMetrics?.collector,
|
|
149
|
+
durationSampler
|
|
130
150
|
});
|
|
131
151
|
const client = createClient(
|
|
132
152
|
{ ...options, enabled },
|
|
@@ -145,7 +165,7 @@ var createBoundRuntime = (options, hooks, capture) => {
|
|
|
145
165
|
const bound = bindClient(
|
|
146
166
|
client,
|
|
147
167
|
runtime,
|
|
148
|
-
|
|
168
|
+
observeExecutions,
|
|
149
169
|
{
|
|
150
170
|
projectApiKey: options.projectApiKey,
|
|
151
171
|
release: options.release,
|
|
@@ -158,7 +178,8 @@ var createBoundRuntime = (options, hooks, capture) => {
|
|
|
158
178
|
},
|
|
159
179
|
() => uninstallHandlers(),
|
|
160
180
|
policy,
|
|
161
|
-
metrics
|
|
181
|
+
metrics,
|
|
182
|
+
executionMetrics
|
|
162
183
|
);
|
|
163
184
|
if (enabled && (hooks.installGlobalHandlers ?? options.installGlobalHandlers) === true) {
|
|
164
185
|
uninstallHandlers = installGlobalHandlers(bound.client);
|
package/dist/sdk-meta.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rasputin-ai/sveltekit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "Official Rasputin AI SDK for SvelteKit.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@rasputin-ai/browser": "0.
|
|
46
|
-
"@rasputin-ai/core": "0.
|
|
47
|
-
"@rasputin-ai/node": "0.
|
|
45
|
+
"@rasputin-ai/browser": "0.15.0",
|
|
46
|
+
"@rasputin-ai/core": "0.15.0",
|
|
47
|
+
"@rasputin-ai/node": "0.15.0",
|
|
48
48
|
"typescript": "5"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|