Data format / Export data
If you want to export data about how your flag are used, you can use the
It collects all the variations events and can save these events on several locations:
- File - create local files with the variation usages.
- Log - use your logger to write the variation usages.
- S3 - export your variation usages to S3.
- Webhook - export your variation usages by calling a webhook.
Currently, we are supporting only feature events.
It represents individual flag evaluations and are considered "full fidelity" events.
|The kind for a feature event is feature. A feature event will only be generated if the trackEvents attribute of the flag is set to true.|
|The kind of context which generated an event. This will only be "anonymousUser" for events generated on behalf of an anonymous user or the reserved word "user" for events generated on behalf of a non-anonymous user|
|The key of the user object used in a feature flag evaluation.|
|When the feature flag was requested at Unix epoch time in milliseconds.|
|The key of the feature flag requested.|
|The variation of the flag requested. Available values are:|
True: if the flag was evaluated to True
False: if the flag was evaluated to False
Dafault: if the flag was evaluated to Default
SdkDefault: if something wrong happened and the SDK default value was used.
|The value of the feature flag returned by feature flag evaluation.|
|(Optional) This value is set to true if feature flag evaluation failed, in which case the value returned was the default value passed to variation.|
Events are collected and send in bulk to avoid spamming your exporter (see details in how to configure data export)
How to configure data export?
ffclient.Config add the
DataExporter field and configure your export location.
To avoid spamming your location everytime you have a variation called,
go-feature-flag is storing in memory all the events and send them in bulk to the exporter.
You can decide the threshold on when to send the data with the properties
MaxEventInMemory. The first threshold hit will export the data.
If there are some flags you don't want to export, you can use
trackEvents fields on these specific flags to disable the data export (see flag file format).
FlushInterval: 10 * time.Second,
|The configuration of the exporter you want to use. All the exporters are available in the |
Time to wait before exporting the data.
Default: 60 seconds.
Don't track a flag
By default, all flags are trackable, and their data are exported.
If you want to exclude a specific flag from the data export, you can set the property
false on your flag, and you will have no export for it.
``` yaml linenums="1" hl_lines="6"
``` json linenums="1" hl_lines="7"
``` toml linenums="1" hl_lines="6"
percentage = 50.0
true = "B"
false = "A"
default = "Default"
trackEvents = false