/gitlab-clickhouse-exporter

A gitlab-exporter gRPC server endpoint that records data in ClickHouse.

Primary LanguageGoMIT LicenseMIT

gitlab-clickhouse-exporter

gitlab-clickhouse-exporter serves a gRPC endpoint that records data from a gitlab-exporter and exports it to a ClickHouse database.

Installation

To install gitlab-clickhouse-exporter you can download a prebuilt binary that matches your system, e.g.

# download latest release archive
RELEASE_TAG=$(curl -sSfL https://api.github.com/repos/cluttrdev/gitlab-clickhouse-exporter/releases/latest | jq -r '.tag_name')
curl -sSfL -o /tmp/gitlab-clickhouse-exporter.tar.gz \
    https://github.com/cluttrdev/gitlab-clickhouse-exporter/releases/download/${RELEASE_TAG}/gitlab-clickhouse-exporter_${RELEASE_TAG}_linux_amd64.tar.gz
# extract executable binary into install dir (must exist)
INSTALL_DIR=$HOME/.local/bin
tar -C ${INSTALL_DIR} -zxof /tmp/gitlab-clickhouse-exporter.tar.gz gitlab-clickhouse-exporter

Alternatively, if you have the Go tools installed on your machine, you can use

go install github.com/cluttrdev/gitlab-clickhouse-exporter@latest

Usage

gitlab-clickhouse-exporter can either run in server mode or execute one-off commands.

Server Mode

To run gitlab-clickhouse-exporter in server mode use:

gitlab-clickhouse-exporter run --config CONFIG_FILE

This will start a gRPC server that exports recorded data to the configured ClickHouse database. See Configuration for configuration options.

Command Mode

gitlab-clickhouse-exporter supports commands that can be executed individually. Use the following to get an overview of available commands:

gitlab-clickhouse-exporter -h

Configuration

Configuration options can be specified in a config file that is passed to the application using the --config command-line flag.

For an overview of available configuration options and their default values, see configs/gitlab-clickhouse-exporter.yaml.

Common options can also be overridden with command-line flags and/or environment variables, where flags take precedence.

Flag Environment Variable Default Value
# global options
--clickhouse-host GLCHE_CLICKHOUSE_HOST "127.0.0.1"
--clickhouse-port GLCHE_CLICKHOUSE_PORT "9000"
--clickhouse-database GLCHE_CLICKHOUSE_DATABASE "default"
--clickhouse-user GLCHE_CLICKHOUSE_USER "default"
--clickhouse-password GLCHE_CLICKHOUSE_PASSWORD ""
# run options
--server-host GLCHE_SERVER_HOST "0.0.0.0"
--server-port GLCHE_SERVER_PORT "0"
--log-level GLCHE_LOG_LEVEL "info"
--log-format GLCHE_LOG_FORMAT "text"

Getting Started

To get up and running, have a look at the quickstart example which contains a docker compose setup to provision a ClickHouse server and a Grafana instance that includes predefined dashboards.

License

This project is licensed under the MIT License.