-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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(flags): Document self-serve feature flags integrations #12203
Open
cmanallen
wants to merge
3
commits into
master
Choose a base branch
from
cmanallen/flags-generic-provider
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
docs/organization/integrations/feature-flag/self-serve/index.mdx
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,57 @@ | ||||||
--- | ||||||
title: Self-Serve | ||||||
sidebar_order: 1 | ||||||
description: Learn about Sentry's self-serve feature-flag integrations. | ||||||
--- | ||||||
|
||||||
## Evaluation Tracking | ||||||
|
||||||
Sentry can track flag evaluations as they happen within your application. Flag evaluations will appear in the "Feature Flag" section of Issue Details page as a table, with "suspect" flag predictions highlighted in yellow. Learn more about how to interact with feature flag insights within the Sentry UI by reading the [Issue Details page documentation](/product/issues/issue-details/#feature-flags). | ||||||
|
||||||
### Set Up Evaluation Tracking | ||||||
|
||||||
To set up evaluation tracking visit the [explore page](/product/explore/feature-flags/) and select the language and SDK of your choice. Not using a supported SDK? That's okay. We support self-serve integrations with your existing system. | ||||||
|
||||||
To set up self-serve evaluation tracking visit one of our supported languages pages: | ||||||
* [JavaScript](/platforms/javascript/configuration/integrations/self-serve/) | ||||||
* [Python](/platforms/python/integrations/self-serve/) | ||||||
|
||||||
## Change Tracking | ||||||
|
||||||
Sentry can track changes to feature flag definitions and report suspicious feature flag edits. | ||||||
|
||||||
Sentry offers a change tracking feature which functions as an audit-log of feature flag changes. When a feature flag definition changes in your back-end you can emit a web hook to Sentry. | ||||||
|
||||||
### API Documentation | ||||||
|
||||||
If you're using a self-serve integration it means you will likelyneed to write code to support this endpoint. This section documents our authentication proceedures as well as the resource's fields and structure. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
#### Authentication | ||||||
|
||||||
Authentication is performed using a "signing secret". The "signing secret" must be used to sign the web hook payload in your feature flagging system. Signing the payload with your secret produces a "signature". Sentry needs this signature so it can compare the results of our signing function to yours. Both sides must use the same signing function. Sentry uses a HMAC SHA256 hex-digest of the web hook payload. In Python this function looks like: | ||||||
|
||||||
```python | ||||||
def hmac_sha256_hex_digest(secret: str, message: bytes): | ||||||
return hmac.new(secret.encode(), message, hashlib.sha256).hexdigest() | ||||||
``` | ||||||
|
||||||
The result of this function must be sent as a header to Sentry: `X-Sentry-Signature signature_result`. | ||||||
|
||||||
#### API Blueprint | ||||||
|
||||||
[An API blueprint is available at this permalink](https://github.com/getsentry/sentry/blob/ed324708947ca26392d6579ed76b93fc94a61ab6/src/sentry/flags/docs/api.md#create-generic-flag-log-post). We strive to keep this page updated. Be sure to check the latest master branch for new protocol versions. We will always maintain backwards compatibility so there is no harm in implementing an old version. However, new versions might introduce new features. | ||||||
|
||||||
### Set Up Change Tracking | ||||||
|
||||||
Enabling Change Tracking is a three step process. To get started visit the [feature-flags settings page](https://sentry.io/orgredirect/organizations/:orgslug/settings/feature-flags) in a new tab. Then follow the steps listed below. | ||||||
|
||||||
1. **Click the "Add New Provider" button. | ||||||
- One webhook secret can be registered per provider type. | ||||||
2. **Register the webhook URL**. | ||||||
- Copy the provided Sentry webhook URL and configure your feature flagging system to emit web hooks to this URL. | ||||||
3. **Set the Signing Secret**. | ||||||
- In your feature flagging system's UI retries the "Signing Secret". | ||||||
- Copy the signing secret in the revealed input box and paste it into the input box labeled "Secret" in Sentry. | ||||||
- Save the secret by clicking "Save Secret" in the Sentry fly out. | ||||||
|
||||||
Once saved Sentry will now accept and authenticate all inbound hooks to your organization's feature flag webhook endpoint. |
2 changes: 1 addition & 1 deletion
2
...nfiguration/integrations/featureflags.mdx → ...configuration/integrations/self-serve.mdx
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,50 @@ | ||||||
--- | ||||||
title: Self Serve Feature Flags | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
description: "Learn how to attach custom feature flag data to Sentry error events." | ||||||
--- | ||||||
|
||||||
<PlatformContent includePath="feature-flags/prerelease-alert" /> | ||||||
|
||||||
The Feature Flags integration allows you to manually track feature flag evaluations through an API. 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.** | ||||||
|
||||||
## Install | ||||||
|
||||||
Install `sentry-sdk` from PyPI. | ||||||
|
||||||
```bash | ||||||
pip install --upgrade 'sentry-sdk' | ||||||
``` | ||||||
|
||||||
## Configure | ||||||
|
||||||
Add `FeatureFlagsIntegration()` to your `integrations` list: | ||||||
|
||||||
```python | ||||||
import sentry_sdk | ||||||
from sentry_sdk.integrations.featureflags import FeatureFlagsIntegration | ||||||
|
||||||
sentry_sdk.init( | ||||||
dsn="___PUBLIC_DSN___", | ||||||
integrations=[ | ||||||
FeatureFlagsIntegration(), | ||||||
], | ||||||
) | ||||||
``` | ||||||
|
||||||
## Verify | ||||||
|
||||||
The integration is tested by calling the `add_feature_flag` API before capturing an exception. | ||||||
|
||||||
```python | ||||||
import sentry_sdk | ||||||
from sentry_sdk.integrations.featureflags import add_feature_flag | ||||||
|
||||||
add_feature_flag('test-flag', False) | ||||||
|
||||||
sentry_sdk.capture_exception(Exception("Something went wrong!")) | ||||||
``` | ||||||
|
||||||
Visit the Sentry website and confirm that your error event has recorded the feature flag "test-flag" and its value "false". | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
<PlatformContent includePath="feature-flags/next-steps" /> |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.