<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
<!-- add the description of the PR here -->
- adds a toggle `disable-sync-metadata` for the Sync Service to disable
or enable the deprecated `getMetadata` request
### Related Issues
[#1688 [FEATURE] Temporary Context Enrichment
toggle](https://github.com/open-feature/flagd/issues/1688)
---------
Signed-off-by: Konvalinka <lea.konvalinka@dynatrace.com>
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
<!-- add the description of the PR here -->
- adds server side deadline for sync and event streams configurable via
cmd argument `--stream-deadline`
### Related Issues
#1582
### Notes
<!-- any additional notes for this PR -->
### How to test
1. Run flagd with `--stream-deadline 3s` // 3s can be replaced with any
duration the deadline should have
2. Test Event Stream deadline: run `grpcurl -v --proto
schemas/protobuf/flagd/evaluation/v1/evaluation.proto -plaintext
localhost:8013 flagd.evaluation.v1.Service/EventStream` or similar
depending on your flagd settings to check if the deadline exceeded is
returned after the specified duration
3. Test Sync Service Stream deadline: run `grpcurl -v --proto
schemas/protobuf/flagd/sync/v1/sync.proto -plaintext localhost:8015
flagd.sync.v1.FlagSyncService/SyncFlags` or similar depending on your
flagd settings to check if the deadline exceeded is returned after the
specified duration
Signed-off-by: alexandra.oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
Able to update context map using headers present in
- OFREP requests
- Connect Requests (via Flag Evaluator V2 service)
### Related Issues
Fixes#1583
### Notes
Context values passed via headers is high priority
If same context key is updated via
- Headers
- Request Body
- Static Config
_Context via Headers will be considered_
### Usage
```
flagd start --port 8013 --uri file:./samples/example_flags.flagd.json -H Header=contextKey
```
or
```
flagd start --port 8013 --uri file:./samples/example_flags.flagd.json --context-from-header Header=contextKey
```
---------
Signed-off-by: Rahul Baradol <rahul.baradol.14@gmail.com>
## This PR
adds support for unix sockets in sync service
### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->
Fixes#1518
### How to test
start flagd with the new option `-e /tmp/socketpath` and try to connect
with an in-process provider to the same socket path & request a flag
---------
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: alexandraoberaigner <82218944+alexandraoberaigner@users.noreply.github.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Adds a bit of conceptual docs about metadata. We already have lots of
detail on how to configure it, how it's merged in the `definitions`
page, and how it's implemented in in-process providers.
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
⚠️ This PR brings a breaking change to the
[flagd-core](https://pkg.go.dev/github.com/open-feature/flagd/core)
library: the `IStore` interface now returns an additional value
representing the flag set metadata. There are no breaking changes in
flagd's behavior.
Changes in flagd:
- returns flag set metadata as metadata for error flags (best effort)
- returns flag set metadata in OFREP and RPC calls
- moves metadata merging logic to evaluator (all flags inherent flag set
metadata, but can override, as as before but now reusable in flagd core)
- removes duplicated flag set metadata keys when the same flag set
metadata key exists in multiple sources
### To Test
- requires `curl`, `grpcurl`, and `jq`
#### RPC
```shell
grpcurl -import-path /...../schemas/protobuf/flagd/evaluation/v1 -proto evaluation.proto -plaintext localhost:8013 flagd.evaluation.v1.Service/ResolveAll | jq
```
### OFREP
```shell
curl --location 'http://localhost:8016/ofrep/v1/evaluate/flags' --header 'Content-Type: application/json' --data '{"context": {"color": "yellow"}}' | jq
```
### Sync
```shell
grpcurl -import-path /...../schemas/protobuf/flagd/sync/v1/ -proto sync.proto -plaintext localhost:8015 flagd.sync.v1.FlagSyncService/FetchAllFlags | jq -r .flagConfiguration | jq
```
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
update of spec for https://github.com/open-feature/flagd/issues/1504
---------
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
Intent of this PR is to add the docs that were missing from #1449
### Notes
Happy holidays yall.
---------
Signed-off-by: Dave Josephsen <dave.josephsen@gmail.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
updating specification based on findings in
https://github.com/open-feature/flagd/issues/1472
---------
Signed-off-by: Simon Schrottner <simon.schrottner@dynatrace.com>
Co-authored-by: chrfwow <christian.lutnik@dynatrace.com>
- add the `--context-value` command line flag to pass arbitrary key
value pairs to the evaluation context
Signed-off-by: Aleksei Muratov <muratoff.alexey@gmail.com>
This PR contains significant enhancements to flagd provider specs. If
merged, I will be opening a bunch of issues to implement what's
described here based on recon I've been doing with the existing
implementations
Specifically:
- adds `retryGraceAttempts` param, which defines the amount of stream
retry attempts before provider moves from `STALE` to `ERROR` state
- adds `contextEnricher` param, which defines mapping function for
sync-metadata to evaluation context for in process providers (exists
already in Java provider)
- improves consistency between in-process and RPC stream reconnect
behavior
- simplifies provider doc and spec to remove duplication and improve
readability
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Guido Breitenhuber <157148191+guidobrei@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
## This PR
Added custom gRPC resolver to support envoy proxy
- support gRPC custom resolver
### Related Issues
Fixes https://github.com/open-feature/go-sdk-contrib/issues/585
### Notes
- update `.github/workflow/build.yaml` to install `envoy`
[binary](https://www.envoyproxy.io/docs/envoy/latest/start/install#install-binaries)
part of e2e test.
- this is a pre-requisite for `flagd` go [provider
update](https://github.com/open-feature/go-sdk-contrib/issues/585)
### How to test
Unit test are already added for the custom resolver for integration test
you need a working envoy proxy support or any of the supported core
resolver mentioned
[here](https://grpc.io/docs/guides/custom-name-resolution/#overview)
```shell
bin % ./flagd start -x --uri envoy://localhost:9211/test.service
______ __ ________ _______ ______
/_____/\ /_/\ /_______/\ /______/\ /_____/\
\::::_\/_\:\ \ \::: _ \ \\::::__\/__\:::_ \ \
\:\/___/\\:\ \ \::(_) \ \\:\ /____/\\:\ \ \ \
\:::._\/ \:\ \____\:: __ \ \\:\\_ _\/ \:\ \ \ \
\:\ \ \:\/___/\\:.\ \ \ \\:\_\ \ \ \:\/.:| |
\_\/ \_____\/ \__\/\__\/ \_____\/ \____/_/
2024-10-14T20:19:51.411+0200 info cmd/start.go:120 flagd version: dev (f716423), built at: 2024-10-14T20:19:34Z {"component": "start"}
2024-10-14T20:19:51.412+0200 debug telemetry/builder.go:81 skipping trace provider setup as collector target is not set. Traces will use NoopTracerProvider provider and propagator will use no-Op TextMapPropagator
2024-10-14T20:19:51.412+0200 info flag-sync/sync_service.go:54 starting flag sync service on port 8015 {"component": "FlagSyncService"}
2024-10-14T20:19:51.412+0200 debug builder/syncbuilder.go:111 using grpc sync-provider for: envoy://localhost:9211/test.service {"component": "sync"}
2024-10-14T20:19:51.413+0200 info flag-evaluation/connect_service.go:247 metrics and probes listening at 8014 {"component": "service"}
2024-10-14T20:19:51.413+0200 info ofrep/ofrep_service.go:56 ofrep service listening at 8016 {"component": "OFREPService"}
2024-10-14T20:19:51.415+0200 info flag-evaluation/connect_service.go:227 Flag IResolver listening at [::]:8013 {"component": "service"}
2024-10-14T20:19:51.428+0200 debug grpc/grpc_sync.go:201 received full configuration payload {"component": "sync", "sync": "grpc"}
2024-10-14T20:19:55.057+0200 debug grpc/grpc_sync.go:201 received full configuration payload {"component": "sync", "sync": "grpc"}
```
---------
Signed-off-by: Pradeep <pradeepbbl@gmail.com>
Signed-off-by: Matthew Wilson <54033231+wilson-matthew@users.noreply.github.com>
Co-authored-by: Matthew Wilson <54033231+wilson-matthew@users.noreply.github.com>
## This PR
Fixes a typo in `docs/reference/openfeature-operator/overview.md`
Signed-off-by: Matthew Wilson <54033231+wilson-matthew@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
## This PR
The OpenTelemetry collectors in my production environment are configured
to use TLS for uploading metrics / traces so this PR aims to
- add the ability to use mTLS + self-signed certificates when exporting
to the opentelemetry collector
This is the 'quick and dirty' approach so wanted to make an initial PR
to make sure the high level implementation is the approach you're
looking for.
### Follow-up Tasks
- [ ] update the documentation when this approach is approved
### How to test
I am struggling to figure out how to test this with self signed
certificates to give a specific set of commands you can run because the
TLS connection is never successful (assuming this is because of my
commands)
```bash
openssl req -x509 -newkey rsa:4096 -keyout ca.key.pem -out ca.cert.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=localhost"
openssl req -x509 -newkey rsa:4096 -keyout client.key.pem -out client.cert.pem -CA ca.cert.pem -CAkey ca.key.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=localhost" -addext "subjectAltName = IP:127.0.0.1"
openssl req -x509 -newkey rsa:4096 -keyout server.key.pem -out server.cert.pem -CA ca.cert.pem -CAkey ca.key.pem -sha256 -days 3650 -nodes -subj "/C=XX/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=localhost" -addext "subjectAltName = IP:127.0.0.1"
```
; however, when I pull certificates from my production environment to
test this works
---------
Signed-off-by: Kevin Schoonover <me@kschoon.me>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Implement fsnotify and `os.Stat` based watchers
fixes: #1344
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
Intent of this PR is to begin a conversation about fixing #1344. The
approach taken is to replace the current use of `fsontify.Watcher` with
a local `Watcher` interface type that describes the `fsnotify.Watcher`
interface.
My original take was to use fsnotify.Watcher directly as an
implementation of local `Watcher`, but fsnotify's Watcher directly
exposes its Error and Event channels, making it impossible to describe
with an interface, so I had to create a small wrapper for
`fsnotify.Watcher` to satisfy the new Watcher interface (this is
fsnotify_watcher.go). From there, we implement the `Watcher` interface
again, this time using `os.Stat` and `fs.FileInfo` (this is
fileinfo_watcher.go).
Then we change the filepath sync code to use an interface to Watcher,
rather than fsnotify.Watcher directly. The new fileinfo watcher plugs
right in, and nothing really needs to change in the sync.
* I have not wired up configs, so the fileinfo watcher has a hard-coded
1-second polling interval, and there is no current means of selecting
between them.
* I've added a couple tests, to demonstrate how unit tests would work in
general (we use a configurable os-stat func in the fileinfo watcher,
which can be mocked for tests)
* I don't have a way of testing this on Windows. I'm vaguely aware
there's an upstream issue in package `fs` that may require some
work-around boilerplate to make this work on windows at the moment.
If yall are favorable to this approach, I'll finish wiring up configs,
and flesh out the tests. I didn't want to go much further without some
buy-in or feedback.
### Related Issues
Fixes#1344
### Notes
See bullet-points above
### How to test
go test -v ./...
---------
Signed-off-by: Dave Josephsen <dave.josephsen@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
## This PR
Added a new config option `maxMsgSize` which will
allow users to override default message size 4Mb.
- allow override default max message size 4Mb
### Related Issues
Fixes#1357
### How to test
To test this feature you need a flag source with large number of flags >
4Mb, e.g. below we are running with max size of 5Mb+
```
./flagd start --port 8013 --sync-port 8017 --sources='[{"uri": "localhost:8015", "provider": "grpc", "tls": false, "providerID": "flagd-sidecar", "selector": "all-flags", "maxMsgSize": 5728474}]'
______ __ ________ _______ ______
/_____/\ /_/\ /_______/\ /______/\ /_____/\
\::::_\/_\:\ \ \::: _ \ \\::::__\/__\:::_ \ \
\:\/___/\\:\ \ \::(_) \ \\:\ /____/\\:\ \ \ \
\:::._\/ \:\ \____\:: __ \ \\:\\_ _\/ \:\ \ \ \
\:\ \ \:\/___/\\:.\ \ \ \\:\_\ \ \ \:\/.:| |
\_\/ \_____\/ \__\/\__\/ \_____\/ \____/_/
2024-07-11T11:31:57.024+0200 info cmd/start.go:107 flagd version: dev (da01e08), built at: 2024-07-11T11:14:44Z {"component": "start"}
2024-07-11T11:31:57.026+0200 info flag-sync/sync_service.go:54 starting flag sync service on port 8017 {"component": "FlagSyncService"}
2024-07-11T11:31:57.027+0200 info grpc/grpc_sync.go:70 setting max receive message size 5728474 bytes default 4MB {"component": "sync", "sync": "grpc"}
```
---------
Signed-off-by: Pradeep Mishra <pradeepbbl@gmail.com>
Signed-off-by: pradeepbbl <pradeepbbl@gmail.com>
Signed-off-by: Pradeep Mishra <pradeepbbl@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Closes#1282
This PR adds support for using relative weights instead of percentages
that need to add up to 100.
The behavior for existing flag configs does not change with this PR, so
those will continue to work as they did previously
---------
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Remove references to old protos, update `/schemas` submodule.
The old protos were still being used to generate the doc. I've updated
them. Also, the `schemas` submodule was set to some very old version, I
couldn't even run the live docs for that reason. I've updated it to the
latest release of that module.
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
<!-- add the description of the PR here -->
- no longer injects flagKey as seed for fractional op when user has
provided custom targeting
- updates schema to allow `cat` and other operations so that custom
targeting can be properly seeded
### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->
https://github.com/open-feature/flagd/issues/1264
### Notes
<!-- any additional notes for this PR -->
### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->
### How to test
<!-- if applicable, add testing instructions under this section -->
```bash
# unit tests
make test
# gherkin tests
./bin/flagd start -f file:test-harness/flags/testing-flags.json -f file:test-harness/flags/custom-ops.json -f file:test-harness/flags/evaluator-refs.json -f file:test-harness/flags/zero-flags.json
make flagd-integration-test
```
---------
Signed-off-by: Cole Bailey <cole.bailey@deliveryhero.com>
Signed-off-by: Cole Bailey <cole.bailey.one@gmail.com>
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
## This PR
Fixes#1245 and introduce OFREP support for flagd
OFREP service runs on 8016 by default and can simply use curl for flag
evaluations,
```shell
curl -X POST 'http://localhost:8016/ofrep/v1/evaluate/flags/myBoolFlag'
```
NOTE - This PR touch several files as I had to migrate from
`github.com/golang/mock/gomock` to `go.uber.org/mock/gomock`. This is
because https://github.com/golang/mock is no longer maintained.
---------
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Co-authored-by: Florian Bacher <florian.bacher@dynatrace.com>
## This PR
Introduce flag sync capability to flagd as discussed at [1] and fixes
https://github.com/open-feature/flagd/issues/1230 .
**What's changed ?**
The change included with this PR introduces the gRPC sync contract [2].
This allows flagd to expose its store to in-process provider which
consumes gRPC flag stream.

**How to use ?**
flagd will start sync service on port `8015`. You can alter the default
sync port by providing desired port to the startup flag `syncPort`
(`--sync-port=8686`)
**Implementation details**
- Sync service startup is delayed to allow configured flag sources to
complete their initial loading (dealy is 5 seconds)
- Sync request's `selector` can be used to specify the specific flag
source. If unset, all flags will be sent
- A new stream response will be created whenever there are updates from
flag sources
[1] - https://github.com/open-feature/flagd/discussions/1153
[2] -
https://github.com/open-feature/flagd-schemas/blob/main/protobuf/flagd/sync/v1/sync.proto
---------
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
- adds redirects to appropriate OFO docs
- adds an OFO overview page
### Related Issues
Fixes#1055
### Notes
This PR removes most of the OFO docs so that we only have to maintain
content in a single location. In the future, it would be ideal if we
could include relative content automatically in the flagd docs, but that
was out of scope of this PR.
Signed-off-by: Michael Beemer <beeme1mr@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
- adds support for any auth scheme in HTTP-sync auth header
### Related Issues
Closes#1150
---------
Signed-off-by: Best Olunusi <olunusibest@gmail.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Closes#1029
This PR introduces support for the newly introduced evaluation and sync
schemas.
Supporting both the old and new schemas involves some duplication, but I
tried to keep it as minimal as possible. I'm of course open for
suggestions for any ideas on how to make this simpler :)
See reasoning for new naming
[here](https://github.com/open-feature/flagd/issues/948).
---------
Signed-off-by: Florian Bacher <florian.bacher@dynatrace.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
Remove deprecated flags in flagd and flagd-proxy. Slight clean up of the
code by removing `getPortValueOrDefault`. Setting the default value in
the definition of the flag accomplishes the same thing.
Signed-off-by: Craig Pastro <craig.pastro@gmail.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>
- returning variants from targeting which are not in the variants list is now an error
- minor spec changes
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
Co-authored-by: Michael Beemer <beeme1mr@users.noreply.github.com>