@@ -12,14 +12,32 @@ import { normalize_error } from '../../utils/error.js';
12
12
import { check_incorrect_fail_use } from './page/actions.js' ;
13
13
import { DEV } from 'esm-env' ;
14
14
import { get_event_state } from './event-state.js' ;
15
+ import { record_span } from '../telemetry/record_span.js' ;
16
+ import { merge_tracing } from '../utils.js' ;
17
+
18
+ /** @type {typeof handle_remote_call_internal } */
19
+ export async function handle_remote_call ( event , options , manifest , id ) {
20
+ return record_span ( {
21
+ name : 'sveltekit.remote.call' ,
22
+ attributes : {
23
+ 'sveltekit.remote.call.id' : id
24
+ } ,
25
+ fn : async ( current ) => {
26
+ const traced_event = merge_tracing ( event , current ) ;
27
+ return with_event ( traced_event , ( ) =>
28
+ handle_remote_call_internal ( event , options , manifest , id )
29
+ ) ;
30
+ }
31
+ } ) ;
32
+ }
15
33
16
34
/**
17
35
* @param {RequestEvent } event
18
36
* @param {SSROptions } options
19
37
* @param {SSRManifest } manifest
20
38
* @param {string } id
21
39
*/
22
- export async function handle_remote_call ( event , options , manifest , id ) {
40
+ export async function handle_remote_call_internal ( event , options , manifest , id ) {
23
41
const [ hash , name , prerender_args ] = id . split ( '/' ) ;
24
42
const remotes = manifest . _ . remotes ;
25
43
@@ -155,13 +173,27 @@ export async function handle_remote_call(event, options, manifest, id) {
155
173
}
156
174
}
157
175
176
+ /** @type {typeof handle_remote_form_post_internal } */
177
+ export async function handle_remote_form_post ( event , manifest , id ) {
178
+ return record_span ( {
179
+ name : 'sveltekit.remote.form.post' ,
180
+ attributes : {
181
+ 'sveltekit.remote.form.post.id' : id
182
+ } ,
183
+ fn : async ( current ) => {
184
+ const traced_event = merge_tracing ( event , current ) ;
185
+ return with_event ( traced_event , ( ) => handle_remote_form_post_internal ( event , manifest , id ) ) ;
186
+ }
187
+ } ) ;
188
+ }
189
+
158
190
/**
159
191
* @param {RequestEvent } event
160
192
* @param {SSRManifest } manifest
161
193
* @param {string } id
162
194
* @returns {Promise<ActionResult> }
163
195
*/
164
- export async function handle_remote_form_post ( event , manifest , id ) {
196
+ async function handle_remote_form_post_internal ( event , manifest , id ) {
165
197
const [ hash , name , action_id ] = id . split ( '/' ) ;
166
198
const remotes = manifest . _ . remotes ;
167
199
const module = await remotes [ hash ] ?. ( ) ;
0 commit comments