-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
422 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/.git/ | ||
/.wrangler/ | ||
/.yarn/cache/ | ||
/.yarn/sdks/ | ||
/.yarn/unplugged/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
COOKIE_DOMAIN=localhost | ||
ENVIRONMENT_NAME=development | ||
HOST=localhost:3000 | ||
PATREON_OAUTH_CLIENT_ID=4kCae2AHZdKyyuonaPzhGillxJ2HyyLQEDu8StvMtixBHmWmN4KVG0QVP6R45tjG | ||
PATREON_OAUTH_CLIENT_SECRET= | ||
PATREON_OAUTH_HOST=https://www.patreon.com | ||
PATREON_OAUTH_REDIRECT_URI=https://localhost:5882/patreon/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
'use client'; | ||
|
||
import { useEffect, type ReactElement, type ReactNode } from 'react'; | ||
import GITHUB_SHA from '../constants/github-sha.js'; | ||
import { WHOAMI } from '../constants/whoami.js'; | ||
import useLogRocket from '../hooks/use-log-rocket.js'; | ||
import { type LogRocketOptions, type LogRocketRequest, type LogRocketResponse } from '../types/log-rocket.js'; | ||
import getHostname from '../utils/get-hostname.js'; | ||
|
||
interface Props { | ||
readonly appId: string; | ||
readonly children: ReactNode; | ||
} | ||
|
||
const BROWSER: Required<Required<LogRocketOptions>['browser']> = { | ||
urlSanitizer(): string | null { | ||
return null; | ||
}, | ||
}; | ||
|
||
const CONSOLE_IS_ENABLED: Required<Required<Required<LogRocketOptions>['console']>['isEnabled']> = { | ||
debug: false, | ||
error: true, | ||
info: true, | ||
log: true, | ||
warn: true, | ||
}; | ||
|
||
const CONSOLE: Required<Required<LogRocketOptions>['console']> = { | ||
isEnabled: CONSOLE_IS_ENABLED, | ||
shouldAggregateConsoleErrors: true, | ||
}; | ||
|
||
const DOM: Required<Omit<Required<LogRocketOptions>['dom'], 'baseHref'>> = { | ||
hiddenAttributes: [], | ||
inputSanitizer: false, | ||
isEnabled: true, | ||
privateAttributeBlocklist: [], | ||
privateClassNameBlocklist: [], | ||
textSanitizer: false, | ||
}; | ||
|
||
const NETWORK_REQUEST_IDS: Map<string, string> = new Map<string, string>(); | ||
|
||
const NETWORK: Required<Required<LogRocketOptions>['network']> = { | ||
isEnabled: true, | ||
|
||
requestSanitizer(request: LogRocketRequest): LogRocketRequest | null { | ||
NETWORK_REQUEST_IDS.set(request.reqId, request.url); | ||
|
||
return { | ||
...request, | ||
headers: { | ||
...request.headers, | ||
Cookie: undefined, | ||
}, | ||
}; | ||
}, | ||
|
||
responseSanitizer(response: LogRocketResponse): LogRocketResponse | null { | ||
const requestUrl: string | undefined = NETWORK_REQUEST_IDS.get(response.reqId); | ||
|
||
if (requestUrl === WHOAMI) { | ||
return null; | ||
} | ||
|
||
return { | ||
...response, | ||
headers: { | ||
...response.headers, | ||
}, | ||
}; | ||
}, | ||
}; | ||
|
||
export default function LogRocket({ appId, children }: Props): ReactElement { | ||
const LogRocket = useLogRocket(); | ||
|
||
useEffect((): void => { | ||
LogRocket.init(appId, { | ||
browser: BROWSER, | ||
childDomains: [], | ||
console: CONSOLE, | ||
disableBusyFramesTracker: false, | ||
mergeIframes: true, | ||
network: NETWORK, | ||
parentDomain: null, | ||
release: GITHUB_SHA ?? 'dev', | ||
rootHostname: getHostname(), | ||
shouldAugmentNPS: true, | ||
shouldCaptureIP: true, | ||
shouldDebugLog: false, | ||
shouldDetectExceptions: true, | ||
shouldParseXHRBlob: true, | ||
dom: { | ||
...DOM, | ||
baseHref: `${window.location.origin}/`, | ||
}, | ||
} satisfies Required<Omit<LogRocketOptions, 'serverURL' | 'shouldSendData' | 'uploadTimeInterval'>>); | ||
}, [appId, LogRocket]); | ||
|
||
return <>{children}</>; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
packages/next/src/constants/open-telemetry-instrumentation.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import validateString from "../utils/validate-string.js"; | ||
|
||
export const WHOAMI: string = validateString(process.env['WHOAMI']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { BatchSpanProcessor } from "@opentelemetry/sdk-trace-web"; | ||
import OTLPTraceExporter from "./otlp-trace-exporter.js"; | ||
|
||
export default class BatchSpanProcessorImpl extends BatchSpanProcessor { | ||
public readonly otlpTraceExporter: OTLPTraceExporter; | ||
|
||
public constructor(hostname: string) { | ||
const otlpTraceExporter: OTLPTraceExporter = | ||
new OTLPTraceExporter(hostname); | ||
|
||
super(otlpTraceExporter); | ||
|
||
this.otlpTraceExporter = otlpTraceExporter; | ||
} | ||
} |
Oops, something went wrong.