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

docs(flags): Add OpenFeature JS integration docs #11837

Closed
wants to merge 2 commits into from

Conversation

cmanallen
Copy link
Member

DESCRIBE YOUR PR

Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.

IS YOUR CHANGE URGENT?

Help us prioritize incoming PRs by letting us know when the change needs to go live.

  • Urgent deadline (GA date, etc.):
  • Other deadline:
  • None: Not urgent, can wait up to 1 week+

SLA

  • Teamwork makes the dream work, so please add a reviewer to your PRs.
  • Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it.
    Thanks in advance for your help!

PRE-MERGE CHECKLIST

Make sure you've checked the following before merging your changes:

  • Checked Vercel preview for correctness, including links
  • PR was reviewed and approved by any necessary SMEs (subject matter experts)
  • PR was reviewed and approved by a member of the Sentry docs team

LEGAL BOILERPLATE

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

EXTRA RESOURCES

Copy link

vercel bot commented Nov 15, 2024

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

Name Status Preview Comments Updated (UTC)
sentry-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 15, 2024 8:32pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
changelog ⬜️ Ignored (Inspect) Visit Preview Nov 15, 2024 8:32pm
develop-docs ⬜️ Ignored (Inspect) Visit Preview Nov 15, 2024 8:32pm

Copy link

codecov bot commented Nov 15, 2024

Bundle Report

Changes will increase total bundle size by 255 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
sentry-docs-server-cjs 8.59MB 261 bytes (0.0%) ⬆️
sentry-docs-client-array-push 8.94MB 6 bytes (-0.0%) ⬇️

Comment on lines 40 to 41
const client = OpenFeature.getClient();
client.addHooks(new OpenFeatureIntegrationHook());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More of a review to be done here: getsentry/sentry-javascript#14326

But could the integration itself do this? Since it's a "global" function that we're calling we could just auto register and avoid having the user do this bit of code?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not without taking on a dependency. We either ask them to pass the client to us at integration init time (which may or may not be desired depending on their code's structure) or we ask them to register the hook explicitly. Just my two cents. Could be more options I don't know about.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be Sentry.OpenFeatureIntegrationHook?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes thank you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not without taking on a dependency.

I see so we're not shipping a @sentry/openfeature here and this is the way?

It's not the easist set up but it does make our lives much easier for now at least (no additional package requirements)

Copy link
Member Author

@cmanallen cmanallen Nov 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah its just a browser integration so no extra install steps. I agree its not an ideal setup. But I don't think its unexpected setup friction either.

If one day the flag buffer is a property on the scope we could remove the integration registration step all together and just have people register the hook. Which would be a one line change on the customer's side rather than two.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@lizokm lizokm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this, I've left a few wording suggestions.

@@ -0,0 +1,51 @@
---
title: OpenFeature
description: "Attaches recent OpenFeature feature flag evaluations to error event context."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
description: "Attaches recent OpenFeature feature flag evaluations to error event context."
description: "Learn how to attach Sentry's OpenFeature feature flag evaluations to error event context."


_Import name: `Sentry.openFeatureIntegration` and `Sentry.OpenFeatureIntegrationHook`_

The [OpenFeature](https://https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and, in the event an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.**
Copy link
Contributor

@lizokm lizokm Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The [OpenFeature](https://https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and, in the event an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.**
The [OpenFeature](https://openfeature.dev/) integration tracks feature flag evaluations produced by the OpenFeature SDK. These evaluations are held in memory and, if an error occurs, sent to Sentry for review and analysis. **At the moment, we only support boolean flag evaluations.**

const client = OpenFeature.getClient();
client.addHooks(new Sentry.OpenFeatureIntegrationHook());

// Evaluating flags will record the result on the Sentry client.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Evaluating flags will record the result on the Sentry client.
// When you evaluate flags, the result will be recorded by the Sentry client.

Comment on lines +49 to +51
## Options

There are no setup options for this integration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Options
There are no setup options for this integration.
## Options
There are no setup options for this integration.

Maybe it's better to just not have this section since there aren't any options?

@michellewzhang michellewzhang changed the title docs(flags): Add OpenFeature integration docs docs(flags): Add OpenFeature JS integration docs Nov 19, 2024
@michellewzhang
Copy link
Member

michellewzhang commented Nov 27, 2024

we should make it clear that there's another step to setting up flags (the change tracking / webhook step). can link to the index docs in this PR: #11969. can mirror the changes made here: #11970

see figjam for full map!


</Alert>

_Import name: `Sentry.openFeatureIntegration` and `Sentry.OpenFeatureIntegrationHook`_
Copy link
Member

@michellewzhang michellewzhang Nov 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should also add an alert saying this is in beta to match the other docs (same with the LD JS doc too)

i've been doing this:

<Alert level="info" title="Currently in Beta">

The support for **feature flag change tracking** and **feature flag evaluation tracking** is currently in beta.

</Alert>

@ryan953
Copy link
Member

ryan953 commented Dec 2, 2024

looks like this got pulled into the big docs PR here: https://github.com/getsentry/sentry-docs/pull/12005/files#diff-9f766b64b39c2a17b915efb1536f14ed4dede9c406a6e9fe920f1f1110ba7bcf

closing this so we can focus there.

@ryan953 ryan953 closed this Dec 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants