Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow overriding the remote read path #261

Merged
merged 1 commit into from
Jan 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions cmd/promxy/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ promxy:
anti_affinity: 10s
# Controls whether to use remote_read or the prom HTTP API for fetching remote raw data
remote_read: true
# configures the path to send remote read requests to. The default is "api/v1/read"
remote_read_path: api/v1/read
# path_prefix defines a prefix to prepend to all queries to hosts in this servergroup
path_prefix: /example/prefix
# query_params adds the following map of query parameters to downstream requests.
Expand All @@ -56,10 +58,10 @@ promxy:
dial_timeout: 1s
tls_config:
insecure_skip_verify: true

# relative_time_range defines a relative-to-now time range that this server group contains.
# this is completely optional and start/end are both optional as well
# an example is if this servergroup only has the most recent 3h of data
# an example is if this servergroup only has the most recent 3h of data
# the "start" would be -3h and the end would be left out
relative_time_range:
start: -3h
Expand Down
7 changes: 5 additions & 2 deletions pkg/servergroup/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import (
var (
// DefaultConfig is the Default base promxy configuration
DefaultConfig = Config{
AntiAffinity: time.Second * 10,
Scheme: "http",
AntiAffinity: time.Second * 10,
Scheme: "http",
RemoteReadPath: "api/v1/read",
HTTPConfig: HTTPClientConfig{
DialTimeout: time.Millisecond * 2000, // Default dial timeout of 200ms
},
Expand Down Expand Up @@ -43,6 +44,8 @@ type Config struct {
// from the same memory-balooning problems that the HTTP+JSON API originally had.
// It has **less** of a problem (its 2x memory instead of 14x) so it is a viable option.
RemoteRead bool `yaml:"remote_read"`
// RemoteReadPath sets the remote read path for the hosts in this servergroup
RemoteReadPath string `yaml:"remote_read_path"`
// HTTP client config for promxy to use when connecting to the various server_groups
// this is the same config as prometheus
HTTPConfig HTTPClientConfig `yaml:"http_client"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/servergroup/servergroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ SYNC_LOOP:
apiClient = &promclient.PromAPIV1{v1.NewAPI(client)}

if s.Cfg.RemoteRead {
u.Path = path.Join(u.Path, "api/v1/read")
u.Path = path.Join(u.Path, s.Cfg.RemoteReadPath)
cfg := &remote.ClientConfig{
URL: &config_util.URL{u},
// TODO: from context?
Expand Down