Skip to content

Commit

Permalink
chore: update clickhouse docs (#187)
Browse files Browse the repository at this point in the history
* chore: update clickhouse docs

* chore: format code

---------

Co-authored-by: markphelps <[email protected]>
  • Loading branch information
markphelps and markphelps authored Feb 16, 2024
1 parent 8bcc17b commit 369cfb4
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 31 deletions.
51 changes: 42 additions & 9 deletions configuration/analytics.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@ description: This document describes various configuration mechanisms for contro

## Analytics

Since [v1.37.0](https://github.com/flipt-io/flipt/releases/tag/v1.37.0) Flipt includes functionality for reporting analytical data to a configurable storage engine.
As of [v1.37.0](https://github.com/flipt-io/flipt/releases/tag/v1.37.0), Flipt includes functionality for reporting analytical data to a configurable storage engine.

Currently, Flipt has support for collecting data into:
Currently, Flipt has support for collecting data into the following storage engines:

- [Clickhouse](https://clickhouse.com/)
- [ClickHouse](https://clickhouse.com/)

The data that gets collected currently includes:

- Flag Evaluation Count

Once a storage backend is configured, these analytics are viewable in the UI allowing users to visualize up to 24 hours of data for each metric.
Once a storage engine is configured, these analytics are viewable in the UI allowing users to visualize up to 24 hours of data for each metric.

![UI For Analytics](/images/configuration/analytics_quick_view.png)

The image above shows the past 30 minutes of the flag `flag1` evaluation counts.

## Considerations
### Origin

### Database
Analytics are currently only collected as they pass through the evaluation server. This means that analytics will be captured if you are using the REST or GRPC APIs via one of our [Server SDKs](/integration/server/rest) or [GRPC SDKs](/integration/server/grpc) for evaluations.

We have plans to support collecting analytics for [Client-Side](/integration/client) evaluations in the future.

## ClickHouse

You can use a self-hosted ClickHouse instance or a [managed instance](https://clickhouse.com/cloud/) to store your analytics data.

We highly **recommend** using a separate database for analytics produced by Flipt. This ensures that Flipt analytic data can be logically isolated from the rest of your Clickhouse data.

Expand All @@ -33,8 +39,35 @@ We highly **recommend** using a separate database for analytics produced by Flip
[migration](/configuration/storage#migrations) section for more info.
</Note>

### Origin of Analytics
To create a database for Flipt analytics, you can use the following SQL:

Analytics are currently only collected as they pass through the evaluation server. This means that analytics will be captured if you are using the REST or GRPC APIs via one of our [Server SDKs](/integration/server/rest) or [GRPC SDKs](/integration/server/grpc) for evaluations.
```sql
CREATE DATABASE IF NOT EXISTS flipt_analytics;
```

We have plans to support collecting analytics for [Client-Side](/integration/client) evaluations in the future.
See the [ClickHouse documentation](https://clickhouse.com/docs) for more information on how to get started with ClickHouse.

### Configuration

To configure Flipt to use ClickHouse for analytics, you will need to add the following configuration to your `config.yml` file or environment variables:

<Tabs>
<Tab title="Environment Variables">

```bash
FLIPT_ANALYTICS_CLICKHOUSE_ENABLED=true
FLIPT_ANALYTICS_CLICKHOUSE_URL=clickhouse://clickhouse:9000/flipt_analytics
```

</Tab>
<Tab title="Configuration YAML">

```yaml
analytics:
clickhouse:
enabled: true
url: clickhouse://clickhouse:9000/flipt_analytics
```
</Tab>
</Tabs>
24 changes: 12 additions & 12 deletions configuration/storage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ This is particularly useful for local development and validation of flag state c
Flipt will periodically rebuild its state from the local disk every 10 seconds.

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_STORAGE_TYPE="local"
FLIPT_STORAGE_LOCAL_PATH="."
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
storage:
Expand All @@ -184,7 +184,7 @@ This cadence is also configurable and defaults to 30 seconds.
Flipt will follow the configured reference (e.g. branch name) and keep up to date with new changes.

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_STORAGE_TYPE="git"
Expand All @@ -197,7 +197,7 @@ Flipt will follow the configured reference (e.g. branch name) and keep up to dat
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
storage:
Expand Down Expand Up @@ -302,7 +302,7 @@ The AWS S3 backend can be configured to serve state from a single bucket from a
The following is an example of how to configure Flipt to leverage this backend type:

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_STORAGE_TYPE="object"
Expand All @@ -317,7 +317,7 @@ The following is an example of how to configure Flipt to leverage this backend t
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
storage:
Expand Down Expand Up @@ -356,7 +356,7 @@ The Azure Blob Storage backend can be configured to serve state from a single co
The following is an example of how to configure Flipt to leverage this backend type:

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_STORAGE_TYPE="object"
Expand All @@ -368,7 +368,7 @@ The following is an example of how to configure Flipt to leverage this backend t
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
storage:
Expand Down Expand Up @@ -414,7 +414,7 @@ The Google Cloud Storage backend can be configured to serve state from a single
The following is an example of how to configure Flipt to leverage this backend type:

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_STORAGE_TYPE="object"
Expand All @@ -426,7 +426,7 @@ The following is an example of how to configure Flipt to leverage this backend t
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
storage:
Expand Down Expand Up @@ -462,7 +462,7 @@ Since `v1.31.0`, Flipt supports using any [OCI](https://opencontainers.org/) com
Flipt has its own custom OCI manifest format (we call them `bundles`), which can be built and managed using the [Flipt CLI](/cli/commands/bundle).

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_STORAGE_TYPE="oci"
Expand All @@ -476,7 +476,7 @@ Flipt has its own custom OCI manifest format (we call them `bundles`), which can
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
storage:
Expand Down
20 changes: 10 additions & 10 deletions operations/production.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ You should tweak that number to be above 0, and to whatever fits your use case.
This can be altered either via the Flipt configuration file or environment variables:

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_DB_MAX_OPEN_CONN=5
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
db:
Expand All @@ -45,14 +45,14 @@ If MaxOpenConns is greater than 0 but less than the new MaxIdleConns, then the n
Keep in mind that tuning `MaxOpenConn` may lead to tuning `MaxIdleConn` as well.

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_DB_MAX_IDLE_CONN=5
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
db:
Expand All @@ -71,14 +71,14 @@ For instance, PGBouncer doesn't support prepared statements in its [transaction
You can disable prepared statements for the database client using:
<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">
```bash
FLIPT_DB_PREPARED_STATEMENTS_ENABLED=false
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
db:
Expand All @@ -95,14 +95,14 @@ Debug logging can be useful if you are actively developing or trying to fix prob
It's recommended to disable Flipt's debug logging in a production environment by increasing the log level:
<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">
```bash
FLIPT_LOG_LEVEL=info
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
log:
Expand All @@ -119,14 +119,14 @@ Flipt exposes profiling endpoints (`/debug/pprof`) that can be useful for debugg
You can disable these endpoints by setting the following configuration options:

<Tabs>
<Tab title="Environment Variable">
<Tab title="Environment Variables">

```bash
FLIPT_DIAGNOSTICS_PROFILING_ENABLED=false
```

</Tab>
<Tab title="Configuration Yaml">
<Tab title="Configuration YAML">

```yaml
diagnostics:
Expand Down

0 comments on commit 369cfb4

Please sign in to comment.