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:
parent
2f6cbe59eb
commit
0c464a9963
6 changed files with 37 additions and 18 deletions
|
|
@ -3,24 +3,12 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import * as Sentry from "@sentry/vue";
|
|
||||||
import { onMounted } from "vue";
|
import { onMounted } from "vue";
|
||||||
import { apiClient } from "@/client";
|
import { apiClient } from "@/client";
|
||||||
import router from "@/route/config";
|
import router from "@/route/config";
|
||||||
|
|
||||||
import { SSEManager, type SSEMessageResource } from "@/SSEManager";
|
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(() => {
|
onMounted(() => {
|
||||||
SSEManager.connect("/api/events");
|
SSEManager.connect("/api/events");
|
||||||
SSEManager.subscribe((msg: SSEMessageResource) => {
|
SSEManager.subscribe((msg: SSEMessageResource) => {
|
||||||
|
|
@ -28,6 +16,5 @@ onMounted(() => {
|
||||||
console.log("SSE", msg);
|
console.log("SSE", msg);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
sentryInit();
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
22
ts/sentry.ts
Normal file
22
ts/sentry.ts
Normal 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);
|
||||||
|
}
|
||||||
|
|
@ -35,11 +35,16 @@ export interface TegolaURLs {
|
||||||
nidus: string;
|
nidus: string;
|
||||||
rmo: string;
|
rmo: string;
|
||||||
}
|
}
|
||||||
|
export interface Version {
|
||||||
|
build_time: string;
|
||||||
|
is_modified: boolean;
|
||||||
|
revision: string;
|
||||||
|
}
|
||||||
export interface APIProperties {
|
export interface APIProperties {
|
||||||
environment: string;
|
environment: string;
|
||||||
sentry_dsn: string;
|
sentry_dsn: string;
|
||||||
tegola: TegolaURLs;
|
tegola: TegolaURLs;
|
||||||
version: string;
|
version: Version;
|
||||||
}
|
}
|
||||||
export interface BoundsDTO {
|
export interface BoundsDTO {
|
||||||
min: Location;
|
min: Location;
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type VersionInfo struct {
|
type VersionInfo struct {
|
||||||
BuildTime time.Time
|
BuildTime time.Time `json:"build_time"`
|
||||||
IsModified bool
|
IsModified bool `json:"is_modified"`
|
||||||
Revision string
|
Revision string `json:"revision"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func Get() VersionInfo {
|
func Get() VersionInfo {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import "@/gen/custom-icons.scss";
|
||||||
import "@/style/rmo.scss";
|
import "@/style/rmo.scss";
|
||||||
import router from "@/rmo/route/config";
|
import router from "@/rmo/route/config";
|
||||||
import App from "@/rmo/App.vue";
|
import App from "@/rmo/App.vue";
|
||||||
|
import * as sentry from "@/sentry";
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
const head = createHead();
|
const head = createHead();
|
||||||
|
|
@ -15,3 +16,5 @@ app.use(head);
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
|
|
||||||
|
sentry.Init(app, pinia);
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
import { createApp } from "vue";
|
import { createApp } from "vue";
|
||||||
import { createPinia } from "pinia";
|
import { createPinia } from "pinia";
|
||||||
import App from "@/AppSync.vue";
|
import App from "@/AppSync.vue";
|
||||||
import router from "@/route/config";
|
|
||||||
import * as config from "@/config";
|
import * as config from "@/config";
|
||||||
|
import router from "@/route/config";
|
||||||
|
import * as sentry from "@/sentry";
|
||||||
|
|
||||||
import "maplibre-gl/dist/maplibre-gl.css";
|
import "maplibre-gl/dist/maplibre-gl.css";
|
||||||
|
|
||||||
|
|
@ -22,3 +23,4 @@ const app = createApp(App);
|
||||||
app.use(pinia);
|
app.use(pinia);
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
|
sentry.Init(app, pinia);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue