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.
22 lines
597 B
TypeScript
22 lines
597 B
TypeScript
import { updateCheck } from "../../src/dev/update_check.ts";
|
|
import { DAY } from "@std/datetime";
|
|
|
|
// deno-lint-ignore require-await
|
|
async function getLatestVersion() {
|
|
// deno-lint-ignore no-console
|
|
console.log("fetching latest version");
|
|
return Deno.env.get("LATEST_VERSION") ?? "99.99.999";
|
|
}
|
|
|
|
function getCurrentVersion() {
|
|
return Deno.env.get("CURRENT_VERSION")!;
|
|
}
|
|
|
|
const interval = +(Deno.env.get("UPDATE_INTERVAL") ?? DAY);
|
|
await updateCheck(
|
|
interval,
|
|
() => Deno.env.get("TEST_HOME")!,
|
|
getLatestVersion,
|
|
Deno.env.has("CURRENT_VERSION") ? getCurrentVersion : undefined,
|
|
);
|