You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/svelte.dev/content/docs/kit/20-core-concepts/60-remote-functions.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,17 +11,25 @@ Remote functions are a tool for type-safe communication between client and serve
11
11
12
12
Combined with Svelte's experimental support for [`await`](/docs/svelte/await-expressions), it allows you to load and manipulate data directly inside your components.
13
13
14
-
This feature is currently experimental, meaning it is likely to contain bugs and is subject to change without notice. You must opt in by adding the `kit.experimental.remoteFunctions` option in your `svelte.config.js`:
14
+
This feature is currently experimental, meaning it is likely to contain bugs and is subject to change without notice. You must opt in by adding the `kit.experimental.remoteFunctions` option in your `svelte.config.js` and optionally, the `compilerOptions.experimental.async` option to use `await` in components:
15
15
16
16
```js
17
17
/// file: svelte.config.js
18
-
exportdefault {
18
+
/**@type{import('@sveltejs/kit').Config}*/
19
+
constconfig= {
19
20
kit: {
20
21
experimental: {
21
22
+++remoteFunctions:true+++
22
23
}
24
+
},
25
+
compilerOptions: {
26
+
experimental: {
27
+
+++async:true+++
28
+
}
23
29
}
24
30
};
31
+
32
+
exportdefaultconfig;
25
33
```
26
34
27
35
## Overview
@@ -88,6 +96,8 @@ While using `await` is recommended, as an alternative the query also has `loadin
Copy file name to clipboardExpand all lines: apps/svelte.dev/content/docs/kit/30-advanced/68-observability.md
+19-17Lines changed: 19 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,38 +7,39 @@ title: Observability
7
7
<p>Available since 2.29</p>
8
8
</blockquote>
9
9
10
-
> [!NOTE] This feature is experimental. Expect bugs and breaking changes in minor versions (though we'll do our best to keep those to an absolute minimum). Please provide feedback!
11
-
12
10
Sometimes, you may need to observe how your application is behaving in order to improve performance or find the root cause of a pesky bug. To help with this, SvelteKit can emit server-side [OpenTelemetry](https://opentelemetry.io) spans for the following:
13
11
14
-
-[`handle`](hooks#Server-hooks-handle) hook (`handle` functions running in a [`sequence`](@sveltejs-kit-hooks#sequence) will show up as children of each other and the root handle hook)
15
-
-[`load`](load) functions (includes universal `load` functions when they're run on the server)
12
+
-The [`handle`](hooks#Server-hooks-handle) hook and `handle` functions running in a [`sequence`](@sveltejs-kit-hooks#sequence)(these will show up as children of each other and the root `handle` hook)
13
+
-Server [`load`](load) functions and universal `load` functions when they're run on the server
16
14
-[Form actions](form-actions)
17
15
-[Remote functions](remote-functions)
18
16
19
17
Just telling SvelteKit to emit spans won't get you far, though — you need to actually collect them somewhere to be able to view them. SvelteKit provides `src/instrumentation.server.ts` as a place to write your tracing setup and instrumentation code. It's guaranteed to be run prior to your application code being imported, providing your deployment platform supports it and your adapter is aware of it.
20
18
21
-
To enable both of these features, add the following to your `svelte.config.js`:
19
+
Both of these features are currently experimental, meaning they are likely to contain bugs and are subject to change without notice. You must opt in by adding the `kit.experimental.tracing.server` and `kit.experimental.instrumentation.server` option in your `svelte.config.js`:
22
20
23
21
```js
24
22
/// file: svelte.config.js
25
-
exportdefault {
23
+
/**@type{import('@sveltejs/kit').Config}*/
24
+
constconfig= {
26
25
kit: {
27
-
+++experimental: {
28
-
tracing: {
26
+
experimental: {
27
+
+++tracing: {
29
28
server:true
30
29
},
31
30
instrumentation: {
32
31
server:true
33
-
}
34
-
}+++
32
+
}+++
33
+
}
35
34
}
36
35
};
36
+
37
+
exportdefaultconfig;
37
38
```
38
39
39
40
> [!NOTE] Tracing — and more significantly, observability instrumentation — can have a nontrivial overhead. Before you go all-in on tracing, consider whether or not you really need it, or if it might be more appropriate to turn it on in development and preview environments only.
40
41
41
-
## Agumenting SvelteKit's builtin tracing
42
+
## Augmenting the built-in tracing
42
43
43
44
SvelteKit provides access to the `root` span and the `current` span on the request event. The root span is the one associated with your root `handle` function, and the current span could be associated with `handle`, `load`, a form action, or a remote function, depending on the context. You can annotate these spans with any attributes you wish to record:
44
45
@@ -66,19 +67,20 @@ async function authenticate() {
66
67
67
68
To view your first trace, you'll need to set up a local collector. We'll use [Jaeger](https://www.jaegertracing.io/docs/getting-started/) in this example, as they provide an easy-to-use quickstart command. Once your collector is running locally:
68
69
69
-
- Turn on the experimental flag mentioned above in your `svelte.config.js` file
70
-
- Use your package manager to install the dependencies you'll need
70
+
- Turn on the experimental flags mentioned earlier in your `svelte.config.js` file
71
+
- Use your package manager to install the dependencies you'll need:
71
72
```sh
72
73
npm i @opentelemetry/sdk-node @opentelemetry/auto-instrumentations-node @opentelemetry/exporter-trace-oltp-proto import-in-the-middle
73
74
```
74
-
- Create `src/instrumentation.server.ts` with the following:
75
+
- Create `src/instrumentation.server.js` with the following:
0 commit comments