Skip to content

PromQL remote write from the collector sends no ClickHouse credentials, so it is rejected when the default user has a password #3906

Backlog

Description

@rrsela

What happened?

With PromQL enabled, the OpAMP-managed collector config gets a prometheusremotewrite exporter that posts to ${CLICKHOUSE_PROMETHEUS_METRICS_ENDPOINT}/write, with no credentials. ClickHouse handles the request as the default user. If default has a password, which is the usual hardening since the operator otherwise leaves it with no password and GRANT ALL, every remote write is rejected with code 194, about once every 3 seconds. metrics_ts stays empty, so PromQL sources return nothing.

Expected: the remote-write exporter authenticates the same way the clickhouse exporter in the same config does, with ${env:CLICKHOUSE_USER} / ${env:CLICKHOUSE_PASSWORD}. For example, it could send X-ClickHouse-User / X-ClickHouse-Key headers, or use a basicauth client extension. The collector user already has INSERT on the database in the chart's default grants.

Where it comes from:

  • packages/api/src/opamp/controllers/opampController.ts: otelCollectorConfig.exporters.prometheusremotewrite = { endpoint, tls, resource_to_telemetry_conversion } has no headers or auth.
  • docker/otel-collector/config.standalone.promql.yaml: the same in standalone mode.
  • The scrape of ClickHouse's /metrics (expose_metrics) works without credentials, so only the remote write is affected.

Steps to reproduce

Reproduces on play.hyperdx.io? didn't try (needs control over the ClickHouse users)

  1. Install the clickstack Helm chart with clickstack.promql.enabled: true (the default).
  2. Give ClickHouse's default user a password, for example clickhouse.cluster.spec.settings.defaultUserPassword pointing at a Secret.
  3. Send any OTLP metric to the collector, then look at the ClickHouse server log and SELECT count() FROM default.metrics_ts.

How are you running HyperDX?

Helm: clickstack chart 3.9.0 with the clickstack-operators chart 1.1.1 (ClickHouse operator 0.0.7), collector image clickstack-otel-collector:2.47.0 (user agent hyperdx-opentelemetry-collector/0.165.0), ClickHouse 26.8.51.4-alpine, on EKS.

Where does it show up?

The OpenTelemetry collector (remote write) and ClickHouse. No UI error; PromQL sources are just empty.

Debug info

N/A (collector / ClickHouse).

Logs

ClickHouse server log, repeating every ~3 seconds:

<Information> PrometheusRequestHandler: Handling remote write request from hyperdx-opentelemetry-collector/0.165.0
<Error> PrometheusRequestHandler: Code: 194. DB::Exception: default: Authentication failed: password is incorrect, or there is no user with such name

Over 20 minutes: 227 remote-write requests, 227 rejections.

Workaround: clickstack.promql.enabled: false. Leaving default without a password isn't an option for us, because other workloads share the cluster network.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions