Skip to content

avalanche overrides remote url path #173

@watson28

Description

@watson28

Since avalanche migrated to prometheus/client_golang's exp/api/remote package, the path component of --remote-url is no longer respected. The library appends the default path api/v1/write to whatever path the user provides, making it impossible to target endpoints that use a different path — most notably Thanos Receiver, which expects /api/v1/receive.

Reproduction

services:
avalanche:
image: quay.io/prometheuscommunity/avalanche:main
command:
- --remote-url=https://user:pass@thanos-receiver.example.com/api/v1/receive
- --gauge-metric-count=100
- --series-count=10

Expected: POST requests to https://thanos-receiver.example.com/api/v1/receive.
Actual: POST requests to https://thanos-receiver.example.com/api/v1/receive/api/v1/write → 404 Not Found from Thanos Receiver.

Root cause

In metricsgen/write.go (lines 115-119), remote.NewAPI is called without WithAPIPath:

remoteAPI, err := remote.NewAPI(
cfg.URL.String(),
remote.WithAPIHTTPClient(httpClient),
remote.WithAPILogger(logger.With("component", "remote_write_api")),
)

prometheus/client_golang/exp/api/remote/remote_api.go then defaults o.path to "api/v1/write" (line 81) and joins it onto the parsed URL (line
151):

parsedURL.Path = path.Join(parsedURL.Path, o.path)

So any path supplied in --remote-url is treated as a prefix, not the final path.

The help claims "By default, path is set to api/v1/write," which now reads as misleading — the path provided in the URL is silently overridden, not used as a default.

Workaround

Pin to quay.io/prometheuscommunity/avalanche:v0.6.0, which uses http.NewRequest("POST", c.config.URL.String(), ...) directly
(metrics/write.go:309) and respects the URL path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions