Skip to content

Commit

Permalink
docs: flag and flag-set metadata (#1505)
Browse files Browse the repository at this point in the history
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
  • Loading branch information
toddbaert authored Jan 10, 2025
1 parent 426c36e commit 6c78080
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 14 additions & 0 deletions docs/reference/flag-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ A fully configured flag may look like this.
"on",
"off"
]
},
"metadata": {
"version": "17"
}
}
},
"metadata": {
"team": "user-experience",
"flagSetId": "ecommerce"
}
}
```
Expand Down Expand Up @@ -339,6 +346,13 @@ Example:
}
```

## Metadata

Metadata can be defined at both the flag set (as a sibling of [flags](#flags)) and within each flag.
Flag metadata conveys arbitrary information about the flag or flag set, such as a version number, or the business unit that is responsible for the flag.
When flagd resolves flags, the returned [flag metadata](https://openfeature.dev/specification/types/#flag-metadata) is a merged representation of the metadata defined in the flag set, and the metadata defined in the flag, with the metadata defined in the flag taking priority.
See the [playground](/playground/?scenario-name=Flag+metadata) for an interactive example.

## Boolean Variant Shorthand

Since rules that return `true` or `false` map to the variant indexed by the equivalent string (`"true"`, `"false"`), you can use shorthand for these cases.
Expand Down
8 changes: 7 additions & 1 deletion docs/reference/specifications/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ The provider metadata includes properties returned from the [provider_ready even

## In-Process Evaluation

In-process providers use the [sync schema](./protos.md#syncflagsresponse) to connect to flagd, initiate the [sync stream](./protos.md#eventstreamresponse), and download the `flag-set` rules to evaluate them locally.
In-process providers use the [sync schema](./protos.md#syncflagsresponse) to connect to flagd, initiate the [sync stream](./protos.md#eventstreamresponse), and download the `flag set` rules to evaluate them locally.
In-process providers are relatively complex (compared to RPC providers) to implement since they essentially must implement more of flagd's logic to evaluate flags locally.
Local evaluation has the impact of much lower latency and almost no serialization compared to RPC providers.

Expand Down Expand Up @@ -290,3 +290,9 @@ envoy://localhost:9211/flagd-sync.service

The custom name resolver provider in this case will use the endpoint name i.e. `flagd-sync.service` as [authority](https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/nameresolve/ExampleNameResolver.java#L55-L61)
and connect to `localhost:9211`.

### Metadata

When a flag is resolved, the returned [metadata](./flag-definitions.md#metadata) is a merged representation of the metadata defined on the flag set, and on the flag, with the flag metadata taking priority.
Flag metadata is returned on a "best effort" basis when flags are resolved: disabled, missing or erroneous flags return the metadata of the associated flag set whenever possible.
This is particularly important for debugging purposes and error metrics.

0 comments on commit 6c78080

Please sign in to comment.