File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 "validate" : " svelte-check"
1818 },
1919 "dependencies" : {
20+ "@honeycombio/opentelemetry-web" : " ^0.15.0" ,
21+ "@opentelemetry/auto-instrumentations-web" : " ^0.46.0" ,
2022 "@pi-base/core" : " workspace:*" ,
2123 "@sentry/browser" : " ^7.93.0" ,
2224 "bootstrap" : " ^4.6.2" ,
Original file line number Diff line number Diff line change @@ -3,10 +3,34 @@ import { defaultHost } from '@/constants'
33import * as errors from '@/errors'
44import { sync } from '@/gateway'
55import type { LayoutLoad } from './$types'
6+ import { browser } from '$app/environment'
7+
8+ import { HoneycombWebSDK } from '@honeycombio/opentelemetry-web'
9+ import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web'
610
711export const load : LayoutLoad = async ( { fetch, url : { host } } ) => {
812 const dev = host . match ( / ( d e v ( e l o p m e n t ) ? [ . - ] | l o c a l h o s t ) / ) !== null
913
14+ if ( browser ) {
15+ const configDefaults = {
16+ ignoreNetworkEvents : true ,
17+ }
18+
19+ const sdk = new HoneycombWebSDK ( {
20+ debug : dev ,
21+ apiKey : 'Sx608N12wwH9ZJ6qmHMVnA' ,
22+ serviceName : 'π-base web' ,
23+ instrumentations : [
24+ getWebAutoInstrumentations ( {
25+ '@opentelemetry/instrumentation-xml-http-request' : configDefaults ,
26+ '@opentelemetry/instrumentation-fetch' : configDefaults ,
27+ '@opentelemetry/instrumentation-document-load' : configDefaults ,
28+ } ) ,
29+ ] ,
30+ } )
31+ sdk . start ( )
32+ }
33+
1034 const errorHandler = dev
1135 ? errors . log ( )
1236 : errors . sentry ( { environment : errorEnv ( host ) } )
You can’t perform that action at this time.
0 commit comments