fix: various bugs in observability / OTel (#1564)

This commit is contained in:
Alessandro (Ale) Segala
2026-07-05 14:14:39 -07:00
committed by GitHub
parent f68ad42618
commit eefd51cc4d
29 changed files with 1358 additions and 1301 deletions
+5
View File
@@ -4,11 +4,16 @@
import Header from '$lib/components/header/header.svelte';
import { Toaster } from '$lib/components/ui/sonner';
import { m } from '$lib/paraglide/messages';
import { startPageTrace } from '$lib/utils/tracing-util';
import { beforeNavigate } from '$app/navigation';
import { ModeWatcher } from 'mode-watcher';
import { type Snippet } from 'svelte';
import '../app.css';
import type { LayoutData } from './$types';
// Start a new page-level trace on each navigation so a page view and the API calls it triggers are correlated as a single trace.
beforeNavigate((nav) => startPageTrace(nav.to?.url.pathname));
let {
data,
children
+5
View File
@@ -4,6 +4,7 @@ import appConfigStore from '$lib/stores/application-configuration-store';
import userStore from '$lib/stores/user-store';
import { setLocaleForLibraries } from '$lib/utils/locale.util';
import { getAuthRedirectPath } from '$lib/utils/redirection-util';
import { setTracingEnabled } from '$lib/utils/tracing-util';
import { redirect } from '@sveltejs/kit';
import type { LayoutLoad } from './$types';
@@ -37,6 +38,10 @@ export const load: LayoutLoad = async ({ url }) => {
appConfigStore.set(appConfig);
}
// Only export traces when the backend is configured to forward them; otherwise the SPA would POST spans to an unregistered endpoint.
// When enabled this dynamically imports the OpenTelemetry libraries, so awaiting it ensures the tracer provider is ready before any traced navigation or request.
await setTracingEnabled(appConfig?.tracingEnabled ?? false);
await setLocaleForLibraries();
return {