From 2bcd9f2f691c07fa92170ebf728c6235c48f4677 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Tue, 21 Sep 2021 21:35:33 +0530 Subject: [PATCH 01/36] Link 2 more TSDB blog posts in tsdb/README.md (#9371) Signed-off-by: Ganesh Vernekar --- tsdb/README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tsdb/README.md b/tsdb/README.md index 98443f1785..59f800c7ae 100644 --- a/tsdb/README.md +++ b/tsdb/README.md @@ -17,4 +17,6 @@ A series of blog posts explaining different components of TSDB: * [WAL and Checkpoint](https://ganeshvernekar.com/blog/prometheus-tsdb-wal-and-checkpoint/) * [Memory Mapping of Head Chunks from Disk](https://ganeshvernekar.com/blog/prometheus-tsdb-mmapping-head-chunks-from-disk/) * [Persistent Block and its Index](https://ganeshvernekar.com/blog/prometheus-tsdb-persistent-block-and-its-index/) -* [Queries](https://ganeshvernekar.com/blog/prometheus-tsdb-queries/) \ No newline at end of file +* [Queries](https://ganeshvernekar.com/blog/prometheus-tsdb-queries/) +* [Compaction and Retention](https://ganeshvernekar.com/blog/prometheus-tsdb-compaction-and-retention/) +* [Snapshot on Shutdown](https://ganeshvernekar.com/blog/prometheus-tsdb-snapshot-on-shutdown/) From d77c985f8c122cf5947b0eb621999fcc8dcca9bf Mon Sep 17 00:00:00 2001 From: Serge Catudal Date: Tue, 21 Sep 2021 16:53:27 -0400 Subject: [PATCH 02/36] Add initial support for exemplar to the remote write receiver endpoint (#9319) * Add initial support for exemplar to the remote write receiver endpoint Signed-off-by: Serge Catudal * Update storage remote write handler tests with exemplars Signed-off-by: Serge Catudal * Update remote write handler in order to have a distinct checkAppendExemplarError function from scrape Signed-off-by: Serge Catudal --- storage/remote/codec.go | 12 +++++ storage/remote/codec_test.go | 6 ++- storage/remote/write_handler.go | 41 ++++++++++++++++- storage/remote/write_handler_test.go | 68 ++++++++++++++++++++++++---- 4 files changed, 114 insertions(+), 13 deletions(-) diff --git a/storage/remote/codec.go b/storage/remote/codec.go index 0bd1b97622..545138da56 100644 --- a/storage/remote/codec.go +++ b/storage/remote/codec.go @@ -26,6 +26,7 @@ import ( "github.com/pkg/errors" "github.com/prometheus/common/model" + "github.com/prometheus/prometheus/pkg/exemplar" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/pkg/textparse" "github.com/prometheus/prometheus/prompb" @@ -450,6 +451,17 @@ func FromLabelMatchers(matchers []*prompb.LabelMatcher) ([]*labels.Matcher, erro return result, nil } +func exemplarProtoToExemplar(ep prompb.Exemplar) exemplar.Exemplar { + timestamp := ep.Timestamp + + return exemplar.Exemplar{ + Labels: labelProtosToLabels(ep.Labels), + Value: ep.Value, + Ts: timestamp, + HasTs: timestamp != 0, + } +} + // LabelProtosToMetric unpack a []*prompb.Label to a model.Metric func LabelProtosToMetric(labelPairs []*prompb.Label) model.Metric { metric := make(model.Metric, len(labelPairs)) diff --git a/storage/remote/codec_test.go b/storage/remote/codec_test.go index 0f6a56bdad..68cfe9899f 100644 --- a/storage/remote/codec_test.go +++ b/storage/remote/codec_test.go @@ -36,7 +36,8 @@ var writeRequestFixture = &prompb.WriteRequest{ {Name: "d", Value: "e"}, {Name: "foo", Value: "bar"}, }, - Samples: []prompb.Sample{{Value: 1, Timestamp: 0}}, + Samples: []prompb.Sample{{Value: 1, Timestamp: 0}}, + Exemplars: []prompb.Exemplar{{Labels: []prompb.Label{{Name: "f", Value: "g"}}, Value: 1, Timestamp: 0}}, }, { Labels: []prompb.Label{ @@ -46,7 +47,8 @@ var writeRequestFixture = &prompb.WriteRequest{ {Name: "d", Value: "e"}, {Name: "foo", Value: "bar"}, }, - Samples: []prompb.Sample{{Value: 2, Timestamp: 1}}, + Samples: []prompb.Sample{{Value: 2, Timestamp: 1}}, + Exemplars: []prompb.Exemplar{{Labels: []prompb.Label{{Name: "h", Value: "i"}}, Value: 2, Timestamp: 1}}, }, }, } diff --git a/storage/remote/write_handler.go b/storage/remote/write_handler.go index a3dee6136a..92637cf471 100644 --- a/storage/remote/write_handler.go +++ b/storage/remote/write_handler.go @@ -15,10 +15,14 @@ package remote import ( "context" + "fmt" "net/http" "github.com/go-kit/log" "github.com/go-kit/log/level" + "github.com/pkg/errors" + + "github.com/prometheus/prometheus/pkg/exemplar" "github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/storage" ) @@ -62,16 +66,35 @@ func (h *writeHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusNoContent) } +// checkAppendExemplarError modifies the AppendExamplar's returned error based on the error cause. +func (h *writeHandler) checkAppendExemplarError(err error, e exemplar.Exemplar, outOfOrderErrs *int) error { + switch errors.Cause(err) { + case storage.ErrNotFound: + return storage.ErrNotFound + case storage.ErrOutOfOrderExemplar: + *outOfOrderErrs++ + level.Debug(h.logger).Log("msg", "Out of order exemplar", "exemplar", fmt.Sprintf("%+v", e)) + return nil + default: + return err + } +} + func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err error) { + var ( + outOfOrderExemplarErrs = 0 + ) + app := h.appendable.Appender(ctx) defer func() { if err != nil { - app.Rollback() + _ = app.Rollback() return } err = app.Commit() }() + var exemplarErr error for _, ts := range req.Timeseries { labels := labelProtosToLabels(ts.Labels) for _, s := range ts.Samples { @@ -79,7 +102,23 @@ func (h *writeHandler) write(ctx context.Context, req *prompb.WriteRequest) (err if err != nil { return err } + } + + for _, ep := range ts.Exemplars { + e := exemplarProtoToExemplar(ep) + + _, exemplarErr = app.AppendExemplar(0, labels, e) + exemplarErr = h.checkAppendExemplarError(exemplarErr, e, &outOfOrderExemplarErrs) + if exemplarErr != nil { + // Since exemplar storage is still experimental, we don't fail the request on ingestion errors. + level.Debug(h.logger).Log("msg", "Error while adding exemplar in AddExemplar", "exemplar", fmt.Sprintf("%+v", e), "err", exemplarErr) + } + } + } + + if outOfOrderExemplarErrs > 0 { + _ = level.Warn(h.logger).Log("msg", "Error on ingesting out-of-order exemplars", "num_dropped", outOfOrderExemplarErrs) } return nil diff --git a/storage/remote/write_handler_test.go b/storage/remote/write_handler_test.go index 5e086fe2fa..d4ba5bfd8b 100644 --- a/storage/remote/write_handler_test.go +++ b/storage/remote/write_handler_test.go @@ -23,11 +23,12 @@ import ( "testing" "github.com/go-kit/log" + "github.com/stretchr/testify/require" + "github.com/prometheus/prometheus/pkg/exemplar" "github.com/prometheus/prometheus/pkg/labels" "github.com/prometheus/prometheus/prompb" "github.com/prometheus/prometheus/storage" - "github.com/stretchr/testify/require" ) func TestRemoteWriteHandler(t *testing.T) { @@ -47,16 +48,23 @@ func TestRemoteWriteHandler(t *testing.T) { require.Equal(t, http.StatusNoContent, resp.StatusCode) i := 0 + j := 0 for _, ts := range writeRequestFixture.Timeseries { labels := labelProtosToLabels(ts.Labels) for _, s := range ts.Samples { require.Equal(t, mockSample{labels, s.Timestamp, s.Value}, appendable.samples[i]) i++ } + + for _, e := range ts.Exemplars { + exemplarLabels := labelProtosToLabels(e.Labels) + require.Equal(t, mockExemplar{labels, exemplarLabels, e.Timestamp, e.Value}, appendable.exemplars[j]) + j++ + } } } -func TestOutOfOrder(t *testing.T) { +func TestOutOfOrderSample(t *testing.T) { buf, _, err := buildWriteRequest([]prompb.TimeSeries{{ Labels: []prompb.Label{{Name: "__name__", Value: "test_metric"}}, Samples: []prompb.Sample{{Value: 1, Timestamp: 0}}, @@ -67,7 +75,7 @@ func TestOutOfOrder(t *testing.T) { require.NoError(t, err) appendable := &mockAppendable{ - latest: 100, + latestSample: 100, } handler := NewWriteHandler(log.NewNopLogger(), appendable) @@ -78,6 +86,32 @@ func TestOutOfOrder(t *testing.T) { require.Equal(t, http.StatusBadRequest, resp.StatusCode) } +// This test case currently aims to verify that the WriteHandler endpoint +// don't fail on ingestion errors since the exemplar storage is +// still experimental. +func TestOutOfOrderExemplar(t *testing.T) { + buf, _, err := buildWriteRequest([]prompb.TimeSeries{{ + Labels: []prompb.Label{{Name: "__name__", Value: "test_metric"}}, + Exemplars: []prompb.Exemplar{{Labels: []prompb.Label{{Name: "foo", Value: "bar"}}, Value: 1, Timestamp: 0}}, + }}, nil, nil) + require.NoError(t, err) + + req, err := http.NewRequest("", "", bytes.NewReader(buf)) + require.NoError(t, err) + + appendable := &mockAppendable{ + latestExemplar: 100, + } + handler := NewWriteHandler(log.NewNopLogger(), appendable) + + recorder := httptest.NewRecorder() + handler.ServeHTTP(recorder, req) + + resp := recorder.Result() + // TODO: update to require.Equal(t, http.StatusConflict, resp.StatusCode) once exemplar storage is not experimental. + require.Equal(t, http.StatusNoContent, resp.StatusCode) +} + func TestCommitErr(t *testing.T) { buf, _, err := buildWriteRequest(writeRequestFixture.Timeseries, nil, nil) require.NoError(t, err) @@ -101,9 +135,11 @@ func TestCommitErr(t *testing.T) { } type mockAppendable struct { - latest int64 - samples []mockSample - commitErr error + latestSample int64 + samples []mockSample + latestExemplar int64 + exemplars []mockExemplar + commitErr error } type mockSample struct { @@ -112,16 +148,23 @@ type mockSample struct { v float64 } +type mockExemplar struct { + l labels.Labels + el labels.Labels + t int64 + v float64 +} + func (m *mockAppendable) Appender(_ context.Context) storage.Appender { return m } func (m *mockAppendable) Append(_ uint64, l labels.Labels, t int64, v float64) (uint64, error) { - if t < m.latest { + if t < m.latestSample { return 0, storage.ErrOutOfOrderSample } - m.latest = t + m.latestSample = t m.samples = append(m.samples, mockSample{l, t, v}) return 0, nil } @@ -134,7 +177,12 @@ func (*mockAppendable) Rollback() error { return fmt.Errorf("not implemented") } -func (*mockAppendable) AppendExemplar(ref uint64, l labels.Labels, e exemplar.Exemplar) (uint64, error) { - // noop until we implement exemplars over remote write +func (m *mockAppendable) AppendExemplar(_ uint64, l labels.Labels, e exemplar.Exemplar) (uint64, error) { + if e.Ts < m.latestExemplar { + return 0, storage.ErrOutOfOrderExemplar + } + + m.latestExemplar = e.Ts + m.exemplars = append(m.exemplars, mockExemplar{l, e.Labels, e.Ts, e.Value}) return 0, nil } From 8547a2bd8603787fa12fc46163ed768b5431b2aa Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Tue, 24 Aug 2021 19:22:14 -0400 Subject: [PATCH 03/36] Add `atan2` binary operator Signed-off-by: Levi Harrison --- promql/engine.go | 2 + promql/parser/generated_parser.y | 4 +- promql/parser/generated_parser.y.go | 1023 ++++++++++++++------------- promql/parser/lex.go | 1 + 4 files changed, 521 insertions(+), 509 deletions(-) diff --git a/promql/engine.go b/promql/engine.go index 3b1d357571..e5dbcd2d77 100644 --- a/promql/engine.go +++ b/promql/engine.go @@ -2116,6 +2116,8 @@ func vectorElemBinop(op parser.ItemType, lhs, rhs float64) (float64, bool) { return lhs, lhs >= rhs case parser.LTE: return lhs, lhs <= rhs + case parser.ATAN2: + return math.Atan2(lhs, rhs), true } panic(errors.Errorf("operator %q not allowed for operations between Vectors", op)) } diff --git a/promql/parser/generated_parser.y b/promql/parser/generated_parser.y index 75f147ee41..4380da4ee1 100644 --- a/promql/parser/generated_parser.y +++ b/promql/parser/generated_parser.y @@ -84,6 +84,7 @@ NEQ_REGEX POW SUB AT +ATAN2 %token operatorsEnd // Aggregators. @@ -156,7 +157,7 @@ START_METRIC_SELECTOR %left LAND LUNLESS %left EQLC GTE GTR LSS LTE NEQ %left ADD SUB -%left MUL DIV MOD +%left MUL DIV MOD ATAN2 %right POW // Offset modifiers do not have associativity. @@ -237,6 +238,7 @@ aggregate_modifier: // Operator precedence only works if each of those is listed separately. binary_expr : expr ADD bin_modifier expr { $$ = yylex.(*parser).newBinaryExpression($1, $2, $3, $4) } + | expr ATAN2 bin_modifier expr { $$ = yylex.(*parser).newBinaryExpression($1, $2, $3, $4) } | expr DIV bin_modifier expr { $$ = yylex.(*parser).newBinaryExpression($1, $2, $3, $4) } | expr EQLC bin_modifier expr { $$ = yylex.(*parser).newBinaryExpression($1, $2, $3, $4) } | expr GTE bin_modifier expr { $$ = yylex.(*parser).newBinaryExpression($1, $2, $3, $4) } diff --git a/promql/parser/generated_parser.y.go b/promql/parser/generated_parser.y.go index 5a2aafe3de..a9eb6d99ec 100644 --- a/promql/parser/generated_parser.y.go +++ b/promql/parser/generated_parser.y.go @@ -1,11 +1,11 @@ -// Code generated by goyacc -o generated_parser.y.go generated_parser.y. DO NOT EDIT. +// Code generated by goyacc -o promql/parser/generated_parser.y.go promql/parser/generated_parser.y. DO NOT EDIT. -//line generated_parser.y:15 +//line promql/parser/generated_parser.y:15 package parser import __yyfmt__ "fmt" -//line generated_parser.y:15 +//line promql/parser/generated_parser.y:15 import ( "math" @@ -17,7 +17,7 @@ import ( "github.com/prometheus/prometheus/pkg/value" ) -//line generated_parser.y:28 +//line promql/parser/generated_parser.y:28 type yySymType struct { yys int node Node @@ -73,41 +73,42 @@ const NEQ_REGEX = 57382 const POW = 57383 const SUB = 57384 const AT = 57385 -const operatorsEnd = 57386 -const aggregatorsStart = 57387 -const AVG = 57388 -const BOTTOMK = 57389 -const COUNT = 57390 -const COUNT_VALUES = 57391 -const GROUP = 57392 -const MAX = 57393 -const MIN = 57394 -const QUANTILE = 57395 -const STDDEV = 57396 -const STDVAR = 57397 -const SUM = 57398 -const TOPK = 57399 -const aggregatorsEnd = 57400 -const keywordsStart = 57401 -const BOOL = 57402 -const BY = 57403 -const GROUP_LEFT = 57404 -const GROUP_RIGHT = 57405 -const IGNORING = 57406 -const OFFSET = 57407 -const ON = 57408 -const WITHOUT = 57409 -const keywordsEnd = 57410 -const preprocessorStart = 57411 -const START = 57412 -const END = 57413 -const preprocessorEnd = 57414 -const startSymbolsStart = 57415 -const START_METRIC = 57416 -const START_SERIES_DESCRIPTION = 57417 -const START_EXPRESSION = 57418 -const START_METRIC_SELECTOR = 57419 -const startSymbolsEnd = 57420 +const ATAN2 = 57386 +const operatorsEnd = 57387 +const aggregatorsStart = 57388 +const AVG = 57389 +const BOTTOMK = 57390 +const COUNT = 57391 +const COUNT_VALUES = 57392 +const GROUP = 57393 +const MAX = 57394 +const MIN = 57395 +const QUANTILE = 57396 +const STDDEV = 57397 +const STDVAR = 57398 +const SUM = 57399 +const TOPK = 57400 +const aggregatorsEnd = 57401 +const keywordsStart = 57402 +const BOOL = 57403 +const BY = 57404 +const GROUP_LEFT = 57405 +const GROUP_RIGHT = 57406 +const IGNORING = 57407 +const OFFSET = 57408 +const ON = 57409 +const WITHOUT = 57410 +const keywordsEnd = 57411 +const preprocessorStart = 57412 +const START = 57413 +const END = 57414 +const preprocessorEnd = 57415 +const startSymbolsStart = 57416 +const START_METRIC = 57417 +const START_SERIES_DESCRIPTION = 57418 +const START_EXPRESSION = 57419 +const START_METRIC_SELECTOR = 57420 +const startSymbolsEnd = 57421 var yyToknames = [...]string{ "$end", @@ -153,6 +154,7 @@ var yyToknames = [...]string{ "POW", "SUB", "AT", + "ATAN2", "operatorsEnd", "aggregatorsStart", "AVG", @@ -196,7 +198,7 @@ const yyEofCode = 1 const yyErrCode = 2 const yyInitialStackSize = 16 -//line generated_parser.y:747 +//line promql/parser/generated_parser.y:749 //line yacctab:1 var yyExca = [...]int{ @@ -204,258 +206,257 @@ var yyExca = [...]int{ 1, -1, -2, 0, -1, 35, - 1, 130, - 10, 130, - 22, 130, + 1, 131, + 10, 131, + 22, 131, -2, 0, -1, 58, - 2, 142, - 15, 142, - 61, 142, - 67, 142, - -2, 96, - -1, 59, 2, 143, 15, 143, - 61, 143, - 67, 143, + 62, 143, + 68, 143, -2, 97, - -1, 60, + -1, 59, 2, 144, 15, 144, - 61, 144, - 67, 144, - -2, 99, - -1, 61, + 62, 144, + 68, 144, + -2, 98, + -1, 60, 2, 145, 15, 145, - 61, 145, - 67, 145, + 62, 145, + 68, 145, -2, 100, - -1, 62, + -1, 61, 2, 146, 15, 146, - 61, 146, - 67, 146, + 62, 146, + 68, 146, -2, 101, - -1, 63, + -1, 62, 2, 147, 15, 147, - 61, 147, - 67, 147, - -2, 106, - -1, 64, + 62, 147, + 68, 147, + -2, 102, + -1, 63, 2, 148, 15, 148, - 61, 148, - 67, 148, - -2, 108, - -1, 65, + 62, 148, + 68, 148, + -2, 107, + -1, 64, 2, 149, 15, 149, - 61, 149, - 67, 149, - -2, 110, - -1, 66, + 62, 149, + 68, 149, + -2, 109, + -1, 65, 2, 150, 15, 150, - 61, 150, - 67, 150, + 62, 150, + 68, 150, -2, 111, - -1, 67, + -1, 66, 2, 151, 15, 151, - 61, 151, - 67, 151, + 62, 151, + 68, 151, -2, 112, - -1, 68, + -1, 67, 2, 152, 15, 152, - 61, 152, - 67, 152, + 62, 152, + 68, 152, -2, 113, - -1, 69, + -1, 68, 2, 153, 15, 153, - 61, 153, - 67, 153, + 62, 153, + 68, 153, -2, 114, - -1, 188, - 12, 197, - 13, 197, - 16, 197, - 17, 197, - 23, 197, - 26, 197, - 32, 197, - 33, 197, - 36, 197, - 42, 197, - 46, 197, - 47, 197, - 48, 197, - 49, 197, - 50, 197, - 51, 197, - 52, 197, - 53, 197, - 54, 197, - 55, 197, - 56, 197, - 57, 197, - 61, 197, - 65, 197, - 67, 197, - 70, 197, - 71, 197, + -1, 69, + 2, 154, + 15, 154, + 62, 154, + 68, 154, + -2, 115, + -1, 190, + 12, 198, + 13, 198, + 16, 198, + 17, 198, + 23, 198, + 26, 198, + 32, 198, + 33, 198, + 36, 198, + 42, 198, + 47, 198, + 48, 198, + 49, 198, + 50, 198, + 51, 198, + 52, 198, + 53, 198, + 54, 198, + 55, 198, + 56, 198, + 57, 198, + 58, 198, + 62, 198, + 66, 198, + 68, 198, + 71, 198, + 72, 198, -2, 0, - -1, 189, - 12, 197, - 13, 197, - 16, 197, - 17, 197, - 23, 197, - 26, 197, - 32, 197, - 33, 197, - 36, 197, - 42, 197, - 46, 197, - 47, 197, - 48, 197, - 49, 197, - 50, 197, - 51, 197, - 52, 197, - 53, 197, - 54, 197, - 55, 197, - 56, 197, - 57, 197, - 61, 197, - 65, 197, - 67, 197, - 70, 197, - 71, 197, + -1, 191, + 12, 198, + 13, 198, + 16, 198, + 17, 198, + 23, 198, + 26, 198, + 32, 198, + 33, 198, + 36, 198, + 42, 198, + 47, 198, + 48, 198, + 49, 198, + 50, 198, + 51, 198, + 52, 198, + 53, 198, + 54, 198, + 55, 198, + 56, 198, + 57, 198, + 58, 198, + 62, 198, + 66, 198, + 68, 198, + 71, 198, + 72, 198, -2, 0, - -1, 209, - 19, 195, - -2, 0, - -1, 258, + -1, 212, 19, 196, -2, 0, + -1, 261, + 19, 197, + -2, 0, } const yyPrivate = 57344 -const yyLast = 654 +const yyLast = 649 var yyAct = [...]int{ - 264, 37, 213, 140, 254, 253, 148, 112, 77, 101, - 100, 146, 186, 103, 187, 188, 189, 6, 102, 104, - 125, 267, 248, 147, 57, 99, 151, 247, 120, 51, - 72, 105, 53, 22, 52, 152, 72, 163, 265, 256, - 54, 268, 249, 70, 152, 243, 151, 205, 246, 18, - 19, 153, 95, 20, 98, 107, 105, 108, 242, 71, - 153, 106, 121, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 178, 97, 103, 13, 149, - 150, 109, 24, 104, 30, 33, 142, 31, 32, 2, - 3, 4, 5, 143, 210, 262, 177, 7, 209, 143, - 261, 168, 269, 154, 114, 79, 167, 164, 158, 161, - 156, 208, 157, 260, 113, 78, 48, 166, 81, 34, - 244, 175, 73, 185, 1, 176, 141, 184, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, 203, 257, 47, 183, 204, 126, 127, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, - 160, 46, 170, 117, 171, 259, 8, 119, 116, 118, - 35, 155, 143, 159, 114, 245, 206, 207, 143, 115, - 36, 99, 51, 72, 113, 53, 22, 52, 250, 173, - 111, 251, 252, 54, 83, 255, 70, 10, 45, 172, - 174, 44, 18, 19, 92, 93, 20, 74, 95, 124, - 98, 56, 71, 258, 9, 9, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 215, 43, - 42, 13, 97, 79, 41, 24, 122, 30, 225, 162, - 31, 32, 231, 78, 40, 263, 270, 123, 180, 76, - 266, 39, 38, 49, 144, 182, 181, 80, 227, 228, - 151, 179, 229, 211, 271, 75, 145, 55, 272, 152, - 214, 169, 216, 218, 220, 221, 222, 230, 232, 235, - 236, 237, 238, 239, 50, 153, 217, 219, 223, 224, - 226, 233, 234, 110, 0, 0, 240, 241, 51, 72, - 0, 53, 22, 52, 0, 0, 0, 0, 0, 54, - 0, 0, 70, 0, 0, 0, 0, 0, 18, 19, - 0, 0, 20, 0, 0, 0, 0, 0, 71, 0, - 0, 0, 58, 59, 60, 61, 62, 63, 64, 65, - 66, 67, 68, 69, 215, 0, 0, 13, 0, 0, - 0, 24, 0, 30, 225, 0, 31, 32, 231, 0, - 0, 0, 212, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 227, 228, 0, 0, 229, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 216, 218, - 220, 221, 222, 230, 232, 235, 236, 237, 238, 239, - 0, 0, 217, 219, 223, 224, 226, 233, 234, 0, - 17, 72, 240, 241, 22, 0, 0, 0, 0, 0, + 267, 37, 216, 142, 257, 256, 150, 113, 77, 102, + 101, 104, 148, 188, 126, 189, 270, 105, 6, 103, + 190, 191, 252, 149, 154, 251, 57, 153, 250, 121, + 51, 72, 106, 53, 22, 52, 154, 180, 165, 259, + 155, 54, 271, 145, 70, 268, 246, 153, 208, 249, + 18, 19, 155, 106, 20, 108, 144, 109, 179, 245, + 71, 107, 72, 145, 122, 58, 59, 60, 61, 62, + 63, 64, 65, 66, 67, 68, 69, 33, 7, 104, + 13, 151, 152, 110, 24, 105, 30, 162, 272, 31, + 32, 2, 3, 4, 5, 213, 143, 265, 170, 212, + 161, 48, 264, 169, 156, 34, 115, 73, 166, 160, + 163, 158, 211, 159, 168, 263, 114, 100, 262, 120, + 157, 119, 247, 81, 187, 145, 178, 145, 186, 192, + 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, + 203, 204, 205, 206, 96, 185, 99, 207, 127, 128, + 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, + 139, 140, 141, 10, 172, 79, 173, 1, 56, 98, + 115, 9, 9, 74, 260, 78, 47, 248, 209, 210, + 114, 177, 36, 100, 51, 72, 112, 53, 22, 52, + 253, 175, 46, 254, 255, 54, 84, 258, 70, 79, + 45, 174, 176, 44, 18, 19, 93, 94, 20, 78, + 96, 125, 99, 83, 71, 76, 261, 43, 42, 58, + 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, + 69, 218, 8, 41, 13, 98, 35, 123, 24, 164, + 30, 228, 40, 31, 32, 234, 124, 39, 266, 273, + 118, 182, 38, 269, 49, 117, 146, 183, 184, 80, + 181, 230, 231, 153, 214, 232, 116, 274, 75, 147, + 55, 275, 154, 217, 171, 50, 219, 221, 223, 224, + 225, 233, 235, 238, 239, 240, 241, 242, 155, 111, + 220, 222, 226, 227, 229, 236, 237, 0, 0, 0, + 243, 244, 51, 72, 0, 53, 22, 52, 0, 0, + 0, 0, 0, 54, 0, 0, 70, 0, 0, 0, + 0, 0, 18, 19, 0, 0, 20, 0, 0, 0, + 0, 0, 71, 0, 0, 0, 0, 58, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 218, + 0, 0, 13, 0, 0, 0, 24, 0, 30, 228, + 0, 31, 32, 234, 0, 0, 0, 215, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, + 231, 0, 0, 232, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 219, 221, 223, 224, 225, 233, + 235, 238, 239, 240, 241, 242, 0, 0, 220, 222, + 226, 227, 229, 236, 237, 0, 17, 72, 243, 244, + 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 18, 19, 0, 0, + 20, 0, 0, 17, 33, 0, 0, 22, 0, 0, + 0, 11, 12, 14, 15, 16, 21, 23, 25, 26, + 27, 28, 29, 18, 19, 0, 13, 20, 0, 0, + 24, 0, 30, 0, 0, 31, 32, 0, 11, 12, + 14, 15, 16, 21, 23, 25, 26, 27, 28, 29, + 0, 0, 100, 13, 0, 0, 0, 24, 167, 30, + 0, 0, 31, 32, 82, 84, 85, 0, 86, 87, + 88, 89, 90, 91, 92, 93, 94, 95, 100, 96, + 97, 99, 83, 0, 0, 0, 0, 0, 0, 0, + 82, 84, 85, 0, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 98, 96, 97, 99, 83, 0, + 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 82, 84, 85, 0, 86, 87, 88, + 98, 90, 91, 92, 93, 94, 95, 100, 96, 97, + 99, 83, 0, 0, 0, 0, 0, 0, 0, 82, + 84, 85, 0, 86, 87, 0, 100, 90, 91, 0, + 93, 94, 95, 98, 96, 97, 99, 83, 82, 84, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, + 94, 0, 0, 96, 97, 99, 83, 0, 0, 98, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 18, 19, 0, 0, 20, 0, 17, 33, 0, 0, - 22, 0, 0, 0, 11, 12, 14, 15, 16, 21, - 23, 25, 26, 27, 28, 29, 18, 19, 0, 13, - 20, 0, 0, 24, 0, 30, 0, 0, 31, 32, - 11, 12, 14, 15, 16, 21, 23, 25, 26, 27, - 28, 29, 0, 0, 99, 13, 0, 0, 0, 24, - 165, 30, 0, 0, 31, 32, 82, 83, 84, 0, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 0, 95, 96, 98, 0, 0, 0, 0, 0, 0, - 99, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 82, 83, 84, 97, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 0, 95, 96, 98, - 0, 0, 99, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 82, 83, 84, 0, 85, 86, - 87, 97, 89, 90, 91, 92, 93, 94, 0, 95, - 96, 98, 0, 0, 99, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 83, 84, 0, - 85, 86, 99, 97, 89, 90, 0, 92, 93, 94, - 0, 95, 96, 98, 82, 83, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 92, 93, 0, 0, 95, - 96, 98, 0, 0, 0, 97, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 97, + 0, 0, 0, 0, 0, 0, 0, 0, 98, } var yyPact = [...]int{ - 15, 87, 424, 424, 170, 398, -1000, -1000, -1000, 72, + 16, 68, 431, 431, 172, 404, -1000, -1000, -1000, 64, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, 231, -1000, 116, -1000, 506, -1000, -1000, + -1000, -1000, -1000, 197, -1000, 121, -1000, 504, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - 16, 41, -1000, 286, -1000, 286, 23, -1000, -1000, -1000, + 17, 38, -1000, 290, -1000, 290, 49, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 172, -1000, -1000, 161, -1000, -1000, 165, -1000, - 6, -1000, -40, -40, -40, -40, -40, -40, -40, -40, - -40, -40, -40, -40, -40, -40, -40, 84, 9, 169, - 41, -48, -1000, 158, 158, 17, -1000, 470, 11, -1000, - 99, -1000, -1000, 160, -1000, -1000, 103, -1000, 73, -1000, - 243, 286, -1000, -52, -47, -1000, 286, 286, 286, 286, - 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, - -1000, 90, -1000, -1000, -1000, 32, -1000, -1000, -1000, -1000, - -1000, -1000, 29, 29, 92, -1000, -1000, -1000, -1000, 342, - -1000, -1000, 38, -1000, 506, -1000, -1000, 102, -1000, 25, - -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -2, 18, -1000, -1000, -1000, 167, 158, 158, 158, 158, - 11, 588, 588, 588, 570, 538, 588, 588, 570, 11, - 11, 588, 11, 167, -1000, 19, -1000, -1000, -1000, 163, - -1000, 93, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 168, -1000, -1000, 248, -1000, -1000, 117, -1000, + 7, -1000, -47, -47, -47, -47, -47, -47, -47, -47, + -47, -47, -47, -47, -47, -47, -47, -47, 54, 10, + 118, 38, -51, -1000, 85, 85, 18, -1000, 478, 103, + -1000, 96, -1000, -1000, 162, -1000, -1000, 163, -1000, 35, + -1000, 246, 290, -1000, -52, -43, -1000, 290, 290, 290, + 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, + 290, 290, -1000, 34, -1000, -1000, -1000, 33, -1000, -1000, + -1000, -1000, -1000, -1000, 30, 30, 93, -1000, -1000, -1000, + -1000, 347, -1000, -1000, 39, -1000, 504, -1000, -1000, 104, + -1000, 26, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 1, -2, -1000, -1000, -1000, 169, 85, 85, + 85, 85, 103, 103, 582, 582, 582, 563, 537, 582, + 582, 563, 103, 103, 582, 103, 169, -1000, 19, -1000, + -1000, -1000, 116, -1000, 95, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, 286, -1000, -1000, -1000, -1000, 21, 21, - -3, -1000, -1000, -1000, -1000, -1000, -1000, 22, 100, -1000, - -1000, 226, -1000, 506, -1000, -1000, -1000, 21, -1000, -1000, - -1000, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, -1000, 290, -1000, -1000, -1000, + -1000, 28, 28, -8, -1000, -1000, -1000, -1000, -1000, -1000, + 23, 86, -1000, -1000, 229, -1000, 504, -1000, -1000, -1000, + 28, -1000, -1000, -1000, -1000, -1000, } var yyPgo = [...]int{ - 0, 293, 7, 284, 2, 271, 270, 211, 267, 266, - 197, 265, 166, 8, 263, 4, 5, 261, 257, 0, - 23, 256, 6, 254, 253, 252, 10, 62, 251, 247, - 1, 244, 239, 9, 236, 24, 234, 230, 229, 209, - 201, 198, 161, 143, 116, 3, 142, 124, 119, + 0, 289, 7, 275, 2, 274, 273, 168, 270, 269, + 163, 268, 232, 8, 264, 4, 5, 260, 259, 0, + 23, 257, 6, 256, 254, 252, 10, 64, 247, 246, + 1, 242, 239, 9, 237, 26, 233, 218, 217, 211, + 203, 200, 192, 176, 101, 3, 174, 167, 105, } var yyR1 = [...]int{ @@ -463,22 +464,22 @@ var yyR1 = [...]int{ 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 25, 25, 25, 25, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 27, 29, 29, 39, 39, 34, 34, 34, 34, - 15, 15, 15, 15, 14, 14, 14, 4, 4, 31, - 33, 33, 32, 32, 32, 40, 38, 38, 38, 24, - 24, 24, 9, 9, 36, 42, 42, 42, 42, 42, - 43, 44, 44, 44, 35, 35, 35, 1, 1, 1, - 2, 2, 2, 2, 12, 12, 7, 7, 7, 7, + 28, 28, 27, 29, 29, 39, 39, 34, 34, 34, + 34, 15, 15, 15, 15, 14, 14, 14, 4, 4, + 31, 33, 33, 32, 32, 32, 40, 38, 38, 38, + 24, 24, 24, 9, 9, 36, 42, 42, 42, 42, + 42, 43, 44, 44, 44, 35, 35, 35, 1, 1, + 1, 2, 2, 2, 2, 12, 12, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 10, 10, - 10, 10, 11, 11, 11, 13, 13, 13, 13, 48, - 18, 18, 18, 18, 17, 17, 17, 17, 17, 21, - 21, 21, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 10, + 10, 10, 10, 11, 11, 11, 13, 13, 13, 13, + 48, 18, 18, 18, 18, 17, 17, 17, 17, 17, + 21, 21, 21, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 8, 8, 5, 5, 5, 5, 37, 20, 22, 22, - 23, 23, 19, 45, 41, 46, 46, 16, 16, + 6, 8, 8, 5, 5, 5, 5, 37, 20, 22, + 22, 23, 23, 19, 45, 41, 46, 46, 16, 16, } var yyR2 = [...]int{ @@ -486,84 +487,84 @@ var yyR2 = [...]int{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 1, 0, 1, 3, 3, 1, 1, 3, 3, - 3, 4, 2, 1, 3, 1, 2, 1, 1, 2, - 3, 2, 3, 1, 2, 3, 3, 4, 3, 3, - 5, 3, 1, 1, 4, 6, 6, 5, 4, 3, - 2, 2, 1, 1, 3, 4, 2, 3, 1, 2, - 3, 3, 2, 1, 2, 1, 1, 1, 1, 1, + 4, 4, 1, 0, 1, 3, 3, 1, 1, 3, + 3, 3, 4, 2, 1, 3, 1, 2, 1, 1, + 2, 3, 2, 3, 1, 2, 3, 3, 4, 3, + 3, 5, 3, 1, 1, 4, 6, 6, 5, 4, + 3, 2, 2, 1, 1, 3, 4, 2, 3, 1, + 2, 3, 3, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, - 2, 0, 3, 1, 2, 3, 3, 2, 1, 2, - 0, 3, 2, 1, 1, 3, 1, 3, 4, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, + 4, 2, 0, 3, 1, 2, 3, 3, 2, 1, + 2, 0, 3, 2, 1, 1, 3, 1, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, - 1, 1, 1, 1, 1, 0, 1, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 1, 1, 1, 1, 1, 0, 1, 0, 1, } var yyChk = [...]int{ - -1000, -47, 74, 75, 76, 77, 2, 10, -12, -7, - -10, 46, 47, 61, 48, 49, 50, 12, 32, 33, - 36, 51, 16, 52, 65, 53, 54, 55, 56, 57, - 67, 70, 71, 13, -48, -12, 10, -30, -25, -28, + -1000, -47, 75, 76, 77, 78, 2, 10, -12, -7, + -10, 47, 48, 62, 49, 50, 51, 12, 32, 33, + 36, 52, 16, 53, 66, 54, 55, 56, 57, 58, + 68, 71, 72, 13, -48, -12, 10, -30, -25, -28, -31, -36, -37, -38, -40, -41, -42, -43, -44, -24, - -3, 12, 17, 15, 23, -8, -7, -35, 46, 47, - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + -3, 12, 17, 15, 23, -8, -7, -35, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 26, 42, 13, -44, -10, -11, 18, -13, 12, 2, - -18, 2, 26, 27, 28, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 41, 42, 65, 43, 14, - -26, -33, 2, 61, 67, 15, -33, -30, -30, -35, - -1, 18, -2, 12, 2, 18, 7, 2, 4, 2, - 22, -27, -34, -29, -39, 60, -27, -27, -27, -27, + -18, 2, 26, 44, 27, 28, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 41, 42, 66, 43, + 14, -26, -33, 2, 62, 68, 15, -33, -30, -30, + -35, -1, 18, -2, 12, 2, 18, 7, 2, 4, + 2, 22, -27, -34, -29, -39, 61, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -45, 42, 2, 9, -23, -9, 2, -20, -22, 70, - 71, 17, 26, 42, -45, 2, -33, -26, -15, 15, - 2, -15, -32, 20, -30, 20, 18, 7, 2, -5, - 2, 4, 39, 29, 40, 18, -13, 23, 2, -17, - 5, -21, 12, -20, -22, -30, 64, 66, 62, 63, - -30, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -45, 15, -20, -20, 19, 6, - 2, -14, 20, -4, -6, 2, 46, 60, 47, 61, - 48, 49, 50, 62, 63, 12, 64, 32, 33, 36, - 51, 16, 52, 65, 66, 53, 54, 55, 56, 57, - 70, 71, 20, 7, 18, -2, 23, 2, 24, 24, - -22, -15, -15, -16, -15, -16, 20, -46, -45, 2, - 20, 7, 2, -30, -19, 17, -19, 24, 19, 2, - 20, -4, -19, + -27, -27, -45, 42, 2, 9, -23, -9, 2, -20, + -22, 71, 72, 17, 26, 42, -45, 2, -33, -26, + -15, 15, 2, -15, -32, 20, -30, 20, 18, 7, + 2, -5, 2, 4, 39, 29, 40, 18, -13, 23, + 2, -17, 5, -21, 12, -20, -22, -30, 65, 67, + 63, 64, -30, -30, -30, -30, -30, -30, -30, -30, + -30, -30, -30, -30, -30, -30, -30, -45, 15, -20, + -20, 19, 6, 2, -14, 20, -4, -6, 2, 47, + 61, 48, 62, 49, 50, 51, 63, 64, 12, 65, + 32, 33, 36, 52, 16, 53, 66, 67, 54, 55, + 56, 57, 58, 71, 72, 20, 7, 18, -2, 23, + 2, 24, 24, -22, -15, -15, -16, -15, -16, 20, + -46, -45, 2, 20, 7, 2, -30, -19, 17, -19, + 24, 19, 2, 20, -4, -19, } var yyDef = [...]int{ - 0, -2, 121, 121, 0, 0, 7, 6, 1, 121, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 0, 2, -2, 3, 4, 8, 9, + 0, -2, 122, 122, 0, 0, 7, 6, 1, 122, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, 117, 118, 0, 2, -2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 0, 102, 186, 0, 194, 0, 82, 83, -2, -2, + 0, 103, 187, 0, 195, 0, 83, 84, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, - 180, 181, 0, 5, 94, 0, 120, 123, 0, 128, - 129, 133, 42, 42, 42, 42, 42, 42, 42, 42, - 42, 42, 42, 42, 42, 42, 42, 0, 0, 0, - 0, 22, 23, 0, 0, 0, 59, 0, 80, 81, - 0, 86, 88, 0, 93, 118, 0, 124, 0, 127, - 132, 0, 41, 46, 47, 43, 0, 0, 0, 0, + 181, 182, 0, 5, 95, 0, 121, 124, 0, 129, + 130, 134, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, + 0, 0, 22, 23, 0, 0, 0, 60, 0, 81, + 82, 0, 87, 89, 0, 94, 119, 0, 125, 0, + 128, 133, 0, 42, 47, 48, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 66, 0, 68, 193, 69, 0, 71, 190, 191, 72, - 73, 187, 0, 0, 0, 79, 20, 21, 24, 0, - 53, 25, 0, 61, 63, 65, 84, 0, 89, 0, - 92, 182, 183, 184, 185, 119, 122, 125, 126, 131, - 134, 136, 139, 140, 141, 26, 0, 0, -2, -2, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 67, 0, 188, 189, 74, -2, - 78, 0, 52, 55, 57, 58, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 60, 64, 85, 87, 90, 91, 0, 0, - 0, 44, 45, 48, 198, 49, 70, 0, -2, 77, - 50, 0, 56, 62, 135, 192, 137, 0, 75, 76, - 51, 54, 138, + 0, 0, 67, 0, 69, 194, 70, 0, 72, 191, + 192, 73, 74, 188, 0, 0, 0, 80, 20, 21, + 24, 0, 54, 25, 0, 62, 64, 66, 85, 0, + 90, 0, 93, 183, 184, 185, 186, 120, 123, 126, + 127, 132, 135, 137, 140, 141, 142, 26, 0, 0, + -2, -2, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 68, 0, 189, + 190, 75, -2, 79, 0, 53, 56, 58, 59, 155, + 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, + 176, 177, 178, 179, 180, 61, 65, 86, 88, 91, + 92, 0, 0, 0, 45, 46, 49, 199, 50, 71, + 0, -2, 78, 51, 0, 57, 63, 136, 193, 138, + 0, 76, 77, 52, 55, 139, } var yyTok1 = [...]int{ @@ -578,7 +579,7 @@ var yyTok2 = [...]int{ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, + 72, 73, 74, 75, 76, 77, 78, 79, } var yyTok3 = [...]int{ @@ -924,62 +925,62 @@ yydefault: case 1: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:173 +//line promql/parser/generated_parser.y:174 { yylex.(*parser).generatedParserResult = yyDollar[2].labels } case 3: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:176 +//line promql/parser/generated_parser.y:177 { yylex.(*parser).addParseErrf(PositionRange{}, "no expression found in input") } case 4: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:178 +//line promql/parser/generated_parser.y:179 { yylex.(*parser).generatedParserResult = yyDollar[2].node } case 5: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:180 +//line promql/parser/generated_parser.y:181 { yylex.(*parser).generatedParserResult = yyDollar[2].node } case 7: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:183 +//line promql/parser/generated_parser.y:184 { yylex.(*parser).unexpected("", "") } case 20: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:206 +//line promql/parser/generated_parser.y:207 { yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[2].node, yyDollar[3].node) } case 21: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:208 +//line promql/parser/generated_parser.y:209 { yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, yyDollar[3].node, yyDollar[2].node) } case 22: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:210 +//line promql/parser/generated_parser.y:211 { yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, yyDollar[2].node) } case 23: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:212 +//line promql/parser/generated_parser.y:213 { yylex.(*parser).unexpected("aggregation", "") yyVAL.node = yylex.(*parser).newAggregateExpr(yyDollar[1].item, &AggregateExpr{}, Expressions{}) } case 24: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:220 +//line promql/parser/generated_parser.y:221 { yyVAL.node = &AggregateExpr{ Grouping: yyDollar[2].strings, @@ -987,7 +988,7 @@ yydefault: } case 25: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:226 +//line promql/parser/generated_parser.y:227 { yyVAL.node = &AggregateExpr{ Grouping: yyDollar[2].strings, @@ -996,205 +997,211 @@ yydefault: } case 26: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:239 +//line promql/parser/generated_parser.y:240 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 27: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:240 +//line promql/parser/generated_parser.y:241 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 28: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:241 +//line promql/parser/generated_parser.y:242 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 29: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:242 +//line promql/parser/generated_parser.y:243 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 30: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:243 +//line promql/parser/generated_parser.y:244 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 31: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:244 +//line promql/parser/generated_parser.y:245 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 32: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:245 +//line promql/parser/generated_parser.y:246 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 33: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:246 +//line promql/parser/generated_parser.y:247 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 34: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:247 +//line promql/parser/generated_parser.y:248 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 35: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:248 +//line promql/parser/generated_parser.y:249 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 36: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:249 +//line promql/parser/generated_parser.y:250 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 37: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:250 +//line promql/parser/generated_parser.y:251 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 38: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:251 +//line promql/parser/generated_parser.y:252 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 39: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:252 +//line promql/parser/generated_parser.y:253 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } case 40: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:253 +//line promql/parser/generated_parser.y:254 { yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) } - case 42: + case 41: + yyDollar = yyS[yypt-4 : yypt+1] +//line promql/parser/generated_parser.y:255 + { + yyVAL.node = yylex.(*parser).newBinaryExpression(yyDollar[1].node, yyDollar[2].item, yyDollar[3].node, yyDollar[4].node) + } + case 43: yyDollar = yyS[yypt-0 : yypt+1] -//line generated_parser.y:261 +//line promql/parser/generated_parser.y:263 { yyVAL.node = &BinaryExpr{ VectorMatching: &VectorMatching{Card: CardOneToOne}, } } - case 43: + case 44: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:266 +//line promql/parser/generated_parser.y:268 { yyVAL.node = &BinaryExpr{ VectorMatching: &VectorMatching{Card: CardOneToOne}, ReturnBool: true, } } - case 44: + case 45: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:274 +//line promql/parser/generated_parser.y:276 { yyVAL.node = yyDollar[1].node yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings } - case 45: + case 46: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:279 +//line promql/parser/generated_parser.y:281 { yyVAL.node = yyDollar[1].node yyVAL.node.(*BinaryExpr).VectorMatching.MatchingLabels = yyDollar[3].strings yyVAL.node.(*BinaryExpr).VectorMatching.On = true } - case 48: + case 49: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:289 +//line promql/parser/generated_parser.y:291 { yyVAL.node = yyDollar[1].node yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardManyToOne yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings } - case 49: + case 50: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:295 +//line promql/parser/generated_parser.y:297 { yyVAL.node = yyDollar[1].node yyVAL.node.(*BinaryExpr).VectorMatching.Card = CardOneToMany yyVAL.node.(*BinaryExpr).VectorMatching.Include = yyDollar[3].strings } - case 50: - yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:304 - { - yyVAL.strings = yyDollar[2].strings - } case 51: - yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:306 + yyDollar = yyS[yypt-3 : yypt+1] +//line promql/parser/generated_parser.y:306 { yyVAL.strings = yyDollar[2].strings } case 52: + yyDollar = yyS[yypt-4 : yypt+1] +//line promql/parser/generated_parser.y:308 + { + yyVAL.strings = yyDollar[2].strings + } + case 53: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:308 +//line promql/parser/generated_parser.y:310 { yyVAL.strings = []string{} } - case 53: + case 54: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:310 +//line promql/parser/generated_parser.y:312 { yylex.(*parser).unexpected("grouping opts", "\"(\"") yyVAL.strings = nil } - case 54: + case 55: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:316 +//line promql/parser/generated_parser.y:318 { yyVAL.strings = append(yyDollar[1].strings, yyDollar[3].item.Val) } - case 55: + case 56: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:318 +//line promql/parser/generated_parser.y:320 { yyVAL.strings = []string{yyDollar[1].item.Val} } - case 56: + case 57: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:320 +//line promql/parser/generated_parser.y:322 { yylex.(*parser).unexpected("grouping opts", "\",\" or \")\"") yyVAL.strings = yyDollar[1].strings } - case 57: + case 58: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:324 +//line promql/parser/generated_parser.y:326 { if !isLabel(yyDollar[1].item.Val) { yylex.(*parser).unexpected("grouping opts", "label") } yyVAL.item = yyDollar[1].item } - case 58: + case 59: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:331 +//line promql/parser/generated_parser.y:333 { yylex.(*parser).unexpected("grouping opts", "label") yyVAL.item = Item{} } - case 59: + case 60: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:339 +//line promql/parser/generated_parser.y:341 { fn, exist := getFunction(yyDollar[1].item.Val) if !exist { @@ -1209,88 +1216,88 @@ yydefault: }, } } - case 60: + case 61: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:356 +//line promql/parser/generated_parser.y:358 { yyVAL.node = yyDollar[2].node } - case 61: + case 62: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:358 +//line promql/parser/generated_parser.y:360 { yyVAL.node = Expressions{} } - case 62: + case 63: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:362 +//line promql/parser/generated_parser.y:364 { yyVAL.node = append(yyDollar[1].node.(Expressions), yyDollar[3].node.(Expr)) } - case 63: + case 64: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:364 +//line promql/parser/generated_parser.y:366 { yyVAL.node = Expressions{yyDollar[1].node.(Expr)} } - case 64: + case 65: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:366 +//line promql/parser/generated_parser.y:368 { yylex.(*parser).addParseErrf(yyDollar[2].item.PositionRange(), "trailing commas not allowed in function call args") yyVAL.node = yyDollar[1].node } - case 65: + case 66: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:377 +//line promql/parser/generated_parser.y:379 { yyVAL.node = &ParenExpr{Expr: yyDollar[2].node.(Expr), PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item)} } - case 66: + case 67: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:385 +//line promql/parser/generated_parser.y:387 { yylex.(*parser).addOffset(yyDollar[1].node, yyDollar[3].duration) yyVAL.node = yyDollar[1].node } - case 67: + case 68: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:390 +//line promql/parser/generated_parser.y:392 { yylex.(*parser).addOffset(yyDollar[1].node, -yyDollar[4].duration) yyVAL.node = yyDollar[1].node } - case 68: + case 69: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:395 +//line promql/parser/generated_parser.y:397 { yylex.(*parser).unexpected("offset", "duration") yyVAL.node = yyDollar[1].node } - case 69: + case 70: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:402 +//line promql/parser/generated_parser.y:404 { yylex.(*parser).setTimestamp(yyDollar[1].node, yyDollar[3].float) yyVAL.node = yyDollar[1].node } - case 70: + case 71: yyDollar = yyS[yypt-5 : yypt+1] -//line generated_parser.y:407 +//line promql/parser/generated_parser.y:409 { yylex.(*parser).setAtModifierPreprocessor(yyDollar[1].node, yyDollar[3].item) yyVAL.node = yyDollar[1].node } - case 71: + case 72: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:412 +//line promql/parser/generated_parser.y:414 { yylex.(*parser).unexpected("@", "timestamp") yyVAL.node = yyDollar[1].node } - case 74: + case 75: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:422 +//line promql/parser/generated_parser.y:424 { var errMsg string vs, ok := yyDollar[1].node.(*VectorSelector) @@ -1313,9 +1320,9 @@ yydefault: EndPos: yylex.(*parser).lastClosing, } } - case 75: + case 76: yyDollar = yyS[yypt-6 : yypt+1] -//line generated_parser.y:447 +//line promql/parser/generated_parser.y:449 { yyVAL.node = &SubqueryExpr{ Expr: yyDollar[1].node.(Expr), @@ -1325,37 +1332,37 @@ yydefault: EndPos: yyDollar[6].item.Pos + 1, } } - case 76: + case 77: yyDollar = yyS[yypt-6 : yypt+1] -//line generated_parser.y:457 +//line promql/parser/generated_parser.y:459 { yylex.(*parser).unexpected("subquery selector", "\"]\"") yyVAL.node = yyDollar[1].node } - case 77: + case 78: yyDollar = yyS[yypt-5 : yypt+1] -//line generated_parser.y:459 +//line promql/parser/generated_parser.y:461 { yylex.(*parser).unexpected("subquery selector", "duration or \"]\"") yyVAL.node = yyDollar[1].node } - case 78: + case 79: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:461 +//line promql/parser/generated_parser.y:463 { yylex.(*parser).unexpected("subquery or range", "\":\" or \"]\"") yyVAL.node = yyDollar[1].node } - case 79: + case 80: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:463 +//line promql/parser/generated_parser.y:465 { yylex.(*parser).unexpected("subquery selector", "duration") yyVAL.node = yyDollar[1].node } - case 80: + case 81: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:473 +//line promql/parser/generated_parser.y:475 { if nl, ok := yyDollar[2].node.(*NumberLiteral); ok { if yyDollar[1].item.Typ == SUB { @@ -1367,9 +1374,9 @@ yydefault: yyVAL.node = &UnaryExpr{Op: yyDollar[1].item.Typ, Expr: yyDollar[2].node.(Expr), StartPos: yyDollar[1].item.Pos} } } - case 81: + case 82: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:491 +//line promql/parser/generated_parser.y:493 { vs := yyDollar[2].node.(*VectorSelector) vs.PosRange = mergeRanges(&yyDollar[1].item, vs) @@ -1377,9 +1384,9 @@ yydefault: yylex.(*parser).assembleVectorSelector(vs) yyVAL.node = vs } - case 82: + case 83: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:499 +//line promql/parser/generated_parser.y:501 { vs := &VectorSelector{ Name: yyDollar[1].item.Val, @@ -1389,44 +1396,44 @@ yydefault: yylex.(*parser).assembleVectorSelector(vs) yyVAL.node = vs } - case 83: + case 84: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:509 +//line promql/parser/generated_parser.y:511 { vs := yyDollar[1].node.(*VectorSelector) yylex.(*parser).assembleVectorSelector(vs) yyVAL.node = vs } - case 84: + case 85: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:517 +//line promql/parser/generated_parser.y:519 { yyVAL.node = &VectorSelector{ LabelMatchers: yyDollar[2].matchers, PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[3].item), } } - case 85: + case 86: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:524 +//line promql/parser/generated_parser.y:526 { yyVAL.node = &VectorSelector{ LabelMatchers: yyDollar[2].matchers, PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[4].item), } } - case 86: + case 87: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:531 +//line promql/parser/generated_parser.y:533 { yyVAL.node = &VectorSelector{ LabelMatchers: []*labels.Matcher{}, PosRange: mergeRanges(&yyDollar[1].item, &yyDollar[2].item), } } - case 87: + case 88: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:540 +//line promql/parser/generated_parser.y:542 { if yyDollar[1].matchers != nil { yyVAL.matchers = append(yyDollar[1].matchers, yyDollar[3].matcher) @@ -1434,196 +1441,196 @@ yydefault: yyVAL.matchers = yyDollar[1].matchers } } - case 88: + case 89: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:548 +//line promql/parser/generated_parser.y:550 { yyVAL.matchers = []*labels.Matcher{yyDollar[1].matcher} } - case 89: + case 90: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:550 +//line promql/parser/generated_parser.y:552 { yylex.(*parser).unexpected("label matching", "\",\" or \"}\"") yyVAL.matchers = yyDollar[1].matchers } - case 90: + case 91: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:554 +//line promql/parser/generated_parser.y:556 { yyVAL.matcher = yylex.(*parser).newLabelMatcher(yyDollar[1].item, yyDollar[2].item, yyDollar[3].item) } - case 91: + case 92: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:556 +//line promql/parser/generated_parser.y:558 { yylex.(*parser).unexpected("label matching", "string") yyVAL.matcher = nil } - case 92: + case 93: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:558 +//line promql/parser/generated_parser.y:560 { yylex.(*parser).unexpected("label matching", "label matching operator") yyVAL.matcher = nil } - case 93: + case 94: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:560 +//line promql/parser/generated_parser.y:562 { yylex.(*parser).unexpected("label matching", "identifier or \"}\"") yyVAL.matcher = nil } - case 94: + case 95: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:568 +//line promql/parser/generated_parser.y:570 { yyVAL.labels = append(yyDollar[2].labels, labels.Label{Name: labels.MetricName, Value: yyDollar[1].item.Val}) sort.Sort(yyVAL.labels) } - case 95: + case 96: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:570 +//line promql/parser/generated_parser.y:572 { yyVAL.labels = yyDollar[1].labels } - case 118: - yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:577 - { - yyVAL.labels = labels.New(yyDollar[2].labels...) - } case 119: - yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:579 + yyDollar = yyS[yypt-3 : yypt+1] +//line promql/parser/generated_parser.y:579 { yyVAL.labels = labels.New(yyDollar[2].labels...) } case 120: - yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:581 + yyDollar = yyS[yypt-4 : yypt+1] +//line promql/parser/generated_parser.y:581 { - yyVAL.labels = labels.New() + yyVAL.labels = labels.New(yyDollar[2].labels...) } case 121: - yyDollar = yyS[yypt-0 : yypt+1] -//line generated_parser.y:583 + yyDollar = yyS[yypt-2 : yypt+1] +//line promql/parser/generated_parser.y:583 { yyVAL.labels = labels.New() } case 122: + yyDollar = yyS[yypt-0 : yypt+1] +//line promql/parser/generated_parser.y:585 + { + yyVAL.labels = labels.New() + } + case 123: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:587 +//line promql/parser/generated_parser.y:589 { yyVAL.labels = append(yyDollar[1].labels, yyDollar[3].label) } - case 123: + case 124: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:589 +//line promql/parser/generated_parser.y:591 { yyVAL.labels = []labels.Label{yyDollar[1].label} } - case 124: + case 125: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:591 +//line promql/parser/generated_parser.y:593 { yylex.(*parser).unexpected("label set", "\",\" or \"}\"") yyVAL.labels = yyDollar[1].labels } - case 125: + case 126: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:596 +//line promql/parser/generated_parser.y:598 { yyVAL.label = labels.Label{Name: yyDollar[1].item.Val, Value: yylex.(*parser).unquoteString(yyDollar[3].item.Val)} } - case 126: + case 127: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:598 +//line promql/parser/generated_parser.y:600 { yylex.(*parser).unexpected("label set", "string") yyVAL.label = labels.Label{} } - case 127: + case 128: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:600 +//line promql/parser/generated_parser.y:602 { yylex.(*parser).unexpected("label set", "\"=\"") yyVAL.label = labels.Label{} } - case 128: + case 129: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:602 +//line promql/parser/generated_parser.y:604 { yylex.(*parser).unexpected("label set", "identifier or \"}\"") yyVAL.label = labels.Label{} } - case 129: + case 130: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:610 +//line promql/parser/generated_parser.y:612 { yylex.(*parser).generatedParserResult = &seriesDescription{ labels: yyDollar[1].labels, values: yyDollar[2].series, } } - case 130: + case 131: yyDollar = yyS[yypt-0 : yypt+1] -//line generated_parser.y:619 +//line promql/parser/generated_parser.y:621 { yyVAL.series = []SequenceValue{} } - case 131: + case 132: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:621 +//line promql/parser/generated_parser.y:623 { yyVAL.series = append(yyDollar[1].series, yyDollar[3].series...) } - case 132: + case 133: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:623 +//line promql/parser/generated_parser.y:625 { yyVAL.series = yyDollar[1].series } - case 133: + case 134: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:625 +//line promql/parser/generated_parser.y:627 { yylex.(*parser).unexpected("series values", "") yyVAL.series = nil } - case 134: + case 135: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:629 +//line promql/parser/generated_parser.y:631 { yyVAL.series = []SequenceValue{{Omitted: true}} } - case 135: + case 136: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:631 +//line promql/parser/generated_parser.y:633 { yyVAL.series = []SequenceValue{} for i := uint64(0); i < yyDollar[3].uint; i++ { yyVAL.series = append(yyVAL.series, SequenceValue{Omitted: true}) } } - case 136: + case 137: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:638 +//line promql/parser/generated_parser.y:640 { yyVAL.series = []SequenceValue{{Value: yyDollar[1].float}} } - case 137: + case 138: yyDollar = yyS[yypt-3 : yypt+1] -//line generated_parser.y:640 +//line promql/parser/generated_parser.y:642 { yyVAL.series = []SequenceValue{} for i := uint64(0); i <= yyDollar[3].uint; i++ { yyVAL.series = append(yyVAL.series, SequenceValue{Value: yyDollar[1].float}) } } - case 138: + case 139: yyDollar = yyS[yypt-4 : yypt+1] -//line generated_parser.y:647 +//line promql/parser/generated_parser.y:649 { yyVAL.series = []SequenceValue{} for i := uint64(0); i <= yyDollar[4].uint; i++ { @@ -1631,45 +1638,45 @@ yydefault: yyDollar[1].float += yyDollar[2].float } } - case 139: + case 140: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:657 +//line promql/parser/generated_parser.y:659 { if yyDollar[1].item.Val != "stale" { yylex.(*parser).unexpected("series values", "number or \"stale\"") } yyVAL.float = math.Float64frombits(value.StaleNaN) } - case 186: + case 187: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:688 +//line promql/parser/generated_parser.y:690 { yyVAL.node = &NumberLiteral{ Val: yylex.(*parser).number(yyDollar[1].item.Val), PosRange: yyDollar[1].item.PositionRange(), } } - case 187: + case 188: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:696 +//line promql/parser/generated_parser.y:698 { yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val) } - case 188: + case 189: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:698 +//line promql/parser/generated_parser.y:700 { yyVAL.float = yyDollar[2].float } - case 189: + case 190: yyDollar = yyS[yypt-2 : yypt+1] -//line generated_parser.y:699 +//line promql/parser/generated_parser.y:701 { yyVAL.float = -yyDollar[2].float } - case 192: + case 193: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:705 +//line promql/parser/generated_parser.y:707 { var err error yyVAL.uint, err = strconv.ParseUint(yyDollar[1].item.Val, 10, 64) @@ -1677,9 +1684,9 @@ yydefault: yylex.(*parser).addParseErrf(yyDollar[1].item.PositionRange(), "invalid repetition in series values: %s", err) } } - case 193: + case 194: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:715 +//line promql/parser/generated_parser.y:717 { var err error yyVAL.duration, err = parseDuration(yyDollar[1].item.Val) @@ -1687,24 +1694,24 @@ yydefault: yylex.(*parser).addParseErr(yyDollar[1].item.PositionRange(), err) } } - case 194: + case 195: yyDollar = yyS[yypt-1 : yypt+1] -//line generated_parser.y:726 +//line promql/parser/generated_parser.y:728 { yyVAL.node = &StringLiteral{ Val: yylex.(*parser).unquoteString(yyDollar[1].item.Val), PosRange: yyDollar[1].item.PositionRange(), } } - case 195: + case 196: yyDollar = yyS[yypt-0 : yypt+1] -//line generated_parser.y:739 +//line promql/parser/generated_parser.y:741 { yyVAL.duration = 0 } - case 197: + case 198: yyDollar = yyS[yypt-0 : yypt+1] -//line generated_parser.y:743 +//line promql/parser/generated_parser.y:745 { yyVAL.strings = nil } diff --git a/promql/parser/lex.go b/promql/parser/lex.go index 313bd8f88b..e1dee33564 100644 --- a/promql/parser/lex.go +++ b/promql/parser/lex.go @@ -97,6 +97,7 @@ var key = map[string]ItemType{ "and": LAND, "or": LOR, "unless": LUNLESS, + "atan2": ATAN2, // Aggregators. "sum": SUM, From 7471208b5c8ff6b65b644adedf7eb964da3d50ae Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Wed, 25 Aug 2021 06:51:12 -0400 Subject: [PATCH 04/36] Add `ATAN2` to `maybe_label` Signed-off-by: Levi Harrison --- promql/parser/generated_parser.y | 2 +- promql/parser/generated_parser.y.go | 317 ++++++++++++++-------------- 2 files changed, 161 insertions(+), 158 deletions(-) diff --git a/promql/parser/generated_parser.y b/promql/parser/generated_parser.y index 4380da4ee1..fcf504aca5 100644 --- a/promql/parser/generated_parser.y +++ b/promql/parser/generated_parser.y @@ -676,7 +676,7 @@ series_value : IDENTIFIER aggregate_op : AVG | BOTTOMK | COUNT | COUNT_VALUES | GROUP | MAX | MIN | QUANTILE | STDDEV | STDVAR | SUM | TOPK ; // inside of grouping options label names can be recognized as keywords by the lexer. This is a list of keywords that could also be a label name. -maybe_label : AVG | BOOL | BOTTOMK | BY | COUNT | COUNT_VALUES | GROUP | GROUP_LEFT | GROUP_RIGHT | IDENTIFIER | IGNORING | LAND | LOR | LUNLESS | MAX | METRIC_IDENTIFIER | MIN | OFFSET | ON | QUANTILE | STDDEV | STDVAR | SUM | TOPK | START | END; +maybe_label : AVG | BOOL | BOTTOMK | BY | COUNT | COUNT_VALUES | GROUP | GROUP_LEFT | GROUP_RIGHT | IDENTIFIER | IGNORING | LAND | LOR | LUNLESS | MAX | METRIC_IDENTIFIER | MIN | OFFSET | ON | QUANTILE | STDDEV | STDVAR | SUM | TOPK | START | END | ATAN2; unary_op : ADD | SUB; diff --git a/promql/parser/generated_parser.y.go b/promql/parser/generated_parser.y.go index a9eb6d99ec..71614913a0 100644 --- a/promql/parser/generated_parser.y.go +++ b/promql/parser/generated_parser.y.go @@ -283,124 +283,125 @@ var yyExca = [...]int{ 68, 154, -2, 115, -1, 190, - 12, 198, - 13, 198, - 16, 198, - 17, 198, - 23, 198, - 26, 198, - 32, 198, - 33, 198, - 36, 198, - 42, 198, - 47, 198, - 48, 198, - 49, 198, - 50, 198, - 51, 198, - 52, 198, - 53, 198, - 54, 198, - 55, 198, - 56, 198, - 57, 198, - 58, 198, - 62, 198, - 66, 198, - 68, 198, - 71, 198, - 72, 198, + 12, 199, + 13, 199, + 16, 199, + 17, 199, + 23, 199, + 26, 199, + 32, 199, + 33, 199, + 36, 199, + 42, 199, + 47, 199, + 48, 199, + 49, 199, + 50, 199, + 51, 199, + 52, 199, + 53, 199, + 54, 199, + 55, 199, + 56, 199, + 57, 199, + 58, 199, + 62, 199, + 66, 199, + 68, 199, + 71, 199, + 72, 199, -2, 0, -1, 191, - 12, 198, - 13, 198, - 16, 198, - 17, 198, - 23, 198, - 26, 198, - 32, 198, - 33, 198, - 36, 198, - 42, 198, - 47, 198, - 48, 198, - 49, 198, - 50, 198, - 51, 198, - 52, 198, - 53, 198, - 54, 198, - 55, 198, - 56, 198, - 57, 198, - 58, 198, - 62, 198, - 66, 198, - 68, 198, - 71, 198, - 72, 198, + 12, 199, + 13, 199, + 16, 199, + 17, 199, + 23, 199, + 26, 199, + 32, 199, + 33, 199, + 36, 199, + 42, 199, + 47, 199, + 48, 199, + 49, 199, + 50, 199, + 51, 199, + 52, 199, + 53, 199, + 54, 199, + 55, 199, + 56, 199, + 57, 199, + 58, 199, + 62, 199, + 66, 199, + 68, 199, + 71, 199, + 72, 199, -2, 0, -1, 212, - 19, 196, - -2, 0, - -1, 261, 19, 197, -2, 0, + -1, 262, + 19, 198, + -2, 0, } const yyPrivate = 57344 -const yyLast = 649 +const yyLast = 659 var yyAct = [...]int{ - 267, 37, 216, 142, 257, 256, 150, 113, 77, 102, - 101, 104, 148, 188, 126, 189, 270, 105, 6, 103, - 190, 191, 252, 149, 154, 251, 57, 153, 250, 121, - 51, 72, 106, 53, 22, 52, 154, 180, 165, 259, - 155, 54, 271, 145, 70, 268, 246, 153, 208, 249, - 18, 19, 155, 106, 20, 108, 144, 109, 179, 245, - 71, 107, 72, 145, 122, 58, 59, 60, 61, 62, - 63, 64, 65, 66, 67, 68, 69, 33, 7, 104, - 13, 151, 152, 110, 24, 105, 30, 162, 272, 31, - 32, 2, 3, 4, 5, 213, 143, 265, 170, 212, - 161, 48, 264, 169, 156, 34, 115, 73, 166, 160, - 163, 158, 211, 159, 168, 263, 114, 100, 262, 120, - 157, 119, 247, 81, 187, 145, 178, 145, 186, 192, + 268, 37, 216, 142, 258, 257, 150, 113, 77, 102, + 101, 104, 188, 271, 189, 190, 191, 105, 6, 126, + 218, 57, 253, 149, 154, 252, 251, 266, 180, 121, + 228, 260, 265, 272, 234, 103, 269, 144, 274, 247, + 155, 72, 213, 162, 145, 264, 212, 250, 106, 179, + 230, 231, 246, 153, 232, 108, 161, 109, 208, 211, + 106, 107, 245, 33, 122, 219, 221, 223, 224, 225, + 233, 235, 238, 239, 240, 241, 242, 143, 110, 220, + 222, 226, 227, 229, 236, 237, 115, 79, 7, 243, + 244, 2, 3, 4, 5, 104, 114, 78, 145, 263, + 170, 105, 248, 177, 156, 169, 145, 118, 166, 160, + 163, 158, 117, 159, 157, 10, 168, 100, 120, 273, + 119, 145, 81, 116, 187, 74, 178, 34, 186, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 96, 185, 99, 207, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 10, 172, 79, 173, 1, 56, 98, - 115, 9, 9, 74, 260, 78, 47, 248, 209, 210, - 114, 177, 36, 100, 51, 72, 112, 53, 22, 52, - 253, 175, 46, 254, 255, 54, 84, 258, 70, 79, - 45, 174, 176, 44, 18, 19, 93, 94, 20, 78, - 96, 125, 99, 83, 71, 76, 261, 43, 42, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 218, 8, 41, 13, 98, 35, 123, 24, 164, - 30, 228, 40, 31, 32, 234, 124, 39, 266, 273, - 118, 182, 38, 269, 49, 117, 146, 183, 184, 80, - 181, 230, 231, 153, 214, 232, 116, 274, 75, 147, - 55, 275, 154, 217, 171, 50, 219, 221, 223, 224, - 225, 233, 235, 238, 239, 240, 241, 242, 155, 111, - 220, 222, 226, 227, 229, 236, 237, 0, 0, 0, - 243, 244, 51, 72, 0, 53, 22, 52, 0, 0, - 0, 0, 0, 54, 0, 0, 70, 0, 0, 0, - 0, 0, 18, 19, 0, 0, 20, 0, 0, 0, - 0, 0, 71, 0, 0, 0, 0, 58, 59, 60, - 61, 62, 63, 64, 65, 66, 67, 68, 69, 218, - 0, 0, 13, 0, 0, 0, 24, 0, 30, 228, - 0, 31, 32, 234, 0, 0, 0, 215, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 230, - 231, 0, 0, 232, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 219, 221, 223, 224, 225, 233, - 235, 238, 239, 240, 241, 242, 0, 0, 220, 222, - 226, 227, 229, 236, 237, 0, 17, 72, 243, 244, - 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 19, 0, 0, - 20, 0, 0, 17, 33, 0, 0, 22, 0, 0, + 139, 140, 141, 182, 56, 1, 115, 9, 9, 98, + 184, 148, 172, 218, 173, 153, 114, 249, 209, 210, + 261, 8, 112, 228, 154, 35, 153, 234, 47, 46, + 254, 215, 79, 255, 256, 154, 45, 259, 44, 175, + 155, 125, 78, 230, 231, 43, 48, 232, 76, 174, + 176, 155, 73, 42, 41, 245, 262, 123, 219, 221, + 223, 224, 225, 233, 235, 238, 239, 240, 241, 242, + 164, 40, 220, 222, 226, 227, 229, 236, 237, 124, + 151, 152, 243, 244, 39, 38, 49, 146, 183, 267, + 80, 181, 214, 75, 270, 51, 72, 147, 53, 22, + 52, 55, 217, 165, 171, 50, 54, 111, 275, 70, + 0, 0, 276, 0, 0, 18, 19, 0, 0, 20, + 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, + 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 0, 0, 0, 13, 0, 0, 0, 24, + 0, 30, 0, 0, 31, 32, 36, 100, 51, 72, + 0, 53, 22, 52, 0, 0, 0, 0, 0, 54, + 84, 0, 70, 0, 0, 0, 0, 0, 18, 19, + 93, 94, 20, 0, 96, 0, 99, 83, 71, 0, + 0, 0, 0, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 0, 0, 0, 13, 98, + 0, 0, 24, 0, 30, 0, 0, 31, 32, 51, + 72, 0, 53, 22, 52, 0, 0, 0, 0, 0, + 54, 0, 0, 70, 0, 0, 0, 0, 0, 18, + 19, 0, 0, 20, 0, 0, 17, 72, 0, 71, + 22, 0, 0, 0, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 18, 19, 0, 13, + 20, 0, 0, 24, 0, 30, 0, 0, 31, 32, 0, 11, 12, 14, 15, 16, 21, 23, 25, 26, - 27, 28, 29, 18, 19, 0, 13, 20, 0, 0, - 24, 0, 30, 0, 0, 31, 32, 0, 11, 12, + 27, 28, 29, 17, 33, 0, 13, 22, 0, 0, + 24, 0, 30, 0, 0, 31, 32, 0, 0, 0, + 0, 0, 0, 18, 19, 0, 0, 20, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 11, 12, 14, 15, 16, 21, 23, 25, 26, 27, 28, 29, 0, 0, 100, 13, 0, 0, 0, 24, 167, 30, 0, 0, 31, 32, 82, 84, 85, 0, 86, 87, @@ -421,42 +422,42 @@ var yyAct = [...]int{ } var yyPact = [...]int{ - 16, 68, 431, 431, 172, 404, -1000, -1000, -1000, 64, + 16, 78, 441, 441, 306, 394, -1000, -1000, -1000, 50, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, 197, -1000, 121, -1000, 504, -1000, -1000, + -1000, -1000, -1000, 190, -1000, 120, -1000, 514, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - 17, 38, -1000, 290, -1000, 290, 49, -1000, -1000, -1000, + 33, 45, -1000, 367, -1000, 367, 28, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 168, -1000, -1000, 248, -1000, -1000, 117, -1000, - 7, -1000, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, 54, 10, - 118, 38, -51, -1000, 85, 85, 18, -1000, 478, 103, - -1000, 96, -1000, -1000, 162, -1000, -1000, 163, -1000, 35, - -1000, 246, 290, -1000, -52, -43, -1000, 290, 290, 290, - 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, - 290, 290, -1000, 34, -1000, -1000, -1000, 33, -1000, -1000, - -1000, -1000, -1000, -1000, 30, 30, 93, -1000, -1000, -1000, - -1000, 347, -1000, -1000, 39, -1000, 504, -1000, -1000, 104, - -1000, 26, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, 1, -2, -1000, -1000, -1000, 169, 85, 85, - 85, 85, 103, 103, 582, 582, 582, 563, 537, 582, - 582, 563, 103, 103, 582, 103, 169, -1000, 19, -1000, - -1000, -1000, 116, -1000, 95, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 164, -1000, -1000, 105, -1000, -1000, 116, -1000, + 7, -1000, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, 35, 169, + 112, 45, -51, -1000, 41, 41, 243, -1000, 488, 103, + -1000, 98, -1000, -1000, 170, -1000, -1000, 85, -1000, 26, + -1000, 158, 367, -1000, -53, -48, -1000, 367, 367, 367, + 367, 367, 367, 367, 367, 367, 367, 367, 367, 367, + 367, 367, -1000, 89, -1000, -1000, -1000, 43, -1000, -1000, + -1000, -1000, -1000, -1000, 36, 36, 40, -1000, -1000, -1000, + -1000, 171, -1000, -1000, 32, -1000, 514, -1000, -1000, 84, + -1000, 24, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, 1, -2, -1000, -1000, -1000, 303, 41, 41, + 41, 41, 103, 103, 592, 592, 592, 573, 547, 592, + 592, 573, 103, 103, 592, 103, 303, -1000, 11, -1000, + -1000, -1000, 97, -1000, 25, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, - -1000, -1000, -1000, -1000, -1000, -1000, 290, -1000, -1000, -1000, - -1000, 28, 28, -8, -1000, -1000, -1000, -1000, -1000, -1000, - 23, 86, -1000, -1000, 229, -1000, 504, -1000, -1000, -1000, - 28, -1000, -1000, -1000, -1000, -1000, + -1000, -1000, -1000, -1000, -1000, -1000, -1000, 367, -1000, -1000, + -1000, -1000, 19, 19, -11, -1000, -1000, -1000, -1000, -1000, + -1000, 14, 117, -1000, -1000, 18, -1000, 514, -1000, -1000, + -1000, 19, -1000, -1000, -1000, -1000, -1000, } var yyPgo = [...]int{ - 0, 289, 7, 275, 2, 274, 273, 168, 270, 269, - 163, 268, 232, 8, 264, 4, 5, 260, 259, 0, - 23, 257, 6, 256, 254, 252, 10, 64, 247, 246, - 1, 242, 239, 9, 237, 26, 233, 218, 217, 211, - 203, 200, 192, 176, 101, 3, 174, 167, 105, + 0, 267, 7, 265, 2, 264, 262, 164, 261, 257, + 115, 253, 181, 8, 252, 4, 5, 251, 250, 0, + 23, 248, 6, 247, 246, 245, 10, 64, 244, 239, + 1, 231, 230, 9, 217, 21, 214, 213, 205, 201, + 198, 196, 189, 188, 206, 3, 180, 165, 127, } var yyR1 = [...]int{ @@ -478,8 +479,9 @@ var yyR1 = [...]int{ 3, 3, 3, 3, 3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 6, 8, 8, 5, 5, 5, 5, 37, 20, 22, - 22, 23, 23, 19, 45, 41, 46, 46, 16, 16, + 6, 6, 8, 8, 5, 5, 5, 5, 37, 20, + 22, 22, 23, 23, 19, 45, 41, 46, 46, 16, + 16, } var yyR2 = [...]int{ @@ -501,8 +503,9 @@ var yyR2 = [...]int{ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 1, 1, 1, 1, 1, 0, 1, 0, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 1, 1, 1, 1, 1, 0, 1, 0, + 1, } var yyChk = [...]int{ @@ -530,10 +533,10 @@ var yyChk = [...]int{ -20, 19, 6, 2, -14, 20, -4, -6, 2, 47, 61, 48, 62, 49, 50, 51, 63, 64, 12, 65, 32, 33, 36, 52, 16, 53, 66, 67, 54, 55, - 56, 57, 58, 71, 72, 20, 7, 18, -2, 23, - 2, 24, 24, -22, -15, -15, -16, -15, -16, 20, - -46, -45, 2, 20, 7, 2, -30, -19, 17, -19, - 24, 19, 2, 20, -4, -19, + 56, 57, 58, 71, 72, 44, 20, 7, 18, -2, + 23, 2, 24, 24, -22, -15, -15, -16, -15, -16, + 20, -46, -45, 2, 20, 7, 2, -30, -19, 17, + -19, 24, 19, 2, 20, -4, -19, } var yyDef = [...]int{ @@ -542,29 +545,29 @@ var yyDef = [...]int{ 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 0, 2, -2, 3, 4, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, - 0, 103, 187, 0, 195, 0, 83, 84, -2, -2, + 0, 103, 188, 0, 196, 0, 83, 84, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, -2, - 181, 182, 0, 5, 95, 0, 121, 124, 0, 129, + 182, 183, 0, 5, 95, 0, 121, 124, 0, 129, 130, 134, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 0, 0, 0, 0, 22, 23, 0, 0, 0, 60, 0, 81, 82, 0, 87, 89, 0, 94, 119, 0, 125, 0, 128, 133, 0, 42, 47, 48, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 67, 0, 69, 194, 70, 0, 72, 191, - 192, 73, 74, 188, 0, 0, 0, 80, 20, 21, + 0, 0, 67, 0, 69, 195, 70, 0, 72, 192, + 193, 73, 74, 189, 0, 0, 0, 80, 20, 21, 24, 0, 54, 25, 0, 62, 64, 66, 85, 0, - 90, 0, 93, 183, 184, 185, 186, 120, 123, 126, + 90, 0, 93, 184, 185, 186, 187, 120, 123, 126, 127, 132, 135, 137, 140, 141, 142, 26, 0, 0, -2, -2, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 68, 0, 189, - 190, 75, -2, 79, 0, 53, 56, 58, 59, 155, + 35, 36, 37, 38, 39, 40, 41, 68, 0, 190, + 191, 75, -2, 79, 0, 53, 56, 58, 59, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 61, 65, 86, 88, 91, - 92, 0, 0, 0, 45, 46, 49, 199, 50, 71, - 0, -2, 78, 51, 0, 57, 63, 136, 193, 138, - 0, 76, 77, 52, 55, 139, + 176, 177, 178, 179, 180, 181, 61, 65, 86, 88, + 91, 92, 0, 0, 0, 45, 46, 49, 200, 50, + 71, 0, -2, 78, 51, 0, 57, 63, 136, 194, + 138, 0, 76, 77, 52, 55, 139, } var yyTok1 = [...]int{ @@ -1647,7 +1650,7 @@ yydefault: } yyVAL.float = math.Float64frombits(value.StaleNaN) } - case 187: + case 188: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:690 { @@ -1656,25 +1659,25 @@ yydefault: PosRange: yyDollar[1].item.PositionRange(), } } - case 188: + case 189: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:698 { yyVAL.float = yylex.(*parser).number(yyDollar[1].item.Val) } - case 189: + case 190: yyDollar = yyS[yypt-2 : yypt+1] //line promql/parser/generated_parser.y:700 { yyVAL.float = yyDollar[2].float } - case 190: + case 191: yyDollar = yyS[yypt-2 : yypt+1] //line promql/parser/generated_parser.y:701 { yyVAL.float = -yyDollar[2].float } - case 193: + case 194: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:707 { @@ -1684,7 +1687,7 @@ yydefault: yylex.(*parser).addParseErrf(yyDollar[1].item.PositionRange(), "invalid repetition in series values: %s", err) } } - case 194: + case 195: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:717 { @@ -1694,7 +1697,7 @@ yydefault: yylex.(*parser).addParseErr(yyDollar[1].item.PositionRange(), err) } } - case 195: + case 196: yyDollar = yyS[yypt-1 : yypt+1] //line promql/parser/generated_parser.y:728 { @@ -1703,13 +1706,13 @@ yydefault: PosRange: yyDollar[1].item.PositionRange(), } } - case 196: + case 197: yyDollar = yyS[yypt-0 : yypt+1] //line promql/parser/generated_parser.y:741 { yyVAL.duration = 0 } - case 198: + case 199: yyDollar = yyS[yypt-0 : yypt+1] //line promql/parser/generated_parser.y:745 { From f5c6ee4df6edd246d96a3380496fb716c3a93cdc Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Wed, 25 Aug 2021 07:57:49 -0400 Subject: [PATCH 05/36] Add lex test Signed-off-by: Levi Harrison --- promql/parser/lex_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/promql/parser/lex_test.go b/promql/parser/lex_test.go index 65e142f45b..95f4d978da 100644 --- a/promql/parser/lex_test.go +++ b/promql/parser/lex_test.go @@ -340,6 +340,10 @@ var tests = []struct { input: "bool", expected: []Item{{BOOL, 0, "bool"}}, }, + { + input: "atan2", + expected: []Item{{ATAN2, 0, "atan2"}}, + }, }, }, { From be6ce7bcc210df78043071ffc38a3612a000b1bd Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Wed, 25 Aug 2021 07:58:30 -0400 Subject: [PATCH 06/36] Add docs Signed-off-by: Levi Harrison --- docs/querying/operators.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/querying/operators.md b/docs/querying/operators.md index d998d7326b..b790ed1da7 100644 --- a/docs/querying/operators.md +++ b/docs/querying/operators.md @@ -40,6 +40,16 @@ grouping labels becoming the output label set. The metric name is dropped. Entri for which no matching entry in the right-hand vector can be found are not part of the result. +### Trigonometric binary operators + +The following trigonometric binary operators exist in Prometheus: + +* `atan2` (https://pkg.go.dev/math#Atan2, _This is experimental_) + +Trigonometric operators allow trigonometric functions to be executed on two vectors using +vector matching, which isn't available with normal functions. They act in the same manner +as arithmetic operators. + ### Comparison binary operators The following binary comparison operators exist in Prometheus: @@ -264,7 +274,7 @@ The following list shows the precedence of binary operators in Prometheus, from highest to lowest. 1. `^` -2. `*`, `/`, `%` +2. `*`, `/`, `%`, `atan2` 3. `+`, `-` 4. `==`, `!=`, `<=`, `<`, `>=`, `>` 5. `and`, `unless` From 587cb950930eb611486402aad081c96a91a14535 Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Wed, 25 Aug 2021 08:10:25 -0400 Subject: [PATCH 07/36] Add operator tests Signed-off-by: Levi Harrison --- promql/testdata/operators.test | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/promql/testdata/operators.test b/promql/testdata/operators.test index d5a4d76f50..a6072eef31 100644 --- a/promql/testdata/operators.test +++ b/promql/testdata/operators.test @@ -467,3 +467,17 @@ eval instant at 5m test_total < bool test_smaller {instance="localhost"} 0 eval instant at 5m test_total < test_smaller + +clear + +# Testing atan2. +load 5m + trigy{} 10 + trigx{} 20 + trigNaN{} NaN + +eval instant at 5m trigy atan2 trigx + trigy{} 0.4636476090008061 + +eval instant at 5m trigy atan2 trigNaN + trigy{} NaN From a283b52e8ca8a69461628219753ff40570aafb63 Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Wed, 25 Aug 2021 08:33:42 -0400 Subject: [PATCH 08/36] Added unit Signed-off-by: Levi Harrison --- docs/querying/operators.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/querying/operators.md b/docs/querying/operators.md index b790ed1da7..1f6455b7ad 100644 --- a/docs/querying/operators.md +++ b/docs/querying/operators.md @@ -42,7 +42,7 @@ the result. ### Trigonometric binary operators -The following trigonometric binary operators exist in Prometheus: +The following trigonometric binary operators, which work in radians, exist in Prometheus: * `atan2` (https://pkg.go.dev/math#Atan2, _This is experimental_) From e27ac3e7e42f8fb01d333ea7191f775d113cf8e5 Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Sun, 29 Aug 2021 14:18:23 -0400 Subject: [PATCH 09/36] Add grammar (maybe?) Signed-off-by: Levi Harrison --- web/ui/module/codemirror-promql/src/complete/promql.terms.ts | 1 + web/ui/module/codemirror-promql/src/grammar/promql.grammar | 5 ++++- web/ui/module/codemirror-promql/src/promql.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/web/ui/module/codemirror-promql/src/complete/promql.terms.ts b/web/ui/module/codemirror-promql/src/complete/promql.terms.ts index 3caf235bfb..4aba94e9f6 100644 --- a/web/ui/module/codemirror-promql/src/complete/promql.terms.ts +++ b/web/ui/module/codemirror-promql/src/complete/promql.terms.ts @@ -28,6 +28,7 @@ export const binOpTerms = [ { label: '<' }, { label: '<=' }, { label: '!=' }, + { label: 'atan2' }, { label: 'and' }, { label: 'or' }, { label: 'unless' }, diff --git a/web/ui/module/codemirror-promql/src/grammar/promql.grammar b/web/ui/module/codemirror-promql/src/grammar/promql.grammar index 2814a35c52..a086003ce8 100644 --- a/web/ui/module/codemirror-promql/src/grammar/promql.grammar +++ b/web/ui/module/codemirror-promql/src/grammar/promql.grammar @@ -16,7 +16,8 @@ @precedence { pow @right, - mul @left, + mul @left + atan2 @left, add @left, eql @left, and @left, @@ -69,6 +70,7 @@ BinaryExpr { Expr !mul Mul BinModifiers Expr | Expr !mul Div BinModifiers Expr | Expr !mul Mod BinModifiers Expr | + Expr !mul Atan2 BinModifiers Expr | Expr !add Add BinModifiers Expr | Expr !add Sub BinModifiers Expr | Expr !eql Eql BinModifiers Expr | @@ -333,6 +335,7 @@ NumberLiteral { // Contextual keywords @external extend {Identifier} extendIdentifier from "./tokens" { + Atan2, Avg, Bottomk, Count, diff --git a/web/ui/module/codemirror-promql/src/promql.ts b/web/ui/module/codemirror-promql/src/promql.ts index 8d282572fe..a0bf724810 100644 --- a/web/ui/module/codemirror-promql/src/promql.ts +++ b/web/ui/module/codemirror-promql/src/promql.ts @@ -40,7 +40,7 @@ export function promQLLanguage(top: LanguageType): LezerLanguage { 'Avg Bottomk Count Count_values Group Max Min Quantile Stddev Stdvar Sum Topk': tags.operatorKeyword, 'By Without Bool On Ignoring GroupLeft GroupRight Offset Start End': tags.modifier, 'And Unless Or': tags.logicOperator, - 'Sub Add Mul Mod Div Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At': tags.operator, + 'Sub Add Mul Mod Div Atan2 Eql Neq Lte Lss Gte Gtr EqlRegex EqlSingle NeqRegex Pow At': tags.operator, UnaryOp: tags.arithmeticOperator, '( )': tags.paren, '[ ]': tags.squareBracket, From acee8c8a88809a875c36a64059d2b1bdfd0ec4fe Mon Sep 17 00:00:00 2001 From: Nick Pillitteri <56quarters@users.noreply.github.com> Date: Thu, 23 Sep 2021 14:34:09 -0400 Subject: [PATCH 10/36] Redact remote write URL when used for metric label (#9383) Redact any basic auth passwords in the remote write URL (which are technically allowed although not recommended) when used as metric labels. Signed-off-by: Nick Pillitteri --- storage/remote/write.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/remote/write.go b/storage/remote/write.go index 2d96f70ae2..b3fec364a7 100644 --- a/storage/remote/write.go +++ b/storage/remote/write.go @@ -158,7 +158,10 @@ func (rws *WriteStorage) ApplyConfig(conf *config.Config) error { continue } - endpoint := rwConf.URL.String() + // Redacted to remove any passwords in the URL (that are + // technically accepted but not recommended) since this is + // only used for metric labels. + endpoint := rwConf.URL.Redacted() newQueues[hash] = NewQueueManager( newQueueManagerMetrics(rws.reg, name, endpoint), rws.watcherMetrics, From 7bcca77340cf4b20556b5edc0c6c235bf4b6e82a Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Fri, 24 Sep 2021 07:52:50 +0200 Subject: [PATCH 11/36] provide a way to override the apiPrefix in codemirror prom client + cleanup readme (#9384) Signed-off-by: Augustin Husson --- web/ui/module/codemirror-promql/README.md | 29 ++++++----------- .../src/client/prometheus.ts | 32 +++++++++++++------ 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/web/ui/module/codemirror-promql/README.md b/web/ui/module/codemirror-promql/README.md index 63a50bc27c..b717b2d149 100644 --- a/web/ui/module/codemirror-promql/README.md +++ b/web/ui/module/codemirror-promql/README.md @@ -172,6 +172,16 @@ You can change it to use the HTTP method `GET` if you prefer. const promQL = new PromQLExtension().setComplete({ remote: { httpMethod: 'GET' } }) ``` +###### Override the API Prefix + +The default Prometheus Client, when building the query to get data from Prometheus, is using an API prefix which is by default `/api/v1`. + +You can override this value like this: + +```typescript +const promql = new PromQLExtension().setComplete({ remote: { apiPrefix: '/my/api/prefix' } }) +``` + ###### Cache The default client has an embedded cache that is used to store the different metrics and labels retrieved from a remote @@ -232,7 +242,6 @@ Note: In case this parameter is provided, then the rest of the configuration is ### Example -* The development [app](./src/app) can give you an example of how to use it with no TS Framework. * [ReactJS example](https://github.com/prometheus/prometheus/blob/431ea75a11ca165dad9dd5d629b3cf975f4c186b/web/ui/react-app/src/pages/graph/CMExpressionInput.tsx) * [Angular example](https://github.com/perses/perses/blob/28b3bdac88b0ed7a4602f9c91106442eafcb6c34/internal/api/front/perses/src/app/project/prometheusrule/promql-editor/promql-editor.component.ts) @@ -242,24 +251,6 @@ Any contribution or suggestion would be really appreciated. Feel free to [file an issue](https://github.com/prometheus-community/codemirror-promql/issues) or [send a pull request](https://github.com/prometheus-community/codemirror-promql/pulls). -## Development - -In case you want to contribute and change the code by yourself, run the following commands: - -To install all dependencies: - -``` -npm install -``` - -To start the web server: - -``` -npm start -``` - -This should create a tab in your browser with the development app that contains CodeMirror Next with the PromQL plugin. - ## License [MIT](./LICENSE) diff --git a/web/ui/module/codemirror-promql/src/client/prometheus.ts b/web/ui/module/codemirror-promql/src/client/prometheus.ts index ad9be14a57..2a03ec6284 100644 --- a/web/ui/module/codemirror-promql/src/client/prometheus.ts +++ b/web/ui/module/codemirror-promql/src/client/prometheus.ts @@ -16,12 +16,6 @@ import { Matcher } from '../types'; import { labelMatchersToString } from '../parser'; import LRUCache from 'lru-cache'; -const apiPrefix = '/api/v1'; -const labelsEndpoint = apiPrefix + '/labels'; -const labelValuesEndpoint = apiPrefix + '/label/:name/values'; -const seriesEndpoint = apiPrefix + '/series'; -const metricMetadataEndpoint = apiPrefix + '/metadata'; - export interface MetricMetadata { type: string; help: string; @@ -61,6 +55,7 @@ export interface PrometheusConfig { // cache will allow user to change the configuration of the cached Prometheus client (which is used by default) cache?: CacheConfig; httpMethod?: 'POST' | 'GET'; + apiPrefix?: string; } interface APIResponse { @@ -83,6 +78,7 @@ export class HTTPPrometheusClient implements PrometheusClient { // eslint-disable-next-line @typescript-eslint/no-explicit-any private readonly errorHandler?: (error: any) => void; private readonly httpMethod: 'POST' | 'GET' = 'POST'; + private readonly apiPrefix: string = '/api/v1'; // For some reason, just assigning via "= fetch" here does not end up executing fetch correctly // when calling it, thus the indirection via another function wrapper. private readonly fetchFn: FetchFn = (input: RequestInfo, init?: RequestInit): Promise => fetch(input, init); @@ -99,6 +95,9 @@ export class HTTPPrometheusClient implements PrometheusClient { if (config.httpMethod) { this.httpMethod = config.httpMethod; } + if (config.apiPrefix) { + this.apiPrefix = config.apiPrefix; + } } labelNames(metricName?: string): Promise { @@ -106,7 +105,7 @@ export class HTTPPrometheusClient implements PrometheusClient { const start = new Date(end.getTime() - this.lookbackInterval); if (metricName === undefined || metricName === '') { const request = this.buildRequest( - labelsEndpoint, + this.labelsEndpoint(), new URLSearchParams({ start: start.toISOString(), end: end.toISOString(), @@ -150,7 +149,7 @@ export class HTTPPrometheusClient implements PrometheusClient { end: end.toISOString(), }); // See https://prometheus.io/docs/prometheus/latest/querying/api/#querying-label-values - return this.fetchAPI(`${labelValuesEndpoint.replace(/:name/gi, labelName)}?${params}`).catch((error) => { + return this.fetchAPI(`${this.labelValuesEndpoint().replace(/:name/gi, labelName)}?${params}`).catch((error) => { if (this.errorHandler) { this.errorHandler(error); } @@ -175,7 +174,7 @@ export class HTTPPrometheusClient implements PrometheusClient { } metricMetadata(): Promise> { - return this.fetchAPI>(metricMetadataEndpoint).catch((error) => { + return this.fetchAPI>(this.metricMetadataEndpoint()).catch((error) => { if (this.errorHandler) { this.errorHandler(error); } @@ -187,7 +186,7 @@ export class HTTPPrometheusClient implements PrometheusClient { const end = new Date(); const start = new Date(end.getTime() - this.lookbackInterval); const request = this.buildRequest( - seriesEndpoint, + this.seriesEndpoint(), new URLSearchParams({ start: start.toISOString(), end: end.toISOString(), @@ -239,6 +238,19 @@ export class HTTPPrometheusClient implements PrometheusClient { } return { uri, body }; } + + private labelsEndpoint(): string { + return `${this.apiPrefix}/labels`; + } + private labelValuesEndpoint(): string { + return `${this.apiPrefix}/label/:name/values`; + } + private seriesEndpoint(): string { + return `${this.apiPrefix}/series`; + } + private metricMetadataEndpoint(): string { + return `${this.apiPrefix}/metadata`; + } } class Cache { From 7c40eb52ef84e81583a96a60b499b9c01c981237 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Fri, 24 Sep 2021 15:54:25 +0200 Subject: [PATCH 12/36] Add sync_codemirror (#9379) * Add sync_codemirror Signed-off-by: Julien Pivotto --- .circleci/config.yml | 1 + scripts/sync_codemirror.sh | 135 +++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100755 scripts/sync_codemirror.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index cf59c1a4d1..01b2b10a1e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -120,6 +120,7 @@ jobs: steps: - checkout - run: ./scripts/sync_repo_files.sh + - run: ./scripts/sync_codemirror.sh workflows: version: 2 diff --git a/scripts/sync_codemirror.sh b/scripts/sync_codemirror.sh new file mode 100755 index 0000000000..9b04f9368a --- /dev/null +++ b/scripts/sync_codemirror.sh @@ -0,0 +1,135 @@ +#!/usr/bin/env bash +# vim: ts=2 et +# Setting -x is absolutely forbidden as it could leak the GitHub token. +set -uo pipefail + +# GITHUB_TOKEN required scope: repo.repo_public + +git_mail="prometheus-team@googlegroups.com" +git_user="prombot" +branch="repo_sync_codemirror" +commit_msg="Update codemirror" +pr_title="Synchronize codemirror from prometheus/prometheus" +pr_msg="Propagating changes from prometheus/prometheus default branch." +target_repo="prometheus-community/codemirror-promql" +source_path="web/ui/module/codemirror-promql" + +color_red='\e[31m' +color_green='\e[32m' +color_yellow='\e[33m' +color_none='\e[0m' + +echo_red() { + echo -e "${color_red}$@${color_none}" 1>&2 +} + +echo_green() { + echo -e "${color_green}$@${color_none}" 1>&2 +} + +echo_yellow() { + echo -e "${color_yellow}$@${color_none}" 1>&2 +} + +GITHUB_TOKEN="${GITHUB_TOKEN:-}" +if [ -z "${GITHUB_TOKEN}" ]; then + echo_red 'GitHub token (GITHUB_TOKEN) not set. Terminating.' + exit 1 +fi + +# List of files that should not be synced. +excluded_files="CODE_OF_CONDUCT.md LICENSE Makefile.common SECURITY.md .yamllint MAINTAINERS.md" +excluded_dirs=".github .circleci" + +# Go to the root of the repo +cd "$(git rev-parse --show-cdup)" || exit 1 + +source_dir="$(pwd)/${source_path}" + +tmp_dir="$(mktemp -d)" +trap 'rm -rf "${tmp_dir}"' EXIT + +## Internal functions +github_api() { + local url + url="https://api.github.com/${1}" + shift 1 + curl --retry 5 --silent --fail -u "${git_user}:${GITHUB_TOKEN}" "${url}" "$@" +} + +get_default_branch() { + github_api "repos/${1}" 2> /dev/null | + jq -r .default_branch +} + +push_branch() { + local git_url + git_url="https://${git_user}:${GITHUB_TOKEN}@github.com/${1}" + # stdout and stderr are redirected to /dev/null otherwise git-push could leak + # the token in the logs. + # Delete the remote branch in case it was merged but not deleted. + git push --quiet "${git_url}" ":${branch}" 1>/dev/null 2>&1 + git push --quiet "${git_url}" --set-upstream "${branch}" 1>/dev/null 2>&1 +} + +post_pull_request() { + local repo="$1" + local default_branch="$2" + local post_json + post_json="$(printf '{"title":"%s","base":"%s","head":"%s","body":"%s"}' "${pr_title}" "${default_branch}" "${branch}" "${pr_msg}")" + echo "Posting PR to ${default_branch} on ${repo}" + github_api "repos/${repo}/pulls" --data "${post_json}" --show-error | + jq -r '"PR URL " + .html_url' +} + +process_repo() { + local org_repo + local default_branch + org_repo="$1" + mkdir -p "${tmp_dir}/${org_repo}" + echo_green "Processing '${org_repo}'" + + default_branch="$(get_default_branch "${org_repo}")" + if [[ -z "${default_branch}" ]]; then + echo "Can't get the default branch." + return + fi + echo "Default branch: ${default_branch}" + + # Clone target repo to temporary directory and checkout to new branch + git clone --quiet "https://github.com/${org_repo}.git" "${tmp_dir}/${org_repo}" + cd "${tmp_dir}/${org_repo}" || return 1 + git checkout -b "${branch}" || return 1 + + git rm -r . + + cp -ra ${source_dir}/. . + git add . + + for excluded_dir in ${excluded_dirs}; do + git restore --staged "${excluded_dir}/*" + git restore "${excluded_dir}/*" + done + + for excluded_file in ${excluded_files}; do + git restore --staged "${excluded_file}" + git restore "${excluded_file}" + done + + if [[ -n "$(git status --porcelain)" ]]; then + git config user.email "${git_mail}" + git config user.name "${git_user}" + git add . + git commit -s -m "${commit_msg}" + if push_branch "${org_repo}"; then + if ! post_pull_request "${org_repo}" "${default_branch}"; then + return 1 + fi + else + echo "Pushing ${branch} to ${org_repo} failed" + return 1 + fi + fi +} + +process_repo ${target_repo} From 3e494eac714302d2bafc246a750409d9ffb39456 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Fri, 24 Sep 2021 21:40:49 +0200 Subject: [PATCH 13/36] upgrade to codemirror v19 (#9363) * upgrade to codemirror v19 Signed-off-by: Augustin Husson * fix autocomplete test Signed-off-by: Augustin Husson * fix wording Signed-off-by: Augustin Husson --- web/ui/module/codemirror-promql/package.json | 32 +- .../src/complete/hybrid.test.ts | 17 + .../codemirror-promql/src/complete/hybrid.ts | 37 +- .../src/grammar/test/test-promql.test.ts | 2 +- .../codemirror-promql/src/parser/matcher.ts | 2 +- .../codemirror-promql/src/parser/parser.ts | 2 +- .../src/parser/path-finder.test.ts | 10 +- .../src/parser/path-finder.ts | 2 +- .../codemirror-promql/src/parser/type.ts | 2 +- .../codemirror-promql/src/parser/vector.ts | 2 +- web/ui/module/codemirror-promql/src/promql.ts | 6 +- .../codemirror-promql/src/test/utils.test.ts | 4 +- web/ui/package-lock.json | 757 +++++++++--------- web/ui/react-app/package.json | 24 +- 14 files changed, 459 insertions(+), 440 deletions(-) diff --git a/web/ui/module/codemirror-promql/package.json b/web/ui/module/codemirror-promql/package.json index 222eee4bb6..bf0899ee7b 100644 --- a/web/ui/module/codemirror-promql/package.json +++ b/web/ui/module/codemirror-promql/package.json @@ -34,13 +34,15 @@ "lru-cache": "^6.0.0" }, "devDependencies": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/basic-setup": "^0.18.0", - "@codemirror/highlight": "^0.18.3", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.1", + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/basic-setup": "^0.19.0", + "@codemirror/highlight": "^0.19.5", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", + "@lezer/common": "^0.15.5", + "@lezer/generator": "^0.15.1", "@types/chai": "^4.2.12", "@types/lru-cache": "^5.1.0", "@types/mocha": "^8.0.3", @@ -55,8 +57,6 @@ "eslint-plugin-import": "^2.24.2", "eslint-plugin-prettier": "^4.0.0", "isomorphic-fetch": "^3.0.0", - "lezer": "^0.13.1", - "lezer-generator": "^0.13.1", "mocha": "^8.1.2", "nock": "^13.0.11", "nyc": "^15.1.0", @@ -67,13 +67,13 @@ "typescript": "^4.2.3" }, "peerDependencies": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/highlight": "^0.18.3", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.1", - "lezer": "^0.13.0" + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/highlight": "^0.19.5", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", + "@lezer/common": "^0.15.5" }, "prettier": { "singleQuote": true, diff --git a/web/ui/module/codemirror-promql/src/complete/hybrid.test.ts b/web/ui/module/codemirror-promql/src/complete/hybrid.test.ts index c3a57ad569..a1476fa1ff 100644 --- a/web/ui/module/codemirror-promql/src/complete/hybrid.test.ts +++ b/web/ui/module/codemirror-promql/src/complete/hybrid.test.ts @@ -452,6 +452,12 @@ describe('analyzeCompletion test', () => { pos: 16, expectedContext: [{ kind: ContextKind.BinOp }, { kind: ContextKind.Offset }], }, + { + title: 'autocomplete offset or binop 5', + expr: 'sum(http_requests_total{method="GET"} off)', + pos: 41, + expectedContext: [{ kind: ContextKind.BinOp }, { kind: ContextKind.Offset }], + }, { title: 'not autocompleting duration for a matrixSelector', expr: 'go[]', @@ -1051,6 +1057,17 @@ describe('autocomplete promQL test', () => { span: /^[a-zA-Z0-9_:]+$/, }, }, + { + title: 'autocomplete offset or binop 5', + expr: 'sum(http_requests_total{method="GET"} off)', + pos: 41, + expectedResult: { + options: ([] as Completion[]).concat(binOpTerms, [{ label: 'offset' }]), + from: 38, + to: 41, + span: /^[a-zA-Z0-9_:]+$/, + }, + }, { title: 'offline not autocompleting duration for a matrixSelector', expr: 'go[]', diff --git a/web/ui/module/codemirror-promql/src/complete/hybrid.ts b/web/ui/module/codemirror-promql/src/complete/hybrid.ts index 4e7eb7b60b..8e1c3d4c93 100644 --- a/web/ui/module/codemirror-promql/src/complete/hybrid.ts +++ b/web/ui/module/codemirror-promql/src/complete/hybrid.ts @@ -12,7 +12,7 @@ // limitations under the License. import { CompleteStrategy } from './index'; -import { SyntaxNode } from 'lezer-tree'; +import { SyntaxNode } from '@lezer/common'; import { PrometheusClient } from '../client'; import { Add, @@ -230,22 +230,22 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode): Context case Identifier: // sometimes an Identifier has an error has parent. This should be treated in priority if (node.parent?.type.id === 0) { - const parent = node.parent; - if (parent.parent?.type.id === StepInvariantExpr) { + const errorNodeParent = node.parent.parent; + if (errorNodeParent?.type.id === StepInvariantExpr) { // we are likely in the given situation: // `expr @ s` // we can autocomplete start / end result.push({ kind: ContextKind.AtModifiers }); break; } - if (parent.parent?.type.id === AggregateExpr) { + if (errorNodeParent?.type.id === AggregateExpr) { // it matches 'sum() b'. So here we can autocomplete: // - the aggregate operation modifier // - the binary operation (since it's not mandatory to have an aggregate operation modifier) result.push({ kind: ContextKind.AggregateOpModifier }, { kind: ContextKind.BinOp }); break; } - if (parent.parent?.type.id === VectorSelector) { + if (errorNodeParent?.type.id === VectorSelector) { // it matches 'sum b'. So here we also have to autocomplete the aggregate operation modifier only // if the associated metricIdentifier is matching an aggregation operation. // Note: here is the corresponding tree in order to understand the situation: @@ -267,16 +267,29 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode): Context result.push({ kind: ContextKind.BinOp }, { kind: ContextKind.Offset }); break; } + + if (errorNodeParent && containsChild(errorNodeParent, Expr)) { + // this last case can appear with the following expression: + // 1. http_requests_total{method="GET"} off + // 2. rate(foo[5m]) un + // 3. sum(http_requests_total{method="GET"} off) + // For these different cases we have this kind of tree: + // Parent ( + // Expr(), + // ⚠(Identifier) + // ) + // We don't really care about the parent, here we are more interested if in the siblings of the error node, there is the node 'Expr' + // If it is the case, then likely we should autocomplete the BinOp or the offset. + result.push({ kind: ContextKind.BinOp }, { kind: ContextKind.Offset }); + break; + } } - // As the leaf Identifier is coming for a lot of different case, we have to take a bit time to analyze the tree + // As the leaf Identifier is coming for different cases, we have to take a bit time to analyze the tree // in order to know what we have to autocomplete exactly. // Here is some cases: // 1. metric_name / ignor --> we should autocomplete the BinOpModifier + metric/function/aggregation - // 2. http_requests_total{method="GET"} off --> offset or binOp should be autocompleted here - // 3. rate(foo[5m]) un --> offset or binOp should be autocompleted - // 4. sum(http_requests_total{method="GET"} off) --> offset or binOp should be autocompleted - // 5. sum(http_requests_total{method="GET"} / o) --> BinOpModifier + metric/function/aggregation - // All examples above give a different tree each time but ends up to be treated in this case. + // 2. sum(http_requests_total{method="GET"} / o) --> BinOpModifier + metric/function/aggregation + // Examples above give a different tree each time and ends up to be treated in this case. // But they all have the following common tree pattern: // Parent( Expr(...), // ... , @@ -314,8 +327,6 @@ export function analyzeCompletion(state: EditorState, node: SyntaxNode): Context if (containsAtLeastOneChild(parent, Eql, Gte, Gtr, Lte, Lss, Neq) && !walkThrough(parent, BinModifiers, Bool)) { result.push({ kind: ContextKind.Bool }); } - } else if (parent.type.id !== BinaryExpr || (parent.type.id === BinaryExpr && containsAtLeastOneChild(parent, 0))) { - result.push({ kind: ContextKind.BinOp }, { kind: ContextKind.Offset }); } } else { result.push( diff --git a/web/ui/module/codemirror-promql/src/grammar/test/test-promql.test.ts b/web/ui/module/codemirror-promql/src/grammar/test/test-promql.test.ts index 15c2049e2e..0583a71255 100644 --- a/web/ui/module/codemirror-promql/src/grammar/test/test-promql.test.ts +++ b/web/ui/module/codemirror-promql/src/grammar/test/test-promql.test.ts @@ -1,5 +1,5 @@ import { parser } from '../parser'; -import { fileTests } from 'lezer-generator/dist/test'; +import { fileTests } from '@lezer/generator/dist/test'; import * as fs from 'fs'; import * as path from 'path'; diff --git a/web/ui/module/codemirror-promql/src/parser/matcher.ts b/web/ui/module/codemirror-promql/src/parser/matcher.ts index 22421559a1..95b1abb988 100644 --- a/web/ui/module/codemirror-promql/src/parser/matcher.ts +++ b/web/ui/module/codemirror-promql/src/parser/matcher.ts @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { SyntaxNode } from 'lezer-tree'; +import { SyntaxNode } from '@lezer/common'; import { EqlRegex, EqlSingle, LabelName, MatchOp, Neq, NeqRegex, StringLiteral } from '../grammar/parser.terms'; import { EditorState } from '@codemirror/state'; import { Matcher } from '../types'; diff --git a/web/ui/module/codemirror-promql/src/parser/parser.ts b/web/ui/module/codemirror-promql/src/parser/parser.ts index d90dd27cde..75067b340e 100644 --- a/web/ui/module/codemirror-promql/src/parser/parser.ts +++ b/web/ui/module/codemirror-promql/src/parser/parser.ts @@ -12,7 +12,7 @@ // limitations under the License. import { Diagnostic } from '@codemirror/lint'; -import { SyntaxNode, Tree } from 'lezer-tree'; +import { SyntaxNode, Tree } from '@lezer/common'; import { AggregateExpr, And, diff --git a/web/ui/module/codemirror-promql/src/parser/path-finder.test.ts b/web/ui/module/codemirror-promql/src/parser/path-finder.test.ts index 8b113bbe41..73e4d7af2e 100644 --- a/web/ui/module/codemirror-promql/src/parser/path-finder.test.ts +++ b/web/ui/module/codemirror-promql/src/parser/path-finder.test.ts @@ -35,7 +35,7 @@ import { } from '../grammar/parser.terms'; import { createEditorState } from '../test/utils.test'; import { containsAtLeastOneChild, containsChild, retrieveAllRecursiveNodes, walkBackward, walkThrough } from './path-finder'; -import { SyntaxNode } from 'lezer-tree'; +import { SyntaxNode } from '@lezer/common'; import { syntaxTree } from '@codemirror/language'; describe('walkThrough test', () => { @@ -147,14 +147,6 @@ describe('containsChild test', () => { walkThrough: [Expr, BinaryExpr], child: [Expr, Expr], }, - { - title: 'Should find all expr in a subtree 2', - expr: 'http_requests_total{method="GET"} off', - pos: 0, - expectedResult: true, - walkThrough: [Expr, BinaryExpr], - child: [Expr, Expr], - }, { title: 'Should not find all child required', expr: 'sum(ra)', diff --git a/web/ui/module/codemirror-promql/src/parser/path-finder.ts b/web/ui/module/codemirror-promql/src/parser/path-finder.ts index fbef6ad255..47efbe693a 100644 --- a/web/ui/module/codemirror-promql/src/parser/path-finder.ts +++ b/web/ui/module/codemirror-promql/src/parser/path-finder.ts @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { SyntaxNode } from 'lezer-tree'; +import { SyntaxNode } from '@lezer/common'; // walkBackward will iterate other the tree from the leaf to the root until it founds the given `exit` node. // It returns null if the exit is not found. diff --git a/web/ui/module/codemirror-promql/src/parser/type.ts b/web/ui/module/codemirror-promql/src/parser/type.ts index 786bb18a30..b729f82966 100644 --- a/web/ui/module/codemirror-promql/src/parser/type.ts +++ b/web/ui/module/codemirror-promql/src/parser/type.ts @@ -11,7 +11,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { SyntaxNode } from 'lezer-tree'; +import { SyntaxNode } from '@lezer/common'; import { AggregateExpr, BinaryExpr, diff --git a/web/ui/module/codemirror-promql/src/parser/vector.ts b/web/ui/module/codemirror-promql/src/parser/vector.ts index c219c3d100..269169217e 100644 --- a/web/ui/module/codemirror-promql/src/parser/vector.ts +++ b/web/ui/module/codemirror-promql/src/parser/vector.ts @@ -12,7 +12,7 @@ // limitations under the License. import { EditorState } from '@codemirror/state'; -import { SyntaxNode } from 'lezer-tree'; +import { SyntaxNode } from '@lezer/common'; import { And, BinaryExpr, diff --git a/web/ui/module/codemirror-promql/src/promql.ts b/web/ui/module/codemirror-promql/src/promql.ts index 8d282572fe..04d5a9ad07 100644 --- a/web/ui/module/codemirror-promql/src/promql.ts +++ b/web/ui/module/codemirror-promql/src/promql.ts @@ -17,15 +17,15 @@ import { Extension } from '@codemirror/state'; import { CompleteConfiguration, CompleteStrategy, newCompleteStrategy } from './complete'; import { LintStrategy, newLintStrategy, promQLLinter } from './lint'; import { CompletionContext } from '@codemirror/autocomplete'; -import { LezerLanguage } from '@codemirror/language'; +import { LRLanguage } from '@codemirror/language'; export enum LanguageType { PromQL = 'PromQL', MetricName = 'MetricName', } -export function promQLLanguage(top: LanguageType): LezerLanguage { - return LezerLanguage.define({ +export function promQLLanguage(top: LanguageType): LRLanguage { + return LRLanguage.define({ parser: parser.configure({ top: top, props: [ diff --git a/web/ui/module/codemirror-promql/src/test/utils.test.ts b/web/ui/module/codemirror-promql/src/test/utils.test.ts index c1e5383426..32e635c31e 100644 --- a/web/ui/module/codemirror-promql/src/test/utils.test.ts +++ b/web/ui/module/codemirror-promql/src/test/utils.test.ts @@ -13,13 +13,13 @@ import { parser } from '../grammar/parser'; import { EditorState } from '@codemirror/state'; -import { LezerLanguage } from '@codemirror/language'; +import { LRLanguage } from '@codemirror/language'; import nock from 'nock'; // used to inject an implementation of fetch in NodeJS require('isomorphic-fetch'); -const lightPromQLSyntax = LezerLanguage.define({ parser: parser }); +const lightPromQLSyntax = LRLanguage.define({ parser: parser }); export function createEditorState(expr: string): EditorState { return EditorState.create({ diff --git a/web/ui/package-lock.json b/web/ui/package-lock.json index d5371e82f6..a64d4a457d 100644 --- a/web/ui/package-lock.json +++ b/web/ui/package-lock.json @@ -20,13 +20,15 @@ "lru-cache": "^6.0.0" }, "devDependencies": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/basic-setup": "^0.18.0", - "@codemirror/highlight": "^0.18.3", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.1", + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/basic-setup": "^0.19.0", + "@codemirror/highlight": "^0.19.5", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", + "@lezer/common": "^0.15.5", + "@lezer/generator": "^0.15.1", "@types/chai": "^4.2.12", "@types/lru-cache": "^5.1.0", "@types/mocha": "^8.0.3", @@ -41,8 +43,6 @@ "eslint-plugin-import": "^2.24.2", "eslint-plugin-prettier": "^4.0.0", "isomorphic-fetch": "^3.0.0", - "lezer": "^0.13.1", - "lezer-generator": "^0.13.1", "mocha": "^8.1.2", "nock": "^13.0.11", "nyc": "^15.1.0", @@ -56,13 +56,13 @@ "node": ">=12.0.0" }, "peerDependencies": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/highlight": "^0.18.3", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.1", - "lezer": "^0.13.0" + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/highlight": "^0.19.5", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", + "@lezer/common": "^0.15.5" } }, "node_modules/@babel/code-frame": { @@ -517,228 +517,228 @@ } }, "node_modules/@codemirror/autocomplete": { - "version": "0.18.8", - "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.18.8.tgz", - "integrity": "sha512-Va1Q763Vu/rVmIazru/ZnO2kkWVq6SlmMEjeD0qmxLAypyP6j/QNdpmaPDI1qb/+Mb9VFZBbac6a0aLTTi8qxQ==", + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.19.3.tgz", + "integrity": "sha512-5juP6hVrHAogzQ0JUTQuibE8j1seqeGNJ98qLUPuliI6kLBg5INS4qvUI1Brqye+wYPFu7UHqrrn13RLh5YSzw==", "dependencies": { - "@codemirror/language": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/tooltip": "^0.18.4", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0" + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.2", + "@codemirror/tooltip": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" } }, "node_modules/@codemirror/basic-setup": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/basic-setup/-/basic-setup-0.18.2.tgz", - "integrity": "sha512-4UNFQ4jhU7wKxJH23AJcZW6Ho54VXUpmbtFnN5amIdtGci4ZLvci4M7JKgKFraHmKfDIYQnSzN8d8ohXR7CRhw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/basic-setup/-/basic-setup-0.19.0.tgz", + "integrity": "sha512-Yhrf7fIz8+INHWOhpWeRwbs8fpc0KsydX9baD7TyYqniLVWyTi0Hwm52mr0f5O+k4YaJPeHAgT3x9gzDXZIvOw==", "dev": true, "dependencies": { - "@codemirror/autocomplete": "^0.18.0", - "@codemirror/closebrackets": "^0.18.0", - "@codemirror/commands": "^0.18.0", - "@codemirror/comment": "^0.18.0", - "@codemirror/fold": "^0.18.0", - "@codemirror/gutter": "^0.18.3", - "@codemirror/highlight": "^0.18.0", - "@codemirror/history": "^0.18.0", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.0", - "@codemirror/matchbrackets": "^0.18.0", - "@codemirror/rectangular-selection": "^0.18.0", - "@codemirror/search": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/autocomplete": "^0.19.0", + "@codemirror/closebrackets": "^0.19.0", + "@codemirror/commands": "^0.19.0", + "@codemirror/comment": "^0.19.0", + "@codemirror/fold": "^0.19.0", + "@codemirror/gutter": "^0.19.0", + "@codemirror/highlight": "^0.19.0", + "@codemirror/history": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/lint": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/rectangular-selection": "^0.19.0", + "@codemirror/search": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/closebrackets": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@codemirror/closebrackets/-/closebrackets-0.18.0.tgz", - "integrity": "sha512-O1RAgUkzF4nq/B8IyXenZKZ1rJi2Mc7I6y4IhWhELiTnjyQy7YdAthTsJ40mNr8kZ6gRbasYe3K7TraITElZJA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/closebrackets/-/closebrackets-0.19.0.tgz", + "integrity": "sha512-dFWX5OEVYWRNtGaifSbwIAlymnRRjxWMiMbffbAjF7p0zfGHDbdGkiT56q3Xud63h5/tQdSo5dK1iyNTzHz5vg==", "dependencies": { - "@codemirror/language": "^0.18.0", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/commands": { - "version": "0.18.3", - "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-0.18.3.tgz", - "integrity": "sha512-nHYDG13qOirioXTAKmjl10W2L0eZ1ftvmTwvUTNY27UWVBPFSpk5zDXP3WqJ0mgMhQ4AOFLJaTjJEO3hmPComg==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-0.19.4.tgz", + "integrity": "sha512-EW6ffAIdu7aGWWwEG4xRcKLR+1RXH7hJqMt5mbrxDSc2xAQBgqxIPFglcMeSkC7qqkwPuqv3xavVh1+0gQ0piQ==", "dependencies": { - "@codemirror/language": "^0.18.0", - "@codemirror/matchbrackets": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0" + "@codemirror/language": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" } }, "node_modules/@codemirror/comment": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/comment/-/comment-0.18.1.tgz", - "integrity": "sha512-Inhqs0F24WE28Fcp1dBZghwixBGv1HDwY9MjE0d5tpMY/IPGI6uT30fGyHAXrir6hUqk7eJRkO4UYnODGOnoIA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/comment/-/comment-0.19.0.tgz", + "integrity": "sha512-3hqAd0548fxqOBm4khFMcXVIivX8p0bSlbAuZJ6PNoUn/0wXhxkxowPp0FmFzU2+y37Z+ZQF5cRB5EREWPRIiQ==", "dependencies": { - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/fold": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.18.2.tgz", - "integrity": "sha512-kkQ+stpUbOAU0ASPP9NW5uLLhe5LVC46m47zJUnWDlsT9rS5NZW6NDiWzrDlN8dWQT8fePzkMA174BG4tr2GJw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.19.0.tgz", + "integrity": "sha512-cHbr2hqKe2pMls1Ia1a4IwXly87ljpmvPUKkul6H/Uv9kCwpQLOP3dGMPXbMGm/1hGjBF/0wnc+m2iba9iJBTQ==", "dev": true, "dependencies": { - "@codemirror/gutter": "^0.18.0", - "@codemirror/language": "^0.18.0", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/gutter": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/gutter": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/gutter/-/gutter-0.18.4.tgz", - "integrity": "sha512-Sf2IWshMi9zwVVqpGmd2NRplY0qfrE2IiBEII9n2gB9M8hgIMg5GCyhdnsUDsOm0gcSut65W62vV7/DfYJHQCA==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/gutter/-/gutter-0.19.2.tgz", + "integrity": "sha512-xiayxhc9uq1UXiG/r/E3AAYXZt+EtSdgdQXC4nlMHvbfw2EmtryfzGO3HrgasHRyAW8uNCaO9JO4n7mU7rm1rQ==", "dev": true, "dependencies": { - "@codemirror/rangeset": "^0.18.3", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/highlight": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/highlight/-/highlight-0.18.4.tgz", - "integrity": "sha512-3azJntqWrShOIq/0kVcdMc9k7ACL0LQErgK+A6aWXmCj5Mx0gShq+Iajy8AMQ2zB0v3nhCBgFaniL1LLD5m5hQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@codemirror/highlight/-/highlight-0.19.5.tgz", + "integrity": "sha512-JDGEH/l/DGpxG2k+mgqMKcuFURIs42eoTB4H4tN7QmzyW/z/MlNKiHHv7pWXyN+H5QvftK5yctsxUu77EZikmw==", "dependencies": { - "@codemirror/language": "^0.18.0", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0", + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0", "style-mod": "^4.0.0" } }, "node_modules/@codemirror/history": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/history/-/history-0.18.1.tgz", - "integrity": "sha512-Aad3p4zs6UYKCUMXYjh7cvPK0ajuL+rMib9yBZ61w81LLl6OkM31Xrn9J6CLJmPxCwP3OJFiqBmNSBQ05oIsTw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/history/-/history-0.19.0.tgz", + "integrity": "sha512-E0H+lncH66IMDhaND9jgkjE7s0dhYfjCPmS+Ig2Yes9I8+UIEecIdObj8c8HPCFGctGg3fxXqRAw2mdHl2Wouw==", "dependencies": { - "@codemirror/state": "^0.18.3", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/language": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.18.2.tgz", - "integrity": "sha512-2Kz0Xyfvt1Ex2KfTUcYZ3IBxpnFCqHaJijwZknGBT7JXv9dwbOPs9SfPfL4oxVuDIHZx8JTPfoV3LTTJrm8M3Q==", + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.19.3.tgz", + "integrity": "sha512-6vjkRYHRJg/z9wdAk75nU2fQwCJBsh2HpkIjKXIHfzISSgLt5qSDxVhPd8Uu8PD5WMmFFP8tX7I9kdIt873o0A==", "dependencies": { - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer": "^0.13.4", - "lezer-tree": "^0.13.0" + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.5", + "@lezer/lr": "^0.15.0" } }, "node_modules/@codemirror/lint": { - "version": "0.18.6", - "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-0.18.6.tgz", - "integrity": "sha512-juE05YyDoLp9WCcR0hQagphOCIZ0r4WRocRFu9tbFwsMjfuForjn4m+wsLSDaDgp2Z9secMyOSGDpBNtVwM9lQ==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-0.19.1.tgz", + "integrity": "sha512-Ef0TnXpF4Q4B+lvBdgHexe1dHbvkKBvBHsLB8HwTYffwjekg1YvEM+6zyjyjG9m6s1Ru0VaCNlNwotLaVZjHGQ==", "dependencies": { - "@codemirror/panel": "^0.18.1", - "@codemirror/state": "^0.18.0", - "@codemirror/tooltip": "^0.18.4", - "@codemirror/view": "^0.18.0", + "@codemirror/panel": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/tooltip": "^0.19.0", + "@codemirror/view": "^0.19.0", "crelt": "^1.0.5" } }, "node_modules/@codemirror/matchbrackets": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@codemirror/matchbrackets/-/matchbrackets-0.18.0.tgz", - "integrity": "sha512-dPDopnZVkD54sSYdmQbyQbPdiuIA83p7XxX6Hp1ScEkOjukwCiFXiA/84x10FUTsQpUYp8bDzm7gwII119bGIw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/matchbrackets/-/matchbrackets-0.19.1.tgz", + "integrity": "sha512-jBEW2Uu3hWcrrkwkauaikCAE7s5liCwbccFa6rLK6DzwaynOqCKJGyDsbkfrhikofNRc1yh4V3vwUuxt2u4QbA==", "dependencies": { - "@codemirror/language": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0" + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" } }, "node_modules/@codemirror/panel": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/panel/-/panel-0.18.2.tgz", - "integrity": "sha512-ea/g2aAKtfmie1kD7C8GDutD/5u+uzRJr/varUiAbHKr1sAdjtz5xYvC3GBAMYMan1GOh0vD5zP1yEupJl3b3Q==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/panel/-/panel-0.19.0.tgz", + "integrity": "sha512-LJuu49xnuhaAztlhnLJQ57ddOirSyf8/lnl7twsQUG/05RkxodBZ9F7q8r5AOLqOkaQOy9WySEKX1Ur8lD9Q5w==", "dependencies": { - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/rangeset": { - "version": "0.18.5", - "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.18.5.tgz", - "integrity": "sha512-gvYniNeEbGRp74MM8EQ+0tylK85pVody4r4N5bs94msPwHQSKFkEmosl8tVmS0Z4e8gRtlB37m8/cWoRiuSz5Q==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.1.tgz", + "integrity": "sha512-WaKTEw8JB/3QFlQzpdgRoklopcWvG8O/Xp+rxxOfFKYTaeaejpY/tjpyBBg+Ea65Ka3m7+pPp9d5j/oR2rd9NA==", "dependencies": { - "@codemirror/state": "^0.18.0" + "@codemirror/state": "^0.19.0" } }, "node_modules/@codemirror/rectangular-selection": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/rectangular-selection/-/rectangular-selection-0.18.1.tgz", - "integrity": "sha512-WpdIo6wyxamncvSZQEO1xsZArRnE5/NtNGnuLCjYUkW5JepdYtEJzIE9czaJqxVGrCBs//Lv58CbGX77/1GAoA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/rectangular-selection/-/rectangular-selection-0.19.0.tgz", + "integrity": "sha512-KdvoEweBgVsOcqdYFEinYGroS028pwUPkO3REzQC7Z/hT1KNqZUlyfoi6WBv3Gzp8b6l8NNA+rLnnYMSHlcGYA==", "dev": true, "dependencies": { - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.1", - "@codemirror/view": "^0.18.18" + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/search": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.18.4.tgz", - "integrity": "sha512-3chVkMPzl+pTUSqtimTicebhti4SLpvkj03pQx2aPZScXxIiYuDk4cLdIJK9omjmO1+oycRKbOrqvG7iZJJwMg==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.2.tgz", + "integrity": "sha512-TrRxUxyJ/a7HXtUvMZhgkOUbKE1xO33UhXjn1XACEHKWhgovw1vEeEEti9dZejN8/QOOFJed39InUxmp7oQ8HA==", "dependencies": { - "@codemirror/panel": "^0.18.1", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.6", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0", + "@codemirror/panel": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", "crelt": "^1.0.5" } }, "node_modules/@codemirror/state": { - "version": "0.18.7", - "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.18.7.tgz", - "integrity": "sha512-cVyTiAC9vv90NKmGOfNtBjyIem3BqKui1L5Hfcxurp8K9votQj2oH9COcgWPnQ2Xs64yC70tEuTt9DF1pj5PFQ==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.2.tgz", + "integrity": "sha512-dDqCrtkb0c/LYUlvQBLyLfkISEskbZnhvBbcVOF4j2AusJ1ptJ3EGMxBL9G16GP1TOdC1T613gA1J1qc3pbfGQ==", "dependencies": { - "@codemirror/text": "^0.18.0" + "@codemirror/text": "^0.19.0" } }, "node_modules/@codemirror/text": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/text/-/text-0.18.1.tgz", - "integrity": "sha512-vjXs6mi1F418kucTPlFvnCt9glKnjtYssdXb8mm1oaY/F5O+tgGVepm9Z8F7AKWCQvW8Bns1D3uLz/DOIEywIw==" + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@codemirror/text/-/text-0.19.3.tgz", + "integrity": "sha512-A0HBPZRwQ72XVMN1tg/pVUnvS5CKboBeHZE7cylYw0ljx9eX+NoYaK7apPSJO/Fwh9XhH9m8Va06EGc11VOzUw==" }, "node_modules/@codemirror/tooltip": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/tooltip/-/tooltip-0.18.4.tgz", - "integrity": "sha512-LDlDOSEfjoG24uapLN7exK3Z3JchYFKUwWqo1x/9YdlAkmD1ik7cMSQZboCquP1uJVcXhtbpKmaO6vENGVaarg==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/tooltip/-/tooltip-0.19.2.tgz", + "integrity": "sha512-FMMGGLrr62Ck54NEz8yTGpgo8ihobAsC3sbeQg+OpY4jv9dt1yIP5B9LzsIV+TXQB57JZQZxtTqzkhnFq76haw==", "dependencies": { - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "node_modules/@codemirror/view": { - "version": "0.18.19", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.18.19.tgz", - "integrity": "sha512-TmazVl8H3L+aYwlNb8xk6qADRb8KiYOO047pz51R4mGCg4Ja2siSjXktZgUvklsyWbUY7h9q+oAf4piH+mQZTw==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.7.tgz", + "integrity": "sha512-m9AKO8gec/QnyxR1uq182It0WwauTIaHkdjqtdlKx1IRgknH44SKIJIxwxZt4Y6VDhhivcEbugjoadNy0zR3wQ==", "dependencies": { - "@codemirror/rangeset": "^0.18.2", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.1", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.0", "style-mod": "^4.0.0", "w3c-keyname": "^2.2.4" } @@ -887,6 +887,32 @@ "node": ">=8" } }, + "node_modules/@lezer/common": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.5.tgz", + "integrity": "sha512-ufcjclusHXGdhp4gSPbPD7sUd38SgOej7m5tAEuG2tNPzqzV0d1vwwLh57R6IwW79ml2mb3tUjAoDfqI7v1HEw==" + }, + "node_modules/@lezer/generator": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@lezer/generator/-/generator-0.15.1.tgz", + "integrity": "sha512-OlG6ogwrTUeCsKVzPjXX5cFLT3XGESZY75Ust7DLMwmEgH1Awu/E4PGMFQZeTfI5lBWVo10reqXowiOhNKwOYQ==", + "dev": true, + "dependencies": { + "@lezer/common": "^0.15.0", + "@lezer/lr": "^0.15.0" + }, + "bin": { + "lezer-generator": "dist/lezer-generator.cjs" + } + }, + "node_modules/@lezer/lr": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.2.tgz", + "integrity": "sha512-gkQUkKCAw/zxOiTCGhjctV/C+FPmfwqXscM9EGgcYhUZewkLu2AsEl2Vlcral7xtDU0t6xwakT6Fw5jlMvMX6Q==", + "dependencies": { + "@lezer/common": "^0.15.0" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3397,34 +3423,6 @@ "node": ">= 0.8.0" } }, - "node_modules/lezer": { - "version": "0.13.5", - "resolved": "https://registry.npmjs.org/lezer/-/lezer-0.13.5.tgz", - "integrity": "sha512-cAiMQZGUo2BD8mpcz7Nv1TlKzWP7YIdIRrX41CiP5bk5t4GHxskOxWUx2iAOuHlz8dO+ivbuXr0J1bfHsWD+lQ==", - "deprecated": "This package has been replaced by @lezer/lr", - "dependencies": { - "lezer-tree": "^0.13.2" - } - }, - "node_modules/lezer-generator": { - "version": "0.13.4", - "resolved": "https://registry.npmjs.org/lezer-generator/-/lezer-generator-0.13.4.tgz", - "integrity": "sha512-pTWxEgw6U41jM/IwMbhPBPonrcQV5YYL3XoY4QPR7ibOjgo2RaF4wVrdabN1ILtBbGvtHZekTGyrbsqfKnMHMA==", - "deprecated": "This package has been replaced by @lezer/generator", - "dev": true, - "dependencies": { - "lezer": "^0.13.2" - }, - "bin": { - "lezer-generator": "dist/lezer-generator.cjs" - } - }, - "node_modules/lezer-tree": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/lezer-tree/-/lezer-tree-0.13.2.tgz", - "integrity": "sha512-15ZxW8TxVNAOkHIo43Iouv4zbSkQQ5chQHBpwXcD2bBFz46RB4jYLEEww5l1V0xyIx9U2clSyyrLes+hAUFrGQ==", - "deprecated": "This package has been replaced by @lezer/common" - }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -5697,18 +5695,18 @@ "name": "graph", "version": "0.1.0", "dependencies": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/closebrackets": "^0.18.0", - "@codemirror/commands": "^0.18.0", - "@codemirror/comment": "^0.18.0", - "@codemirror/highlight": "^0.18.3", - "@codemirror/history": "^0.18.0", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/matchbrackets": "^0.18.0", - "@codemirror/search": "^0.18.2", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.3", + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/closebrackets": "^0.19.0", + "@codemirror/commands": "^0.19.4", + "@codemirror/comment": "^0.19.0", + "@codemirror/highlight": "^0.19.5", + "@codemirror/history": "^0.19.0", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/matchbrackets": "^0.19.1", + "@codemirror/search": "^0.19.2", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", "@forevolve/bootstrap-dark": "^1.0.0", "@fortawesome/fontawesome-svg-core": "^1.2.14", "@fortawesome/free-solid-svg-icons": "^5.7.1", @@ -27169,228 +27167,228 @@ } }, "@codemirror/autocomplete": { - "version": "0.18.8", - "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.18.8.tgz", - "integrity": "sha512-Va1Q763Vu/rVmIazru/ZnO2kkWVq6SlmMEjeD0qmxLAypyP6j/QNdpmaPDI1qb/+Mb9VFZBbac6a0aLTTi8qxQ==", + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-0.19.3.tgz", + "integrity": "sha512-5juP6hVrHAogzQ0JUTQuibE8j1seqeGNJ98qLUPuliI6kLBg5INS4qvUI1Brqye+wYPFu7UHqrrn13RLh5YSzw==", "requires": { - "@codemirror/language": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/tooltip": "^0.18.4", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0" + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.2", + "@codemirror/tooltip": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" } }, "@codemirror/basic-setup": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/basic-setup/-/basic-setup-0.18.2.tgz", - "integrity": "sha512-4UNFQ4jhU7wKxJH23AJcZW6Ho54VXUpmbtFnN5amIdtGci4ZLvci4M7JKgKFraHmKfDIYQnSzN8d8ohXR7CRhw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/basic-setup/-/basic-setup-0.19.0.tgz", + "integrity": "sha512-Yhrf7fIz8+INHWOhpWeRwbs8fpc0KsydX9baD7TyYqniLVWyTi0Hwm52mr0f5O+k4YaJPeHAgT3x9gzDXZIvOw==", "dev": true, "requires": { - "@codemirror/autocomplete": "^0.18.0", - "@codemirror/closebrackets": "^0.18.0", - "@codemirror/commands": "^0.18.0", - "@codemirror/comment": "^0.18.0", - "@codemirror/fold": "^0.18.0", - "@codemirror/gutter": "^0.18.3", - "@codemirror/highlight": "^0.18.0", - "@codemirror/history": "^0.18.0", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.0", - "@codemirror/matchbrackets": "^0.18.0", - "@codemirror/rectangular-selection": "^0.18.0", - "@codemirror/search": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/autocomplete": "^0.19.0", + "@codemirror/closebrackets": "^0.19.0", + "@codemirror/commands": "^0.19.0", + "@codemirror/comment": "^0.19.0", + "@codemirror/fold": "^0.19.0", + "@codemirror/gutter": "^0.19.0", + "@codemirror/highlight": "^0.19.0", + "@codemirror/history": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/lint": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/rectangular-selection": "^0.19.0", + "@codemirror/search": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/closebrackets": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@codemirror/closebrackets/-/closebrackets-0.18.0.tgz", - "integrity": "sha512-O1RAgUkzF4nq/B8IyXenZKZ1rJi2Mc7I6y4IhWhELiTnjyQy7YdAthTsJ40mNr8kZ6gRbasYe3K7TraITElZJA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/closebrackets/-/closebrackets-0.19.0.tgz", + "integrity": "sha512-dFWX5OEVYWRNtGaifSbwIAlymnRRjxWMiMbffbAjF7p0zfGHDbdGkiT56q3Xud63h5/tQdSo5dK1iyNTzHz5vg==", "requires": { - "@codemirror/language": "^0.18.0", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/commands": { - "version": "0.18.3", - "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-0.18.3.tgz", - "integrity": "sha512-nHYDG13qOirioXTAKmjl10W2L0eZ1ftvmTwvUTNY27UWVBPFSpk5zDXP3WqJ0mgMhQ4AOFLJaTjJEO3hmPComg==", + "version": "0.19.4", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-0.19.4.tgz", + "integrity": "sha512-EW6ffAIdu7aGWWwEG4xRcKLR+1RXH7hJqMt5mbrxDSc2xAQBgqxIPFglcMeSkC7qqkwPuqv3xavVh1+0gQ0piQ==", "requires": { - "@codemirror/language": "^0.18.0", - "@codemirror/matchbrackets": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0" + "@codemirror/language": "^0.19.0", + "@codemirror/matchbrackets": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" } }, "@codemirror/comment": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/comment/-/comment-0.18.1.tgz", - "integrity": "sha512-Inhqs0F24WE28Fcp1dBZghwixBGv1HDwY9MjE0d5tpMY/IPGI6uT30fGyHAXrir6hUqk7eJRkO4UYnODGOnoIA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/comment/-/comment-0.19.0.tgz", + "integrity": "sha512-3hqAd0548fxqOBm4khFMcXVIivX8p0bSlbAuZJ6PNoUn/0wXhxkxowPp0FmFzU2+y37Z+ZQF5cRB5EREWPRIiQ==", "requires": { - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/fold": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.18.2.tgz", - "integrity": "sha512-kkQ+stpUbOAU0ASPP9NW5uLLhe5LVC46m47zJUnWDlsT9rS5NZW6NDiWzrDlN8dWQT8fePzkMA174BG4tr2GJw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/fold/-/fold-0.19.0.tgz", + "integrity": "sha512-cHbr2hqKe2pMls1Ia1a4IwXly87ljpmvPUKkul6H/Uv9kCwpQLOP3dGMPXbMGm/1hGjBF/0wnc+m2iba9iJBTQ==", "dev": true, "requires": { - "@codemirror/gutter": "^0.18.0", - "@codemirror/language": "^0.18.0", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/gutter": "^0.19.0", + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/gutter": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/gutter/-/gutter-0.18.4.tgz", - "integrity": "sha512-Sf2IWshMi9zwVVqpGmd2NRplY0qfrE2IiBEII9n2gB9M8hgIMg5GCyhdnsUDsOm0gcSut65W62vV7/DfYJHQCA==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/gutter/-/gutter-0.19.2.tgz", + "integrity": "sha512-xiayxhc9uq1UXiG/r/E3AAYXZt+EtSdgdQXC4nlMHvbfw2EmtryfzGO3HrgasHRyAW8uNCaO9JO4n7mU7rm1rQ==", "dev": true, "requires": { - "@codemirror/rangeset": "^0.18.3", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/highlight": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/highlight/-/highlight-0.18.4.tgz", - "integrity": "sha512-3azJntqWrShOIq/0kVcdMc9k7ACL0LQErgK+A6aWXmCj5Mx0gShq+Iajy8AMQ2zB0v3nhCBgFaniL1LLD5m5hQ==", + "version": "0.19.5", + "resolved": "https://registry.npmjs.org/@codemirror/highlight/-/highlight-0.19.5.tgz", + "integrity": "sha512-JDGEH/l/DGpxG2k+mgqMKcuFURIs42eoTB4H4tN7QmzyW/z/MlNKiHHv7pWXyN+H5QvftK5yctsxUu77EZikmw==", "requires": { - "@codemirror/language": "^0.18.0", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0", + "@codemirror/language": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0", "style-mod": "^4.0.0" } }, "@codemirror/history": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/history/-/history-0.18.1.tgz", - "integrity": "sha512-Aad3p4zs6UYKCUMXYjh7cvPK0ajuL+rMib9yBZ61w81LLl6OkM31Xrn9J6CLJmPxCwP3OJFiqBmNSBQ05oIsTw==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/history/-/history-0.19.0.tgz", + "integrity": "sha512-E0H+lncH66IMDhaND9jgkjE7s0dhYfjCPmS+Ig2Yes9I8+UIEecIdObj8c8HPCFGctGg3fxXqRAw2mdHl2Wouw==", "requires": { - "@codemirror/state": "^0.18.3", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/language": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.18.2.tgz", - "integrity": "sha512-2Kz0Xyfvt1Ex2KfTUcYZ3IBxpnFCqHaJijwZknGBT7JXv9dwbOPs9SfPfL4oxVuDIHZx8JTPfoV3LTTJrm8M3Q==", + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@codemirror/language/-/language-0.19.3.tgz", + "integrity": "sha512-6vjkRYHRJg/z9wdAk75nU2fQwCJBsh2HpkIjKXIHfzISSgLt5qSDxVhPd8Uu8PD5WMmFFP8tX7I9kdIt873o0A==", "requires": { - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer": "^0.13.4", - "lezer-tree": "^0.13.0" + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.5", + "@lezer/lr": "^0.15.0" } }, "@codemirror/lint": { - "version": "0.18.6", - "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-0.18.6.tgz", - "integrity": "sha512-juE05YyDoLp9WCcR0hQagphOCIZ0r4WRocRFu9tbFwsMjfuForjn4m+wsLSDaDgp2Z9secMyOSGDpBNtVwM9lQ==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-0.19.1.tgz", + "integrity": "sha512-Ef0TnXpF4Q4B+lvBdgHexe1dHbvkKBvBHsLB8HwTYffwjekg1YvEM+6zyjyjG9m6s1Ru0VaCNlNwotLaVZjHGQ==", "requires": { - "@codemirror/panel": "^0.18.1", - "@codemirror/state": "^0.18.0", - "@codemirror/tooltip": "^0.18.4", - "@codemirror/view": "^0.18.0", + "@codemirror/panel": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/tooltip": "^0.19.0", + "@codemirror/view": "^0.19.0", "crelt": "^1.0.5" } }, "@codemirror/matchbrackets": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/@codemirror/matchbrackets/-/matchbrackets-0.18.0.tgz", - "integrity": "sha512-dPDopnZVkD54sSYdmQbyQbPdiuIA83p7XxX6Hp1ScEkOjukwCiFXiA/84x10FUTsQpUYp8bDzm7gwII119bGIw==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/matchbrackets/-/matchbrackets-0.19.1.tgz", + "integrity": "sha512-jBEW2Uu3hWcrrkwkauaikCAE7s5liCwbccFa6rLK6DzwaynOqCKJGyDsbkfrhikofNRc1yh4V3vwUuxt2u4QbA==", "requires": { - "@codemirror/language": "^0.18.0", - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0", - "lezer-tree": "^0.13.0" + "@codemirror/language": "^0.19.0", + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0", + "@lezer/common": "^0.15.0" } }, "@codemirror/panel": { - "version": "0.18.2", - "resolved": "https://registry.npmjs.org/@codemirror/panel/-/panel-0.18.2.tgz", - "integrity": "sha512-ea/g2aAKtfmie1kD7C8GDutD/5u+uzRJr/varUiAbHKr1sAdjtz5xYvC3GBAMYMan1GOh0vD5zP1yEupJl3b3Q==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/panel/-/panel-0.19.0.tgz", + "integrity": "sha512-LJuu49xnuhaAztlhnLJQ57ddOirSyf8/lnl7twsQUG/05RkxodBZ9F7q8r5AOLqOkaQOy9WySEKX1Ur8lD9Q5w==", "requires": { - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/rangeset": { - "version": "0.18.5", - "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.18.5.tgz", - "integrity": "sha512-gvYniNeEbGRp74MM8EQ+0tylK85pVody4r4N5bs94msPwHQSKFkEmosl8tVmS0Z4e8gRtlB37m8/cWoRiuSz5Q==", + "version": "0.19.1", + "resolved": "https://registry.npmjs.org/@codemirror/rangeset/-/rangeset-0.19.1.tgz", + "integrity": "sha512-WaKTEw8JB/3QFlQzpdgRoklopcWvG8O/Xp+rxxOfFKYTaeaejpY/tjpyBBg+Ea65Ka3m7+pPp9d5j/oR2rd9NA==", "requires": { - "@codemirror/state": "^0.18.0" + "@codemirror/state": "^0.19.0" } }, "@codemirror/rectangular-selection": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/rectangular-selection/-/rectangular-selection-0.18.1.tgz", - "integrity": "sha512-WpdIo6wyxamncvSZQEO1xsZArRnE5/NtNGnuLCjYUkW5JepdYtEJzIE9czaJqxVGrCBs//Lv58CbGX77/1GAoA==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/@codemirror/rectangular-selection/-/rectangular-selection-0.19.0.tgz", + "integrity": "sha512-KdvoEweBgVsOcqdYFEinYGroS028pwUPkO3REzQC7Z/hT1KNqZUlyfoi6WBv3Gzp8b6l8NNA+rLnnYMSHlcGYA==", "dev": true, "requires": { - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.1", - "@codemirror/view": "^0.18.18" + "@codemirror/state": "^0.19.0", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/search": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.18.4.tgz", - "integrity": "sha512-3chVkMPzl+pTUSqtimTicebhti4SLpvkj03pQx2aPZScXxIiYuDk4cLdIJK9omjmO1+oycRKbOrqvG7iZJJwMg==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-0.19.2.tgz", + "integrity": "sha512-TrRxUxyJ/a7HXtUvMZhgkOUbKE1xO33UhXjn1XACEHKWhgovw1vEeEEti9dZejN8/QOOFJed39InUxmp7oQ8HA==", "requires": { - "@codemirror/panel": "^0.18.1", - "@codemirror/rangeset": "^0.18.0", - "@codemirror/state": "^0.18.6", - "@codemirror/text": "^0.18.0", - "@codemirror/view": "^0.18.0", + "@codemirror/panel": "^0.19.0", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.0", + "@codemirror/view": "^0.19.0", "crelt": "^1.0.5" } }, "@codemirror/state": { - "version": "0.18.7", - "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.18.7.tgz", - "integrity": "sha512-cVyTiAC9vv90NKmGOfNtBjyIem3BqKui1L5Hfcxurp8K9votQj2oH9COcgWPnQ2Xs64yC70tEuTt9DF1pj5PFQ==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-0.19.2.tgz", + "integrity": "sha512-dDqCrtkb0c/LYUlvQBLyLfkISEskbZnhvBbcVOF4j2AusJ1ptJ3EGMxBL9G16GP1TOdC1T613gA1J1qc3pbfGQ==", "requires": { - "@codemirror/text": "^0.18.0" + "@codemirror/text": "^0.19.0" } }, "@codemirror/text": { - "version": "0.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/text/-/text-0.18.1.tgz", - "integrity": "sha512-vjXs6mi1F418kucTPlFvnCt9glKnjtYssdXb8mm1oaY/F5O+tgGVepm9Z8F7AKWCQvW8Bns1D3uLz/DOIEywIw==" + "version": "0.19.3", + "resolved": "https://registry.npmjs.org/@codemirror/text/-/text-0.19.3.tgz", + "integrity": "sha512-A0HBPZRwQ72XVMN1tg/pVUnvS5CKboBeHZE7cylYw0ljx9eX+NoYaK7apPSJO/Fwh9XhH9m8Va06EGc11VOzUw==" }, "@codemirror/tooltip": { - "version": "0.18.4", - "resolved": "https://registry.npmjs.org/@codemirror/tooltip/-/tooltip-0.18.4.tgz", - "integrity": "sha512-LDlDOSEfjoG24uapLN7exK3Z3JchYFKUwWqo1x/9YdlAkmD1ik7cMSQZboCquP1uJVcXhtbpKmaO6vENGVaarg==", + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@codemirror/tooltip/-/tooltip-0.19.2.tgz", + "integrity": "sha512-FMMGGLrr62Ck54NEz8yTGpgo8ihobAsC3sbeQg+OpY4jv9dt1yIP5B9LzsIV+TXQB57JZQZxtTqzkhnFq76haw==", "requires": { - "@codemirror/state": "^0.18.0", - "@codemirror/view": "^0.18.0" + "@codemirror/state": "^0.19.0", + "@codemirror/view": "^0.19.0" } }, "@codemirror/view": { - "version": "0.18.19", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.18.19.tgz", - "integrity": "sha512-TmazVl8H3L+aYwlNb8xk6qADRb8KiYOO047pz51R4mGCg4Ja2siSjXktZgUvklsyWbUY7h9q+oAf4piH+mQZTw==", + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-0.19.7.tgz", + "integrity": "sha512-m9AKO8gec/QnyxR1uq182It0WwauTIaHkdjqtdlKx1IRgknH44SKIJIxwxZt4Y6VDhhivcEbugjoadNy0zR3wQ==", "requires": { - "@codemirror/rangeset": "^0.18.2", - "@codemirror/state": "^0.18.0", - "@codemirror/text": "^0.18.1", + "@codemirror/rangeset": "^0.19.0", + "@codemirror/state": "^0.19.2", + "@codemirror/text": "^0.19.0", "style-mod": "^4.0.0", "w3c-keyname": "^2.2.4" } @@ -27505,6 +27503,29 @@ "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", "dev": true }, + "@lezer/common": { + "version": "0.15.5", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-0.15.5.tgz", + "integrity": "sha512-ufcjclusHXGdhp4gSPbPD7sUd38SgOej7m5tAEuG2tNPzqzV0d1vwwLh57R6IwW79ml2mb3tUjAoDfqI7v1HEw==" + }, + "@lezer/generator": { + "version": "0.15.1", + "resolved": "https://registry.npmjs.org/@lezer/generator/-/generator-0.15.1.tgz", + "integrity": "sha512-OlG6ogwrTUeCsKVzPjXX5cFLT3XGESZY75Ust7DLMwmEgH1Awu/E4PGMFQZeTfI5lBWVo10reqXowiOhNKwOYQ==", + "dev": true, + "requires": { + "@lezer/common": "^0.15.0", + "@lezer/lr": "^0.15.0" + } + }, + "@lezer/lr": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@lezer/lr/-/lr-0.15.2.tgz", + "integrity": "sha512-gkQUkKCAw/zxOiTCGhjctV/C+FPmfwqXscM9EGgcYhUZewkLu2AsEl2Vlcral7xtDU0t6xwakT6Fw5jlMvMX6Q==", + "requires": { + "@lezer/common": "^0.15.0" + } + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -28021,13 +28042,15 @@ "codemirror-promql": { "version": "file:module/codemirror-promql", "requires": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/basic-setup": "^0.18.0", - "@codemirror/highlight": "^0.18.3", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.1", + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/basic-setup": "^0.19.0", + "@codemirror/highlight": "^0.19.5", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", + "@lezer/common": "^0.15.5", + "@lezer/generator": "^0.15.1", "@types/chai": "^4.2.12", "@types/lru-cache": "^5.1.0", "@types/mocha": "^8.0.3", @@ -28042,8 +28065,6 @@ "eslint-plugin-import": "^2.24.2", "eslint-plugin-prettier": "^4.0.0", "isomorphic-fetch": "^3.0.0", - "lezer": "^0.13.1", - "lezer-generator": "^0.13.1", "lru-cache": "^6.0.0", "mocha": "^8.1.2", "nock": "^13.0.11", @@ -28913,18 +28934,18 @@ "graph": { "version": "file:react-app", "requires": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/closebrackets": "^0.18.0", - "@codemirror/commands": "^0.18.0", - "@codemirror/comment": "^0.18.0", - "@codemirror/highlight": "^0.18.3", - "@codemirror/history": "^0.18.0", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/matchbrackets": "^0.18.0", - "@codemirror/search": "^0.18.2", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.3", + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/closebrackets": "^0.19.0", + "@codemirror/commands": "^0.19.4", + "@codemirror/comment": "^0.19.0", + "@codemirror/highlight": "^0.19.5", + "@codemirror/history": "^0.19.0", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/matchbrackets": "^0.19.1", + "@codemirror/search": "^0.19.2", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", "@forevolve/bootstrap-dark": "^1.0.0", "@fortawesome/fontawesome-svg-core": "^1.2.14", "@fortawesome/free-solid-svg-icons": "^5.7.1", @@ -43852,28 +43873,6 @@ "type-check": "~0.4.0" } }, - "lezer": { - "version": "0.13.5", - "resolved": "https://registry.npmjs.org/lezer/-/lezer-0.13.5.tgz", - "integrity": "sha512-cAiMQZGUo2BD8mpcz7Nv1TlKzWP7YIdIRrX41CiP5bk5t4GHxskOxWUx2iAOuHlz8dO+ivbuXr0J1bfHsWD+lQ==", - "requires": { - "lezer-tree": "^0.13.2" - } - }, - "lezer-generator": { - "version": "0.13.4", - "resolved": "https://registry.npmjs.org/lezer-generator/-/lezer-generator-0.13.4.tgz", - "integrity": "sha512-pTWxEgw6U41jM/IwMbhPBPonrcQV5YYL3XoY4QPR7ibOjgo2RaF4wVrdabN1ILtBbGvtHZekTGyrbsqfKnMHMA==", - "dev": true, - "requires": { - "lezer": "^0.13.2" - } - }, - "lezer-tree": { - "version": "0.13.2", - "resolved": "https://registry.npmjs.org/lezer-tree/-/lezer-tree-0.13.2.tgz", - "integrity": "sha512-15ZxW8TxVNAOkHIo43Iouv4zbSkQQ5chQHBpwXcD2bBFz46RB4jYLEEww5l1V0xyIx9U2clSyyrLes+hAUFrGQ==" - }, "load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", diff --git a/web/ui/react-app/package.json b/web/ui/react-app/package.json index f8ec094ac0..28a83358ae 100644 --- a/web/ui/react-app/package.json +++ b/web/ui/react-app/package.json @@ -3,18 +3,18 @@ "version": "0.1.0", "private": true, "dependencies": { - "@codemirror/autocomplete": "^0.18.3", - "@codemirror/closebrackets": "^0.18.0", - "@codemirror/commands": "^0.18.0", - "@codemirror/comment": "^0.18.0", - "@codemirror/highlight": "^0.18.3", - "@codemirror/history": "^0.18.0", - "@codemirror/language": "^0.18.0", - "@codemirror/lint": "^0.18.1", - "@codemirror/matchbrackets": "^0.18.0", - "@codemirror/search": "^0.18.2", - "@codemirror/state": "^0.18.2", - "@codemirror/view": "^0.18.3", + "@codemirror/autocomplete": "^0.19.3", + "@codemirror/closebrackets": "^0.19.0", + "@codemirror/commands": "^0.19.4", + "@codemirror/comment": "^0.19.0", + "@codemirror/highlight": "^0.19.5", + "@codemirror/history": "^0.19.0", + "@codemirror/language": "^0.19.3", + "@codemirror/lint": "^0.19.1", + "@codemirror/matchbrackets": "^0.19.1", + "@codemirror/search": "^0.19.2", + "@codemirror/state": "^0.19.2", + "@codemirror/view": "^0.19.7", "@forevolve/bootstrap-dark": "^1.0.0", "@fortawesome/fontawesome-svg-core": "^1.2.14", "@fortawesome/free-solid-svg-icons": "^5.7.1", From 1681a8d5393a8d5e3eb8f785b85f477c627e2fd1 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Sat, 25 Sep 2021 00:30:18 +0200 Subject: [PATCH 14/36] Azure: Fix panic when no computername is set (#9387) Signed-off-by: Julien Pivotto --- discovery/azure/azure.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/discovery/azure/azure.go b/discovery/azure/azure.go index 6de0995ef0..b0de0abd8c 100644 --- a/discovery/azure/azure.go +++ b/discovery/azure/azure.go @@ -464,7 +464,9 @@ func mapFromVM(vm compute.VirtualMachine) virtualMachine { } } - if vm.VirtualMachineProperties != nil && vm.VirtualMachineProperties.OsProfile != nil { + if vm.VirtualMachineProperties != nil && + vm.VirtualMachineProperties.OsProfile != nil && + vm.VirtualMachineProperties.OsProfile.ComputerName != nil { computerName = *(vm.VirtualMachineProperties.OsProfile.ComputerName) } From 0de0e1ee0efaef94c033d3aaae80c8548cdfa82b Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Sat, 25 Sep 2021 12:38:57 +0200 Subject: [PATCH 15/36] codemirror_sync: Use reset and checkout instead of restore (#9396) The git version we are using for CI is too old. Signed-off-by: Julien Pivotto --- scripts/sync_codemirror.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/sync_codemirror.sh b/scripts/sync_codemirror.sh index 9b04f9368a..82362d2cfe 100755 --- a/scripts/sync_codemirror.sh +++ b/scripts/sync_codemirror.sh @@ -107,13 +107,13 @@ process_repo() { git add . for excluded_dir in ${excluded_dirs}; do - git restore --staged "${excluded_dir}/*" - git restore "${excluded_dir}/*" + git reset -- "${excluded_dir}/*" + git checkout -- "${excluded_dir}/*" done for excluded_file in ${excluded_files}; do - git restore --staged "${excluded_file}" - git restore "${excluded_file}" + git reset -- "${excluded_file}" + git checkout -- "${excluded_file}" done if [[ -n "$(git status --porcelain)" ]]; then From 2f896c98ff81179aaea4f25a6908697df9de1e1c Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Sun, 26 Sep 2021 15:45:25 -0400 Subject: [PATCH 16/36] Address review comments Signed-off-by: Levi Harrison --- docs/querying/operators.md | 2 +- web/ui/module/codemirror-promql/src/grammar/promql.grammar | 1 - .../codemirror-promql/src/grammar/test/expression.txt | 7 +++++++ web/ui/module/codemirror-promql/src/grammar/tokens.js | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/querying/operators.md b/docs/querying/operators.md index 1f6455b7ad..88781adc25 100644 --- a/docs/querying/operators.md +++ b/docs/querying/operators.md @@ -44,7 +44,7 @@ the result. The following trigonometric binary operators, which work in radians, exist in Prometheus: -* `atan2` (https://pkg.go.dev/math#Atan2, _This is experimental_) +* `atan2` (based on https://pkg.go.dev/math#Atan2, _This is experimental_) Trigonometric operators allow trigonometric functions to be executed on two vectors using vector matching, which isn't available with normal functions. They act in the same manner diff --git a/web/ui/module/codemirror-promql/src/grammar/promql.grammar b/web/ui/module/codemirror-promql/src/grammar/promql.grammar index a086003ce8..642d25f109 100644 --- a/web/ui/module/codemirror-promql/src/grammar/promql.grammar +++ b/web/ui/module/codemirror-promql/src/grammar/promql.grammar @@ -17,7 +17,6 @@ @precedence { pow @right, mul @left - atan2 @left, add @left, eql @left, and @left, diff --git a/web/ui/module/codemirror-promql/src/grammar/test/expression.txt b/web/ui/module/codemirror-promql/src/grammar/test/expression.txt index 3e9883155b..a4dfcd9ce3 100644 --- a/web/ui/module/codemirror-promql/src/grammar/test/expression.txt +++ b/web/ui/module/codemirror-promql/src/grammar/test/expression.txt @@ -840,3 +840,10 @@ sum:my_metric_name:rate5m ==> MetricName(MetricIdentifier(Identifier)) + +# Testing Atan2 inherited precedence level + +1 + foo atan2 bar + +==> +PromQL(Expr(BinaryExpr(Expr(NumberLiteral),Add,BinModifiers,Expr(BinaryExpr(Expr(VectorSelector(MetricIdentifier(Identifier))),Atan2,BinModifiers,Expr(VectorSelector(MetricIdentifier(Identifier)))))))) \ No newline at end of file diff --git a/web/ui/module/codemirror-promql/src/grammar/tokens.js b/web/ui/module/codemirror-promql/src/grammar/tokens.js index c3353485fa..9c9c509e5b 100644 --- a/web/ui/module/codemirror-promql/src/grammar/tokens.js +++ b/web/ui/module/codemirror-promql/src/grammar/tokens.js @@ -14,6 +14,7 @@ import { And, Avg, + Atan2, Bool, Bottomk, By, @@ -58,6 +59,7 @@ export const specializeIdentifier = (value, stack) => { const contextualKeywordTokens = { avg: Avg, + atan2: Atan2, bottomk: Bottomk, count: Count, count_values: CountValues, From a16a4cad2dd7cd3f131e38312a83db96eaa2f7b6 Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Sun, 26 Sep 2021 16:35:02 -0400 Subject: [PATCH 17/36] Add example Credit goes to @leonerd for the original example Signed-off-by: Levi Harrison --- docs/querying/operators.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/docs/querying/operators.md b/docs/querying/operators.md index 88781adc25..a34574c50e 100644 --- a/docs/querying/operators.md +++ b/docs/querying/operators.md @@ -45,6 +45,36 @@ the result. The following trigonometric binary operators, which work in radians, exist in Prometheus: * `atan2` (based on https://pkg.go.dev/math#Atan2, _This is experimental_) + + A usecase of `atan2` is converting directional data between the [polar](https://en.wikipedia.org/wiki/Polar_coordinate_system) (r, theta) + and [cartesian](https://en.wikipedia.org/wiki/Cartesian_coordinate_system) (x, y) coordinate forms. + + Example: + + Take some wind speed and direction data in the polar form. To get a trend over a + longer period of time, it's not correct to just average out the direction data. + The polar data needs to be converted into the cartesian form: + + ``` + wind:northwards = windspeed * cos(rad(winddirection)) + wind:westwards = windspeed * sin(rad(winddirection)) + ``` + + Having done that, the longerterm averages over northwards and westwards now make sense: + + ``` + wind:northwards:avg1h = avg_over_time(wind:northwards[1h]) + wind:westwards:avg1h = avg_over_time(wind:westwards[1h]) + ``` + + The "average" direction can be extracted out of these again by using `atan2`: + + ``` + wind:direction:avg1h = deg(wind:northwards:avg1h atan2 wind:westwards:avg1h) + ``` + + The Wikipedia article on the circular mean has more about this calculation: + https://en.wikipedia.org/wiki/Circular_mean Trigonometric operators allow trigonometric functions to be executed on two vectors using vector matching, which isn't available with normal functions. They act in the same manner From 63b3e4e5ec580e1a2f84fc6e84be14b5cdb03c09 Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Sun, 26 Sep 2021 23:16:12 +0200 Subject: [PATCH 18/36] Enable HTTP2 again (#9398) We are re-enabling HTTP 2 again. There has been a few bugfixes upstream in go, and we have also enabled ReadIdleTimeout. Fix #7588 Fix #9068 Signed-off-by: Julien Pivotto --- discovery/consul/consul.go | 2 +- discovery/digitalocean/digitalocean.go | 2 +- discovery/eureka/eureka.go | 2 +- discovery/hetzner/hcloud.go | 2 +- discovery/hetzner/robot.go | 2 +- discovery/http/http.go | 2 +- discovery/kubernetes/kubernetes.go | 2 +- discovery/linode/linode.go | 2 +- discovery/marathon/marathon.go | 2 +- discovery/moby/docker.go | 2 +- discovery/moby/dockerswarm.go | 2 +- discovery/puppetdb/puppetdb.go | 2 +- discovery/scaleway/baremetal.go | 2 +- discovery/scaleway/instance.go | 2 +- discovery/xds/client.go | 2 +- go.mod | 2 +- go.sum | 3 ++- notifier/notifier.go | 2 +- notifier/notifier_test.go | 2 +- scrape/scrape.go | 4 ++-- scrape/target_test.go | 16 ++++++++-------- storage/remote/client.go | 4 ++-- 22 files changed, 32 insertions(+), 31 deletions(-) diff --git a/discovery/consul/consul.go b/discovery/consul/consul.go index 19dc9ecca3..16d0d26282 100644 --- a/discovery/consul/consul.go +++ b/discovery/consul/consul.go @@ -199,7 +199,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { logger = log.NewNopLogger() } - wrapper, err := config.NewClientFromConfig(conf.HTTPClientConfig, "consul_sd", config.WithHTTP2Disabled(), config.WithIdleConnTimeout(2*watchTimeout)) + wrapper, err := config.NewClientFromConfig(conf.HTTPClientConfig, "consul_sd", config.WithIdleConnTimeout(2*watchTimeout)) if err != nil { return nil, err } diff --git a/discovery/digitalocean/digitalocean.go b/discovery/digitalocean/digitalocean.go index b887ada046..10f8582ebc 100644 --- a/discovery/digitalocean/digitalocean.go +++ b/discovery/digitalocean/digitalocean.go @@ -108,7 +108,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { port: conf.Port, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "digitalocean_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "digitalocean_sd") if err != nil { return nil, err } diff --git a/discovery/eureka/eureka.go b/discovery/eureka/eureka.go index dcfc2be102..110a5d8622 100644 --- a/discovery/eureka/eureka.go +++ b/discovery/eureka/eureka.go @@ -118,7 +118,7 @@ type Discovery struct { // NewDiscovery creates a new Eureka discovery for the given role. func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "eureka_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "eureka_sd") if err != nil { return nil, err } diff --git a/discovery/hetzner/hcloud.go b/discovery/hetzner/hcloud.go index 494321fd52..35492e6a0a 100644 --- a/discovery/hetzner/hcloud.go +++ b/discovery/hetzner/hcloud.go @@ -64,7 +64,7 @@ func newHcloudDiscovery(conf *SDConfig, logger log.Logger) (*hcloudDiscovery, er port: conf.Port, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd") if err != nil { return nil, err } diff --git a/discovery/hetzner/robot.go b/discovery/hetzner/robot.go index f7079d909b..25f04502f1 100644 --- a/discovery/hetzner/robot.go +++ b/discovery/hetzner/robot.go @@ -59,7 +59,7 @@ func newRobotDiscovery(conf *SDConfig, logger log.Logger) (*robotDiscovery, erro endpoint: conf.robotEndpoint, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "hetzner_sd") if err != nil { return nil, err } diff --git a/discovery/http/http.go b/discovery/http/http.go index af2e99939f..ee3643fdb8 100644 --- a/discovery/http/http.go +++ b/discovery/http/http.go @@ -113,7 +113,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { logger = log.NewNopLogger() } - client, err := config.NewClientFromConfig(conf.HTTPClientConfig, "http", config.WithHTTP2Disabled()) + client, err := config.NewClientFromConfig(conf.HTTPClientConfig, "http") if err != nil { return nil, err } diff --git a/discovery/kubernetes/kubernetes.go b/discovery/kubernetes/kubernetes.go index 3a02922a44..a87203e4ee 100644 --- a/discovery/kubernetes/kubernetes.go +++ b/discovery/kubernetes/kubernetes.go @@ -283,7 +283,7 @@ func New(l log.Logger, conf *SDConfig) (*Discovery, error) { } level.Info(l).Log("msg", "Using pod service account via in-cluster config") } else { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "kubernetes_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "kubernetes_sd") if err != nil { return nil, err } diff --git a/discovery/linode/linode.go b/discovery/linode/linode.go index 21c8568579..fad2a74f19 100644 --- a/discovery/linode/linode.go +++ b/discovery/linode/linode.go @@ -132,7 +132,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { eventPollingEnabled: true, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "linode_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "linode_sd") if err != nil { return nil, err } diff --git a/discovery/marathon/marathon.go b/discovery/marathon/marathon.go index 586245bc42..30c32bb5d9 100644 --- a/discovery/marathon/marathon.go +++ b/discovery/marathon/marathon.go @@ -131,7 +131,7 @@ type Discovery struct { // NewDiscovery returns a new Marathon Discovery. func NewDiscovery(conf SDConfig, logger log.Logger) (*Discovery, error) { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "marathon_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "marathon_sd") if err != nil { return nil, err } diff --git a/discovery/moby/docker.go b/discovery/moby/docker.go index 98dc42acbb..deabcdd1e2 100644 --- a/discovery/moby/docker.go +++ b/discovery/moby/docker.go @@ -142,7 +142,7 @@ func NewDockerDiscovery(conf *DockerSDConfig, logger log.Logger) (*DockerDiscove // unix, which are not supported by the HTTP client. Passing HTTP client // options to the Docker client makes those non-HTTP requests fail. if hostURL.Scheme == "http" || hostURL.Scheme == "https" { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "docker_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "docker_sd") if err != nil { return nil, err } diff --git a/discovery/moby/dockerswarm.go b/discovery/moby/dockerswarm.go index a9eabfd720..371f9d5ed1 100644 --- a/discovery/moby/dockerswarm.go +++ b/discovery/moby/dockerswarm.go @@ -146,7 +146,7 @@ func NewDiscovery(conf *DockerSwarmSDConfig, logger log.Logger) (*Discovery, err // unix, which are not supported by the HTTP client. Passing HTTP client // options to the Docker client makes those non-HTTP requests fail. if hostURL.Scheme == "http" || hostURL.Scheme == "https" { - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "dockerswarm_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "dockerswarm_sd") if err != nil { return nil, err } diff --git a/discovery/puppetdb/puppetdb.go b/discovery/puppetdb/puppetdb.go index cad07b33d1..c6e93ebe9a 100644 --- a/discovery/puppetdb/puppetdb.go +++ b/discovery/puppetdb/puppetdb.go @@ -136,7 +136,7 @@ func NewDiscovery(conf *SDConfig, logger log.Logger) (*Discovery, error) { logger = log.NewNopLogger() } - client, err := config.NewClientFromConfig(conf.HTTPClientConfig, "http", config.WithHTTP2Disabled()) + client, err := config.NewClientFromConfig(conf.HTTPClientConfig, "http") if err != nil { return nil, err } diff --git a/discovery/scaleway/baremetal.go b/discovery/scaleway/baremetal.go index 066c0b6048..9e002b9878 100644 --- a/discovery/scaleway/baremetal.go +++ b/discovery/scaleway/baremetal.go @@ -70,7 +70,7 @@ func newBaremetalDiscovery(conf *SDConfig) (*baremetalDiscovery, error) { tagsFilter: conf.TagsFilter, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd") if err != nil { return nil, err } diff --git a/discovery/scaleway/instance.go b/discovery/scaleway/instance.go index 8b26031654..a78c5e93ca 100644 --- a/discovery/scaleway/instance.go +++ b/discovery/scaleway/instance.go @@ -81,7 +81,7 @@ func newInstanceDiscovery(conf *SDConfig) (*instanceDiscovery, error) { tagsFilter: conf.TagsFilter, } - rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd", config.WithHTTP2Disabled()) + rt, err := config.NewRoundTripperFromConfig(conf.HTTPClientConfig, "scaleway_sd") if err != nil { return nil, err } diff --git a/discovery/xds/client.go b/discovery/xds/client.go index cd8ffb017b..05d1ca40cd 100644 --- a/discovery/xds/client.go +++ b/discovery/xds/client.go @@ -112,7 +112,7 @@ func NewHTTPResourceClient(conf *HTTPResourceClientConfig, protocolVersion Proto endpointURL.RawQuery = conf.ExtraQueryParams.Encode() } - client, err := config.NewClientFromConfig(conf.HTTPClientConfig, conf.Name, config.WithHTTP2Disabled(), config.WithIdleConnTimeout(conf.Timeout)) + client, err := config.NewClientFromConfig(conf.HTTPClientConfig, conf.Name, config.WithIdleConnTimeout(conf.Timeout)) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index 8445c6df47..3830b553ad 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( github.com/prometheus/alertmanager v0.23.0 github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_model v0.2.0 - github.com/prometheus/common v0.30.0 + github.com/prometheus/common v0.31.0 github.com/prometheus/common/sigv4 v0.1.0 github.com/prometheus/exporter-toolkit v0.6.1 github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210223165440-c65ae3540d44 diff --git a/go.sum b/go.sum index 28dab20d83..71a26a26b7 100644 --- a/go.sum +++ b/go.sum @@ -1140,8 +1140,9 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.30.0 h1:JEkYlQnpzrzQFxi6gnukFPdQ+ac82oRhzMcIduJu/Ug= github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.31.0 h1:FTJdLTjtrh4dXlCjpzdZJXMnejSTL5F/nVQm5sNwD34= +github.com/prometheus/common v0.31.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/exporter-toolkit v0.6.1 h1:Aqk75wQD92N9CqmTlZwjKwq6272nOGrWIbc8Z7+xQO0= diff --git a/notifier/notifier.go b/notifier/notifier.go index 7af21c565c..97086d5629 100644 --- a/notifier/notifier.go +++ b/notifier/notifier.go @@ -634,7 +634,7 @@ type alertmanagerSet struct { } func newAlertmanagerSet(cfg *config.AlertmanagerConfig, logger log.Logger, metrics *alertMetrics) (*alertmanagerSet, error) { - client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, "alertmanager", config_util.WithHTTP2Disabled()) + client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, "alertmanager") if err != nil { return nil, err } diff --git a/notifier/notifier_test.go b/notifier/notifier_test.go index 0b7d8e089e..e4a7f26cdc 100644 --- a/notifier/notifier_test.go +++ b/notifier/notifier_test.go @@ -154,7 +154,7 @@ func TestHandlerSendAll(t *testing.T) { Username: "prometheus", Password: "testing_password", }, - }, "auth_alertmanager", config_util.WithHTTP2Disabled()) + }, "auth_alertmanager") h.alertmanagers = make(map[string]*alertmanagerSet) diff --git a/scrape/scrape.go b/scrape/scrape.go index 1a152323b7..f3622cf2ea 100644 --- a/scrape/scrape.go +++ b/scrape/scrape.go @@ -269,7 +269,7 @@ func newScrapePool(cfg *config.ScrapeConfig, app storage.Appendable, jitterSeed logger = log.NewNopLogger() } - client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName, config_util.WithHTTP2Disabled()) + client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName) if err != nil { targetScrapePoolsFailed.Inc() return nil, errors.Wrap(err, "error creating HTTP client") @@ -380,7 +380,7 @@ func (sp *scrapePool) reload(cfg *config.ScrapeConfig) error { targetScrapePoolReloads.Inc() start := time.Now() - client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName, config_util.WithHTTP2Disabled()) + client, err := config_util.NewClientFromConfig(cfg.HTTPClientConfig, cfg.JobName) if err != nil { targetScrapePoolReloadsFailed.Inc() return errors.Wrap(err, "error creating HTTP client") diff --git a/scrape/target_test.go b/scrape/target_test.go index d17dcc314e..a578d2760b 100644 --- a/scrape/target_test.go +++ b/scrape/target_test.go @@ -149,7 +149,7 @@ func TestNewHTTPBearerToken(t *testing.T) { cfg := config_util.HTTPClientConfig{ BearerToken: "1234", } - c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } @@ -176,7 +176,7 @@ func TestNewHTTPBearerTokenFile(t *testing.T) { cfg := config_util.HTTPClientConfig{ BearerTokenFile: "testdata/bearertoken.txt", } - c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } @@ -205,7 +205,7 @@ func TestNewHTTPBasicAuth(t *testing.T) { Password: "password123", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } @@ -233,7 +233,7 @@ func TestNewHTTPCACert(t *testing.T) { CAFile: caCertPath, }, } - c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } @@ -266,7 +266,7 @@ func TestNewHTTPClientCert(t *testing.T) { KeyFile: "testdata/client.key", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } @@ -295,7 +295,7 @@ func TestNewHTTPWithServerName(t *testing.T) { ServerName: "prometheus.rocks", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } @@ -324,7 +324,7 @@ func TestNewHTTPWithBadServerName(t *testing.T) { ServerName: "badname", }, } - c, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + c, err := config_util.NewClientFromConfig(cfg, "test") if err != nil { t.Fatal(err) } @@ -362,7 +362,7 @@ func TestNewClientWithBadTLSConfig(t *testing.T) { KeyFile: "testdata/nonexistent_client.key", }, } - _, err := config_util.NewClientFromConfig(cfg, "test", config_util.WithHTTP2Disabled()) + _, err := config_util.NewClientFromConfig(cfg, "test") if err == nil { t.Fatalf("Expected error, got nil.") } diff --git a/storage/remote/client.go b/storage/remote/client.go index 2d6c5a10ab..7539c2c92e 100644 --- a/storage/remote/client.go +++ b/storage/remote/client.go @@ -110,7 +110,7 @@ type ReadClient interface { // NewReadClient creates a new client for remote read. func NewReadClient(name string, conf *ClientConfig) (ReadClient, error) { - httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_read_client", config_util.WithHTTP2Disabled()) + httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_read_client") if err != nil { return nil, err } @@ -136,7 +136,7 @@ func NewReadClient(name string, conf *ClientConfig) (ReadClient, error) { // NewWriteClient creates a new client for remote write. func NewWriteClient(name string, conf *ClientConfig) (WriteClient, error) { - httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_write_client", config_util.WithHTTP2Disabled()) + httpClient, err := config_util.NewClientFromConfig(conf.HTTPClientConfig, "remote_storage_write_client") if err != nil { return nil, err } From dbbfd1ccf657e831d752932f4fdb4e847429780e Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Mon, 27 Sep 2021 10:17:30 +0200 Subject: [PATCH 19/36] change license in package.json file of cmp (#9399) Signed-off-by: Augustin Husson --- web/ui/module/codemirror-promql/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ui/module/codemirror-promql/package.json b/web/ui/module/codemirror-promql/package.json index bf0899ee7b..825383d019 100644 --- a/web/ui/module/codemirror-promql/package.json +++ b/web/ui/module/codemirror-promql/package.json @@ -25,7 +25,7 @@ "prometheus" ], "author": "Prometheus Authors ", - "license": "MIT", + "license": "Apache-2.0", "bugs": { "url": "https://github.com/prometheus-community/codemirror-promql/issues" }, From a7de0cf27620ba36d8b0fa422297ca33c86adb9a Mon Sep 17 00:00:00 2001 From: Levi Harrison Date: Mon, 27 Sep 2021 07:00:08 -0400 Subject: [PATCH 20/36] Remove example and experimental Signed-off-by: Levi Harrison --- docs/querying/operators.md | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/docs/querying/operators.md b/docs/querying/operators.md index a34574c50e..ae6265f6e2 100644 --- a/docs/querying/operators.md +++ b/docs/querying/operators.md @@ -44,37 +44,7 @@ the result. The following trigonometric binary operators, which work in radians, exist in Prometheus: -* `atan2` (based on https://pkg.go.dev/math#Atan2, _This is experimental_) - - A usecase of `atan2` is converting directional data between the [polar](https://en.wikipedia.org/wiki/Polar_coordinate_system) (r, theta) - and [cartesian](https://en.wikipedia.org/wiki/Cartesian_coordinate_system) (x, y) coordinate forms. - - Example: - - Take some wind speed and direction data in the polar form. To get a trend over a - longer period of time, it's not correct to just average out the direction data. - The polar data needs to be converted into the cartesian form: - - ``` - wind:northwards = windspeed * cos(rad(winddirection)) - wind:westwards = windspeed * sin(rad(winddirection)) - ``` - - Having done that, the longerterm averages over northwards and westwards now make sense: - - ``` - wind:northwards:avg1h = avg_over_time(wind:northwards[1h]) - wind:westwards:avg1h = avg_over_time(wind:westwards[1h]) - ``` - - The "average" direction can be extracted out of these again by using `atan2`: - - ``` - wind:direction:avg1h = deg(wind:northwards:avg1h atan2 wind:westwards:avg1h) - ``` - - The Wikipedia article on the circular mean has more about this calculation: - https://en.wikipedia.org/wiki/Circular_mean +* `atan2` (based on https://pkg.go.dev/math#Atan2) Trigonometric operators allow trigonometric functions to be executed on two vectors using vector matching, which isn't available with normal functions. They act in the same manner From 1fb3c1b5980d2ae3f844b6b9ae2ad38117710aa0 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Mon, 27 Sep 2021 13:03:53 +0100 Subject: [PATCH 21/36] Replace calls to strings.Compare (#9397) < is clearer and faster. As the documentation says, "Basically no one should use strings.Compare." Signed-off-by: Bryan Boreham --- storage/merge.go | 9 +++------ tsdb/index/postings.go | 5 ++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/storage/merge.go b/storage/merge.go index 1c08a537f4..bf81fcc6dd 100644 --- a/storage/merge.go +++ b/storage/merge.go @@ -18,7 +18,6 @@ import ( "container/heap" "math" "sort" - "strings" "sync" "github.com/pkg/errors" @@ -197,15 +196,13 @@ func mergeStrings(a, b []string) []string { res := make([]string, 0, maxl*10/9) for len(a) > 0 && len(b) > 0 { - d := strings.Compare(a[0], b[0]) - - if d == 0 { + if a[0] == b[0] { res = append(res, a[0]) a, b = a[1:], b[1:] - } else if d < 0 { + } else if a[0] < b[0] { res = append(res, a[0]) a = a[1:] - } else if d > 0 { + } else { res = append(res, b[0]) b = b[1:] } diff --git a/tsdb/index/postings.go b/tsdb/index/postings.go index c63cff7136..6c493be1df 100644 --- a/tsdb/index/postings.go +++ b/tsdb/index/postings.go @@ -18,7 +18,6 @@ import ( "encoding/binary" "runtime" "sort" - "strings" "sync" "github.com/prometheus/prometheus/pkg/labels" @@ -94,8 +93,8 @@ func (p *MemPostings) SortedKeys() []labels.Label { p.mtx.RUnlock() sort.Slice(keys, func(i, j int) bool { - if d := strings.Compare(keys[i].Name, keys[j].Name); d != 0 { - return d < 0 + if keys[i].Name != keys[j].Name { + return keys[i].Name < keys[j].Name } return keys[i].Value < keys[j].Value }) From eca9546ba49e0d639e1a42f6134494d2a7442996 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Mon, 27 Sep 2021 18:58:41 +0200 Subject: [PATCH 22/36] fix package-lock.json (#9400) Signed-off-by: Augustin Husson --- web/ui/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/ui/package-lock.json b/web/ui/package-lock.json index a64d4a457d..b14cf08235 100644 --- a/web/ui/package-lock.json +++ b/web/ui/package-lock.json @@ -15,7 +15,7 @@ }, "module/codemirror-promql": { "version": "0.18.0", - "license": "MIT", + "license": "Apache-2.0", "dependencies": { "lru-cache": "^6.0.0" }, From 160fc4144151d7f77d3395cfc860d3a7b5551957 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Thu, 16 Sep 2021 13:19:11 +0200 Subject: [PATCH 23/36] add gitpod dockerfile to upgrade node and npm version Signed-off-by: Augustin Husson --- .gitpod.Dockerfile | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitpod.Dockerfile diff --git a/.gitpod.Dockerfile b/.gitpod.Dockerfile new file mode 100644 index 0000000000..22df08f68f --- /dev/null +++ b/.gitpod.Dockerfile @@ -0,0 +1,7 @@ +FROM gitpod/workspace-full + +ENV CUSTOM_NODE_VERSION=16 + +RUN bash -c ". .nvm/nvm.sh && nvm install ${CUSTOM_NODE_VERSION} && nvm use ${CUSTOM_NODE_VERSION} && nvm alias default ${CUSTOM_NODE_VERSION}" + +RUN echo "nvm use default &>/dev/null" >> ~/.bashrc.d/51-nvm-fix From 722eb4bd640f150685c73232bb6320fae407cec2 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Thu, 16 Sep 2021 13:19:54 +0200 Subject: [PATCH 24/36] fix gitpod by using custome dockerfile and accurate npm ui path Signed-off-by: Augustin Husson --- .gitpod.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitpod.yml b/.gitpod.yml index 6dbc6c2068..bb38f6d2c4 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -1,4 +1,5 @@ ---- +image: + file: .gitpod.Dockerfile tasks: - init: make build @@ -6,7 +7,7 @@ tasks: gp sync-done build ./prometheus --config.file=documentation/examples/prometheus.yml - command: | - cd web/ui/react-app + cd web/ui/ gp sync-await build unset BROWSER export DANGEROUSLY_DISABLE_HOST_CHECK=true From 149e36921b9246792a5114b3e36b486227c8e439 Mon Sep 17 00:00:00 2001 From: Augustin Husson Date: Tue, 28 Sep 2021 09:19:04 +0200 Subject: [PATCH 25/36] assess in readme that codemirror-promql is in prometheus/prometheus (#9388) * assess in readme that codemirror is in prometheus/prometheus Signed-off-by: Augustin Husson * fix wording Signed-off-by: Augustin Husson * remove preview Signed-off-by: Augustin Husson --- web/ui/module/codemirror-promql/README.md | 27 +++++++++-------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/web/ui/module/codemirror-promql/README.md b/web/ui/module/codemirror-promql/README.md index b717b2d149..bbc051893f 100644 --- a/web/ui/module/codemirror-promql/README.md +++ b/web/ui/module/codemirror-promql/README.md @@ -1,6 +1,6 @@ CodeMirror-promql ================= -[![CircleCI](https://circleci.com/gh/prometheus-community/codemirror-promql.svg?style=shield)](https://circleci.com/gh/prometheus-community/codemirror-promql) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) +[![CircleCI](https://circleci.com/gh/prometheus-community/codemirror-promql.svg?style=shield)](https://circleci.com/gh/prometheus-community/codemirror-promql) [![GitHub license](https://img.shields.io/badge/license-Apache-blue.svg)](./LICENSE) [![NPM version](https://img.shields.io/npm/v/codemirror-promql.svg)](https://www.npmjs.org/package/codemirror-promql) [![codecov](https://codecov.io/gh/prometheus-community/codemirror-promql/branch/master/graph/badge.svg?token=1OSVPBDKZC)](https://codecov.io/gh/prometheus-community/codemirror-promql) ## Overview @@ -8,6 +8,14 @@ CodeMirror-promql This project provides a mode for [CodeMirror Next](https://codemirror.net/6) that handles syntax highlighting, linting and autocompletion for PromQL ([Prometheus Query Language](https://prometheus.io/docs/introduction/overview/)). +![preview](https://user-images.githubusercontent.com/4548045/95660829-d5e4b680-0b2a-11eb-9ecb-41dca6396273.gif) + +## Where does it come from? + +The authoritative copy of this code lives in `prometheus/prometheus` and is synced to +`prometheus-community/codemirror-promql` on a regular basis by a bot. Please contribute any code changes to the code +in https://github.com/prometheus/prometheus/tree/main/web/ui/module/codemirror-promql. + ### Installation This mode is available as a npm package: @@ -38,15 +46,6 @@ npm install --save @codemirror/autocomplete @codemirror/highlight @codemirror/la npm install --save @codemirror/basic-setup ``` -### Playground - -[Here](https://codemirror-promql.netlify.app/) you have a playground available that is deployed from the latest commit -available on the `master` branch. - -Here is a short preview of it looks like currently: - -![preview](https://user-images.githubusercontent.com/4548045/95660829-d5e4b680-0b2a-11eb-9ecb-41dca6396273.gif) - ## Usage As the setup of the PromQL language can a bit tricky in CMN, this lib provides a class `PromQLExtension` @@ -245,12 +244,6 @@ Note: In case this parameter is provided, then the rest of the configuration is * [ReactJS example](https://github.com/prometheus/prometheus/blob/431ea75a11ca165dad9dd5d629b3cf975f4c186b/web/ui/react-app/src/pages/graph/CMExpressionInput.tsx) * [Angular example](https://github.com/perses/perses/blob/28b3bdac88b0ed7a4602f9c91106442eafcb6c34/internal/api/front/perses/src/app/project/prometheusrule/promql-editor/promql-editor.component.ts) -## Contributions - -Any contribution or suggestion would be really appreciated. Feel free -to [file an issue](https://github.com/prometheus-community/codemirror-promql/issues) -or [send a pull request](https://github.com/prometheus-community/codemirror-promql/pulls). - ## License -[MIT](./LICENSE) +Apache License 2.0, see [LICENSE](https://github.com/prometheus-community/codemirror-promql/blob/master/LICENSE). From 168012f2bdea81fd13819a897fa4689fd31f0056 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Tue, 28 Sep 2021 13:08:02 +0530 Subject: [PATCH 26/36] Upgrade prometheus/common to v0.30.1 (#9408) Signed-off-by: Ganesh Vernekar --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index fa042efafb..aad378d9e6 100644 --- a/go.mod +++ b/go.mod @@ -46,7 +46,7 @@ require ( github.com/prometheus/alertmanager v0.23.0 github.com/prometheus/client_golang v1.11.0 github.com/prometheus/client_model v0.2.0 - github.com/prometheus/common v0.30.0 + github.com/prometheus/common v0.30.1 github.com/prometheus/common/sigv4 v0.1.0 github.com/prometheus/exporter-toolkit v0.6.1 github.com/scaleway/scaleway-sdk-go v1.0.0-beta.7.0.20210223165440-c65ae3540d44 diff --git a/go.sum b/go.sum index 109a86af92..5765ae34cf 100644 --- a/go.sum +++ b/go.sum @@ -1139,8 +1139,9 @@ github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8b github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= github.com/prometheus/common v0.29.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.30.0 h1:JEkYlQnpzrzQFxi6gnukFPdQ+ac82oRhzMcIduJu/Ug= github.com/prometheus/common v0.30.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= +github.com/prometheus/common v0.30.1 h1:MKLrb1ClCc+Yjs6xdw/FW0AMRLNiNgi2ByUZxgeG/wo= +github.com/prometheus/common v0.30.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= github.com/prometheus/common/sigv4 v0.1.0 h1:qoVebwtwwEhS85Czm2dSROY5fTo2PAPEVdDeppTwGX4= github.com/prometheus/common/sigv4 v0.1.0/go.mod h1:2Jkxxk9yYvCkE5G1sQT7GuEXm57JrvHu9k5YwTjsNtI= github.com/prometheus/exporter-toolkit v0.6.1 h1:Aqk75wQD92N9CqmTlZwjKwq6272nOGrWIbc8Z7+xQO0= From fafb309d4027b050c917362d7d2680c5ad6f6e9e Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Tue, 28 Sep 2021 14:24:43 +0530 Subject: [PATCH 27/36] Cut v2.30.1 (#9402) * backfill: Do not align the start of the group since we align every rule. Signed-off-by: Julien Pivotto * Backfill: Do not query after --end (#9340) Signed-off-by: Julien Pivotto * Redact remote write URL when used for metric label (#9383) Redact any basic auth passwords in the remote write URL (which are technically allowed although not recommended) when used as metric labels. Signed-off-by: Nick Pillitteri * Azure: Fix panic when no computername is set (#9387) Signed-off-by: Julien Pivotto * Cut v2.30.1 Signed-off-by: Ganesh Vernekar Co-authored-by: Julien Pivotto Co-authored-by: Nick Pillitteri <56quarters@users.noreply.github.com> --- CHANGELOG.md | 8 ++++++++ VERSION | 2 +- cmd/promtool/rules.go | 9 ++++++--- discovery/azure/azure.go | 4 +++- storage/remote/write.go | 5 ++++- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0089027e40..d65c6bd99a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 2.30.1 / 2021-09-28 + +* [ENHANCEMENT] Remote Write: Redact remote write URL when used for metric label. #9383 +* [ENHANCEMENT] UI: Redact remote write URL and proxy URL passwords in the `/config` page. #9408 +* [BUGFIX] promtool rules backfill: Prevent creation of data before the start time. #9339 +* [BUGFIX] promtool rules backfill: Do not query after the end time. #9340 +* [BUGFIX] Azure SD: Fix panic when no computername is set. #9387 + ## 2.30.0 / 2021-09-14 * [FEATURE] **experimental** TSDB: Snapshot in-memory chunks on shutdown for faster restarts. Behind `--enable-feature=memory-snapshot-on-shutdown` flag. #7229 diff --git a/VERSION b/VERSION index 6a6900382e..bcec02eeb9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.30.0 +2.30.1 diff --git a/cmd/promtool/rules.go b/cmd/promtool/rules.go index 96e21a9f41..7140d8aa9b 100644 --- a/cmd/promtool/rules.go +++ b/cmd/promtool/rules.go @@ -81,10 +81,9 @@ func (importer *ruleImporter) importAll(ctx context.Context) (errs []error) { for name, group := range importer.groups { level.Info(importer.logger).Log("backfiller", "processing group", "name", name) - stimeWithAlignment := group.EvalTimestamp(importer.config.start.UnixNano()) for i, r := range group.Rules() { level.Info(importer.logger).Log("backfiller", "processing rule", "id", i, "name", r.Name()) - if err := importer.importRule(ctx, r.Query().String(), r.Name(), r.Labels(), stimeWithAlignment, importer.config.end, group); err != nil { + if err := importer.importRule(ctx, r.Query().String(), r.Name(), r.Labels(), importer.config.start, importer.config.end, group); err != nil { errs = append(errs, err) } } @@ -106,11 +105,15 @@ func (importer *ruleImporter) importRule(ctx context.Context, ruleExpr, ruleName for startWithAlignment.Unix() < currStart { startWithAlignment = startWithAlignment.Add(grp.Interval()) } + end := time.Unix(min(endOfBlock/int64(time.Second/time.Millisecond), end.Unix()), 0).UTC() + if end.Before(startWithAlignment) { + break + } val, warnings, err := importer.apiClient.QueryRange(ctx, ruleExpr, v1.Range{ Start: startWithAlignment, - End: time.Unix(min(endOfBlock/int64(time.Second/time.Millisecond), end.Unix()), 0).UTC(), + End: end, Step: grp.Interval(), }, ) diff --git a/discovery/azure/azure.go b/discovery/azure/azure.go index 6de0995ef0..b0de0abd8c 100644 --- a/discovery/azure/azure.go +++ b/discovery/azure/azure.go @@ -464,7 +464,9 @@ func mapFromVM(vm compute.VirtualMachine) virtualMachine { } } - if vm.VirtualMachineProperties != nil && vm.VirtualMachineProperties.OsProfile != nil { + if vm.VirtualMachineProperties != nil && + vm.VirtualMachineProperties.OsProfile != nil && + vm.VirtualMachineProperties.OsProfile.ComputerName != nil { computerName = *(vm.VirtualMachineProperties.OsProfile.ComputerName) } diff --git a/storage/remote/write.go b/storage/remote/write.go index 2d96f70ae2..b3fec364a7 100644 --- a/storage/remote/write.go +++ b/storage/remote/write.go @@ -158,7 +158,10 @@ func (rws *WriteStorage) ApplyConfig(conf *config.Config) error { continue } - endpoint := rwConf.URL.String() + // Redacted to remove any passwords in the URL (that are + // technically accepted but not recommended) since this is + // only used for metric labels. + endpoint := rwConf.URL.Redacted() newQueues[hash] = NewQueueManager( newQueueManagerMetrics(rws.reg, name, endpoint), rws.watcherMetrics, From e5b1b15dc3ad11c18de97e600fd5fb84ca69076b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20R=C3=BCger?= Date: Thu, 30 Sep 2021 11:13:44 +0200 Subject: [PATCH 28/36] Dockerfile: Optimize and consolidate steps (#9180) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Moving up workdir will make mkdir call redundant * Consolidate into a single RUN instruction * Prefix etc/prometheus with a slash (it only worked because WORKDIR was / ) Signed-off-by: Manuel Rüger --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 838bf1834a..b47f77dcd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,14 +14,13 @@ COPY LICENSE /LICENSE COPY NOTICE /NOTICE COPY npm_licenses.tar.bz2 /npm_licenses.tar.bz2 -RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ -RUN mkdir -p /prometheus && \ - chown -R nobody:nobody etc/prometheus /prometheus +WORKDIR /prometheus +RUN ln -s /usr/share/prometheus/console_libraries /usr/share/prometheus/consoles/ /etc/prometheus/ && \ + chown -R nobody:nobody /etc/prometheus /prometheus USER nobody EXPOSE 9090 VOLUME [ "/prometheus" ] -WORKDIR /prometheus ENTRYPOINT [ "/bin/prometheus" ] CMD [ "--config.file=/etc/prometheus/prometheus.yml", \ "--storage.tsdb.path=/prometheus", \ From 8c597e5166d7ed670ededb5181952c3d200ca1e1 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Fri, 1 Oct 2021 14:34:12 +0530 Subject: [PATCH 29/36] Don't error on overlapping m-mapped chunks during WAL replay (#9381) Signed-off-by: Ganesh Vernekar --- tsdb/head_wal.go | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/tsdb/head_wal.go b/tsdb/head_wal.go index 6a647dd852..85b076ca6b 100644 --- a/tsdb/head_wal.go +++ b/tsdb/head_wal.go @@ -241,8 +241,6 @@ Outer: } // Checking if the new m-mapped chunks overlap with the already existing ones. - // This should never happen, but we have a check anyway to detect any - // edge cases that we might have missed. if len(mSeries.mmappedChunks) > 0 && len(mmc) > 0 { if overlapsClosedInterval( mSeries.mmappedChunks[0].minTime, @@ -250,9 +248,16 @@ Outer: mmc[0].minTime, mmc[len(mmc)-1].maxTime, ) { - // The m-map chunks for the new series ref overlaps with old m-map chunks. - seriesCreationErr = errors.Errorf("overlapping m-mapped chunks for series %s", mSeries.lset.String()) - break Outer + level.Warn(h.logger).Log( + "msg", "M-mapped chunks overlap on a duplicate series record", + "series", mSeries.lset.String(), + "oldref", mSeries.ref, + "oldmint", mSeries.mmappedChunks[0].minTime, + "oldmaxt", mSeries.mmappedChunks[len(mSeries.mmappedChunks)-1].maxTime, + "newref", walSeries.Ref, + "newmint", mmc[0].minTime, + "newmaxt", mmc[len(mmc)-1].maxTime, + ) } } From a7d499e19a932f4f7cf14e8b8c935dd43d2a9830 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Fri, 1 Oct 2021 15:33:29 +0530 Subject: [PATCH 30/36] Reduce log level during WAL replay on overlapping m-map chunks (#9425) Signed-off-by: Ganesh Vernekar --- tsdb/head_wal.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tsdb/head_wal.go b/tsdb/head_wal.go index 85b076ca6b..ba98c2e467 100644 --- a/tsdb/head_wal.go +++ b/tsdb/head_wal.go @@ -46,6 +46,8 @@ func (h *Head) loadWAL(r *wal.Reader, multiRef map[uint64]uint64, mmappedChunks // for error reporting. var unknownRefs atomic.Uint64 var unknownExemplarRefs atomic.Uint64 + // Track number of series records that had overlapping m-map chunks. + var mmapOverlappingChunks uint64 // Start workers that each process samples for a partition of the series ID space. // They are connected through a ring of channels which ensures that all sample batches @@ -248,7 +250,8 @@ Outer: mmc[0].minTime, mmc[len(mmc)-1].maxTime, ) { - level.Warn(h.logger).Log( + mmapOverlappingChunks++ + level.Debug(h.logger).Log( "msg", "M-mapped chunks overlap on a duplicate series record", "series", mSeries.lset.String(), "oldref", mSeries.ref, @@ -356,6 +359,9 @@ Outer: if unknownRefs.Load() > 0 || unknownExemplarRefs.Load() > 0 { level.Warn(h.logger).Log("msg", "Unknown series references", "samples", unknownRefs.Load(), "exemplars", unknownExemplarRefs.Load()) } + if mmapOverlappingChunks > 0 { + level.Info(h.logger).Log("msg", "Overlapping m-map chunks on duplicate series records", "count", mmapOverlappingChunks) + } return nil } From b30db03f35651888e34ac101a06e25d27d15b476 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Fri, 1 Oct 2021 17:00:22 +0530 Subject: [PATCH 31/36] Cut v2.30.2 (#9426) * Don't error on overlapping m-mapped chunks during WAL replay (#9381) Signed-off-by: Ganesh Vernekar * Reduce log level during WAL replay on overlapping m-map chunks (#9425) Signed-off-by: Ganesh Vernekar * Cut v2.30.2 Signed-off-by: Ganesh Vernekar --- CHANGELOG.md | 4 ++++ VERSION | 2 +- tsdb/head_wal.go | 21 ++++++++++++++++----- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d65c6bd99a..a226f51882 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 2.30.2 / 2021-10-01 + +* [BUGFIX] TSDB: Don't error on overlapping m-mapped chunks during WAL replay. #9381 + ## 2.30.1 / 2021-09-28 * [ENHANCEMENT] Remote Write: Redact remote write URL when used for metric label. #9383 diff --git a/VERSION b/VERSION index bcec02eeb9..0958964f67 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.30.1 +2.30.2 diff --git a/tsdb/head_wal.go b/tsdb/head_wal.go index 6a647dd852..ba98c2e467 100644 --- a/tsdb/head_wal.go +++ b/tsdb/head_wal.go @@ -46,6 +46,8 @@ func (h *Head) loadWAL(r *wal.Reader, multiRef map[uint64]uint64, mmappedChunks // for error reporting. var unknownRefs atomic.Uint64 var unknownExemplarRefs atomic.Uint64 + // Track number of series records that had overlapping m-map chunks. + var mmapOverlappingChunks uint64 // Start workers that each process samples for a partition of the series ID space. // They are connected through a ring of channels which ensures that all sample batches @@ -241,8 +243,6 @@ Outer: } // Checking if the new m-mapped chunks overlap with the already existing ones. - // This should never happen, but we have a check anyway to detect any - // edge cases that we might have missed. if len(mSeries.mmappedChunks) > 0 && len(mmc) > 0 { if overlapsClosedInterval( mSeries.mmappedChunks[0].minTime, @@ -250,9 +250,17 @@ Outer: mmc[0].minTime, mmc[len(mmc)-1].maxTime, ) { - // The m-map chunks for the new series ref overlaps with old m-map chunks. - seriesCreationErr = errors.Errorf("overlapping m-mapped chunks for series %s", mSeries.lset.String()) - break Outer + mmapOverlappingChunks++ + level.Debug(h.logger).Log( + "msg", "M-mapped chunks overlap on a duplicate series record", + "series", mSeries.lset.String(), + "oldref", mSeries.ref, + "oldmint", mSeries.mmappedChunks[0].minTime, + "oldmaxt", mSeries.mmappedChunks[len(mSeries.mmappedChunks)-1].maxTime, + "newref", walSeries.Ref, + "newmint", mmc[0].minTime, + "newmaxt", mmc[len(mmc)-1].maxTime, + ) } } @@ -351,6 +359,9 @@ Outer: if unknownRefs.Load() > 0 || unknownExemplarRefs.Load() > 0 { level.Warn(h.logger).Log("msg", "Unknown series references", "samples", unknownRefs.Load(), "exemplars", unknownExemplarRefs.Load()) } + if mmapOverlappingChunks > 0 { + level.Info(h.logger).Log("msg", "Overlapping m-map chunks on duplicate series records", "count", mmapOverlappingChunks) + } return nil } From a069e7ec803e8cf61466e1db1ad4db21c69ab8ca Mon Sep 17 00:00:00 2001 From: Ivana Huckova <30407135+ivanahuckova@users.noreply.github.com> Date: Sun, 3 Oct 2021 12:22:47 +0200 Subject: [PATCH 32/36] Update api.md (#9429) Fix timestamp in example in exemplars query. The year was `020` instead of `2020`. Signed-off-by: Ivana --- docs/querying/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/querying/api.md b/docs/querying/api.md index 7d25c05181..6fa21cc7d6 100644 --- a/docs/querying/api.md +++ b/docs/querying/api.md @@ -361,7 +361,7 @@ URL query parameters: - `end=`: End timestamp. ```json -$ curl -g 'http://localhost:9090/api/v1/query_exemplars?query=test_exemplar_metric_total&start=2020-09-14T15:22:25.479Z&end=020-09-14T15:23:25.479Z' +$ curl -g 'http://localhost:9090/api/v1/query_exemplars?query=test_exemplar_metric_total&start=2020-09-14T15:22:25.479Z&end=2020-09-14T15:23:25.479Z' { "status": "success", "data": [ From 1270b87970baeb926fcce64552db5c744ffaf83f Mon Sep 17 00:00:00 2001 From: Mayursinh Sarvaiya Date: Sun, 3 Oct 2021 18:35:16 +0530 Subject: [PATCH 33/36] chore(ui): debounce effect in timerange query (#9359) * chore(ui): debounce effect in timerange query Signed-off-by: mayursiinh * chore: private declaration of debounceExecuteQuery Signed-off-by: mayursiinh * fix: lint issue Signed-off-by: mayursiinh --- .../react-app/src/pages/graph/Panel.test.tsx | 3 ++- web/ui/react-app/src/pages/graph/Panel.tsx | 18 +++++++++++------- web/ui/react-app/src/utils/index.ts | 13 +++++++++++++ 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/web/ui/react-app/src/pages/graph/Panel.test.tsx b/web/ui/react-app/src/pages/graph/Panel.test.tsx index e3d2bfb115..2d702b6fbf 100644 --- a/web/ui/react-app/src/pages/graph/Panel.test.tsx +++ b/web/ui/react-app/src/pages/graph/Panel.test.tsx @@ -151,9 +151,10 @@ describe('Panel', () => { //change query without executing panel.setProps({ options: { ...defaultProps.options, expr: newExpr } }); expect(executeQuerySpy).toHaveBeenCalledTimes(0); + const debounceExecuteQuerySpy = jest.spyOn(instance, 'debounceExecuteQuery'); //execute query implicitly with time change panel.setProps({ options: { ...defaultProps.options, expr: newExpr, endTime: 1575744840 } }); - expect(executeQuerySpy).toHaveBeenCalledTimes(1); + expect(debounceExecuteQuerySpy).toHaveBeenCalledTimes(1); }); }); }); diff --git a/web/ui/react-app/src/pages/graph/Panel.tsx b/web/ui/react-app/src/pages/graph/Panel.tsx index a7de9f3421..1dca06ad04 100644 --- a/web/ui/react-app/src/pages/graph/Panel.tsx +++ b/web/ui/react-app/src/pages/graph/Panel.tsx @@ -13,6 +13,7 @@ import TimeInput from './TimeInput'; import QueryStatsView, { QueryStats } from './QueryStatsView'; import { QueryParams, ExemplarData } from '../../types/types'; import { API_PATH } from '../../constants/constants'; +import { debounce } from '../../utils'; interface PanelProps { options: PanelOptions; @@ -69,6 +70,7 @@ export const PanelDefaultOptions: PanelOptions = { class Panel extends Component { private abortInFlightFetch: (() => void) | null = null; + private debounceExecuteQuery: () => void; constructor(props: PanelProps) { super(props); @@ -83,17 +85,19 @@ class Panel extends Component { stats: null, exprInputValue: props.options.expr, }; + + this.debounceExecuteQuery = debounce(this.executeQuery.bind(this), 250); } componentDidUpdate({ options: prevOpts }: PanelProps): void { const { endTime, range, resolution, showExemplars, type } = this.props.options; - if ( - prevOpts.endTime !== endTime || - prevOpts.range !== range || - prevOpts.resolution !== resolution || - prevOpts.type !== type || - showExemplars !== prevOpts.showExemplars - ) { + + if (prevOpts.endTime !== endTime || prevOpts.range !== range) { + this.debounceExecuteQuery(); + return; + } + + if (prevOpts.resolution !== resolution || prevOpts.type !== type || showExemplars !== prevOpts.showExemplars) { this.executeQuery(); } } diff --git a/web/ui/react-app/src/utils/index.ts b/web/ui/react-app/src/utils/index.ts index b01ce840ec..ca714970f5 100644 --- a/web/ui/react-app/src/utils/index.ts +++ b/web/ui/react-app/src/utils/index.ts @@ -269,3 +269,16 @@ export const parsePrometheusFloat = (value: string): string | number => { return Number(value); } }; + +export function debounce( + func: (...args: Params) => unknown, + timeout: number +): (...args: Params) => void { + let timer: NodeJS.Timeout; + return (...args: Params) => { + clearTimeout(timer); + timer = setTimeout(() => { + func(...args); + }, timeout); + }; +} From 6d3a4ed71163cbdf269c11d84a40e562d8a946c6 Mon Sep 17 00:00:00 2001 From: la3mmchen Date: Sun, 3 Oct 2021 21:30:39 +0200 Subject: [PATCH 34/36] fix/9269 add documentation for endpointslice This commits add a documentation for the kubernetes_sd_configs: endpointslice feature. Signed-off-by: la3mmchen --- docs/configuration/configuration.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/docs/configuration/configuration.md b/docs/configuration/configuration.md index 9884a61aed..4e25521109 100644 --- a/docs/configuration/configuration.md +++ b/docs/configuration/configuration.md @@ -1546,6 +1546,29 @@ Available meta labels: * If the endpoints belong to a service, all labels of the `role: service` discovery are attached. * For all targets backed by a pod, all labels of the `role: pod` discovery are attached. +#### `endpointslice` + +The `endpointslice` role discovers targets from existing endpointslices. For each endpoint +address referenced in the endpointslice object one target is discovered. If the endpoint is backed by a pod, all +additional container ports of the pod, not bound to an endpoint port, are discovered as targets as well. + +Available meta labels: +* `__meta_kubernetes_namespace`: The namespace of the endpoints object. +* `__meta_kubernetes_endpointslice_name`: The name of endpointslice object. +* For all targets discovered directly from the endpointslice list (those not additionally inferred + from underlying pods), the following labels are attached: +* `__meta_kubernetes_endpointslice_address_target_kind`: Kind of the referenced object. +* `__meta_kubernetes_endpointslice_address_target_name`: Name of referenced object. +* `__meta_kubernetes_endpointslice_address_type`: The ip protocol family of the adress target. +* `__meta_kubernetes_endpointslice_endpoint_conditions_ready`: Set to `true` or `false` for the referenced endpoint's ready state. +* `__meta_kubernetes_endpointslice_endpoint_topology_kubernetes_io_hostname`: Name of the node hosting the referenced endpoint. +* `__meta_kubernetes_endpointslice_endpoint_topology_present_kubernetes_io_hostname`: Flag that shows if the referenced object has a kubernetes.io/hostname annotation. +* `__meta_kubernetes_endpointslice_port`: Port of the referenced endpoint. +* `__meta_kubernetes_endpointslice_port_name`: Named port of the referenced endpoint. +* `__meta_kubernetes_endpointslice_port_protocol`: Protocol of the referenced endpoint. +* If the endpoints belong to a service, all labels of the `role: service` discovery are attached. +* For all targets backed by a pod, all labels of the `role: pod` discovery are attached. + #### `ingress` The `ingress` role discovers a target for each path of each ingress. @@ -1579,7 +1602,7 @@ See below for the configuration options for Kubernetes discovery: # One of endpoints, service, pod, node, or ingress. role: -# Optional path to a kubeconfig file. +# Optional path to a kubeconfig file. # Note that api_server and kube_config are mutually exclusive. [ kubeconfig_file: ] @@ -1658,7 +1681,7 @@ inside a Prometheus-enabled mesh. The following meta labels are available for each target: -* `__meta_kuma_mesh`: the name of the proxy's Mesh +* `__meta_kuma_mesh`: the name of the proxy's Mesh * `__meta_kuma_dataplane`: the name of the proxy * `__meta_kuma_service`: the name of the proxy's associated Service * `__meta_kuma_label_`: each tag of the proxy From 10bc6e80eeedaafc732826acf002e024e2a0094f Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Tue, 5 Oct 2021 10:51:25 +0530 Subject: [PATCH 35/36] Fix panic on failed snapshot replay and don't hard fail replay on disabled exemplars (#9438) Signed-off-by: Ganesh Vernekar --- tsdb/head.go | 15 ++++++++++++++- tsdb/head_test.go | 13 ++++++++++++- tsdb/head_wal.go | 7 ++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tsdb/head.go b/tsdb/head.go index ec0916bba9..72387236dd 100644 --- a/tsdb/head.go +++ b/tsdb/head.go @@ -176,6 +176,10 @@ func NewHead(r prometheus.Registerer, l log.Logger, wal *wal.WAL, opts *HeadOpti stats = NewHeadStats() } + if !opts.EnableExemplarStorage { + opts.MaxExemplars.Store(0) + } + h := &Head{ wal: wal, logger: l, @@ -211,7 +215,16 @@ func NewHead(r prometheus.Registerer, l log.Logger, wal *wal.WAL, opts *HeadOpti func (h *Head) resetInMemoryState() error { var err error - em := NewExemplarMetrics(h.reg) + var em *ExemplarMetrics + if h.exemplars != nil { + ce, ok := h.exemplars.(*CircularExemplarStorage) + if ok { + em = ce.metrics + } + } + if em == nil { + em = NewExemplarMetrics(h.reg) + } es, err := NewCircularExemplarStorage(h.opts.MaxExemplars.Load(), em) if err != nil { return err diff --git a/tsdb/head_test.go b/tsdb/head_test.go index 7d4b63843a..e404e94f60 100644 --- a/tsdb/head_test.go +++ b/tsdb/head_test.go @@ -31,6 +31,7 @@ import ( "time" "github.com/pkg/errors" + "github.com/prometheus/client_golang/prometheus" prom_testutil "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/require" "go.uber.org/atomic" @@ -2753,7 +2754,16 @@ func TestChunkSnapshot(t *testing.T) { // Test the replay of snapshot. head.opts.EnableMemorySnapshotOnShutdown = true // Enabled to read from snapshot. + + // Disabling exemplars to check that it does not hard fail replay + // https://github.com/prometheus/prometheus/issues/9437#issuecomment-933285870. + head.opts.EnableExemplarStorage = false + head.opts.MaxExemplars.Store(0) + expExemplars = expExemplars[:0] + openHeadAndCheckReplay() + + require.Equal(t, 0.0, prom_testutil.ToFloat64(head.metrics.snapshotReplayErrorTotal)) } } @@ -2805,7 +2815,8 @@ func TestSnapshotError(t *testing.T) { // Create new Head which should replay this snapshot. w, err := wal.NewSize(nil, nil, head.wal.Dir(), 32768, false) require.NoError(t, err) - head, err = NewHead(nil, nil, w, head.opts, nil) + // Testing https://github.com/prometheus/prometheus/issues/9437 with the registry. + head, err = NewHead(prometheus.NewRegistry(), nil, w, head.opts, nil) require.NoError(t, err) require.NoError(t, head.Init(math.MinInt64)) diff --git a/tsdb/head_wal.go b/tsdb/head_wal.go index ba98c2e467..4788298240 100644 --- a/tsdb/head_wal.go +++ b/tsdb/head_wal.go @@ -948,6 +948,11 @@ Outer: } } + if !h.opts.EnableExemplarStorage || h.opts.MaxExemplars.Load() <= 0 { + // Exemplar storage is disabled. + continue Outer + } + decbuf := encoding.Decbuf{B: rec[1:]} exemplarBuf = exemplarBuf[:0] @@ -969,7 +974,7 @@ Outer: Value: e.V, Ts: e.T, }); err != nil { - loopErr = errors.Wrap(err, "append exemplar") + loopErr = errors.Wrap(err, "add exemplar") break Outer } } From f29caccc42557f6a8ec30ea9b3c8c089391bd5df Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar <15064823+codesome@users.noreply.github.com> Date: Tue, 5 Oct 2021 20:31:30 +0530 Subject: [PATCH 36/36] Cut v2.30.3 (#9446) Signed-off-by: Ganesh Vernekar --- CHANGELOG.md | 5 +++++ VERSION | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a226f51882..00919b0572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 2.30.3 / 2021-10-05 + +* [BUGFIX] TSDB: Fix panic on failed snapshot replay. #9438 +* [BUGFIX] TSDB: Don't fail snapshot replay with exemplar storage disabled when the snapshot contains exemplars. #9438 + ## 2.30.2 / 2021-10-01 * [BUGFIX] TSDB: Don't error on overlapping m-mapped chunks during WAL replay. #9381 diff --git a/VERSION b/VERSION index 0958964f67..e88ba89bab 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.30.2 +2.30.3