From 83846b57386cce5e783b69c7938ac771e12df483 Mon Sep 17 00:00:00 2001 From: xander Date: Wed, 6 Aug 2025 15:28:48 +0100 Subject: [PATCH 01/11] chore: update fsnotify Signed-off-by: xander --- go.mod | 5 +---- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index e993819936..49f5487afd 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/envoyproxy/go-control-plane/envoy v1.32.4 github.com/envoyproxy/protoc-gen-validate v1.2.1 github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb - github.com/fsnotify/fsnotify v1.8.0 + github.com/fsnotify/fsnotify v1.9.0 github.com/go-openapi/strfmt v0.23.0 github.com/go-zookeeper/zk v1.0.4 github.com/gogo/protobuf v1.3.2 @@ -246,6 +246,3 @@ exclude ( github.com/grpc-ecosystem/grpc-gateway v1.14.7 google.golang.org/api v0.30.0 ) - -// Pin until https://github.com/fsnotify/fsnotify/issues/656 is resolved. -replace github.com/fsnotify/fsnotify v1.8.0 => github.com/fsnotify/fsnotify v1.7.0 diff --git a/go.sum b/go.sum index 14a9b22ff1..d61c5e9416 100644 --- a/go.sum +++ b/go.sum @@ -139,8 +139,8 @@ github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= -github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= From 8e48f43e0662e54c2c3cfb712502fe43486c353b Mon Sep 17 00:00:00 2001 From: cuiweixie Date: Thu, 21 Aug 2025 13:38:50 +0800 Subject: [PATCH 02/11] discovery: refactor to use reflect.TypeFor Signed-off-by: cuiweixie --- discovery/registry.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/discovery/registry.go b/discovery/registry.go index 92fa3d3d16..ae32cb7c0a 100644 --- a/discovery/registry.go +++ b/discovery/registry.go @@ -42,8 +42,8 @@ var ( configTypesMu sync.Mutex configTypes = make(map[reflect.Type]reflect.Type) - emptyStructType = reflect.TypeOf(struct{}{}) - configsType = reflect.TypeOf(Configs{}) + emptyStructType = reflect.TypeFor[struct{}]() + configsType = reflect.TypeFor[Configs]() ) // RegisterConfig registers the given Config type for YAML marshaling and unmarshaling. @@ -54,7 +54,7 @@ func RegisterConfig(config Config) { func init() { // N.B.: static_configs is the only Config type implemented by default. // All other types are registered at init by their implementing packages. - elemTyp := reflect.TypeOf(&targetgroup.Group{}) + elemTyp := reflect.TypeFor[*targetgroup.Group]() registerConfig(staticConfigsKey, elemTyp, StaticConfig{}) } From a14faab4351025b486fb5dd80362c3653cc319ff Mon Sep 17 00:00:00 2001 From: dancer1325 Date: Mon, 15 Sep 2025 17:25:12 +0200 Subject: [PATCH 03/11] docs(): fix gettingStarted outdated graph reference /graph does NOT exist anymore in the new React app. It has been refactored within /query Signed-off-by: dancer1325 --- docs/getting_started.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started.md b/docs/getting_started.md index aeba295da8..35f1a88a7d 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -79,7 +79,7 @@ navigating to its metrics endpoint: Let us explore data that Prometheus has collected about itself. To use Prometheus's built-in expression browser, navigate to -http://localhost:9090/graph and choose the "Table" view within the "Graph" tab. +http://localhost:9090/query and choose the "Graph" tab. As you can gather from [localhost:9090/metrics](http://localhost:9090/metrics), one metric that Prometheus exports about itself is named @@ -113,7 +113,7 @@ For more about the expression language, see the ## Using the graphing interface -To graph expressions, navigate to http://localhost:9090/graph and use the "Graph" +To graph expressions, navigate to http://localhost:9090/query and use the "Graph" tab. For example, enter the following expression to graph the per-second rate of chunks From aa922ce3b66af7065a4cef9bece23e6bce7e1357 Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Tue, 16 Sep 2025 19:28:19 +0800 Subject: [PATCH 04/11] Added support for string literals and range results for instant queries in test scripting framework (#17055) Signed-off-by: Andrew Hall Co-authored-by: Charles Korn Co-authored-by: Arve Knudsen --- promql/engine_test.go | 83 --------- promql/promqltest/README.md | 36 ++++ promql/promqltest/test.go | 157 +++++++++++++++--- promql/promqltest/test_test.go | 138 +++++++++++++++ promql/promqltest/testdata/literals.test | 15 ++ promql/promqltest/testdata/range_queries.test | 34 ++++ 6 files changed, 355 insertions(+), 108 deletions(-) diff --git a/promql/engine_test.go b/promql/engine_test.go index f70036e3c0..e2aadd7a5d 100644 --- a/promql/engine_test.go +++ b/promql/engine_test.go @@ -3195,89 +3195,6 @@ func TestEngine_Close(t *testing.T) { }) } -func TestInstantQueryWithRangeVectorSelector(t *testing.T) { - engine := newTestEngine(t) - - baseT := timestamp.Time(0) - storage := promqltest.LoadedStorage(t, ` - load 1m - some_metric{env="1"} 0+1x4 - some_metric{env="2"} 0+2x4 - some_metric{env="3"} {{count:0}}+{{count:1}}x4 - some_metric_with_stale_marker 0 1 stale 3 - `) - t.Cleanup(func() { require.NoError(t, storage.Close()) }) - - testCases := map[string]struct { - expr string - expected promql.Matrix - ts time.Time - }{ - "matches series with points in range": { - expr: "some_metric[2m]", - ts: baseT.Add(2 * time.Minute), - expected: promql.Matrix{ - { - Metric: labels.FromStrings("__name__", "some_metric", "env", "1"), - Floats: []promql.FPoint{ - {T: timestamp.FromTime(baseT.Add(time.Minute)), F: 1}, - {T: timestamp.FromTime(baseT.Add(2 * time.Minute)), F: 2}, - }, - }, - { - Metric: labels.FromStrings("__name__", "some_metric", "env", "2"), - Floats: []promql.FPoint{ - {T: timestamp.FromTime(baseT.Add(time.Minute)), F: 2}, - {T: timestamp.FromTime(baseT.Add(2 * time.Minute)), F: 4}, - }, - }, - { - Metric: labels.FromStrings("__name__", "some_metric", "env", "3"), - Histograms: []promql.HPoint{ - {T: timestamp.FromTime(baseT.Add(time.Minute)), H: &histogram.FloatHistogram{Count: 1, CounterResetHint: histogram.NotCounterReset}}, - {T: timestamp.FromTime(baseT.Add(2 * time.Minute)), H: &histogram.FloatHistogram{Count: 2, CounterResetHint: histogram.NotCounterReset}}, - }, - }, - }, - }, - "matches no series": { - expr: "some_nonexistent_metric[1m]", - ts: baseT, - expected: promql.Matrix{}, - }, - "no samples in range": { - expr: "some_metric[1m]", - ts: baseT.Add(20 * time.Minute), - expected: promql.Matrix{}, - }, - "metric with stale marker": { - expr: "some_metric_with_stale_marker[3m]", - ts: baseT.Add(3 * time.Minute), - expected: promql.Matrix{ - { - Metric: labels.FromStrings("__name__", "some_metric_with_stale_marker"), - Floats: []promql.FPoint{ - {T: timestamp.FromTime(baseT.Add(time.Minute)), F: 1}, - {T: timestamp.FromTime(baseT.Add(3 * time.Minute)), F: 3}, - }, - }, - }, - }, - } - - for name, testCase := range testCases { - t.Run(name, func(t *testing.T) { - q, err := engine.NewInstantQuery(context.Background(), storage, nil, testCase.expr, testCase.ts) - require.NoError(t, err) - defer q.Close() - - res := q.Exec(context.Background()) - require.NoError(t, res.Err) - testutil.RequireEqual(t, testCase.expected, res.Value) - }) - } -} - func TestQueryLookbackDelta(t *testing.T) { var ( load = `load 5m diff --git a/promql/promqltest/README.md b/promql/promqltest/README.md index 84a0e69f3a..d26c01c6f1 100644 --- a/promql/promqltest/README.md +++ b/promql/promqltest/README.md @@ -106,8 +106,44 @@ eval range from to step * `` and `` specify the time range of the range query, and use the same syntax as `