Skip to content

Commit

Permalink
ci: add promql benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Jan 14, 2024
1 parent b9d76dd commit bc4c340
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 'Benchmark'

on:
push:
branches: [main]
workflow_dispatch:
pull_request:

env:
REGISTRY: ghcr.io
WORKDIR: dev/local/ch-bench-read
COMPOSE_FILE: docker-compose.ci.yml

jobs:
PromQL:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: "1.21.x"
cache: false

- uses: docker/setup-buildx-action@v3

- name: Docker log in
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: actions/checkout@v4

- name: Get Go environment
id: go-env
run: |
echo "cache=$(go env GOCACHE)" >> $GITHUB_ENV
echo "modcache=$(go env GOMODCACHE)" >> $GITHUB_ENV
echo "goversion=$(go env GOVERSION)" >> $GITHUB_ENV
- name: Set up cache
uses: actions/cache@v3
with:
path: |
${{ env.cache }}
${{ env.modcache }}
key: Benchmark-${{ runner.os }}-go-${{ env.goversion }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
Benchmark-${{ runner.os }}-go-${{ env.goversion }}
- name: Go build
env:
CGO_ENABLED: 0
run: |
go build -v ./cmd/oteldb
go build -v ./cmd/chotel
- name: Start
working-directory: ${{ env.WORKDIR }}
run: docker compose up -d

- name: Test
working-directory: ${{ env.WORKDIR }}
run: go run github.com/go-faster/oteldb/cmd/otelbench promql bench -i testdata/node-exporter-selected.promql.yml --trace
93 changes: 93 additions & 0 deletions dev/local/ch-bench-read/docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
version: "3"

volumes:
prom:

services:
clickhouse:
image: clickhouse/clickhouse-server:23.10
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:8123:8123"
volumes:
- ./clickhouse.xml:/etc/clickhouse-server/config.d/monitoring.xml
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', '127.0.0.1:8123/ping']
interval: 1s
timeout: 1s
retries: 30

prometheus:
image: prom/prometheus
command:
- '--config.file=/etc/prometheus/prometheus.yml'
volumes:
- './prometheus.yml:/etc/prometheus/prometheus.yml'
restart: unless-stopped

oteldb:
build:
context: ../../../
dockerfile: deploy.Dockerfile
command:
- --config=/etc/otel/cfg.yml
volumes:
- ./oteldb.yml:/etc/otel/cfg.yml:ro
environment:
- PPROF_ADDR=0.0.0.0:9010
- OTELDB_STORAGE=ch
- OTEL_LOG_LEVEL=info
- OTEL_EXPORTER_PROMETHEUS_HOST=0.0.0.0
- OTEL_EXPORTER_PROMETHEUS_PORT=9464
- OTEL_METRICS_EXPORTER=prometheus
- OTEL_LOGS_EXPORTER=none
- OTEL_TRACES_EXPORTER=otlp
- OTEL_TRACES_SAMPLER=parentbased_always_off
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4317
- OTEL_RESOURCE_ATTRIBUTES=service.name=go-faster.oteldb
healthcheck:
test: ['CMD', 'wget', '--spider', '-q', '127.0.0.1:13133/liveness']
interval: 1s
timeout: 1s
retries: 30
ports:
- "127.0.0.1:9090:9090" # promql
- "127.0.0.1:9010:9010" # pprof
- "127.0.0.1:19291:19291" # prometheus remote write
depends_on:
- clickhouse

# Exports traces from clickhouse internal table to otel.
chotel:
restart: always
build:
context: ../../../
dockerfile: deploy.chotel.Dockerfile
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=http://otelcol:4317
- OTEL_EXPORTER_OTLP_PROTOCOL=grpc
- OTEL_EXPORTER_OTLP_INSECURE=true
- OTEL_RESOURCE_ATTRIBUTES=service.name=go-faster.oteldb.chotel
- CHOTEL_SEND_RATE=1s
depends_on:
- clickhouse

tempo:
image: grafana/tempo:latest
command: [ "-config.file=/etc/tempo.yml" ]
ports:
- "127.0.0.1:3200:3200"
volumes:
- ./tempo.yml:/etc/tempo.yml

# https://opentelemetry.io/docs/collector/installation/#docker-compose
otelcol:
image: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.89.0
volumes:
- ./otelcol.yml:/etc/otelcol-contrib/config.yaml
ports:
- "127.0.0.1:4317:4317"
command:
- '--config'
- '/etc/otelcol-contrib/config.yaml'

0 comments on commit bc4c340

Please sign in to comment.