data endpoint for entity 90008 (aka. a website)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

feat: throw error if failed to push metrics

dusk 0135c93e 7532137e

+4 -2
-1
src/components/pet.svelte
··· 71 71 72 72 const sendBounceMetrics = () => { 73 73 fetch('/pet/bounce'); 74 - console.log('bouncy'); 75 74 }; 76 75 77 76 const move = () => {
+4 -1
src/lib/metrics.ts
··· 4 4 import { get, writable } from 'svelte/store'; 5 5 6 6 export const pushMetric = async (metrics: Record<string, number>) => { 7 - await pushMetrics(metrics, { 7 + const result = await pushMetrics(metrics, { 8 8 url: env.PROMETHEUS_URL, 9 9 labels: { 10 10 service: 'website' 11 11 } 12 12 }); 13 + if (result.status != 200) { 14 + throw new Error(`failed to push metrics: ${result.status} ${result.errorMessage}`); 15 + } 13 16 }; 14 17 15 18 const bounceCountFile = `${env.WEBSITE_DATA_DIR}/bouncecount`;