Skip to content

Commit 65d61bd

Browse files
authored
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.
1 parent 4a25ac3 commit 65d61bd

22 files changed

+1379
-202
lines changed

deno.json

+6-4
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@
4040
"exclude": ["**/*_test.*", "src/__OLD/**", "*.todo"]
4141
},
4242
"imports": {
43-
"fresh": "jsr:@fresh/core@^2.0.0-alpha.22",
44-
"preact": "npm:preact@^10.24.1",
43+
"fresh": "jsr:@fresh/core@^2.0.0-alpha.25",
44+
"preact": "npm:preact@^10.25.1",
4545
"preact-render-to-string": "npm:preact-render-to-string@^6.5.11",
46+
"$ga4": "https://raw.githubusercontent.com/denoland/ga4/main/mod.ts",
47+
"@luca/esbuild-deno-loader": "jsr:@luca/esbuild-deno-loader@^0.11.0",
48+
"@opentelemetry/api": "npm:@opentelemetry/api@^1.9.0",
4649
"@preact/signals": "npm:@preact/signals@^1.2.3",
4750
"esbuild": "npm:[email protected]",
4851
"esbuild-wasm": "npm:[email protected]",
49-
"@luca/esbuild-deno-loader": "jsr:@luca/esbuild-deno-loader@^0.11.0",
5052
"@std/crypto": "jsr:@std/crypto@1",
5153
"@std/datetime": "jsr:@std/datetime@^0.225.2",
5254
"@std/encoding": "jsr:@std/encoding@1",
@@ -66,7 +68,7 @@
6668
"@std/expect": "jsr:@std/expect@1"
6769
},
6870
"compilerOptions": {
69-
"lib": ["dom", "dom.asynciterable", "deno.ns"],
71+
"lib": ["dom", "dom.asynciterable", "deno.ns", "deno.unstable"],
7072
"jsx": "precompile",
7173
"jsxImportSource": "preact",
7274
"jsxPrecompileSkipElements": ["a", "img", "source", "body", "html", "head"]

0 commit comments

Comments
 (0)