未验证 提交 af04cb22 编写于 作者: B Björn Rabenstein 提交者: GitHub

Merge pull request #6821 from prometheus/release-2.16

Release 2.16
## 2.16.0 / 2020-02-13
* [FEATURE] React UI: Support local timezone on /graph #6692
* [FEATURE] PromQL: add absent_over_time query function #6490
* [FEATURE] Adding optional logging of queries to their own file #6520
* [ENHANCEMENT] React UI: Add support for rules page and "Xs ago" duration displays #6503
* [ENHANCEMENT] React UI: alerts page, replace filtering togglers tabs with checkboxes #6543
* [ENHANCEMENT] TSDB: Export metric for WAL write errors #6647
* [ENHANCEMENT] TSDB: Improve query performance for queries that only touch the most recent 2h of data. #6651
* [ENHANCEMENT] PromQL: Refactoring in parser errors to improve error messages #6634
* [ENHANCEMENT] PromQL: Support trailing commas in grouping opts #6480
* [ENHANCEMENT] Scrape: Reduce memory usage on reloads by reusing scrape cache #6670
* [ENHANCEMENT] Scrape: Add metrics to track bytes and entries in the metadata cache #6675
* [ENHANCEMENT] promtool: Add support for line-column numbers for invalid rules output #6533
* [ENHANCEMENT] Avoid restarting rule groups when it is unnecessary #6450
* [BUGFIX] React UI: Send cookies on fetch() on older browsers #6553
* [BUGFIX] React UI: adopt grafana flot fix for stacked graphs #6603
* [BUFGIX] React UI: broken graph page browser history so that back button works as expected #6659
* [BUGFIX] TSDB: ensure compactionsSkipped metric is registered, and log proper error if one is returned from head.Init #6616
* [BUGFIX] TSDB: return an error on ingesting series with duplicate labels #6664
* [BUGFIX] PromQL: Fix unary operator precedence #6579
* [BUGFIX] PromQL: Respect query.timeout even when we reach query.max-concurrency #6712
* [BUGFIX] PromQL: Fix string and parentheses handling in engine, which affected React UI #6612
* [BUGFIX] PromQL: Remove output labels returned by absent() if they are produced by multiple identical label matchers #6493
* [BUGFIX] Scrape: Validate that OpenMetrics input ends with `# EOF` #6505
* [BUGFIX] Remote read: return the correct error if configs can't be marshal'd to JSON #6622
* [BUGFIX] Remote write: Make remote client `Store` use passed context, which can affect shutdown timing #6673
* [BUGFIX] Remote write: Improve sharding calculation in cases where we would always be consistently behind by tracking pendingSamples #6511
* [BUGFIX] Ensure prometheus_rule_group metrics are deleted when a rule group is removed #6693
## 2.15.2 / 2020-01-06
* [BUGFIX] TSDB: Fixed support for TSDB blocks built with Prometheus before 2.1.0. #6564
......
......@@ -105,7 +105,7 @@ func (p *queryLogTest) query(t *testing.T) {
switch p.origin {
case apiOrigin:
r, err := http.Get(fmt.Sprintf(
"http://%s:%d%s/api/v1/query?query=%s",
"http://%s:%d%s/api/v1/query_range?step=5&start=0&end=3600&query=%s",
p.host,
p.port,
p.prefix,
......@@ -148,7 +148,15 @@ func (p *queryLogTest) queryString() string {
func (p *queryLogTest) validateLastQuery(t *testing.T, ql []queryLogLine) {
q := ql[len(ql)-1]
testutil.Equals(t, p.queryString(), q.Params.Query)
testutil.Equals(t, 0, q.Params.Step)
switch p.origin {
case apiOrigin:
testutil.Equals(t, 5, q.Params.Step)
testutil.Equals(t, "1970-01-01T00:00:00.000Z", q.Params.Start)
testutil.Equals(t, "1970-01-01T01:00:00.000Z", q.Params.End)
default:
testutil.Equals(t, 0, q.Params.Step)
}
if p.origin != ruleOrigin {
host := p.host
......@@ -160,7 +168,7 @@ func (p *queryLogTest) validateLastQuery(t *testing.T, ql []queryLogLine) {
switch p.origin {
case apiOrigin:
testutil.Equals(t, p.prefix+"/api/v1/query", q.Request.Path)
testutil.Equals(t, p.prefix+"/api/v1/query_range", q.Request.Path)
case consoleOrigin:
testutil.Equals(t, p.prefix+"/consoles/test.html", q.Request.Path)
case ruleOrigin:
......@@ -356,6 +364,8 @@ type queryLogLine struct {
Params struct {
Query string `json:"query"`
Step int `json:"step"`
Start string `json:"start"`
End string `json:"end"`
} `json:"params"`
Request struct {
Path string `json:"path"`
......
......@@ -90,7 +90,6 @@ type OpenMetricsParser struct {
hasTS bool
start int
offsets []int
prev token
eOffsets []int
exemplar []byte
......@@ -233,19 +232,14 @@ func (p *OpenMetricsParser) Next() (Entry, error) {
p.exemplarVal = 0
p.hasExemplarTs = false
t := p.nextToken()
defer func() { p.prev = t }()
switch t {
switch t := p.nextToken(); t {
case tEofWord:
if t := p.nextToken(); t != tEOF {
return EntryInvalid, errors.New("unexpected data after # EOF")
}
return EntryInvalid, io.EOF
case tEOF:
if p.prev != tEofWord {
return EntryInvalid, errors.New("data does not end with # EOF")
}
return EntryInvalid, io.EOF
return EntryInvalid, errors.New("data does not end with # EOF")
case tHelp, tType, tUnit:
switch t := p.nextToken(); t {
case tMName:
......
......@@ -446,7 +446,8 @@ func (ng *Engine) exec(ctx context.Context, q *query) (v Value, w storage.Warnin
if eq, ok := q.Statement().(*EvalStmt); ok {
params["start"] = formatDate(eq.Start)
params["end"] = formatDate(eq.End)
params["step"] = eq.Interval
// The step provided by the user is in seconds.
params["step"] = int64(eq.Interval / (time.Second / time.Nanosecond))
}
f := []interface{}{"params", params}
if err != nil {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册