Skip to content

Commit

Permalink
remove privategpt
Browse files Browse the repository at this point in the history
  • Loading branch information
armandobelardo committed May 9, 2024
1 parent adb17e4 commit c824942
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/ui/docs-bundle/sentry.client.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,21 @@ Sentry.init({
],
// This option is required for capturing headers and cookies.
sendDefaultPii: true,

beforeSend: (event: Sentry.Event, _: Sentry.EventHint): Sentry.Event | null => {
// Filter out events from privategpt
if (event.request?.url?.includes("privategpt")) {
return null;
}
if (
event.tags != null &&
event.tags["url"] != null &&
typeof event.tags["url"] === "string" &&
event.tags["url"].includes("privategpt")
) {
return null;
}

return event;
},
});
11 changes: 11 additions & 0 deletions packages/ui/docs-bundle/src/utils/getDocsPageProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { getFeatureFlags } from "../pages/api/fern-docs/feature-flags";
import { getAuthorizationUrl, getJwtTokenSecret } from "./auth";
import { getRedirectForPath } from "./hackRedirects";

import * as Sentry from "@sentry/nextjs";

async function getUnauthenticatedRedirect(xFernHost: string): Promise<Redirect> {
const authorizationUrl = getAuthorizationUrl(
{ organization: await maybeGetWorkosOrganization(xFernHost) },
Expand Down Expand Up @@ -72,6 +74,15 @@ export async function getDocsPageProps(
const toRet = convertDocsToDocsPageProps({ docs: docs.body, slug, url, xFernHost });
const end2 = Date.now();

try {
if (url.includes("privategpt")) {
Sentry.getCurrentHub().getClient()?.getOptions().enabled = false;

Check failure on line 79 in packages/ui/docs-bundle/src/utils/getDocsPageProps.ts

View workflow job for this annotation

GitHub Actions / lint

'getCurrentHub' is deprecated. Use the respective replacement method directly instead

Check failure on line 79 in packages/ui/docs-bundle/src/utils/getDocsPageProps.ts

View workflow job for this annotation

GitHub Actions / lint

'getClient' is deprecated. Use `Sentry.getClient()` instead
}
} catch {
// eslint-disable-next-line no-console
console.log(`Unable to disable Sentry for ${url}`);
}

// eslint-disable-next-line no-console
console.log(`[getDocsPageProps] serializeMdx completed in ${end2 - start2}ms for ${url}`);
return toRet;
Expand Down

0 comments on commit c824942

Please sign in to comment.