add maxSeriesPoints for config.transfer.m3db (#609)
This commit is contained in:
parent
bf1bd3ef5a
commit
3e426537c7
|
@ -2,6 +2,7 @@ backend:
|
|||
datasource: "tsdb"
|
||||
m3db:
|
||||
enabled: false
|
||||
maxSeriesPoints: 720 # default 720
|
||||
name: "m3db"
|
||||
namespace: "default"
|
||||
seriesLimit: 0
|
||||
|
|
|
@ -121,7 +121,7 @@ func xcludeResp(iter ident.TagIterator) *dataobj.XcludeResp {
|
|||
|
||||
func resampleResp(data []*dataobj.TsdbQueryResponse, opts dataobj.QueryDataForUI) []*dataobj.TsdbQueryResponse {
|
||||
for _, v := range data {
|
||||
if len(v.Values) <= MAX_PONINTS {
|
||||
if len(v.Values) <= maxSeriesPoints {
|
||||
continue
|
||||
}
|
||||
v.Values = resample(v.Values, opts.Start, opts.End, int64(opts.Step), opts.ConsolFunc)
|
||||
|
|
|
@ -28,6 +28,10 @@ const (
|
|||
MAX_PONINTS = 720
|
||||
)
|
||||
|
||||
var (
|
||||
maxSeriesPoints = 720
|
||||
)
|
||||
|
||||
type M3dbSection struct {
|
||||
Name string `yaml:"name"`
|
||||
Enabled bool `yaml:"enabled"`
|
||||
|
@ -36,6 +40,7 @@ type M3dbSection struct {
|
|||
SeriesLimit int `yaml:"seriesLimit"`
|
||||
DocsLimit int `yaml:"docsLimit"`
|
||||
MinStep int `yaml:"minStep"`
|
||||
MaxSeriesPoints int `yaml:"maxSeriesPoints"`
|
||||
Config client.Configuration `yaml:",inline"`
|
||||
timeLimit int64 `yaml:"-"`
|
||||
}
|
||||
|
@ -67,6 +72,10 @@ func NewClient(cfg M3dbSection) (*Client, error) {
|
|||
cfg.MinStep = 1
|
||||
}
|
||||
|
||||
if cfg.MaxSeriesPoints > 0 {
|
||||
maxSeriesPoints = cfg.MaxSeriesPoints
|
||||
}
|
||||
|
||||
cfg.timeLimit = int64(86400 * cfg.DaysLimit)
|
||||
|
||||
ret := &Client{
|
||||
|
@ -516,13 +525,13 @@ func (cfg M3dbSection) validateQueryDataForUI(in *dataobj.QueryDataForUI) (err e
|
|||
}
|
||||
|
||||
if in.Step > 0 {
|
||||
if n := (in.End - in.Start) / int64(in.Step); n > MAX_PONINTS {
|
||||
if n := int(in.End-in.Start) / in.Step; n > maxSeriesPoints {
|
||||
in.Step = 0
|
||||
}
|
||||
}
|
||||
|
||||
if in.Step <= 0 {
|
||||
in.Step = int((in.End - in.Start) / MAX_PONINTS)
|
||||
in.Step = int(in.End-in.Start) / maxSeriesPoints
|
||||
}
|
||||
|
||||
if in.Step < cfg.MinStep {
|
||||
|
|
Loading…
Reference in New Issue