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

Create a new documentation version v1.9.1 #735

Merged
merged 2 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions website/versioned_docs/version-v1.9.1/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"position": 0,
"collapsible": true,
"collapsed": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"position": 20,
"collapsible": true,
"collapsed": true,
"label": "Configure your feature flags",
"link": {
"type": "generated-index",
"title": "Configure your feature flags"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
sidebar_position: 40
description: How to export evaluation data?
---
import {Cards} from '@site/src/components/doc/cards';
import customlogo from '@site/static/docs/collectors/custom.png';
import filelogo from '@site/static/docs/collectors/file.png';
import googlelogo from '@site/static/docs/collectors/google.png';
import loglogo from '@site/static/docs/collectors/log.png';
import s3logo from '@site/static/docs/collectors/s3.png';
import webhooklogo from '@site/static/docs/collectors/webhook.png';

# How to export evaluation data
GO Feature Flag allows for the collection of flag usage data.
During flag evaluation, the key, flag variation and other non-sensitive information used are collected and cached for a
configurable period of time.

The usage data is then written to a file in a chosen format (`parquet`, `JSON` or `CSV`) at a specified interval and
exported to your desired location. This provides a single source for easy processing of the data. The feature can be
configured with options for file format, flush interval, and file location.

To use, simply configure, use the feature flag as normal, and analyze the collected usage data.

## Available exporters

<Cards test={
[
{
name:"Local File",
logo: filelogo,
relayproxy: '/docs/relay_proxy/configure_relay_proxy#file-1',
gomodule: '/docs/go_module/data_collection/file'
},
{
name:"Log",
logo: loglogo,
relayproxy: '/docs/relay_proxy/configure_relay_proxy#log',
gomodule: '/docs/go_module/data_collection/log'
},
{
name:"AWS S3",
logo: s3logo,
relayproxy: '/docs/relay_proxy/configure_relay_proxy#s3-1',
gomodule: '/docs/go_module/data_collection/s3'
},
{
name:"Webhook",
logo: webhooklogo,
relayproxy: '/docs/relay_proxy/configure_relay_proxy#webhook',
gomodule: '/docs/go_module/data_collection/webhook'
},
{
name:"Google Cloud Storage",
logo: googlelogo,
relayproxy: '/docs/relay_proxy/configure_relay_proxy#google-storage-1',
gomodule: '/docs/go_module/data_collection/google_cloud_storage'
},
{
name:"Custom exporter",
logo: customlogo,
gomodule: '/docs/go_module/data_collection/custom'
}
]}/>
266 changes: 266 additions & 0 deletions website/versioned_docs/version-v1.9.1/configure_flag/flag_format.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,266 @@
---
sidebar_position: 20
description: What is a flag and how you can create them.
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';


# How to configure a flag

**GO Feature Flag** core feature is to centralize all your feature flags in a source file, and to avoid hosting and maintaining a backend server to manage them.

Your file must be a valid `YAML`, `JSON` or `TOML` file with a list of flags
*(examples: [`YAML`](https://github.com/thomaspoignant/go-feature-flag/tree/main/testdata/flag-config.yaml),
[`JSON`](https://github.com/thomaspoignant/go-feature-flag/tree/main/testdata/flag-config.json),
[`TOML`](https://github.com/thomaspoignant/go-feature-flag/tree/main/testdata/flag-config.toml))*.

:::tip
The easiest way to create your configuration file is to used
[**GO Feature Flag Editor** available at [https://editor.gofeatureflag.org](https://editor.gofeatureflag.org).

If you prefer to do it manually please follow instruction bellow.
:::

## Editor

Creating the first version of the flag is not always pleasant, that's why we have created
[**GO Feature Flag Editor**](https://editor.gofeatureflag.org) a simple editor to create your files.

## Example

A flag configuration looks like:


<Tabs groupId="code">
<TabItem value="yaml" label="YAML">

```yaml
# This is your configuration for your first flag
first-flag:
variations: # All possible return value for your feature flag
A: false
B: true
targeting: # If you want to target a subset of your users in particular
- query: key eq "random-key"
percentage:
A: 0
B: 100
defaultRule: # When no targeting match we use the defaultRule
variation: A

# A second example of a flag configuration
second-flag:
variations:
A: "valueA"
B: "valueB"
defaultValue: "a default value"
targeting:
- name: legacyRuleV0
query: key eq "not-a-key"
percentage:
A: 10
B: 90
defaultRule:
name: legacyDefaultRule
variation: defaultValue
version: "12"
experimentation:
start: 2021-03-20T00:00:00.1-05:00
end: 2021-03-21T00:00:00.1-05:00
```

</TabItem>
<TabItem value="json" label="JSON">

```json
{
"first-flag": {
"variations": {
"A": false,
"B": true
},
"targeting": [
{
"query": "key eq \"random-key\"",
"percentage": {
"A": 0,
"B": 100
}
}
],
"defaultRule": {
"variation": "A"
}
},

"second-flag": {
"variations": {
"A": "valueA",
"B": "valueB",
"defaultValue": "a default value"
},
"targeting": [
{
"name": "legacyRuleV0",
"query": "key eq \"not-a-key\"",
"percentage": {
"A": 10,
"B": 90
}
}
],
"defaultRule": {
"name": "legacyDefaultRule",
"variation": "defaultValue"
},
"version": "12",
"experimentation": {
"start": "2021-03-20T05:00:00.100Z",
"end": "2021-03-21T05:00:00.100Z"
}
}
}
```

</TabItem>
<TabItem value="toml" label="TOML">

```toml
[first-flag.variations]
A = false
B = true

[[first-flag.targeting]]
query = 'key eq "random-key"'

[first-flag.targeting.percentage]
A = 0
B = 100

[first-flag.defaultRule]
variation = "A"

[second-flag]
version = "12"

[second-flag.variations]
A = "valueA"
B = "valueB"
defaultValue = "a default value"

[[second-flag.targeting]]
name = "legacyRuleV0"
query = 'key eq "not-a-key"'

[second-flag.targeting.percentage]
A = 10
B = 90

[second-flag.defaultRule]
name = "legacyDefaultRule"
variation = "defaultValue"

[second-flag.experimentation]
start = 2021-03-20T05:00:00.100Z
end = 2021-03-21T05:00:00.100Z
```

</TabItem>
</Tabs>

## Format details

<table>
<thead>
<tr>
<th>Field</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td width="20%"><strong>flag-key</strong></td>
<td>Name of your flag.<br/><i>It must be unique.<br/>On the example the flag keys are <code>test-flag</code> and <code>test-flag2</code>.</i></td>
</tr>
<tr>
<td><code>variations</code></td>
<td>
<p>Variations are all the variations available for this flag.</p>
<p>It is represented as a key/value element. The key is the name of the variation and the value could be any types available (<code>string</code>, <code>float</code>, <code>int</code>, <code>map</code>, <code>array</code>, <code>bool</code>).</p>
<p>You can have as many variation as needed.</p>
<pre># Some examples<br/>
variationString: test<br/>
variationBool: true<br/>
variationInt: 1000<br/>
variationFloat: 1000.23<br/>
variationArray: <br/> - item1<br/> - item2<br/>
variationObj:<br/> item1: 123<br/> item2: this is a string<br/> item3: false<br/>
</pre>
</td>
</tr>
<tr>
<td><code>targeting</code><br/><i>(optional)</i></td>
<td>
<p>
Targeting contains the list of rules you have to target a subset of your users.
<br/>You can have as many target as needed.
</p>
<p>This field is an <code>array</code> and contains a list of rules.</p>
<p><i>See <a href="./rule_format">rules format</a> to have more info on how to write a rule.</i></p>
</td>
</tr>
<tr>
<td><code>defaultRule</code></td>
<td>
<p>DefaultRule is the rule that is applied if the user does not match in any targeting.</p>
<p><i>See <a href="./rule_format">rules format</a> to have more info on how to write a rule.</i></p>
</td>
</tr>
<tr>
<td><code>trackEvents</code><br/><i>(optional)</i></td>
<td>
<p><code>false</code> if you don't want to export the data in your data exporter.</p>
<p><b>Default:</b> <code>true</code></p>
</td>
</tr>
<tr>
<td><code>disable</code><br/><i>(optional)</i></td>
<td>
<p><code>true</code> if the flag is disabled.</p>
<p><b>Default:</b> <code>false</code></p>
</td>
</tr>
<tr>
<td><code>version</code><br/><i>(optional)</i></td>
<td>
<p>The version is the version of your flag.<br/>This string is used to display the information in the notifiers and data collection, you have to update it your self.</p>
<p><b>Default:</b> <code>""</code></p>
</td>
</tr>
<tr>
<td><code>scheduledRollout</code><br/><i>(optional)</i></td>
<td>
<p>Scheduled allow to patch your flag over time.</p>
<p>You can add several steps that updates the flag, this is typically used if you want to gradually add more user in your flag.</p>
<p><i>See <a href="./rollout/scheduled/">Scheduled rollout</a> to have more info on how to use it.</i></p>
</td>
</tr>
<tr>
<td><code>experimentation</code><br/><i>(optional)</i></td>
<td>
<p>Experimentation allow you to configure a start date and an end date for your flag. When the experimentation is not running, the flag will serve the default value.</p>
<p><i>See <a href="./rollout/experimentation/">Experimentation rollout</a> to have more info on how to use it.</i></p>
</td>
</tr>
</tbody>
</table>




## Advanced configurations

You can have advanced configurations for your flag to have specific behavior for them, such as:
- [Specific rollout strategies](../category/rollout-strategies/)
- [Don't track a flag](../go_module/data_collection/index.md#dont-track-a-flag)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"position": 30,
"collapsible": true,
"collapsed": true,
"label": "Rollout strategies",
"link": {
"type": "generated-index",
"title": "Rollout strategies",
"description": "A critical part of every new feature release is orchestrating the actual launch schedule between Product, Engineering, and Marketing teams. Delivering powerful user experiences typically requires software teams to manage complex releases and make manual updates at inconvenient times. But it does’t have to, having a complex rollout strategy allows you to have lifecycle for your flags."
}
}
Loading