From 0938b2e545d7215649a16ae1a085d7090bf38126 Mon Sep 17 00:00:00 2001 From: David Leek Date: Tue, 26 Sep 2023 12:15:22 +0200 Subject: [PATCH] docs: improve datadog integration docs (#4802) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## About the changes Improvement to the description of the datadog integration. Adds 2 missing event types, removes an event type that is deprecated and about to be completely removed, adds missing description of extra json headers and source type name, and adds description for the new configuration option for JSON body support --------- Co-authored-by: Nuno Góis Co-authored-by: Thomas Heartman --- src/lib/addons/datadog-definition.ts | 8 ++-- .../docs/reference/integrations/datadog.md | 48 ++++++++++++++++++- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/src/lib/addons/datadog-definition.ts b/src/lib/addons/datadog-definition.ts index f5c88daacf..540399de25 100644 --- a/src/lib/addons/datadog-definition.ts +++ b/src/lib/addons/datadog-definition.ts @@ -12,8 +12,8 @@ import { FEATURE_STRATEGY_ADD, FEATURE_METADATA_UPDATED, FEATURE_PROJECT_CHANGE, - FEATURE_VARIANTS_UPDATED, FEATURE_POTENTIALLY_STALE_ON, + FEATURE_ENVIRONMENT_VARIANTS_UPDATED, } from '../types/events'; import { IAddonDefinition } from '../types/model'; @@ -55,8 +55,8 @@ const dataDogDefinition: IAddonDefinition = { name: 'customHeaders', displayName: 'Extra HTTP Headers', placeholder: `{ - "ISTIO_USER_KEY": "hunter2", - "SOME_OTHER_CUSTOM_HTTP_HEADER": "SOMEVALUE" + "SOME_CUSTOM_HTTP_HEADER": "SOME_VALUE", + "SOME_OTHER_CUSTOM_HTTP_HEADER": "SOME_OTHER_VALUE" }`, description: '(Optional) Used to add extra HTTP Headers to the request the plugin fires off. This must be a valid json object of key-value pairs where both the key and the value are strings', @@ -94,7 +94,7 @@ const dataDogDefinition: IAddonDefinition = { FEATURE_STRATEGY_ADD, FEATURE_METADATA_UPDATED, FEATURE_PROJECT_CHANGE, - FEATURE_VARIANTS_UPDATED, + FEATURE_ENVIRONMENT_VARIANTS_UPDATED, FEATURE_POTENTIALLY_STALE_ON, ], tagTypes: [ diff --git a/website/docs/reference/integrations/datadog.md b/website/docs/reference/integrations/datadog.md index 1ce1eaf66f..237504a9ac 100644 --- a/website/docs/reference/integrations/datadog.md +++ b/website/docs/reference/integrations/datadog.md @@ -28,6 +28,8 @@ You can choose to trigger updates for the following events: - feature-stale-off - feature-environment-enabled - feature-environment-disabled +- feature-environment-variants-updated +- feature-potentially-stale-on > *) Deprecated, and will not be used after transition to environments in Unleash v4.3 @@ -35,12 +37,54 @@ You can choose to trigger updates for the following events: Unleash Datadog integration takes the following parameters. -- **Datadog Events URL** - This property is optional. The default url is https://api.datadoghq.com/api/v1/events. Needs to be changed if you are not not on the US1 [Datadog site](https://docs.datadoghq.com/getting_started/site/). Possible alternatives: +- **Datadog Events URL** - This is an optional property. The default URL is https://api.datadoghq.com/api/v1/events. If you are not not using the US1 [Datadog site](https://docs.datadoghq.com/getting_started/site/), you'll need to change this. Some instances and their URLs are: - EU: https://app.datadoghq.eu/api/v1/events - US1: https://app.datadoghq.com/api/v1/events - US3: https://us3.datadoghq.com/api/v1/events - US1-FED: https://app.ddog-gov.com/api/v1/events -- **DD API KEY** - This is a required property. + + +- **Datadog API key** - This is a required property. The API key to use to authenticate with Datadog. + +- **Datadog Source Type Name** - This is an optional property. Sets `source_type_name` parameter to be included in Datadog events. + +- **Extra HTTP Headers** - This is an optional property. Used to set the additional headers when Unleash communicates with Datadog. + +Example: + +```json +{ + "SOME_CUSTOM_HTTP_HEADER": "SOME_VALUE", + "SOME_OTHER_CUSTOM_HTTP_HEADER": "SOME_OTHER_VALUE" +} +``` + +:::info Body template availability + +The body template property will be introduced as a beta feature in Unleash 5.5 and is expected to be made generally available in Unleash 5.6. + +::: + +- **Body template** - This is an optional property. The template is used to override the body template used by Unleash when performing the HTTP POST. You can format your message using a [Mustache template](https://mustache.github.io). Refer to the [Unleash event types](/reference/event-types) reference to find out which event properties you have access to in the template. + +Example: + +```mustache +{ + "event": "{{event.type}}", + "createdBy": "{{event.createdBy}}", + "featureToggle": "{{event.data.name}}", + "timestamp": "{{event.data.createdAt}}" +} +``` + +If you don't specify anything Unleash will send a formatted markdown body. + +Example: + +```markdown +username created feature toggle (featurename)[http://your.url/projects/projectname/features/featurename] in project *projectname* +``` #### Tags {#tags}