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:
+1
-1
@@ -68,7 +68,7 @@ export class Builder implements FreshBuilder {
|
||||
const devApp = new App<T>(app.config)
|
||||
.use(liveReload())
|
||||
.use(devErrorOverlay())
|
||||
.mountApp("*", app);
|
||||
.mountApp("/*", app);
|
||||
|
||||
devApp.config.mode = "development";
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import * as semver from "@std/semver";
|
||||
import * as colors from "@std/fmt/colors";
|
||||
import * as path from "@std/path";
|
||||
import { CURRENT_FRESH_VERSION } from "../otel.ts";
|
||||
|
||||
export interface CheckFile {
|
||||
last_checked: string;
|
||||
@@ -48,10 +49,8 @@ async function fetchLatestVersion() {
|
||||
throw new Error(`Could not fetch latest version.`);
|
||||
}
|
||||
|
||||
async function readCurrentVersion() {
|
||||
return (await import("../../deno.json", {
|
||||
with: { type: "json" },
|
||||
})).default.version;
|
||||
function readCurrentVersion() {
|
||||
return CURRENT_FRESH_VERSION;
|
||||
}
|
||||
|
||||
export async function updateCheck(
|
||||
|
||||
Reference in New Issue
Block a user