Skip to content

Commit

Permalink
Create a new documentation version v1.36.1 (#2501)
Browse files Browse the repository at this point in the history
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: thomaspoignant <[email protected]>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 11, 2024
1 parent b0b2dae commit 88f848c
Show file tree
Hide file tree
Showing 85 changed files with 5,654 additions and 184 deletions.
30 changes: 0 additions & 30 deletions website/docs/openfeature_sdk/server_providers/openfeature_go.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,35 +88,5 @@ if adminFlag {
}
```

## Unit testing

When testing code that relies on feature flags, it's crucial to have control over the flag values to simulate different scenarios and isolate your tests.

The **OpenFeature in-memory provider** offers a convenient solution by allowing you to define and manipulate feature flag values directly within your tests.
This eliminates the need to start a relay-proxy and provides a more efficient and flexible testing environment.

In this example, we demonstrate how to use the in-memory provider to set the value of 2 different feature flags in a test:

```go
func TestMyTest(t *testing.T) {
apiInstance := openfeature.GetApiInstance()
apiInstance.SetProvider(
memprovider.NewInMemoryProvider(
map[string]memprovider.InMemoryFlag{
"my-flag-1": {Key: "my-flag-1", DefaultVariant: "var_a", Variants: map[string]any{"var_a": true}},
"my-flag-2": {Key: "my-flag-2", DefaultVariant: "disabled", Variants: map[string]any{"disabled": false}},
}
))

// Your test code here
}
```
By setting the in memory provider you are able to predict the value of the flag you will get when running your tests.
This is a good way to ensure that your test is using the value you are expecting as response of your feature flag.

:::note
The in memory provider is part of the OpenFeature SDK, you don't need to export any extra dependencies to use it.
:::

## Contribute to the provider
You can find the source of the provider in the [`open-feature/go-sdk-contrib`](https://github.com/open-feature/go-sdk-contrib/tree/main/providers/go-feature-flag) repository.
245 changes: 124 additions & 121 deletions website/docs/relay_proxy/configure_relay_proxy.md

Large diffs are not rendered by default.

37 changes: 7 additions & 30 deletions website/docs/relay_proxy/deploy_relay_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ description: Deploy the relay proxy.

# Deploy the relay proxy

## Deploy in Kubernetes using Helm

## Deploy in Kubernetes using Helm
The relay proxy can be deployed in Kubernetes using a helm chart.
Helm is an invaluable tool for configuring and deploying applications to a Kubernetes environment.

Expand All @@ -28,11 +27,8 @@ helm repo add go-feature-flag https://charts.gofeatureflag.org/

### Step 2: Install the Chart

Install the Helm Chart with the Helm install command and provide the custom repository name, the chart name and any
necessary values files.
You can look at
the [helm doc](https://github.com/thomaspoignant/go-feature-flag/blob/main/cmd/relayproxy/helm-charts/relay-proxy/README.md)
to know exactly what you can change in the values.yaml file.
Install the Helm Chart with the Helm install command and provide the custom repository name, the chart name and any necessary values files.
You can look at the [helm doc](https://github.com/thomaspoignant/go-feature-flag/blob/main/cmd/relayproxy/helm-charts/relay-proxy/README.md) to know exactly what you can change in the values.yaml file.

```shell
helm install go-feature-flag/relay-proxy -f values.yaml
Expand All @@ -47,7 +43,6 @@ helm list
```

## Deploy as AWS Lambda

The GO Feature Flag relay proxy can easily be launched as an AWS Lambda function.
To do this, simply set the `startAsAwsLambda` option in your configuration file to `true`, like so:

Expand All @@ -56,34 +51,16 @@ To do this, simply set the `startAsAwsLambda` option in your configuration file
startAsAwsLambda: true
```
Once you've updated your configuration file, you can deploy your function in AWS and configure it to be accessible
via HTTP. This can be achieved by creating an API Gateway or an Application Load Balancer (ALB) and linking it to
Once you've updated your configuration file, you can deploy your function in AWS and configure it to be accessible
via HTTP. This can be achieved by creating an API Gateway or an Application Load Balancer (ALB) and linking it to
your Lambda function.
By configuring your GO Feature Flag relay proxy to run as an AWS Lambda function, you can take advantage of many
benefits of serverless computing, including automatic scaling, reduced infrastructure costs, and simplified
benefits of serverless computing, including automatic scaling, reduced infrastructure costs, and simplified
deployment and management.
:::info
As part of our release process, we are building an archive ready to be deployed as AWS lambda.
You can find it in the [GitHub release page](https://github.com/thomaspoignant/go-feature-flag/releases),and you can use
the assets named `go-feature-flag-aws-lambda_<version>.zip`.
You can find it in the [GitHub release page](https://github.com/thomaspoignant/go-feature-flag/releases),and you can use the assets named `go-feature-flag-aws-lambda_<version>.zip`.
:::

### Choose the handler for your AWS Lambda

Depending on what you put in front of your Lambda function, you will need to choose the right handler.
GO Feature Flag supports 3 different handlers:

- `APIGatewayV1`: This handler is used when you put an API Gateway with the v1 format in front of your Lambda function.
- `APIGatewayV2`: This handler is used when you put an API Gateway with the v2 format in front of your Lambda function.
- `ALB`: This handler is used when you put an Application Load Balancer in front of your Lambda function.

To choose the right handler, you need to set the `awsLambdaAdapter` option in your configuration file with one of this
value. If you don't set this option, the default value is `APIGatewayV2`.

```yaml
# ...
startAsAwsLambda: true
awsLambdaAdapter: ALB
```
2 changes: 1 addition & 1 deletion website/static/sdk-versions.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"maven":{"sdk":"1.12.0","providerKt":"0.1.0","providerJava":"0.3.0","android":"0.3.0"},"npm":{"core":"1.4.0","serverSDK":"1.15.1","providerServer":"0.7.3","providerWeb":"0.2.1"},"pypi":{"sdk":"0.7.1","provider":"0.2.1"},"nuget":{"sdk":"2.0.0","provider":"0.2.0"},"go":{"provider":"v0.2.1","sdk":"v1.13.0"}}
{"maven":{"sdk":"1.12.0","providerKt":"0.1.0","providerJava":"0.3.0","android":"0.3.0"},"npm":{"core":"1.4.0","serverSDK":"1.15.1","webSDK":"1.2.4","providerWeb":"0.2.1"},"pypi":{"sdk":"0.7.1","provider":"0.2.1"},"nuget":{"sdk":"2.0.0","provider":"0.2.0"},"go":{"provider":"v0.2.1","sdk":"v1.13.0"}}
5 changes: 5 additions & 0 deletions website/versioned_docs/version-v1.36.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,39 @@
---
sidebar_position: 22
description: How to bucket users based on a custom identifier
---

# Custom bucketing

When evaluating flags, the `targetingKey` is usually given a user ID. This key ensures that a user will always be in the same group for each flag.

Sometimes, it is desireable to _bucket_ users based on a different value. The `bucketingKey` field in the flag configuration allows you to define a different identifier to be used instead. For example:

```yaml
first-flag:
bucketingKey: "teamId"
variations:
A: false
B: true
defaultRule: # When no targeting match we use the defaultRule
percentage:
A: 50
B: 50
```
With this flag configuration, the `teamId` value will be used for hashing instead of `targetingKey`. The value must be provided to the evaluation context:


```go
user = ffcontext.NewEvaluationContextBuilder("user126")
.AddCustom("teamId", "f74b72")
.Build()
ffclient.BoolVariation("first-flag", user, false)
```

As a result, users who are members of the same team will receive the same flag variation, consistently. A different `bucketingKey` can be used per experiment, though normally you'll only have a handful of possible values.

This is useful for A/B testing, permissions management and other use cases where targeting a consistent group of users is required.

**Note**: if a value in the corresponding `bucketingKey` is not found in the evaluation context, the flag rules will not be evaluated, and the SDK will return the default value.
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
sidebar_position: 40
description: How to export evaluation data?
---
import {Cards} from '@site/src/components/doc/cardv2';
import { ConfigCardContent } from "@site/src/components/doc/configCardContent";
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';
import sqslogo from '@site/static/docs/collectors/sqs.png';
import kafkalogo from '@site/static/docs/collectors/kafka.png';
import pubsublogo from '@site/static/docs/collectors/pubsub.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 and use the feature flag as normal, and analyze the collected usage data.

## Available exporters
<Cards cards={[
{
logoImg: s3logo,
title:"AWS S3",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#s3-1'}
goModuleLink={'../go_module/data_collection/s3'}
/>
},
{
logoImg: sqslogo,
title:"AWS SQS",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#sqs'}
goModuleLink={'../go_module/data_collection/sqs'}
/>
},
{
logoImg: kafkalogo,
title:"Kafka",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#kafka'}
goModuleLink={'../go_module/data_collection/kafka'}
/>
},
{
logoImg: googlelogo,
title:"Google Storage",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#google-storage-1'}
goModuleLink={'../go_module/data_collection/google_cloud_storage'}
/>
},
{
logoImg: pubsublogo,
title:"Google PubSub",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#google-pubsub'}
goModuleLink={'../go_module/data_collection/google_pubsub'}
/>
},
{
logoImg: webhooklogo,
title:"Webhook",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#webhook'}
goModuleLink={'../go_module/data_collection/webhook'}
/>
},
{
logoImg: filelogo,
title:"Local File",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#file-1'}
goModuleLink={'../go_module/data_collection/file'}
/>
},
{
logoImg: loglogo,
title:"Webhook",
content: <ConfigCardContent
relayproxyLink={'../relay_proxy/configure_relay_proxy#log'}
goModuleLink={'../go_module/data_collection/log'}
/>
},
{
logoImg: customlogo,
title:"Custom ...",
content: <ConfigCardContent
goModuleLink={'../go_module/data_collection/custom'}
/>
},
]} />
Loading

0 comments on commit 88f848c

Please sign in to comment.