# Generic

## [Evaluation Tracking](https://docs.sentry.io/.md#evaluation-tracking)

Sentry can track flag evaluations as they happen within your application. Flag evaluations will appear in the "Feature Flag" section of the 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](https://docs.sentry.io/product/issues/issue-details.md#feature-flags).

### [Set Up Evaluation Tracking](https://docs.sentry.io/.md#set-up-evaluation-tracking)

To set up evaluation tracking, visit the [explore page](https://docs.sentry.io/product/explore/feature-flags.md) and select the language and SDK of your choice. Not using a supported SDK? That's okay. We support generic solutions for your existing system.

To set up generic evaluation tracking, visit one of our supported languages' pages:

* [JavaScript](https://docs.sentry.io/platforms/javascript/configuration/integrations/featureflags.md)
* [Python](https://docs.sentry.io/platforms/python/feature-flags.md#generic-api)

## [Change Tracking](https://docs.sentry.io/.md#change-tracking)

Sentry can track changes to feature flag definitions and report suspicious feature flag edits.

For the generic case, you need to write a webhook that conforms to our API. You can find instructions on how to do this below.

### [Set Up Change Tracking](https://docs.sentry.io/.md#set-up-change-tracking)

Enabling Change Tracking is a four step process. To get started, visit the [feature flags settings page](https://sentry.io/orgredirect/organizations/:orgslug/settings/feature-flags/change-tracking.md) 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.
   * Select Generic in the dropdown that says "Select a provider".

2. **Save the webhook URL**.
   * Copy the provided Sentry webhook URL and save it for step 4.

3. **Set the Signing Secret**.

   * In your feature flagging system's UI, find the "Signing Secret".
   * Copy the signing secret and paste it into the input box next to "Secret" in Sentry settings.
   * Save the secret by clicking "Add Provider" in Sentry settings.

4. **Write your own webhook**.

   * Configure your system to POST to the webhook URL, whenever a feature flag definition changes.
   * Sign your webhook payloads with the Signing Secret from step 3.
   * See [#api-documentation](https://docs.sentry.io/organization/integrations/feature-flag/generic.md#api-documentation) for more details.

### [API Documentation](https://docs.sentry.io/.md#api-documentation)

This section documents our authentication procedures as well as the resource's fields and structure.

#### [Authentication](https://docs.sentry.io/.md#authentication)

Authentication is performed using a "signing secret". The "signing secret" must be used to sign the webhook 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](https://docs.sentry.io/.md#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.
