Skip to content

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

License

Notifications You must be signed in to change notification settings

cluttrdev/gitlab-exporter-clickhouse-recorder

Repository files navigation

gitlab-exporter-clickhouse-recorder

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

Installation

To install gitlab-exporter-clickhouse-recorder 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-exporter-clickhouse-recorder/releases/latest | jq -r '.tag_name')
curl -sSfL -o /tmp/gitlab-exporter-clickhouse-recorder.tar.gz \
    https://github.com/cluttrdev/gitlab-exporter-clickhouse-recorder/releases/download/${RELEASE_TAG}/gitlab-exporter-clickhouse-recorder_${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-exporter-clickhouse-recorder.tar.gz gitlab-exporter-clickhouse-recorder

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

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

Usage

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

Server Mode

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

gitlab-exporter-clickhouse-recorder 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-exporter-clickhouse-recorder supports commands that can be executed individually. Use the following to get an overview of available commands:

gitlab-exporter-clickhouse-recorder -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-exporter-clickhouse-recorder.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 GLCHR_CLICKHOUSE_HOST "127.0.0.1"
--clickhouse-port GLCHR_CLICKHOUSE_PORT "9000"
--clickhouse-database GLCHR_CLICKHOUSE_DATABASE "default"
--clickhouse-user GLCHR_CLICKHOUSE_USER "default"
--clickhouse-password GLCHR_CLICKHOUSE_PASSWORD ""
# run options
--server-host GLCHR_SERVER_HOST "0.0.0.0"
--server-port GLCHR_SERVER_PORT "0"
--log-level GLCHR_LOG_LEVEL "info"
--log-format GLCHR_LOG_FORMAT "text"

Getting Started

To get up and running, have a look at the demo 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.