Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin-sentry): add plugin for sentry #547

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

ysh4296
Copy link

@ysh4296 ysh4296 commented Dec 16, 2024

plugin-sentry (Issue from #520)

Stackflow has a unique screen handling with "Activity."
Currently, Sentry doesn't support tracing for this mechanism,
So we had to create own plugin.

This pr contains a basic functional plugin that works for:

  • Tracing page load events
  • Tracing activity changes (push, pop, replace)

How I Tested It:

  • Test with demo project working on localhost, personal sentry account
  • Load built package from local file path
// demo/.../Stack.tsx

import * as Sentry from "@sentry/browser";
import { sentryPlugin } from "../../../extensions/plugin-sentry/dist";

export const { Stack, actions } = stackflow({
  config,
  components: {
    Main,
    Article,
  },
  plugins: [
    sentryPlugin({
      dsn: "https://example-dsn-key",
      integrations: [Sentry.replayIntegration()],
      // Tracing
      tracesSampleRate: 1.0, //  Capture 100% of the transactions
      // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
      tracePropagationTargets: ["localhost"],
      // Session Replay
      replaysSessionSampleRate: 0.1, // This sets the sample rate at 10%. You may want to change it to 100% while in development and then sample at a lower rate in production.
      replaysOnErrorSampleRate: 1.0, // If you're not already sampling the entire session, change the sample rate to 100% when sampling sessions where errors occur.
    }),
  ],
});

Screen shots & additional explanation

Performance

image
  • Recorded transactions can be viewed under the Performance tab.
  • Both Page Load and Activity Changes (navigation events) are successfully recorded.

Error Tracing

image
  • This plugin integrates seamlessly with other tools (e.g., Replay Integration).
  • It traces user actions within transactions, providing more context for debugging.

Note

I'm not sure if this is the 'desired' behavior, so I would appreciate any feedback.

Copy link

changeset-bot bot commented Dec 16, 2024

⚠️ No Changeset found

Latest commit: 1d27914

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Dec 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
stackflow-docs ✅ Ready (Inspect) Visit Preview Dec 16, 2024 7:25am

@ysh4296 ysh4296 marked this pull request as ready for review December 16, 2024 07:41
@tonyfromundefined tonyfromundefined self-requested a review December 16, 2024 08:57
@tonyfromundefined
Copy link
Member

Hello @ysh4296! It's the end of the year and we're currently busy with other work, so the review is delayed. I think it will be possible early next year, so please keep that in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants