mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-21 14:44:00 +00:00
adds fake response for telegraph queries (#1130)
https://github.com/VictoriaMetrics/VictoriaMetrics/issues/1124
This commit is contained in:
parent
9c77e34ef9
commit
b1aa8c3d8f
4 changed files with 24 additions and 4 deletions
|
@ -515,6 +515,7 @@ See the docs at https://victoriametrics.github.io/vmagent.html .
|
||||||
-import.maxLineLen max_rows_per_line
|
-import.maxLineLen max_rows_per_line
|
||||||
The maximum length in bytes of a single line accepted by /api/v1/import; the line length can be limited with max_rows_per_line query arg passed to /api/v1/export
|
The maximum length in bytes of a single line accepted by /api/v1/import; the line length can be limited with max_rows_per_line query arg passed to /api/v1/export
|
||||||
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 104857600)
|
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 104857600)
|
||||||
|
-influx.databasesNames comma separated names of influx database, that will be returned for /query and /influx/query request.
|
||||||
-influx.maxLineSize value
|
-influx.maxLineSize value
|
||||||
The maximum size in bytes for a single Influx line during parsing
|
The maximum size in bytes for a single Influx line during parsing
|
||||||
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 262144)
|
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 262144)
|
||||||
|
|
|
@ -49,6 +49,7 @@ var (
|
||||||
dryRun = flag.Bool("dryRun", false, "Whether to check only config files without running vmagent. The following files are checked: "+
|
dryRun = flag.Bool("dryRun", false, "Whether to check only config files without running vmagent. The following files are checked: "+
|
||||||
"-promscrape.config, -remoteWrite.relabelConfig, -remoteWrite.urlRelabelConfig . "+
|
"-promscrape.config, -remoteWrite.relabelConfig, -remoteWrite.urlRelabelConfig . "+
|
||||||
"Unknown config entries are allowed in -promscrape.config by default. This can be changed with -promscrape.config.strictParse")
|
"Unknown config entries are allowed in -promscrape.config by default. This can be changed with -promscrape.config.strictParse")
|
||||||
|
influxDatabasesNames = flag.String("influx.databasesNames", "_internal", "Comma separated names of databases, that will be returned for /query and /influx/query api.")
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -205,9 +206,17 @@ func requestHandler(w http.ResponseWriter, r *http.Request) bool {
|
||||||
return true
|
return true
|
||||||
case "/query":
|
case "/query":
|
||||||
// Emulate fake response for influx query.
|
// Emulate fake response for influx query.
|
||||||
// This is required for TSBS benchmark.
|
// This is required for TSBS benchmark and some telegraph plugins.
|
||||||
influxQueryRequests.Inc()
|
influxQueryRequests.Inc()
|
||||||
fmt.Fprintf(w, `{"results":[{"series":[{"values":[]}]}]}`)
|
var dbs string
|
||||||
|
influxDbs := strings.Split(*influxDatabasesNames, ",")
|
||||||
|
for i := range influxDbs {
|
||||||
|
dbs += fmt.Sprintf(`"[%s]"`, influxDbs[i])
|
||||||
|
if i != len(influxDbs)-1 {
|
||||||
|
dbs += ","
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Fprintf(w, `{"results":[{"name":"databases","columns":["name"],"series":[{"values":[%s]}]}]}`, dbs)
|
||||||
return true
|
return true
|
||||||
case "/targets":
|
case "/targets":
|
||||||
promscrapeTargetsRequests.Inc()
|
promscrapeTargetsRequests.Inc()
|
||||||
|
|
|
@ -40,6 +40,7 @@ var (
|
||||||
"Usually :4242 must be set. Doesn't work if empty")
|
"Usually :4242 must be set. Doesn't work if empty")
|
||||||
opentsdbHTTPListenAddr = flag.String("opentsdbHTTPListenAddr", "", "TCP address to listen for OpentTSDB HTTP put requests. Usually :4242 must be set. Doesn't work if empty")
|
opentsdbHTTPListenAddr = flag.String("opentsdbHTTPListenAddr", "", "TCP address to listen for OpentTSDB HTTP put requests. Usually :4242 must be set. Doesn't work if empty")
|
||||||
maxLabelsPerTimeseries = flag.Int("maxLabelsPerTimeseries", 30, "The maximum number of labels accepted per time series. Superfluous labels are dropped")
|
maxLabelsPerTimeseries = flag.Int("maxLabelsPerTimeseries", 30, "The maximum number of labels accepted per time series. Superfluous labels are dropped")
|
||||||
|
influxDatabasesNames = flag.String("influx.databasesNames", "_internal", "Comma separated names of databases, that will be returned for /query and /influx/query api.")
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -148,9 +149,17 @@ func RequestHandler(w http.ResponseWriter, r *http.Request) bool {
|
||||||
return true
|
return true
|
||||||
case "/influx/query", "/query":
|
case "/influx/query", "/query":
|
||||||
// Emulate fake response for influx query.
|
// Emulate fake response for influx query.
|
||||||
// This is required for TSBS benchmark.
|
// This is required for TSBS benchmark and some telegraph plugins.
|
||||||
influxQueryRequests.Inc()
|
influxQueryRequests.Inc()
|
||||||
fmt.Fprintf(w, `{"results":[{"series":[{"values":[]}]}]}`)
|
var dbs string
|
||||||
|
influxDbs := strings.Split(*influxDatabasesNames, ",")
|
||||||
|
for i := range influxDbs {
|
||||||
|
dbs += fmt.Sprintf(`"[%s]"`, influxDbs[i])
|
||||||
|
if i != len(influxDbs)-1 {
|
||||||
|
dbs += ","
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fmt.Fprintf(w, `{"results":[{"name":"databases","columns":["name"],"series":[{"values":[%s]}]}]}`, dbs)
|
||||||
return true
|
return true
|
||||||
case "/prometheus/targets", "/targets":
|
case "/prometheus/targets", "/targets":
|
||||||
promscrapeTargetsRequests.Inc()
|
promscrapeTargetsRequests.Inc()
|
||||||
|
|
|
@ -515,6 +515,7 @@ See the docs at https://victoriametrics.github.io/vmagent.html .
|
||||||
-import.maxLineLen max_rows_per_line
|
-import.maxLineLen max_rows_per_line
|
||||||
The maximum length in bytes of a single line accepted by /api/v1/import; the line length can be limited with max_rows_per_line query arg passed to /api/v1/export
|
The maximum length in bytes of a single line accepted by /api/v1/import; the line length can be limited with max_rows_per_line query arg passed to /api/v1/export
|
||||||
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 104857600)
|
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 104857600)
|
||||||
|
-influx.databasesNames comma separated names of influx database, that will be returned for /query and /influx/query request.
|
||||||
-influx.maxLineSize value
|
-influx.maxLineSize value
|
||||||
The maximum size in bytes for a single Influx line during parsing
|
The maximum size in bytes for a single Influx line during parsing
|
||||||
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 262144)
|
Supports the following optional suffixes for values: KB, MB, GB, KiB, MiB, GiB (default 262144)
|
||||||
|
|
Loading…
Reference in a new issue