feat: add open telemetry instrumentation (#2786)

This commit adds some useful automatic instrumentation for when users
are using `--unstable-otel`:

- Fresh renames the span for incoming HTTP requests to `$METHOD $ROUTE`
and the `http.route` attribute is added.
- Fresh creates a span around FS route handlers, showing whether they
returned a response or data.
- Fresh creates a span around async components, showing how long they
took to execute.
- Fresh adds a span around preact rendering, showing how long rendering
takes.
- Fresh adds a span around static file serving, showing how long it took
and whether there were requests without a cache bust key.

We can improve this in the future with more telemetry, such as metrics.
This commit is contained in:
Luca Casonato
2024-12-10 15:03:50 +01:00
committed by GitHub
parent 4a25ac385f
commit 65d61bd1d5
22 changed files with 1380 additions and 203 deletions
+1 -1
View File
@@ -43,7 +43,6 @@ export function PartialsSection() {
<div class="flex flex-col gap-4 md:sticky md:top-4">
<svg
aria-hidden="true"
alt="Arrows transferring data down "
xmlns="http://www.w3.org/2000/svg"
class="icon icon-tabler icon-tabler-arrows-transfer-down text-fresh"
width="4rem"
@@ -55,6 +54,7 @@ export function PartialsSection() {
stroke-linecap="round"
stroke-linejoin="round"
>
<title>Arrows transferring data down</title>
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M17 3v6" />
<path d="M10 18l-3 3l-3 -3" />