Get working sentry for the UI

Previously it almost, but didn't quite work. Now it actually works, but
the stack traces are minified.
This commit is contained in:
Eli Ribble 2026-04-29 23:59:34 +00:00
parent 2f6cbe59eb
commit 0c464a9963
No known key found for this signature in database
6 changed files with 37 additions and 18 deletions

View file

@ -3,24 +3,12 @@
</template>
<script setup lang="ts">
import * as Sentry from "@sentry/vue";
import { onMounted } from "vue";
import { apiClient } from "@/client";
import router from "@/route/config";
import { SSEManager, type SSEMessageResource } from "@/SSEManager";
async function sentryInit() {
const config = await apiClient.JSONGet("/api");
Sentry.init({
dsn: config.DSN,
integrations: [Sentry.browserTracingIntegration({ router })],
environment: config.ENVIRONMENT,
release: config.RELEASE,
tracesSampleRate: 0.01,
});
console.log("sentry initialized");
}
onMounted(() => {
SSEManager.connect("/api/events");
SSEManager.subscribe((msg: SSEMessageResource) => {
@ -28,6 +16,5 @@ onMounted(() => {
console.log("SSE", msg);
}
});
sentryInit();
});
</script>

22
ts/sentry.ts Normal file
View file

@ -0,0 +1,22 @@
import { type App } from "vue";
import { type Pinia } from "pinia";
import { type Router } from "vue-router";
import * as Sentry from "@sentry/vue";
import { apiClient } from "@/client";
import { APIProperties } from "@/type/api";
export async function Init(app: App, pinia: Pinia) {
const api_info: APIProperties = await apiClient.JSONGet("/api");
Sentry.init({
app,
dsn: api_info.sentry_dsn,
//integrations: [Sentry.browserTracingIntegration({ router })],
environment: api_info.environment,
release:
api_info.version.revision +
(api_info.version.is_modified ? "-dirty" : ""),
tracesSampleRate: 0.01,
});
pinia.use(Sentry.createSentryPiniaPlugin());
console.log("sentry initialized", api_info.sentry_dsn, api_info.environment);
}

View file

@ -35,11 +35,16 @@ export interface TegolaURLs {
nidus: string;
rmo: string;
}
export interface Version {
build_time: string;
is_modified: boolean;
revision: string;
}
export interface APIProperties {
environment: string;
sentry_dsn: string;
tegola: TegolaURLs;
version: string;
version: Version;
}
export interface BoundsDTO {
min: Location;