Skip to content

Commit

Permalink
fix(doc): updating the documentation to be fully relevant
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspoignant committed Nov 10, 2024
1 parent 0cfb020 commit cdc202a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 32 deletions.
3 changes: 3 additions & 0 deletions cmd/relayproxy/config/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func (c *ExporterConf) IsValid() error {
if c.Kind == AzureExporter && c.Container == "" {
return fmt.Errorf("invalid exporter: no \"container\" property found for kind \"%s\"", c.Kind)
}
if c.Kind == AzureExporter && c.AccountName == "" {
return fmt.Errorf("invalid exporter: no \"accountName\" property found for kind \"%s\"", c.Kind)
}

return nil
}
Expand Down
16 changes: 15 additions & 1 deletion cmd/relayproxy/config/exporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestExporterConf_IsValid(t *testing.T) {
Topic string
StreamName string
Container string
AccountName string
}
tests := []struct {
name string
Expand Down Expand Up @@ -81,10 +82,21 @@ func TestExporterConf_IsValid(t *testing.T) {
{
name: "kind azureBlobStorage without container",
fields: fields{
Kind: "azureBlobStorage",
Kind: "azureBlobStorage",
Container: "",
AccountName: "MyAccount",
},
wantErr: true,
errValue: "invalid exporter: no \"container\" property found for kind \"azureBlobStorage\"",
}, {
name: "kind azureBlobStorage without accountName",
fields: fields{
Kind: "azureBlobStorage",
Container: "MyContainer",
AccountName: "",
},
wantErr: true,
errValue: "invalid exporter: no \"accountName\" property found for kind \"azureBlobStorage\"",
},
{
name: "kind webhook without bucket",
Expand Down Expand Up @@ -231,6 +243,8 @@ func TestExporterConf_IsValid(t *testing.T) {
ProjectID: tt.fields.ProjectID,
Topic: tt.fields.Topic,
StreamName: tt.fields.StreamName,
AccountName: tt.fields.AccountName,
Container: tt.fields.Container,
}
err := c.IsValid()
assert.Equal(t, tt.wantErr, err != nil)
Expand Down
2 changes: 2 additions & 0 deletions cmd/relayproxy/service/gofeatureflag.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,8 @@ func createExporter(c *config.ExporterConf) (exporter.CommonExporter, error) {
Filename: filename,
CsvTemplate: csvTemplate,
ParquetCompressionCodec: parquetCompressionCodec,
AccountKey: c.AccountKey,
AccountName: c.AccountName,
}, nil
default:
return nil, fmt.Errorf("invalid exporter: kind \"%s\" is not supported", c.Kind)
Expand Down
22 changes: 11 additions & 11 deletions website/docs/go_module/data_collection/azure_blob_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ Everytime the `FlushInterval` or `MaxEventInMemory` is reached, a new file will
If for some reason the Azure Blob Storage upload failed, we will keep the data in memory and retry to add it the next time we reach `FlushInterval` or `MaxEventInMemory`.
:::

Check this [complete example](https://github.com/thomaspoignant/go-feature-flag/tree/main/examples/data_export_azureblobstorage) to see how to export the data in S3.

## Configuration example
```go showLineNumbers
ffclient.Config{
Expand All @@ -34,14 +32,16 @@ ffclient.Config{
```

## Configuration fields
| Field | Description |
|---------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Container ` | Name of your Azure Blob Storage Container. |
| `CsvTemplate` | *(optional)* CsvTemplate is used if your output format is CSV. This field will be ignored if you are using format other than CSV. You can decide which fields you want in your CSV line with a go-template syntax, please check [internal/exporter/feature_event.go](https://github.com/thomaspoignant/go-feature-flag/blob/main/internal/exporter/feature_event.go) to see what are the fields available.<br/>**Default:** `{{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};{{ .Value}};{{ .Default}};{{ .Source}}\n` |
| `Filename` | *(optional)* Filename is the name of your output file. You can use a templated config to define the name of your exported files.<br/>Available replacements are `{{ .Hostname}}`, `{{ .Timestamp}`} and `{{ .Format}}`<br/>Default: `flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}` |
| `Format` | *(optional)* Format is the output format you want in your exported file. Available formats are **`JSON`**, **`CSV`**, **`Parquet`**. *(Default: `JSON`)* |
| `Options` | *(optional)* An instance of `option.ClientOption` that configures your access to Google Cloud. <br/> Check [this documentation for more info](https://cloud.google.com/docs/authentication). |
| `Path ` | *(optional)* The location of the directory in your container. |
| `ParquetCompressionCodec` | *(optional)* ParquetCompressionCodec is the parquet compression codec for better space efficiency. [Available options](https://github.com/apache/parquet-format/blob/master/Compression.md) *(Default: `SNAPPY`)* |`
| Field | Description |
|---------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Container ` | Name of your Azure Blob Storage Container. |
| `AccountName ` | This is the name of your Azure Blob Storage account. |
| `AccountKey ` | *(optional)* This is the secret key of your Azure Blob Storage account. |
| `CsvTemplate` | *(optional)* CsvTemplate is used if your output format is CSV. This field will be ignored if you are using format other than CSV. You can decide which fields you want in your CSV line with a go-template syntax, please check [internal/exporter/feature_event.go](https://github.com/thomaspoignant/go-feature-flag/blob/main/internal/exporter/feature_event.go) to see what are the fields available.<br/>**Default:** `{{ .Kind}};{{ .ContextKind}};{{ .UserKey}};{{ .CreationDate}};{{ .Key}};{{ .Variation}};{{ .Value}};{{ .Default}};{{ .Source}}\n` |
| `Filename` | *(optional)* Filename is the name of your output file. You can use a templated config to define the name of your exported files.<br/>Available replacements are `{{ .Hostname}}`, `{{ .Timestamp}`} and `{{ .Format}}`<br/>Default: `flag-variation-{{ .Hostname}}-{{ .Timestamp}}.{{ .Format}}` |
| `Format` | *(optional)* Format is the output format you want in your exported file. Available formats are **`JSON`**, **`CSV`**, **`Parquet`**. *(Default: `JSON`)* |
| `Options` | *(optional)* An instance of `option.ClientOption` that configures your access to Google Cloud. <br/> Check [this documentation for more info](https://cloud.google.com/docs/authentication). |
| `Path ` | *(optional)* The location of the directory in your container. |
| `ParquetCompressionCodec` | *(optional)* ParquetCompressionCodec is the parquet compression codec for better space efficiency. [Available options](https://github.com/apache/parquet-format/blob/master/Compression.md) *(Default: `SNAPPY`)* |`

Check the [godoc for full details](https://pkg.go.dev/github.com/thomaspoignant/go-feature-flag/exporter/azureexporter).
Loading

0 comments on commit cdc202a

Please sign in to comment.