Skip to content

feat: let the collector write to a Prometheus outside the release - #102

Merged
jtslear merged 4 commits into
mainfrom
skarbek/collector-remote-write-url
Nov 24, 2026
Merged

jtslear merged 4 commits into
mainfrom
skarbek/collector-remote-write-url

Conversation

@jtslear

@jtslear jtslear commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Adds global.telemetry.metrics.remoteWriteURL and global.telemetry.metrics.remoteWriteExtraConfig. When remoteWriteURL is set, Alloy's remote_write sends there instead of the bundled Prometheus. When both are empty (the default), nothing changes: the default render is unchanged.

Previously the URL was built from the prometheus subchart's service name, so the chart failed to render with prometheus.enabled: false (no template "prometheus.server.fullname"). The lookup now only happens when remoteWriteURL is empty. A render with prometheus.enabled: false and remoteWriteURL set succeeds and writes to the given URL.

Use case: workspace clusters run only the collector (Alloy, kube-state-metrics, node-exporter) and remote-write to the Prometheus in the primary cluster. Disabling just the Prometheus server also needs #101, which makes kube-state-metrics and node-exporter independent of the prometheus subchart. Either PR alone does not give a collector-only install.

Endpoint configuration

remoteWriteURL sets the endpoint URL (including any port). remoteWriteExtraConfig is extra Alloy configuration placed inside the endpoint block of prometheus.remote_write, for authentication, TLS, headers or queue tuning (see the Alloy endpoint block). It is rendered with tpl; read secrets with sys.env("NAME") rather than putting them in values. Do not set url in it. The chart's own write_relabel_config rules and externalLabels stay in place.

Custom endpoint with a port:

prometheus:
  enabled: false

global:
  telemetry:
    metrics:
      externalLabels:
        cluster: workspace-us-east-2
      remoteWriteURL: http://prometheus-remote-write.internal.example.com:9090/api/v1/write

Custom endpoint with a port and authentication:

prometheus:
  enabled: false

global:
  telemetry:
    metrics:
      externalLabels:
        cluster: workspace-us-east-2
      remoteWriteURL: https://prometheus-remote-write.internal.example.com:8443/api/v1/write
      remoteWriteExtraConfig: |
        basic_auth {
          username = "alloy"
          password = sys.env("RW_PASSWORD")
        }

alloy:
  alloy:
    extraEnv:
      - name: RW_PASSWORD
        valueFrom:
          secretKeyRef:
            name: prometheus-remote-write
            key: password

Notes

  • The URL is trimmed, and the chart fails with a clear message if prometheus.enabled is false and no URL is set.
  • Documented in the values comment, README and CHANGELOG: Loki's ruler and Grafana's datasource still target the bundled Prometheus when it is disabled, so disable them too. The receiver needs --web.enable-remote-write-receiver (and native histograms if enabled). Each cluster needs a distinct externalLabels.

🤖 Generated with Claude Code

Add global.telemetry.metrics.remoteWriteURL. When set, Alloy writes there
instead of the bundled Prometheus, and the chart renders with
prometheus.enabled: false. Default output is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
jtslear and others added 2 commits November 5, 2026 22:15
…fix CHANGELOG placement

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ote-write-url

Co-authored-by: linear-code[bot] <222613912+linear-code[bot]@users.noreply.github.com>
…ders)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@jtslear
jtslear requested a review from dannykopping November 24, 2026 15:47
@jtslear

jtslear commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator Author

@dannykopping this is ready for re-review.

@jtslear
jtslear merged commit 5d0a272 into main Nov 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants