diff --git a/configuration/analytics.mdx b/configuration/analytics.mdx index f561be2e..2fc3ef2b 100644 --- a/configuration/analytics.mdx +++ b/configuration/analytics.mdx @@ -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. @@ -33,8 +39,35 @@ We highly **recommend** using a separate database for analytics produced by Flip [migration](/configuration/storage#migrations) section for more info. -### 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: + + + + + ```bash + FLIPT_ANALYTICS_CLICKHOUSE_ENABLED=true + FLIPT_ANALYTICS_CLICKHOUSE_URL=clickhouse://clickhouse:9000/flipt_analytics + ``` + + + + + ```yaml + analytics: + clickhouse: + enabled: true + url: clickhouse://clickhouse:9000/flipt_analytics + ``` + + + diff --git a/configuration/storage.mdx b/configuration/storage.mdx index 1786df17..932ef69e 100644 --- a/configuration/storage.mdx +++ b/configuration/storage.mdx @@ -153,7 +153,7 @@ 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. - + ```bash FLIPT_STORAGE_TYPE="local" @@ -161,7 +161,7 @@ Flipt will periodically rebuild its state from the local disk every 10 seconds. ``` - + ```yaml storage: @@ -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. - + ```bash FLIPT_STORAGE_TYPE="git" @@ -197,7 +197,7 @@ Flipt will follow the configured reference (e.g. branch name) and keep up to dat ``` - + ```yaml storage: @@ -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: - + ```bash FLIPT_STORAGE_TYPE="object" @@ -317,7 +317,7 @@ The following is an example of how to configure Flipt to leverage this backend t ``` - + ```yaml storage: @@ -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: - + ```bash FLIPT_STORAGE_TYPE="object" @@ -368,7 +368,7 @@ The following is an example of how to configure Flipt to leverage this backend t ``` - + ```yaml storage: @@ -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: - + ```bash FLIPT_STORAGE_TYPE="object" @@ -426,7 +426,7 @@ The following is an example of how to configure Flipt to leverage this backend t ``` - + ```yaml storage: @@ -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). - + ```bash FLIPT_STORAGE_TYPE="oci" @@ -476,7 +476,7 @@ Flipt has its own custom OCI manifest format (we call them `bundles`), which can ``` - + ```yaml storage: diff --git a/operations/production.mdx b/operations/production.mdx index 7d518a30..51b9513d 100644 --- a/operations/production.mdx +++ b/operations/production.mdx @@ -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: - + ```bash FLIPT_DB_MAX_OPEN_CONN=5 ``` - + ```yaml db: @@ -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. - + ```bash FLIPT_DB_MAX_IDLE_CONN=5 ``` - + ```yaml db: @@ -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: - + ```bash FLIPT_DB_PREPARED_STATEMENTS_ENABLED=false ``` - + ```yaml db: @@ -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: - + ```bash FLIPT_LOG_LEVEL=info ``` - + ```yaml log: @@ -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: - + ```bash FLIPT_DIAGNOSTICS_PROFILING_ENABLED=false ``` - + ```yaml diagnostics: