Skip to content

Commit 2fdc98b

Browse files
jonathannorrisbruno-garciamoredip
authored
feat: Sentry integration blog post (#1099)
## This PR - Blog post about Sentry's Hook integrations for Javascript / Python --------- Signed-off-by: Jonathan Norris <[email protected]> Co-authored-by: Bruno Garcia <[email protected]> Co-authored-by: Pete Hodgson <[email protected]>
1 parent a4dd3ef commit 2fdc98b

File tree

2 files changed

+106
-0
lines changed

2 files changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
slug: "sentry-openfeature-integration"
3+
title: "Sentry OpenFeature Integration"
4+
date: 2025-04-08
5+
authors: [jonathannorris]
6+
description: "Announcing Sentry's OpenFeature integration for enhanced feature flag observability"
7+
tags: [sentry, openfeature, "feature flags", observability]
8+
draft: false
9+
---
10+
11+
We're excited to announce that Sentry has released OpenFeature Hooks for [JavaScript](https://docs.sentry.io/platforms/javascript/configuration/integrations/openfeature/) and [Python](https://docs.sentry.io/platforms/python/integrations/openfeature/), enabling developers to track feature flag evaluations directly in their error monitoring and performance tracking.
12+
13+
## What is the Sentry OpenFeature Integration?
14+
15+
The Sentry OpenFeature Hook allows Sentry to track feature flag evaluations within your application.
16+
When an error occurs, Sentry will include the state of all evaluated feature flags in the error report, providing crucial context for debugging and troubleshooting.
17+
18+
This integration is currently in beta and only supports boolean flag evaluations.
19+
See their [changelog](https://changelog.sentry.dev/changelog/view-distributions-of-feature-flag-evaluations-inside-issue-details/) for details on how feature flags are integrated into their platform.
20+
21+
<img src={require('@site/static/img/blog/2025-03-25-sentry-openfeature-integration/sentry_dashboard.png').default} />
22+
23+
## JavaScript Integration
24+
25+
To use the Sentry OpenFeature Hook in your JavaScript application:
26+
27+
```typescript
28+
import * as Sentry from "@sentry/browser";
29+
import { OpenFeature } from "@openfeature/web-sdk";
30+
31+
Sentry.init({
32+
dsn: "https://[email protected]/0",
33+
integrations: [Sentry.openFeatureIntegration()],
34+
});
35+
36+
OpenFeature.setProvider(new MyProviderOfChoice());
37+
OpenFeature.addHooks(new Sentry.OpenFeatureIntegrationHook());
38+
39+
const client = OpenFeature.getClient();
40+
const result = client.getBooleanValue("test-flag", false); // evaluate with a default value
41+
Sentry.captureException(new Error("Something went wrong!"));
42+
```
43+
44+
> Requirements: Sentry SDK version 8.43.0 or higher
45+
46+
## Python Integration
47+
48+
For Python applications, you can use the Sentry OpenFeature Hook as follows:
49+
50+
```python
51+
import sentry_sdk
52+
from sentry_sdk.integrations.openfeature import OpenFeatureIntegration
53+
from openfeature import api
54+
55+
// Initialize Sentry with the OpenFeature integration
56+
sentry_sdk.init(
57+
dsn="https://[email protected]/0",
58+
integrations=[
59+
OpenFeatureIntegration(),
60+
],
61+
)
62+
63+
// Get your OpenFeature client
64+
client = api.get_client()
65+
66+
// Evaluate a feature flag
67+
client.get_boolean_value("hello", default_value=False)
68+
69+
// If an error occurs, Sentry will include the feature flag state
70+
sentry_sdk.capture_exception(Exception("Something went wrong!"))
71+
```
72+
73+
> Requirements: sentry-sdk >= 2.19.2, openfeature-sdk >= 0.7.1, Python >= 3.8
74+
75+
## Benefits of Feature Flag Observability
76+
77+
The Sentry OpenFeature integration provides several key benefits:
78+
79+
1. **Contextual Error Reporting**: When errors occur, you'll see exactly which feature flags were active, helping you identify if a flag change contributed to the issue.
80+
81+
2. **Performance Monitoring**: Track how feature flags impact your application's performance.
82+
83+
3. **Debugging Efficiency**: Reduce the time spent reproducing issues by having feature flag state automatically included in error reports.
84+
85+
4. **Release Confidence**: Make data-driven decisions about feature rollouts by correlating errors with specific flag states.
86+
87+
## The Value of Open Standards
88+
89+
This integration exemplifies the power of open standards in the feature flagging ecosystem.
90+
By implementing the OpenFeature specification, Sentry can provide a seamless integration that works with any OpenFeature provider, without requiring vendor-specific implementations.
91+
92+
This aligns with OpenFeature's vision of reducing integration effort by [moving from effort(N*M) to effort(N+M)](https://openfeature.dev/blog/openfeature-a-standard-for-feature-flagging/#from-effortnm-to-effortnm).
93+
OpenFeature delivers a standardized feature flagging SDK, already implemented by most providers, and Sentry can focus on building a great performance monitoring and error-tracking platform for their users.
94+
95+
## Next Steps
96+
97+
If you're using Sentry and OpenFeature, we encourage you to try out this integration.
98+
The feature flag state will be automatically included in your error reports, providing valuable context for debugging.
99+
100+
For more information, check out the official Sentry documentation:
101+
102+
- [JavaScript Integration](https://docs.sentry.io/platforms/javascript/configuration/integrations/openfeature/)
103+
- [Python Integration](https://docs.sentry.io/platforms/python/integrations/openfeature/)
104+
105+
Using another platform? Sentry is planning expanding support for more platforms, starting with mobile.
106+
We're excited to see how this integration helps teams better understand the impact of their feature flags on application stability and performance.
132 KB
Loading

0 commit comments

Comments
 (0)