Skip to content

Commit

Permalink
complete docs
Browse files Browse the repository at this point in the history
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
  • Loading branch information
Kavindu-Dodan committed Mar 7, 2024
1 parent fd714f7 commit d042c9a
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ erDiagram

In-process deployments embed the flagd evaluation engine directly into the client application through the use of an [in-process provider](./installation.md#in-process).
The in-process provider is connected via the sync protocol to an implementing [gRPC service](./concepts/syncs.md#grpc-sync) that provides the flag definitions.
This pattern requires an in-process implementation of the flagd evaluation engine, but has the benefit of no I/O overhead, since no inter-process communication is required.
You can use flagd itself as a [gRPC service](./reference/grpc-sync-service.md).
In this mode, the flag sync stream will expose aggregated flag configurations currently configured through [syncs](./concepts/syncs.md).
This pattern requires an in-process implementation of the flagd evaluation engine but has the benefit of no I/O overhead, since no inter-process communication is required.

```mermaid
---
Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ With flagd you can:
* perform pseudorandom assignments for experimentation
* perform progressive roll-outs of new features
* aggregate flag definitions from multiple sources
* expose aggregated flags as a gRPC stream to be used by in-process providers

It doesn't include a UI, management console or a persistence layer.
It's configurable entirely via a [POSIX-style CLI](./reference/flagd-cli/flagd.md).
Expand Down
41 changes: 41 additions & 0 deletions docs/reference/grpc-sync-service.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
description: flagd as a gRPC sync service
---

# Overview

flagd can expose a gRPC sync service, allowing in-process providers to obtain their flag configurations.
This mode is **disabled** by default, and you can enable it by using startup flag `--sync-enabled` (or `-e` shorthand flag).
The gRPC sync stream contains flag configurations currently configured at flagd as [sync-configurations](./sync-configuration.md).

```mermaid
---
title: gRPC sync
---
erDiagram
flagd ||--o{ "sync (file)" : watches
flagd ||--o{ "sync (http)" : polls
flagd ||--o{ "sync (grpc)" : "sync.proto (gRPC/stream)"
flagd ||--o{ "sync (kubernetes)" : watches
"In-Process provider" ||--|| flagd : "gRPC sync stream (default port 8015)"
```

You may change the default port of the service using startup flag `--sync-port` (or `-g` shothand flag).

By default, the gRPC stream expose all the flag configurations merged following merge strategy of flagd.
You can read more about the merge strategy in our dedicated [concepts guide on syncs](../concepts/syncs.md).

If you specify a `selector` in the gRPC sync request, the gRPC service will attempt match the provided selector valur to a source and stream specific flags.
For example, if `selector` is set to `myFlags.json`, service will stream flags observed from `myFlags.json` file.
And the request will fail if there is no flag source matching the requested `selector`.
flagd provider implementations expose the ability to define the `selector` value.

```java
final FlagdProvider flagdProvider =
new FlagdProvider(FlagdOptions.builder()
.resolverType(Config.Evaluator.IN_PROCESS)
.host("localhost")
.port(8015)
.selector("myFlags.json")
.build());
```

0 comments on commit d042c9a

Please sign in to comment.