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

I modify the remote_storage_adapter/main.go ,is that ok? #3006

Closed
shanquanqiang opened this Issue Jul 31, 2017 · 2 comments

Comments

Projects
None yet
3 participants
@shanquanqiang
Copy link

shanquanqiang commented Jul 31, 2017

I want to read from different influxdbRetentionPolicy and i modify the function buildClients(cfg *config) ([]writer, []reader) like that:
`

if cfg.influxdbURL != "" {
  url, err := url.Parse(cfg.influxdbURL)
  if err != nil {
  log.Fatalf("Failed to parse InfluxDB URL %q: %v", cfg.influxdbURL, err)
  }
  conf := influx.HTTPConfig{
  Addr: url.String(),
  Username: cfg.influxdbUsername,
  Password: cfg.influxdbPassword,
  Timeout: cfg.remoteTimeout,
  }
  c := influxdb.NewClient(conf, cfg.influxdbDatabase, cfg.influxdbRetentionPolicy)
  prometheus.MustRegister(c)
  writers = append(writers, c)
d := influxdb.NewClient(conf, cfg.influxdbDatabase, "sss")
e := influxdb.NewClient(conf, cfg.influxdbDatabase, "xxx")
  readers = append(readers, c)
readers = append(readers, d)
readers = append(readers, e)
  }

when read request comes,i chose different reader like that

if err := proto.Unmarshal(reqBuf, &req); err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
  return
  }
reader = readers[0] if string.Contains(req.String(),"ddd"){
reader = readers[1]
}
if string.Contains(req.String(),"ggg"){
reader = readers[2]
}

`

is ok?

@tomwilkie

This comment has been minimized.

Copy link
Member

tomwilkie commented Aug 2, 2017

I see you asked this question on the mailing list: https://groups.google.com/forum/#!msg/prometheus-users/V9AECACgaRY/2vaw9aiIAwAJ

Thats probably the best place to discuss this, I've replied there. Closing this for now.

@tomwilkie tomwilkie closed this Aug 2, 2017

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.