Skip to content

Commit b86aa8b

Browse files
authored
feat(frontend): launchdarkly tracking on frontend browser (#11076)
<!-- Clearly explain the need for these changes: --> We struggle to identify where issues are coming from feature flags and which are from normal use. This adds that split on the frontend. ### Changes 🏗️ Include sentry in the LD initialization <!-- Concisely describe all of the changes made in this pull request: --> ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> - [x] Test that launch darkly flags get attached to the frontend (browser only)
1 parent e7ab262 commit b86aa8b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

autogpt_platform/frontend/instrumentation-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Sentry.init({
3131
Sentry.extraErrorDataIntegration(),
3232
Sentry.browserProfilingIntegration(),
3333
Sentry.httpClientIntegration(),
34-
// Sentry.launchDarklyIntegration(),
34+
Sentry.launchDarklyIntegration(),
3535
Sentry.replayIntegration({
3636
unmask: [".sentry-unmask, [data-sentry-unmask]"],
3737
}),

autogpt_platform/frontend/src/services/feature-flags/feature-flag-provider.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import type { ReactNode } from "react";
55
import { useMemo } from "react";
66
import { useSupabase } from "@/lib/supabase/hooks/useSupabase";
77
import { BehaveAs, getBehaveAs } from "@/lib/utils";
8+
import * as Sentry from "@sentry/nextjs";
89

910
const clientId = process.env.NEXT_PUBLIC_LAUNCHDARKLY_CLIENT_ID;
1011
const envEnabled = process.env.NEXT_PUBLIC_LAUNCHDARKLY_ENABLED === "true";
@@ -45,7 +46,10 @@ export function LaunchDarklyProvider({ children }: { children: ReactNode }) {
4546
clientSideID={clientId}
4647
context={context}
4748
reactOptions={{ useCamelCaseFlagKeys: false }}
48-
options={{ bootstrap: "localStorage" }}
49+
options={{
50+
bootstrap: "localStorage",
51+
inspectors: [Sentry.buildLaunchDarklyFlagUsedHandler()],
52+
}}
4953
>
5054
{children}
5155
</LDProvider>

0 commit comments

Comments
 (0)