Skip to content

Commit 6aec1b0

Browse files
authored
Revert "try out honeycomb frontend monitoring (#217)" (#218)
This reverts commit 75b3607.
1 parent 75b3607 commit 6aec1b0

6 files changed

Lines changed: 31 additions & 637 deletions

File tree

packages/viewer/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
"validate": "svelte-check"
1818
},
1919
"dependencies": {
20-
"@honeycombio/opentelemetry-web": "^0.15.0",
21-
"@opentelemetry/auto-instrumentations-web": "^0.46.0",
2220
"@pi-base/core": "workspace:*",
2321
"@sentry/browser": "^7.93.0",
2422
"bootstrap": "^4.6.2",

packages/viewer/src/environment.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

packages/viewer/src/errors.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import * as Sentry from '@sentry/browser'
22
import { build, sentryIngest } from '@/constants'
3-
import type { Environment } from './environment'
43

54
type Meta = Record<string, unknown>
65

76
export type Handler = (error: Error, meta?: Meta) => void
87

8+
export type Environment = 'production' | 'deploy-preview' | 'dev'
9+
910
export function log(): Handler {
1011
return function handle(error: Error, meta: Meta = {}) {
1112
console.error(error, meta)
@@ -14,14 +15,14 @@ export function log(): Handler {
1415

1516
export function sentry({
1617
dsn = sentryIngest,
17-
env,
18+
environment,
1819
}: {
1920
dsn?: string
20-
env: Environment
21+
environment: Environment
2122
}): Handler {
2223
const release = `pi-base@${build.version}`
2324

24-
Sentry.init({ dsn, release, environment: env })
25+
Sentry.init({ dsn, release, environment })
2526

2627
return function handle(error: Error, meta: Meta = {}) {
2728
Sentry.withScope(scope => {

packages/viewer/src/honeycomb.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/viewer/src/routes/+layout.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@ import { defaultHost } from '@/constants'
33
import * as errors from '@/errors'
44
import { sync } from '@/gateway'
55
import type { LayoutLoad } from './$types'
6-
import { browser } from '$app/environment'
7-
import { initializeHoneycomb } from '@/honeycomb'
8-
import { forHost } from '@/environment'
96

107
export const load: LayoutLoad = async ({ fetch, url: { host } }) => {
11-
const env = forHost(host)
12-
const dev = env === 'dev'
8+
const dev = host.match(/(dev(elopment)?[.-]|localhost)/) !== null
139

14-
if (browser) {
15-
initializeHoneycomb({ env })
16-
}
17-
18-
const errorHandler = dev ? errors.log() : errors.sentry({ env })
10+
const errorHandler = dev
11+
? errors.log()
12+
: errors.sentry({ environment: errorEnv(host) })
1913

2014
const context = initialize({
2115
showDev: dev,
@@ -30,3 +24,15 @@ export const load: LayoutLoad = async ({ fetch, url: { host } }) => {
3024

3125
return context
3226
}
27+
28+
function errorEnv(host: string): errors.Environment {
29+
if (['topology.pi-base.org', 'topology.pages.dev'].includes(host)) {
30+
return 'production'
31+
}
32+
33+
if (host.includes('pages.dev')) {
34+
return 'deploy-preview'
35+
}
36+
37+
return 'dev'
38+
}

0 commit comments

Comments
 (0)