From 6c893edd82073846643942a7048bcc91427b2256 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:21:33 +0900 Subject: [PATCH 01/19] Update prometheus version to v3.1.0 Signed-off-by: SungJin1212 --- .github/workflows/test.yaml | 2 +- engine/engine.go | 3 + engine/engine_test.go | 21 ++- go.mod | 65 ++++--- go.sum | 366 +++++++++++------------------------- 5 files changed, 155 insertions(+), 302 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0f3a2fcd..569ec584 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -4,7 +4,7 @@ on: push: branches: [ main ] pull_request: - branches: [ main, prometheus-update-65f610353919 ] + branches: [ main, update-prometheus-3.0 ] jobs: skip-check: diff --git a/engine/engine.go b/engine/engine.go index bedd9837..5992a249 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -653,6 +653,9 @@ loop: } } sort.Slice(vector, q.resultSort.comparer(&vector)) + if vector.ContainsSameLabelset() { + return newErrResult(ret, extlabels.ErrDuplicateLabelSet) + } result = vector case parser.ValueTypeScalar: v := math.NaN() diff --git a/engine/engine_test.go b/engine/engine_test.go index f07a26cb..4293cc9f 100644 --- a/engine/engine_test.go +++ b/engine/engine_test.go @@ -65,6 +65,7 @@ func TestPromqlAcceptance(t *testing.T) { engine := engine.New(engine.Opts{ EngineOpts: promql.EngineOpts{ + Logger: promslog.NewNopLogger(), EnableAtModifier: true, EnableNegativeOffset: true, MaxSamples: 5e10, @@ -5148,7 +5149,7 @@ func TestEngineRecoversFromPanic(t *testing.T) { func TestNativeHistogramRateWithNaN(t *testing.T) { type HPoint struct { T int64 - H *histogram.Histogram + H *histogram.FloatHistogram } testStorage := teststorage.New(t) @@ -5156,17 +5157,17 @@ func TestNativeHistogramRateWithNaN(t *testing.T) { app := testStorage.Appender(context.TODO()) points := []HPoint{ - {T: 5574708, H: tsdbutil.GenerateTestHistogram(1)}, - {T: 5604708, H: tsdbutil.GenerateTestHistogram(2)}, - {T: 5634708, H: tsdbutil.GenerateTestHistogram(3)}, - - {T: 6146221, H: &histogram.Histogram{Sum: math.NaN()}}, - {T: 6176221, H: tsdbutil.GenerateTestHistogram(1)}, - {T: 6206221, H: tsdbutil.GenerateTestHistogram(1)}, - {T: 6236221, H: tsdbutil.GenerateTestHistogram(1)}, + {T: 5574708, H: tsdbutil.GenerateTestFloatHistogram(1)}, + {T: 5604708, H: tsdbutil.GenerateTestFloatHistogram(2)}, + {T: 5634708, H: tsdbutil.GenerateTestFloatHistogram(3)}, + + {T: 6146221, H: &histogram.FloatHistogram{Sum: math.NaN()}}, + {T: 6176221, H: tsdbutil.GenerateTestFloatHistogram(1)}, + {T: 6206221, H: tsdbutil.GenerateTestFloatHistogram(1)}, + {T: 6236221, H: tsdbutil.GenerateTestFloatHistogram(1)}, } for _, point := range points { - _, err := app.AppendHistogram(0, labels.FromStrings(labels.MetricName, "test_metric"), point.T, point.H, nil) + _, err := app.AppendHistogram(0, labels.FromStrings(labels.MetricName, "test_metric"), point.T, nil, point.H) require.NoError(t, err) } require.NoError(t, app.Commit()) diff --git a/go.mod b/go.mod index 3b65ba2c..e228843e 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/thanos-io/promql-engine -go 1.22.0 +go 1.22.7 -toolchain go1.22.4 +toolchain go1.23.4 require ( github.com/cespare/xxhash/v2 v2.3.0 @@ -11,25 +11,31 @@ require ( github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb github.com/google/go-cmp v0.6.0 github.com/prometheus/client_golang v1.20.5 - github.com/prometheus/common v0.60.1 - github.com/prometheus/prometheus v0.300.0-beta.0.0.20241007202516-805954d8f8ba - github.com/stretchr/testify v1.9.0 + github.com/prometheus/common v0.61.0 + github.com/prometheus/prometheus v0.301.0 + github.com/stretchr/testify v1.10.0 github.com/zhangyunhao116/umap v0.0.0-20221211160557-cb7705fafa39 go.uber.org/goleak v1.3.0 golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 - golang.org/x/tools v0.26.0 + golang.org/x/tools v0.28.0 gonum.org/v1/gonum v0.15.0 ) require ( - cloud.google.com/go/auth v0.10.0 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.5 // indirect - cloud.google.com/go/compute/metadata v0.5.2 // indirect + github.com/googleapis/gax-go/v2 v2.14.0 // indirect + github.com/prometheus/sigv4 v0.1.0 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect +) + +require ( + cloud.google.com/go/auth v0.13.0 // indirect + cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect + cloud.google.com/go/compute/metadata v0.6.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 // indirect - github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 // indirect + github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b // indirect github.com/aws/aws-sdk-go v1.55.5 // indirect github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -41,7 +47,6 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect - github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/snappy v0.0.4 // indirect github.com/google/s2a-go v0.1.8 // indirect github.com/google/uuid v1.6.0 // indirect @@ -57,30 +62,28 @@ require ( github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common/sigv4 v0.1.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect - go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 // indirect - go.opentelemetry.io/otel v1.31.0 // indirect - go.opentelemetry.io/otel/metric v1.31.0 // indirect - go.opentelemetry.io/otel/trace v1.31.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 // indirect + go.opentelemetry.io/otel v1.33.0 // indirect + go.opentelemetry.io/otel/metric v1.33.0 // indirect + go.opentelemetry.io/otel/trace v1.33.0 // indirect go.uber.org/atomic v1.11.0 // indirect - golang.org/x/crypto v0.28.0 // indirect - golang.org/x/mod v0.21.0 // indirect - golang.org/x/net v0.30.0 // indirect - golang.org/x/oauth2 v0.23.0 // indirect - golang.org/x/sync v0.8.0 // indirect - golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.19.0 // indirect - golang.org/x/time v0.7.0 // indirect - google.golang.org/api v0.204.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect - google.golang.org/grpc v1.67.1 // indirect - google.golang.org/protobuf v1.35.1 // indirect + golang.org/x/crypto v0.31.0 // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.32.0 // indirect + golang.org/x/oauth2 v0.24.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect + golang.org/x/time v0.8.0 // indirect + google.golang.org/api v0.213.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect + google.golang.org/grpc v1.69.0 // indirect + google.golang.org/protobuf v1.36.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apimachinery v0.31.1 // indirect - k8s.io/client-go v0.31.1 // indirect + k8s.io/apimachinery v0.31.3 // indirect + k8s.io/client-go v0.31.3 // indirect k8s.io/klog/v2 v2.130.1 // indirect k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect ) diff --git a/go.sum b/go.sum index bf49a540..6348f41d 100644 --- a/go.sum +++ b/go.sum @@ -1,10 +1,9 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go/auth v0.10.0 h1:tWlkvFAh+wwTOzXIjrwM64karR1iTBZ/GRr0S/DULYo= -cloud.google.com/go/auth v0.10.0/go.mod h1:xxA5AqpDrvS+Gkmo9RqrGGRh6WSNKKOXhY3zNOr38tI= -cloud.google.com/go/auth/oauth2adapt v0.2.5 h1:2p29+dePqsCHPP1bqDJcKj4qxRyYCcbzKpFyKGt3MTk= -cloud.google.com/go/auth/oauth2adapt v0.2.5/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= -cloud.google.com/go/compute/metadata v0.5.2 h1:UxK4uu/Tn+I3p2dYWTfiX4wva7aYlKixAHn3fyqngqo= -cloud.google.com/go/compute/metadata v0.5.2/go.mod h1:C66sj2AluDcIqakBq/M8lw8/ybHgOZqin2obFxa/E5k= +cloud.google.com/go/auth v0.13.0 h1:8Fu8TZy167JkW8Tj3q7dIkr2v4cndv41ouecJx0PAHs= +cloud.google.com/go/auth v0.13.0/go.mod h1:COOjD9gwfKNKz+IIduatIhYJQIc0mG3H102r/EMxX6Q= +cloud.google.com/go/auth/oauth2adapt v0.2.6 h1:V6a6XDu2lTwPZWOawrAa9HUK+DB2zfJyTuciBG5hFkU= +cloud.google.com/go/auth/oauth2adapt v0.2.6/go.mod h1:AlmsELtlEBnaNTL7jCj8VQFLy6mbZv0s4Q7NGBeQ5E8= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0 h1:JZg6HRh6W6U4OLl6lk7BZ7BLisIzM9dG1R50zUk9C/M= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.16.0/go.mod h1:YL1xnZ6QejvQHWJrX/AvhFl4WW4rqHVoKspWNVwFk0M= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.0 h1:B/dfvscEQtew9dVuoxqxrUKKv8Ih2f55PydknDamU+g= @@ -21,37 +20,24 @@ github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJ github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2 h1:XHOnouVk1mxXfQidrMEnLlPk9UMeRtyBTnEFtxkV0kU= github.com/AzureAD/microsoft-authentication-library-for-go v1.2.2/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/Code-Hex/go-generics-cache v1.5.1 h1:6vhZGc5M7Y/YD8cIUcY8kcuQLB4cHR7U+0KMqAA0KcU= github.com/Code-Hex/go-generics-cache v1.5.1/go.mod h1:qxcC9kRVrct9rHeiYpFWSoW1vxyillCVzX13KZG8dl4= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30 h1:t3eaIm0rUkzbrIewtiFmMK5RXHej2XnoXNhxVsAYUfg= -github.com/alecthomas/units v0.0.0-20240626203959-61d1e3462e30/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b h1:mimo19zliBX/vSQ6PWWSL9lK8qwHozUj03+zLoEB8O0= +github.com/alecthomas/units v0.0.0-20240927000941-0f3dac36c52b/go.mod h1:fvzegU4vN3H1qMT+8wDmzjAcDONcgo2/SZ/TyfdUOFs= github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= -github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU= github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU= github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3 h1:6df1vn4bBlDDo4tARvBm7l6KA9iVMnE3NWizDeWSrps= github.com/bboreham/go-loser v0.0.0-20230920113527-fcc2c21820a3/go.mod h1:CIWtjkly68+yqLPbvwwR/fjNJA/idrtULjZWh2v1ys0= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20 h1:N+3sFI5GUjRKBi+i0TxYVST9h4Ie192jJWpHvthBBgg= -github.com/cncf/xds/go v0.0.0-20240723142845-024c85f92f20/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= +github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78 h1:QVw89YDxXxEe+l8gU8ETbOasdwEV+avkR75ZzsVV9WI= +github.com/cncf/xds/go v0.0.0-20240905190251-b4127c9b8d78/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cortexproject/promqlsmith v0.0.0-20240506042652-6cfdd9739a5e h1:nOWmgQD3L/Z0bmm29iDxB7nlqjMnh7yD/PNOx9rnZmA= github.com/cortexproject/promqlsmith v0.0.0-20240506042652-6cfdd9739a5e/go.mod h1:+bSqRETXJ1uk2S93m//htzTVqu8DJPvlGEb3bSE9PzI= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -62,12 +48,12 @@ github.com/dennwc/varint v1.0.0 h1:kGNFFSSw8ToIy3obO/kKr8U9GZYUAxQEVuix4zfDWzE= github.com/dennwc/varint v1.0.0/go.mod h1:hnItb35rvZvJrbTALZtY/iQfDs48JKRG1RPpgziApxA= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78= github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= -github.com/digitalocean/godo v1.122.0 h1:ziytLQi8QKtDp2K1A+YrYl2dWLHLh2uaMzWvcz9HkKg= -github.com/digitalocean/godo v1.122.0/go.mod h1:WQVH83OHUy6gC4gXpEVQKtxTd4L5oCp+5OialidkPLY= +github.com/digitalocean/godo v1.132.0 h1:n0x6+ZkwbyQBtIU1wwBhv26EINqHg0wWQiBXlwYg/HQ= +github.com/digitalocean/godo v1.132.0/go.mod h1:PU8JB6I1XYkQIdHFop8lLAY9ojp6M0XcU0TWaQSxbrc= github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= -github.com/docker/docker v27.2.0+incompatible h1:Rk9nIVdfH3+Vz4cyI/uhbINhEZ/oLmc+CBXmH6fbNk4= -github.com/docker/docker v27.2.0+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v27.4.1+incompatible h1:ZJvcY7gfwHn1JF48PfbyXg7Jyt9ZCWDW+GGXOIxEwp4= +github.com/docker/docker v27.4.1+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -78,12 +64,8 @@ github.com/efficientgo/core v1.0.0-rc.2 h1:7j62qHLnrZqO3V3UA0AqOGd5d5aXV3AX6m/NZ github.com/efficientgo/core v1.0.0-rc.2/go.mod h1:FfGdkzWarkuzOlY04VY+bGfb1lWrjaL6x/GLcQ4vJps= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= github.com/emicklei/go-restful/v3 v3.11.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= -github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= -github.com/envoyproxy/go-control-plane v0.13.0 h1:HzkeUz1Knt+3bK+8LG1bxOO/jzWZmdxpwC51i202les= -github.com/envoyproxy/go-control-plane v0.13.0/go.mod h1:GRaKG3dwvFoTg4nj7aXdZnvMg4d7nvT/wl9WgVXn3Q8= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/envoyproxy/go-control-plane v0.13.1 h1:vPfJZCkob6yTMEgS+0TwfTUfbHjfy/6vOJ8hUWX/uXE= +github.com/envoyproxy/go-control-plane v0.13.1/go.mod h1:X45hY0mufo6Fd0KW3rqsGvQMw58jvjymeCzBU3mWyHw= github.com/envoyproxy/protoc-gen-validate v1.1.0 h1:tntQDh69XqOCOZsDz0lVJQez/2L6Uu2PdjCQwWCJ3bM= github.com/envoyproxy/protoc-gen-validate v1.1.0/go.mod h1:sXRDRVmzEbkM7CVcM06s9shE/m23dg3wzjl0UWqJ2q4= github.com/facette/natsort v0.0.0-20181210072756-2cd4dd1e2dcb h1:IT4JYU7k4ikYg1SCxNI1/Tieq/NFvh6dzLdgi7eu0tM= @@ -92,89 +74,57 @@ 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.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.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= -github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-openapi/jsonpointer v0.20.2 h1:mQc3nmndL8ZBzStEo3JYF8wzmeWffDH4VbXz58sAx6Q= -github.com/go-openapi/jsonpointer v0.20.2/go.mod h1:bHen+N0u1KEO3YlmqOjTT9Adn1RfD91Ar825/PuiRVs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= github.com/go-openapi/jsonreference v0.20.4 h1:bKlDxQxQJgwpUSgOENiMPzCTBVuc7vTdXSSgNeAhojU= github.com/go-openapi/jsonreference v0.20.4/go.mod h1:5pZJyJP2MnYCpoeoMAql78cCHauHj0V9Lhc506VOpw4= -github.com/go-openapi/swag v0.22.9 h1:XX2DssF+mQKM2DHsbgZK74y/zj4mo9I99+89xUmuZCE= -github.com/go-openapi/swag v0.22.9/go.mod h1:3/OXnFfnMAwBD099SwYRk7GD3xOrr1iL7d/XNLXVVwE= -github.com/go-resty/resty/v2 v2.13.1 h1:x+LHXBI2nMB1vqndymf26quycC4aggYJ7DECYbiz03g= -github.com/go-resty/resty/v2 v2.13.1/go.mod h1:GznXlLxkq6Nh4sU59rPmUw3VtgpO3aS96ORAI6Q7d+0= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-resty/resty/v2 v2.15.3 h1:bqff+hcqAflpiF591hhJzNdkRsFhlB96CYfBwSFvql8= +github.com/go-resty/resty/v2 v2.15.3/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU= github.com/go-zookeeper/zk v1.0.4 h1:DPzxraQx7OrPyXq2phlGlNSIyWEsAox0RJmjTseMV6I= github.com/go-zookeeper/zk v1.0.4/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL+UX1Qcw= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= -github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= -github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= -github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= -github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= -github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= -github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= -github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8= github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/s2a-go v0.1.8 h1:zZDs9gcbt9ZPLV0ndSyQk6Kacx2g/X+SKYovpnz3SMM= github.com/google/s2a-go v0.1.8/go.mod h1:6iNWHTpQ+nfNRN5E00MSdfDwVesa8hhS32PhPO8deJA= -github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.3.4 h1:XYIDZApgAnrN1c855gTgghdIA6Stxb52D5RnLI1SLyw= github.com/googleapis/enterprise-certificate-proxy v0.3.4/go.mod h1:YKe7cfqYXjKGpGvmSg28/fFvhNzinZQm8DGnaburhGA= +github.com/googleapis/gax-go/v2 v2.14.0 h1:f+jMrjBPl+DL9nI4IQzLUxMq7XrAqFYB7hBPqMNIe8o= +github.com/googleapis/gax-go/v2 v2.14.0/go.mod h1:lhBCnjdLrWRaPvLWhmc8IS24m9mr07qSYnHncrgo+zk= github.com/gophercloud/gophercloud v1.14.1 h1:DTCNaTVGl8/cFu58O1JwWgis9gtISAFONqpMKNg/Vpw= github.com/gophercloud/gophercloud v1.14.1/go.mod h1:aAVqcocTSXh2vYFZ1JTvx4EQmfgzxRcNupUfxZbBNDM= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc h1:GN2Lv3MGO7AS6PrRoT6yV5+wkrOpcszoIsO4+4ds248= github.com/grafana/regexp v0.0.0-20240518133315-a468a5bfb3bc/go.mod h1:+JKpmjMGhpgPL+rXZ5nsZieVzvarn86asRlBg4uNGnk= -github.com/hashicorp/consul/api v1.29.4 h1:P6slzxDLBOxUSj3fWo2o65VuKtbtOXFi7TSSgtXutuE= -github.com/hashicorp/consul/api v1.29.4/go.mod h1:HUlfw+l2Zy68ceJavv2zAyArl2fqhGWnMycyt56sBgg= +github.com/hashicorp/consul/api v1.30.0 h1:ArHVMMILb1nQv8vZSGIwwQd2gtc+oSQZ6CalyiyH2XQ= +github.com/hashicorp/consul/api v1.30.0/go.mod h1:B2uGchvaXVW2JhFoS8nqTxMD5PBykr4ebY4JWHTTeLM= github.com/hashicorp/cronexpr v1.1.2 h1:wG/ZYIKT+RT3QkOdgYc+xsKWVRgnxJ1OJtjjy84fJ9A= github.com/hashicorp/cronexpr v1.1.2/go.mod h1:P4wA0KBl9C5q2hABiMO7cp6jcIg96CDh1Efb3g1PWA4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= @@ -193,16 +143,16 @@ github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5O github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8= github.com/hashicorp/golang-lru v0.6.0 h1:uL2shRDx7RTrOrTCUZEGP/wJUFiUI8QT6E7z5o8jga4= github.com/hashicorp/golang-lru v0.6.0/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= -github.com/hashicorp/nomad/api v0.0.0-20240717122358-3d93bd3778f3 h1:fgVfQ4AC1avVOnu2cfms8VAiD8lUq3vWI8mTocOXN/w= -github.com/hashicorp/nomad/api v0.0.0-20240717122358-3d93bd3778f3/go.mod h1:svtxn6QnrQ69P23VvIWMR34tg3vmwLz4UdUzm1dSCgE= +github.com/hashicorp/nomad/api v0.0.0-20241218080744-e3ac00f30eec h1:+YBzb977VrmffaCX/OBm17dEVJUcWn5dW+eqs3aIJ/A= +github.com/hashicorp/nomad/api v0.0.0-20241218080744-e3ac00f30eec/go.mod h1:svtxn6QnrQ69P23VvIWMR34tg3vmwLz4UdUzm1dSCgE= github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= -github.com/hetznercloud/hcloud-go/v2 v2.13.1 h1:jq0GP4QaYE5d8xR/Zw17s9qoaESRJMXfGmtD1a/qckQ= -github.com/hetznercloud/hcloud-go/v2 v2.13.1/go.mod h1:dhix40Br3fDiBhwaSG/zgaYOFFddpfBm/6R1Zz0IiF0= -github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= -github.com/ionos-cloud/sdk-go/v6 v6.2.1 h1:mxxN+frNVmbFrmmFfXnBC3g2USYJrl6mc1LW2iNYbFY= -github.com/ionos-cloud/sdk-go/v6 v6.2.1/go.mod h1:SXrO9OGyWjd2rZhAhEpdYN6VUAODzzqRdqA9BCviQtI= +github.com/hetznercloud/hcloud-go/v2 v2.17.1 h1:DPi019dv0WCiECEmtcuTgc//hBvnxESb6QlJnAb4a04= +github.com/hetznercloud/hcloud-go/v2 v2.17.1/go.mod h1:6ygmBba+FdawR2lLp/d9uJljY2k0dTYthprrI8usdLw= +github.com/imdario/mergo v0.3.6 h1:xTNEAn+kxVO7dTZGu0CegyqKZmoWFI0rF8UxjlB2d28= +github.com/imdario/mergo v0.3.6/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= +github.com/ionos-cloud/sdk-go/v6 v6.3.0 h1:/lTieTH9Mo/CWm3cTlFLnK10jgxjUGkAqRffGqvPteY= +github.com/ionos-cloud/sdk-go/v6 v6.3.0/go.mod h1:SXrO9OGyWjd2rZhAhEpdYN6VUAODzzqRdqA9BCviQtI= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8= @@ -211,13 +161,8 @@ github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8Hm github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6 h1:IsMZxCuZqKuao2vNdfD82fjjgPLfyHLpR41Z88viRWs= github.com/keybase/go-keychain v0.0.0-20231219164618-57a3676c3af6/go.mod h1:3VeWNIJaW+O5xpRQbPp0Ybqu1vJd/pm7s2F473HRrkw= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -226,27 +171,20 @@ github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IX github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b h1:udzkj9S/zlT5X367kqJis0QP7YMxobob6zhzq6Yre00= github.com/kolo/xmlrpc v0.0.0-20220921171641-a4b6fa1dd06b/go.mod h1:pcaDhQK0/NJZEvtCO0qQPPropqV0sJOJ6YW7X+9kRwM= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/linode/linodego v1.41.0 h1:GcP7JIBr9iLRJ9FwAtb9/WCT1DuPJS/xUApapfdjtiY= -github.com/linode/linodego v1.41.0/go.mod h1:Ow4/XZ0yvWBzt3iAHwchvhSx30AyLintsSMvvQ2/SJY= +github.com/linode/linodego v1.43.0 h1:sGeBB3caZt7vKBoPS5p4AVzmlG4JoqQOdigIibx3egk= +github.com/linode/linodego v1.43.0/go.mod h1:n4TMFu1UVNala+icHqrTEFFaicYSF74cSAUG5zkTwfA= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/miekg/dns v1.1.62 h1:cN8OuEF1/x5Rq6Np+h1epln8OiyPWV+lROx9LxcGgIQ= github.com/miekg/dns v1.1.62/go.mod h1:mvDlcItzm+br7MToIKqkglaGhlFMHJ9DTNNWONWXbNQ= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= @@ -255,16 +193,12 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= @@ -277,8 +211,6 @@ github.com/ovh/go-ovh v1.6.0 h1:ixLOwxQdzYDx296sXcgS35TOPEahJkpjMGtzPadCjQI= github.com/ovh/go-ovh v1.6.0/go.mod h1:cTVDnl94z4tl8pP1uZ/8jlVxntjSIf09bNcQ5TJSC7c= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ= github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo= @@ -286,61 +218,37 @@ github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y= github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -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.60.1 h1:FUas6GcOw66yB/73KC+BOZoFJmbo/1pojoILArPAaSc= -github.com/prometheus/common v0.60.1/go.mod h1:h0LYf1R1deLSKtD4Vdg8gy4RuOvENW2J/h19V5NADQw= -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/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/common v0.61.0 h1:3gv/GThfX0cV2lpO7gkTUwZru38mxevy90Bj8YFSRQQ= +github.com/prometheus/common v0.61.0/go.mod h1:zr29OCN/2BsJRaFwG8QOBr41D6kkchKbpeNH7pAjb/s= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/prometheus/prometheus v0.300.0-beta.0.0.20241007202516-805954d8f8ba h1:5ma/GhzY2KnNgeFrADOtzJ0UGcoKa7H9mhnfiEhUOu4= -github.com/prometheus/prometheus v0.300.0-beta.0.0.20241007202516-805954d8f8ba/go.mod h1:suua3XMOzCiQC0hE9ADwJF8QbNvBSz3vOhdJRKx8vas= +github.com/prometheus/prometheus v0.301.0 h1:0z8dgegmILivNomCd79RKvVkIols8vBGPKmcIBc7OyY= +github.com/prometheus/prometheus v0.301.0/go.mod h1:BJLjWCKNfRfjp7Q48DrAjARnCi7GhfUVvUFEAWTssZM= +github.com/prometheus/sigv4 v0.1.0 h1:FgxH+m1qf9dGQ4w8Dd6VkthmpFQfGTzUeavMoQeG1LA= +github.com/prometheus/sigv4 v0.1.0/go.mod h1:doosPW9dOitMzYe2I2BN0jZqUuBrGPbXrNsTScN18iU= github.com/redis/go-redis/v9 v9.6.1 h1:HHDteefn6ZkTtY5fGUE8tj8uy85AHk6zP7CpzIAM0y4= github.com/redis/go-redis/v9 v9.6.1/go.mod h1:0C0c6ycQsdpVNQpxb1njEQIqkx5UcsM8FJCQLgE9+RA= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30 h1:yoKAVkEVwAqbGbR8n87rHQ1dulL25rKloGadb3vm770= github.com/scaleway/scaleway-sdk-go v1.0.0-beta.30/go.mod h1:sH0u6fq6x4R5M7WxkoQFY/o7UaiItec0o1LinLCJNq8= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/vultr/govultr/v2 v2.17.2 h1:gej/rwr91Puc/tgh+j33p/BLR16UrIPnSr+AIwYWZQs= github.com/vultr/govultr/v2 v2.17.2/go.mod h1:ZFOKGWmgjytfyjeyAdhQlSWwTjh2ig+X49cAp50dzXI= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -349,173 +257,111 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/zhangyunhao116/umap v0.0.0-20221211160557-cb7705fafa39 h1:D3ltj0b2c2FgUacKrB1pWGgwrUyCESY9W8XYYQ5sqY8= github.com/zhangyunhao116/umap v0.0.0-20221211160557-cb7705fafa39/go.mod h1:r86X1CnsDRrOeLtJlqRWdELPWpkcf933GTlojQlifQw= -go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0 h1:UP6IpuHFkUgOQL9FFQFrZ+5LiwhhYRbi7VZSIx6Nj5s= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.56.0/go.mod h1:qxuZLtbq5QDtdeSHsS7bcf6EH6uO6jUAgk764zd3rhM= -go.opentelemetry.io/otel v1.31.0 h1:NsJcKPIW0D0H3NgzPDHmo0WW6SptzPdqg/L1zsIm2hY= -go.opentelemetry.io/otel v1.31.0/go.mod h1:O0C14Yl9FgkjqcCZAsE053C13OaddMYr/hz6clDkEJE= -go.opentelemetry.io/otel/metric v1.31.0 h1:FSErL0ATQAmYHUIzSezZibnyVlft1ybhy4ozRPcF2fE= -go.opentelemetry.io/otel/metric v1.31.0/go.mod h1:C3dEloVbLuYoX41KpmAhOqNriGbA+qqH6PQ5E5mUfnY= -go.opentelemetry.io/otel/trace v1.31.0 h1:ffjsj1aRouKewfr85U2aGagJ46+MvodynlQ1HYdmJys= -go.opentelemetry.io/otel/trace v1.31.0/go.mod h1:TXZkRk7SM2ZQLtR6eoAWQFIHPvzQ06FJAsO1tJg480A= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/collector/pdata v1.22.0 h1:3yhjL46NLdTMoP8rkkcE9B0pzjf2973crn0KKhX5UrI= +go.opentelemetry.io/collector/pdata v1.22.0/go.mod h1:nLLf6uDg8Kn5g3WNZwGyu8+kf77SwOqQvMTb5AXEbEY= +go.opentelemetry.io/collector/semconv v0.116.0 h1:63xCZomsKJAWmKGWD3lnORiE3WKW6AO4LjnzcHzGx3Y= +go.opentelemetry.io/collector/semconv v0.116.0/go.mod h1:N6XE8Q0JKgBN2fAhkUQtqK9LT7rEGR6+Wu/Rtbal1iI= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.58.0 h1:xwH3QJv6zL4u+gkPUu59NeT1Gyw9nScWT8FQpKLUJJI= +go.opentelemetry.io/contrib/instrumentation/net/http/httptrace/otelhttptrace v0.58.0/go.mod h1:uosvgpqTcTXtcPQORTbEkZNDQTCDOgTz1fe6aLSyqrQ= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0 h1:yd02MEjBdJkG3uabWP9apV+OuWRIXGDuJEUJbOHmCFU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0/go.mod h1:umTcuxiv1n/s/S6/c2AT/g2CQ7u5C59sHDNmfSwgz7Q= +go.opentelemetry.io/otel v1.33.0 h1:/FerN9bax5LoK51X/sI0SVYrjSE0/yUL7DpxW4K3FWw= +go.opentelemetry.io/otel v1.33.0/go.mod h1:SUUkR6csvUQl+yjReHu5uM3EtVV7MBm5FHKRlNx4I8I= +go.opentelemetry.io/otel/metric v1.33.0 h1:r+JOocAyeRVXD8lZpjdQjzMadVZp2M4WmQ+5WtEnklQ= +go.opentelemetry.io/otel/metric v1.33.0/go.mod h1:L9+Fyctbp6HFTddIxClbQkjtubW6O9QS3Ann/M82u6M= +go.opentelemetry.io/otel/sdk v1.33.0 h1:iax7M131HuAm9QkZotNHEfstof92xM+N8sr3uHXc2IM= +go.opentelemetry.io/otel/sdk v1.33.0/go.mod h1:A1Q5oi7/9XaMlIWzPSxLRWOI8nG3FnzHJNbiENQuihM= +go.opentelemetry.io/otel/sdk/metric v1.31.0 h1:i9hxxLJF/9kkvfHppyLL55aW7iIJz4JjxTeYusH7zMc= +go.opentelemetry.io/otel/sdk/metric v1.31.0/go.mod h1:CRInTMVvNhUKgSAMbKyTMxqOBC0zgyxzW55lZzX43Y8= +go.opentelemetry.io/otel/trace v1.33.0 h1:cCJuF7LRjUFso9LPnEAHJDB2pqzp+hbO8eu1qqW2d/s= +go.opentelemetry.io/otel/trace v1.33.0/go.mod h1:uIcdVUZMpTAmz0tI1z04GoVSezK37CbGV4fr1f2nBck= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw= -golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U= +golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0= -golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4= -golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.23.0 h1:PbgcYx2W7i4LvjJWEbf0ngHV6qJYr86PkAV3bXdLEbs= -golang.org/x/oauth2 v0.23.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= +golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24= -golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM= -golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= -golang.org/x/time v0.7.0 h1:ntUhktv3OPE6TgYxXWv9vKvUSJyIFJlyohwbkEwPrKQ= -golang.org/x/time v0.7.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= +golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ= -golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= -google.golang.org/api v0.204.0 h1:3PjmQQEDkR/ENVZZwIYB4W/KzYtN8OrqnNcHWpeR8E4= -google.golang.org/api v0.204.0/go.mod h1:69y8QSoKIbL9F94bWgWAq6wGqGwyjBgi2y8rAK8zLag= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20241021214115-324edc3d5d38 h1:Q3nlH8iSQSRUwOskjbcSMcF2jiYMNiQYZ0c2KEJLKKU= -google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 h1:hjSy6tcFQZ171igDaN5QHOw2n6vx40juYbC/x67CEhc= -google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:qpvKtACPCQhAdu3PyQgV4l3LMXZEtft7y8QcarRsp9I= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:zciRKQ4kBpFgpfC5QQCVtnnNAcLIqweL7plyZRQHVpI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= -google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E= -google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA= -google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= -google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= -google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= -google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= -google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= -google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= -google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA= -google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= +google.golang.org/api v0.213.0 h1:KmF6KaDyFqB417T68tMPbVmmwtIXs2VB60OJKIHB0xQ= +google.golang.org/api v0.213.0/go.mod h1:V0T5ZhNUUNpYAlL306gFZPFt5F5D/IeyLoktduYYnvQ= +google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484 h1:ChAdCYNQFDk5fYvFZMywKLIijG7TC2m1C2CMEu11G3o= +google.golang.org/genproto/googleapis/api v0.0.0-20241216192217-9240e9c98484/go.mod h1:KRUmxRI4JmbpAm8gcZM4Jsffi859fo5LQjILwuqj9z8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 h1:8ZmaLZE4XWrtU3MyClkYqqtl6Oegr3235h7jxsDyqCY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/grpc v1.69.0 h1:quSiOM1GJPmPH5XtU+BCoVXcDVJJAzNcoyfC2cCjGkI= +google.golang.org/grpc v1.69.0/go.mod h1:vyjdE6jLBI76dgpDojsFGNaHlxdjXN9ghpnd2o7JGZ4= +google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ= +google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.31.1 h1:Xe1hX/fPW3PXYYv8BlozYqw63ytA92snr96zMW9gWTU= -k8s.io/api v0.31.1/go.mod h1:sbN1g6eY6XVLeqNsZGLnI5FwVseTrZX7Fv3O26rhAaI= -k8s.io/apimachinery v0.31.1 h1:mhcUBbj7KUjaVhyXILglcVjuS4nYXiwC+KKFBgIVy7U= -k8s.io/apimachinery v0.31.1/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= -k8s.io/client-go v0.31.1 h1:f0ugtWSbWpxHR7sjVpQwuvw9a3ZKLXX0u0itkFXufb0= -k8s.io/client-go v0.31.1/go.mod h1:sKI8871MJN2OyeqRlmA4W4KM9KBdBUpDLu/43eGemCg= +k8s.io/api v0.31.3 h1:umzm5o8lFbdN/hIXbrK9oRpOproJO62CV1zqxXrLgk8= +k8s.io/api v0.31.3/go.mod h1:UJrkIp9pnMOI9K2nlL6vwpxRzzEX5sWgn8kGQe92kCE= +k8s.io/apimachinery v0.31.3 h1:6l0WhcYgasZ/wk9ktLq5vLaoXJJr5ts6lkaQzgeYPq4= +k8s.io/apimachinery v0.31.3/go.mod h1:rsPdaZJfTfLsNJSQzNHQvYoTmxhoOEofxtOsF3rtsMo= +k8s.io/client-go v0.31.3 h1:CAlZuM+PH2cm+86LOBemaJI/lQ5linJ6UFxKX/SoG+4= +k8s.io/client-go v0.31.3/go.mod h1:2CgjPUTpv3fE5dNygAr2NcM8nhHzXvxB8KL5gYc3kJs= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7FjZpUb45WallggurYhKGag= From 9b6203bc0b2319a7d5e2d64296ea01420b382384 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:27:19 +0900 Subject: [PATCH 02/19] Add ctx for adding histogram warning Signed-off-by: SungJin1212 --- execution/aggregate/accumulator.go | 103 ++++++++++++++++++-------- execution/aggregate/hashaggregate.go | 8 +- execution/aggregate/scalar_table.go | 16 ++-- execution/aggregate/vector_table.go | 22 +++++- execution/binary/scalar.go | 2 +- execution/binary/utils.go | 103 ++++++++++++++++++++++++-- execution/binary/vector.go | 19 +++-- execution/function/histogram.go | 4 +- execution/scan/subquery.go | 4 +- ringbuffer/functions.go | 22 +++--- ringbuffer/generic.go | 12 ++- ringbuffer/rate.go | 9 ++- storage/prometheus/matrix_selector.go | 17 +++-- 13 files changed, 250 insertions(+), 91 deletions(-) diff --git a/execution/aggregate/accumulator.go b/execution/aggregate/accumulator.go index 85eee3ef..57a5def4 100644 --- a/execution/aggregate/accumulator.go +++ b/execution/aggregate/accumulator.go @@ -4,6 +4,7 @@ package aggregate import ( + "context" "math" "github.com/prometheus/prometheus/model/histogram" @@ -19,14 +20,14 @@ const ( ) type accumulator interface { - Add(v float64, h *histogram.FloatHistogram) error + Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error Value() (float64, *histogram.FloatHistogram) ValueType() ValueType Reset(float64) } type vectorAccumulator interface { - AddVector(vs []float64, hs []*histogram.FloatHistogram) error + AddVector(ctx context.Context, vs []float64, hs []*histogram.FloatHistogram) error Value() (float64, *histogram.FloatHistogram) ValueType() ValueType Reset(float64) @@ -42,7 +43,7 @@ func newSumAcc() *sumAcc { return &sumAcc{} } -func (s *sumAcc) AddVector(float64s []float64, histograms []*histogram.FloatHistogram) error { +func (s *sumAcc) AddVector(ctx context.Context, float64s []float64, histograms []*histogram.FloatHistogram) error { if len(float64s) > 0 { s.value += SumCompensated(float64s) s.hasFloatVal = true @@ -50,12 +51,12 @@ func (s *sumAcc) AddVector(float64s []float64, histograms []*histogram.FloatHist var err error if len(histograms) > 0 { - s.histSum, err = histogramSum(s.histSum, histograms) + s.histSum, err = histogramSum(ctx, s.histSum, histograms) } return err } -func (s *sumAcc) Add(v float64, h *histogram.FloatHistogram) error { +func (s *sumAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { if h == nil { s.hasFloatVal = true s.value += v @@ -70,11 +71,27 @@ func (s *sumAcc) Add(v float64, h *histogram.FloatHistogram) error { var err error if h.Schema >= s.histSum.Schema { if s.histSum, err = s.histSum.Add(h); err != nil { + if errors.Is(err, histogram.ErrHistogramsIncompatibleSchema) { + warnings.AddToContext(histogram.ErrHistogramsIncompatibleSchema, ctx) + return nil + } + if errors.Is(err, histogram.ErrHistogramsIncompatibleBounds) { + warnings.AddToContext(histogram.ErrHistogramsIncompatibleBounds, ctx) + return nil + } return err } } else { t := h.Copy() - if _, err = t.Add(s.histSum); err != nil { + if s.histSum, err = t.Add(s.histSum); err != nil { + if errors.Is(err, histogram.ErrHistogramsIncompatibleSchema) { + warnings.AddToContext(histogram.ErrHistogramsIncompatibleSchema, ctx) + return nil + } + if errors.Is(err, histogram.ErrHistogramsIncompatibleBounds) { + warnings.AddToContext(histogram.ErrHistogramsIncompatibleBounds, ctx) + return nil + } return err } s.histSum = t @@ -111,20 +128,30 @@ type maxAcc struct { hasValue bool } -func (c *maxAcc) AddVector(vs []float64, hs []*histogram.FloatHistogram) error { +func (c *maxAcc) AddVector(ctx context.Context, vs []float64, hs []*histogram.FloatHistogram) error { + if len(hs) > 0 { + warnings.AddToContext(annotations.NewHistogramIgnoredInAggregationInfo("max", posrange.PositionRange{}), ctx) + } + if len(vs) == 0 { return nil } + fst, rem := vs[0], vs[1:] - if err := c.Add(fst, nil); err != nil { + if err := c.Add(ctx, fst, nil); err != nil { return err } if len(rem) == 0 { return nil } - return c.Add(floats.Max(rem), nil) + return c.Add(ctx, floats.Max(rem), nil) } +func (c *maxAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { + if h != nil { + return nil + } + func (c *maxAcc) Add(v float64, h *histogram.FloatHistogram) error { if !c.hasValue { c.value = v @@ -163,21 +190,30 @@ type minAcc struct { hasValue bool } -func (c *minAcc) AddVector(vs []float64, hs []*histogram.FloatHistogram) error { +func (c *minAcc) AddVector(ctx context.Context, vs []float64, hs []*histogram.FloatHistogram) error { + if len(hs) > 0 { + warnings.AddToContext(annotations.NewHistogramIgnoredInAggregationInfo("min", posrange.PositionRange{}), ctx) + } + if len(vs) == 0 { return nil } + fst, rem := vs[0], vs[1:] - if err := c.Add(fst, nil); err != nil { + if err := c.Add(ctx, fst, nil); err != nil { return err } if len(rem) == 0 { return nil } - return c.Add(floats.Min(rem), nil) + return c.Add(ctx, floats.Min(rem), nil) } -func (c *minAcc) Add(v float64, h *histogram.FloatHistogram) error { +func (c *minAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { + if h != nil { + return nil + } + if !c.hasValue { c.value = v c.hasValue = true @@ -215,7 +251,7 @@ type groupAcc struct { hasValue bool } -func (c *groupAcc) AddVector(vs []float64, hs []*histogram.FloatHistogram) error { +func (c *groupAcc) AddVector(ctx context.Context, vs []float64, hs []*histogram.FloatHistogram) error { if len(vs) == 0 && len(hs) == 0 { return nil } @@ -224,7 +260,7 @@ func (c *groupAcc) AddVector(vs []float64, hs []*histogram.FloatHistogram) error return nil } -func (c *groupAcc) Add(v float64, h *histogram.FloatHistogram) error { +func (c *groupAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { c.hasValue = true c.value = 1 return nil @@ -256,7 +292,8 @@ func newCountAcc() *countAcc { return &countAcc{} } -func (c *countAcc) AddVector(vs []float64, hs []*histogram.FloatHistogram) error { +func (c *countAcc) AddVector(ctx context.Context, vs []float64, hs []*histogram.FloatHistogram) error { + if len(vs) > 0 || len(hs) > 0 { c.hasValue = true c.value += float64(len(vs)) + float64(len(hs)) @@ -264,7 +301,7 @@ func (c *countAcc) AddVector(vs []float64, hs []*histogram.FloatHistogram) error return nil } -func (c *countAcc) Add(v float64, h *histogram.FloatHistogram) error { +func (c *countAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { c.hasValue = true c.value += 1 return nil @@ -304,7 +341,7 @@ func newAvgAcc() *avgAcc { return &avgAcc{} } -func (a *avgAcc) Add(v float64, h *histogram.FloatHistogram) error { +func (a *avgAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { if h != nil { a.histCount++ if a.histSum == nil { @@ -381,14 +418,28 @@ func (a *avgAcc) Add(v float64, h *histogram.FloatHistogram) error { return nil } -func (a *avgAcc) AddVector(vs []float64, hs []*histogram.FloatHistogram) error { +func (a *avgAcc) AddVector(ctx context.Context, vs []float64, hs []*histogram.FloatHistogram) error { for _, v := range vs { - if err := a.Add(v, nil); err != nil { + if err := a.Add(ctx, v, nil); err != nil { return err } } for _, h := range hs { - if err := a.Add(0, h); err != nil { + if err := a.Add(ctx, 0, h); err != nil { + if errors.Is(err, histogram.ErrHistogramsIncompatibleSchema) { + // to make valueType NoValue + a.histSum = nil + a.histCount = 0 + warnings.AddToContext(annotations.NewMixedExponentialCustomHistogramsWarning("", posrange.PositionRange{}), ctx) + return nil + } + if errors.Is(err, histogram.ErrHistogramsIncompatibleBounds) { + // to make valueType NoValue + a.histSum = nil + a.histCount = 0 + warnings.AddToContext(annotations.NewIncompatibleCustomBucketsHistogramsWarning("", posrange.PositionRange{}), ctx) + return nil + } return err } } @@ -430,16 +481,6 @@ type statAcc struct { hasValue bool } -func (s *statAcc) Add(v float64, h *histogram.FloatHistogram) error { - s.hasValue = true - s.count++ - - delta := v - s.mean - s.mean += delta / s.count - s.value += delta * (v - s.mean) - return nil -} - func (s *statAcc) ValueType() ValueType { if s.hasValue { return SingleTypeValue diff --git a/execution/aggregate/hashaggregate.go b/execution/aggregate/hashaggregate.go index 62da9f5d..ec49f387 100644 --- a/execution/aggregate/hashaggregate.go +++ b/execution/aggregate/hashaggregate.go @@ -147,7 +147,7 @@ func (a *aggregate) Next(ctx context.Context) ([]model.StepVector, error) { a.tables[i].reset(p) } if a.lastBatch != nil { - if err := a.aggregate(a.lastBatch); err != nil { + if err := a.aggregate(ctx, a.lastBatch); err != nil { return nil, err } a.lastBatch = nil @@ -163,7 +163,7 @@ func (a *aggregate) Next(ctx context.Context) ([]model.StepVector, error) { // Keep aggregating samples as long as timestamps of batches are equal. currentTs := a.tables[0].timestamp() if currentTs == math.MinInt64 || next[0].T == currentTs { - if err := a.aggregate(next); err != nil { + if err := a.aggregate(ctx, next); err != nil { return nil, err } continue @@ -186,9 +186,9 @@ func (a *aggregate) Next(ctx context.Context) ([]model.StepVector, error) { return result, nil } -func (a *aggregate) aggregate(in []model.StepVector) error { +func (a *aggregate) aggregate(ctx context.Context, in []model.StepVector) error { for i, vector := range in { - if err := a.tables[i].aggregate(vector); err != nil { + if err := a.tables[i].aggregate(ctx, vector); err != nil { return err } a.next.GetPool().PutStepVector(vector) diff --git a/execution/aggregate/scalar_table.go b/execution/aggregate/scalar_table.go index 401db8b5..db5e9928 100644 --- a/execution/aggregate/scalar_table.go +++ b/execution/aggregate/scalar_table.go @@ -28,7 +28,7 @@ type aggregateTable interface { // If the table is empty, it returns math.MinInt64. timestamp() int64 // aggregate aggregates the given vector into the table. - aggregate(vector model.StepVector) error + aggregate(ctx context.Context, vector model.StepVector) error // toVector writes out the accumulated result to the given vector and // resets the table. toVector(ctx context.Context, pool *model.VectorPool) model.StepVector @@ -77,34 +77,34 @@ func newScalarTable(inputSampleIDs []uint64, outputs []*model.Series, aggregatio }, nil } -func (t *scalarTable) aggregate(vector model.StepVector) error { +func (t *scalarTable) aggregate(ctx context.Context, vector model.StepVector) error { t.ts = vector.T for i := range vector.Samples { - if err := t.addSample(vector.SampleIDs[i], vector.Samples[i]); err != nil { + if err := t.addSample(ctx, vector.SampleIDs[i], vector.Samples[i]); err != nil { return err } } for i := range vector.Histograms { - if err := t.addHistogram(vector.HistogramIDs[i], vector.Histograms[i]); err != nil { + if err := t.addHistogram(ctx, vector.HistogramIDs[i], vector.Histograms[i]); err != nil { return err } } return nil } -func (t *scalarTable) addSample(sampleID uint64, sample float64) error { +func (t *scalarTable) addSample(ctx context.Context, sampleID uint64, sample float64) error { outputSampleID := t.inputs[sampleID] output := t.outputs[outputSampleID] - return t.accumulators[output.ID].Add(sample, nil) + return t.accumulators[output.ID].Add(ctx, sample, nil) } -func (t *scalarTable) addHistogram(sampleID uint64, h *histogram.FloatHistogram) error { +func (t *scalarTable) addHistogram(ctx context.Context, sampleID uint64, h *histogram.FloatHistogram) error { outputSampleID := t.inputs[sampleID] output := t.outputs[outputSampleID] - return t.accumulators[output.ID].Add(0, h) + return t.accumulators[output.ID].Add(ctx, 0, h) } func (t *scalarTable) reset(arg float64) { diff --git a/execution/aggregate/vector_table.go b/execution/aggregate/vector_table.go index f8561882..2c58570b 100644 --- a/execution/aggregate/vector_table.go +++ b/execution/aggregate/vector_table.go @@ -48,9 +48,9 @@ func (t *vectorTable) timestamp() int64 { return t.ts } -func (t *vectorTable) aggregate(vector model.StepVector) error { +func (t *vectorTable) aggregate(ctx context.Context, vector model.StepVector) error { t.ts = vector.T - return t.accumulator.AddVector(vector.Samples, vector.Histograms) + return t.accumulator.AddVector(ctx, vector.Samples, vector.Histograms) } func (t *vectorTable) toVector(ctx context.Context, pool *model.VectorPool) model.StepVector { @@ -96,7 +96,7 @@ func newVectorAccumulator(expr parser.ItemType) (vectorAccumulator, error) { return nil, errors.Wrap(parse.ErrNotSupportedExpr, msg) } -func histogramSum(current *histogram.FloatHistogram, histograms []*histogram.FloatHistogram) (*histogram.FloatHistogram, error) { +func histogramSum(ctx context.Context, current *histogram.FloatHistogram, histograms []*histogram.FloatHistogram) (*histogram.FloatHistogram, error) { if len(histograms) == 0 { return current, nil } @@ -116,11 +116,27 @@ func histogramSum(current *histogram.FloatHistogram, histograms []*histogram.Flo if histograms[i].Schema >= histSum.Schema { histSum, err = histSum.Add(histograms[i]) if err != nil { + if errors.Is(err, histogram.ErrHistogramsIncompatibleSchema) { + warnings.AddToContext(annotations.NewMixedExponentialCustomHistogramsWarning("", posrange.PositionRange{}), ctx) + return nil, nil + } + if errors.Is(err, histogram.ErrHistogramsIncompatibleBounds) { + warnings.AddToContext(annotations.NewIncompatibleCustomBucketsHistogramsWarning("", posrange.PositionRange{}), ctx) + return nil, nil + } return nil, err } } else { t := histograms[i].Copy() if histSum, err = t.Add(histSum); err != nil { + if errors.Is(err, histogram.ErrHistogramsIncompatibleSchema) { + warnings.AddToContext(annotations.NewMixedExponentialCustomHistogramsWarning("", posrange.PositionRange{}), ctx) + return nil, nil + } + if errors.Is(err, histogram.ErrHistogramsIncompatibleBounds) { + warnings.AddToContext(annotations.NewIncompatibleCustomBucketsHistogramsWarning("", posrange.PositionRange{}), ctx) + return nil, nil + } return nil, err } } diff --git a/execution/binary/scalar.go b/execution/binary/scalar.go index 1a411175..895302bd 100644 --- a/execution/binary/scalar.go +++ b/execution/binary/scalar.go @@ -162,7 +162,7 @@ func (o *scalarOperator) Next(ctx context.Context) ([]model.StepVector, error) { } for i := range vector.HistogramIDs { - val := o.histOp(vector.Histograms[i], scalarVal) + val := o.histOp(ctx, vector.Histograms[i], scalarVal) if val != nil { step.AppendHistogram(o.pool, vector.HistogramIDs[i], val) } diff --git a/execution/binary/utils.go b/execution/binary/utils.go index be4bc7f7..fed9467b 100644 --- a/execution/binary/utils.go +++ b/execution/binary/utils.go @@ -4,6 +4,7 @@ package binary import ( + "context" "fmt" "math" @@ -109,25 +110,117 @@ func newOperation(expr parser.ItemType, vectorBinOp bool) (operation, error) { } // histogramFloatOperation is an operation defined one histogram and one float. -type histogramFloatOperation func(lhsHist *histogram.FloatHistogram, rhsFloat float64) *histogram.FloatHistogram +type histogramFloatOperation func(ctx context.Context, lhsHist *histogram.FloatHistogram, rhsFloat float64) *histogram.FloatHistogram -func undefinedHistogramOp(_ *histogram.FloatHistogram, _ float64) *histogram.FloatHistogram { +func undefinedHistogramOp(_ context.Context, _ *histogram.FloatHistogram, _ float64) *histogram.FloatHistogram { return nil } var lhsHistogramOperations = map[string]histogramFloatOperation{ - "*": func(hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + "*": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { return hist.Copy().Mul(float) }, - "/": func(hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + "/": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { return hist.Copy().Div(float) }, + "+": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "+", "float", posrange.PositionRange{}), ctx) + return nil + }, + "-": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "-", "float", posrange.PositionRange{}), ctx) + return nil + }, + "^": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "^", "float", posrange.PositionRange{}), ctx) + return nil + }, + "%": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "%", "float", posrange.PositionRange{}), ctx) + return nil + }, + "==": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "==", "float", posrange.PositionRange{}), ctx) + return nil + }, + "!=": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "!=", "float", posrange.PositionRange{}), ctx) + return nil + }, + ">": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", ">", "float", posrange.PositionRange{}), ctx) + return nil + }, + "<": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "<", "float", posrange.PositionRange{}), ctx) + return nil + }, + ">=": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", ">=", "float", posrange.PositionRange{}), ctx) + return nil + }, + "<=": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "<=", "float", posrange.PositionRange{}), ctx) + return nil + }, + "atan2": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("histogram", "atan2", "float", posrange.PositionRange{}), ctx) + return nil + }, } var rhsHistogramOperations = map[string]histogramFloatOperation{ - "*": func(hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + "*": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { return hist.Copy().Mul(float) }, + "+": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "+", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "-": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "-", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "/": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "/", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "^": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "^", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "%": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "%", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "==": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "==", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "!=": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "!=", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + ">": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", ">", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "<": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "<", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + ">=": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", ">=", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "<=": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "<=", "histogram", posrange.PositionRange{}), ctx) + return nil + }, + "atan2": func(ctx context.Context, hist *histogram.FloatHistogram, float float64) *histogram.FloatHistogram { + warnings.AddToContext(annotations.NewIncompatibleTypesInBinOpInfo("float", "atan2", "histogram", posrange.PositionRange{}), ctx) + return nil + }, } func getHistogramFloatOperation(expr parser.ItemType, scalarSide ScalarSide) histogramFloatOperation { diff --git a/execution/binary/vector.go b/execution/binary/vector.go index e2617815..f27eeb32 100644 --- a/execution/binary/vector.go +++ b/execution/binary/vector.go @@ -148,7 +148,7 @@ func (o *vectorOperator) Next(ctx context.Context) ([]model.StepVector, error) { batch := o.pool.GetVectorBatch() for i, vector := range lhs { if i < len(rhs) { - step, err := o.execBinaryOperation(lhs[i], rhs[i]) + step, err := o.execBinaryOperation(ctx, lhs[i], rhs[i]) if err != nil { return nil, err } @@ -204,7 +204,7 @@ func (o *vectorOperator) init(ctx context.Context) error { return nil } -func (o *vectorOperator) execBinaryOperation(lhs, rhs model.StepVector) (model.StepVector, error) { +func (o *vectorOperator) execBinaryOperation(ctx context.Context, lhs, rhs model.StepVector) (model.StepVector, error) { switch o.opType { case parser.LAND: return o.execBinaryAnd(lhs, rhs) @@ -213,7 +213,7 @@ func (o *vectorOperator) execBinaryOperation(lhs, rhs model.StepVector) (model.S case parser.LUNLESS: return o.execBinaryUnless(lhs, rhs) default: - return o.execBinaryArithmetic(lhs, rhs) + return o.execBinaryArithmetic(ctx, lhs, rhs) } } @@ -267,18 +267,17 @@ func (o *vectorOperator) execBinaryUnless(lhs, rhs model.StepVector) (model.Step return step, nil } -// TODO: add support for histogram. -func (o *vectorOperator) computeBinaryPairing(hval, lval float64) (float64, bool, error) { +func (o *vectorOperator) computeBinaryPairing(ctx context.Context, hval, lval float64, hlhs, hrhs *histogram.FloatHistogram) (float64, *histogram.FloatHistogram, bool, error) { // operand is not commutative so we need to address potential swapping if o.matching.Card == parser.CardOneToMany { - v, _, keep, err := vectorElemBinop(o.opType, lval, hval, nil, nil) - return v, keep, err + v, h, keep, err := vectorElemBinop(ctx, o.opType, lval, hval, hlhs, hrhs) + return v, h, keep, err } - v, _, keep, err := vectorElemBinop(o.opType, hval, lval, nil, nil) - return v, keep, err + v, h, keep, err := vectorElemBinop(ctx, o.opType, hval, lval, hlhs, hrhs) + return v, h, keep, err } -func (o *vectorOperator) execBinaryArithmetic(lhs, rhs model.StepVector) (model.StepVector, error) { +func (o *vectorOperator) execBinaryArithmetic(ctx context.Context, lhs, rhs model.StepVector) (model.StepVector, error) { ts := lhs.T step := o.pool.GetStepVector(ts) diff --git a/execution/function/histogram.go b/execution/function/histogram.go index 2dbd775f..a0d4aaee 100644 --- a/execution/function/histogram.go +++ b/execution/function/histogram.go @@ -139,11 +139,11 @@ func (o *histogramOperator) Next(ctx context.Context) ([]model.StepVector, error } o.scalarOp.GetPool().PutVectors(scalars) - return o.processInputSeries(vectors) + return o.processInputSeries(ctx, vectors) } // nolint: unparam -func (o *histogramOperator) processInputSeries(vectors []model.StepVector) ([]model.StepVector, error) { +func (o *histogramOperator) processInputSeries(ctx context.Context, vectors []model.StepVector) ([]model.StepVector, error) { out := o.pool.GetVectorBatch() for stepIndex, vector := range vectors { o.resetBuckets() diff --git a/execution/scan/subquery.go b/execution/scan/subquery.go index 05ce3a8e..1237d20e 100644 --- a/execution/scan/subquery.go +++ b/execution/scan/subquery.go @@ -169,7 +169,7 @@ func (o *subqueryOperator) Next(ctx context.Context) ([]model.StepVector, error) sv := o.pool.GetStepVector(o.currentStep) for sampleId, rangeSamples := range o.buffers { - f, h, ok, err := rangeSamples.Eval(o.params[i], nil) + f, h, ok, err := rangeSamples.Eval(ctx, o.params[i], nil) if err != nil { return nil, err } @@ -233,7 +233,7 @@ func (o *subqueryOperator) initSeries(ctx context.Context) error { o.series = make([]labels.Labels, len(series)) o.buffers = make([]*ringbuffer.GenericRingBuffer, len(series)) for i := range o.buffers { - o.buffers[i] = ringbuffer.New(8, o.subQuery.Range.Milliseconds(), o.subQuery.Offset.Milliseconds(), o.call) + o.buffers[i] = ringbuffer.New(ctx, 8, o.subQuery.Range.Milliseconds(), o.subQuery.Offset.Milliseconds(), o.call) } var b labels.ScratchBuilder for i, s := range series { diff --git a/ringbuffer/functions.go b/ringbuffer/functions.go index f8fe84c4..a371a570 100644 --- a/ringbuffer/functions.go +++ b/ringbuffer/functions.go @@ -4,6 +4,7 @@ package ringbuffer import ( + "context" "math" "github.com/prometheus/prometheus/model/histogram" @@ -15,6 +16,7 @@ import ( type SamplesBuffer GenericRingBuffer type FunctionArgs struct { + ctx context.Context Samples []Sample StepTime int64 SelectRange int64 @@ -166,7 +168,7 @@ var rangeVectorFuncs = map[string]FunctionCall{ if len(f.Samples) < 2 { return 0., nil, false, nil } - v, h, err := extrapolatedRate(f.Samples, len(f.Samples), true, true, f.StepTime, f.SelectRange, f.Offset) + v, h, err := extrapolatedRate(f.ctx, f.Samples, len(f.Samples), true, true, f.StepTime, f.SelectRange, f.Offset) if err != nil { return 0, nil, false, err } @@ -176,7 +178,7 @@ var rangeVectorFuncs = map[string]FunctionCall{ if len(f.Samples) < 2 { return 0., nil, false, nil } - v, h, err := extrapolatedRate(f.Samples, len(f.Samples), false, false, f.StepTime, f.SelectRange, f.Offset) + v, h, err := extrapolatedRate(f.ctx, f.Samples, len(f.Samples), false, false, f.StepTime, f.SelectRange, f.Offset) if err != nil { return 0, nil, false, err } @@ -186,7 +188,7 @@ var rangeVectorFuncs = map[string]FunctionCall{ if len(f.Samples) < 2 { return 0., nil, false, nil } - v, h, err := extrapolatedRate(f.Samples, len(f.Samples), true, false, f.StepTime, f.SelectRange, f.Offset) + v, h, err := extrapolatedRate(f.ctx, f.Samples, len(f.Samples), true, false, f.StepTime, f.SelectRange, f.Offset) if err != nil { return 0, nil, false, err } @@ -212,7 +214,7 @@ var rangeVectorFuncs = map[string]FunctionCall{ if f.MetricAppearedTs == nil { panic("BUG: we got some Samples but metric still hasn't appeared") } - v, h, err := extendedRate(f.Samples, false, false, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) + v, h, err := extendedRate(f.ctx, f.Samples, false, false, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) if err != nil { return 0, nil, false, err } @@ -225,7 +227,7 @@ var rangeVectorFuncs = map[string]FunctionCall{ if f.MetricAppearedTs == nil { panic("BUG: we got some Samples but metric still hasn't appeared") } - v, h, err := extendedRate(f.Samples, true, false, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) + v, h, err := extendedRate(f.ctx, f.Samples, true, false, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) if err != nil { return 0, nil, false, err } @@ -252,7 +254,7 @@ func NewRangeVectorFunc(name string) (FunctionCall, error) { // It calculates the rate (allowing for counter resets if isCounter is true), // extrapolates if the first/last sample is close to the boundary, and returns // the result as either per-second (if isRate is true) or overall. -func extrapolatedRate(samples []Sample, numSamples int, isCounter, isRate bool, stepTime int64, selectRange int64, offset int64) (float64, *histogram.FloatHistogram, error) { +func extrapolatedRate(ctx context.Context, samples []Sample, numSamples int, isCounter, isRate bool, stepTime int64, selectRange int64, offset int64) (*float64, *histogram.FloatHistogram, error) { var ( rangeStart = stepTime - (selectRange + offset) rangeEnd = stepTime - offset @@ -262,7 +264,7 @@ func extrapolatedRate(samples []Sample, numSamples int, isCounter, isRate bool, var err error if samples[0].V.H != nil { - resultHistogram, err = histogramRate(samples, isCounter) + resultHistogram, err = histogramRate(ctx, samples, isCounter) if err != nil { return 0, nil, err } @@ -343,7 +345,7 @@ func extrapolatedRate(samples []Sample, numSamples int, isCounter, isRate bool, // It calculates the rate (allowing for counter resets if isCounter is true), // taking into account the last sample before the range start, and returns // the result as either per-second (if isRate is true) or overall. -func extendedRate(samples []Sample, isCounter, isRate bool, stepTime int64, selectRange int64, offset int64, metricAppearedTs int64) (float64, *histogram.FloatHistogram, error) { +func extendedRate(ctx context.Context, samples []Sample, isCounter, isRate bool, stepTime int64, selectRange int64, offset int64, metricAppearedTs int64) (float64, *histogram.FloatHistogram, error) { var ( rangeStart = stepTime - (selectRange + offset) rangeEnd = stepTime - offset @@ -354,7 +356,7 @@ func extendedRate(samples []Sample, isCounter, isRate bool, stepTime int64, sele if samples[0].V.H != nil { var err error // TODO - support extended rate for histograms - resultHistogram, err = histogramRate(samples, isCounter) + resultHistogram, err = histogramRate(ctx, samples, isCounter) if err != nil { return 0, nil, err } @@ -435,7 +437,7 @@ func extendedRate(samples []Sample, isCounter, isRate bool, stepTime int64, sele // histogramRate is a helper function for extrapolatedRate. It requires // points[0] to be a histogram. It returns nil if any other Point in points is // not a histogram. -func histogramRate(points []Sample, isCounter bool) (*histogram.FloatHistogram, error) { +func histogramRate(ctx context.Context, points []Sample, isCounter bool) (*histogram.FloatHistogram, error) { // Calculating a rate on a single sample is not defined. if len(points) < 2 { return nil, nil diff --git a/ringbuffer/generic.go b/ringbuffer/generic.go index 2d5f94af..007e8d11 100644 --- a/ringbuffer/generic.go +++ b/ringbuffer/generic.go @@ -4,6 +4,7 @@ package ringbuffer import ( + "context" "math" "github.com/prometheus/prometheus/model/histogram" @@ -20,6 +21,7 @@ type Sample struct { } type GenericRingBuffer struct { + ctx context.Context items []Sample tail []Sample @@ -30,12 +32,13 @@ type GenericRingBuffer struct { call FunctionCall } -func New(size int, selectRange, offset int64, call FunctionCall) *GenericRingBuffer { - return NewWithExtLookback(size, selectRange, offset, 0, call) +func New(ctx context.Context, size int, selectRange, offset int64, call FunctionCall) *GenericRingBuffer { + return NewWithExtLookback(ctx, size, selectRange, offset, 0, call) } -func NewWithExtLookback(size int, selectRange, offset, extLookback int64, call FunctionCall) *GenericRingBuffer { +func NewWithExtLookback(ctx context.Context, size int, selectRange, offset, extLookback int64, call FunctionCall) *GenericRingBuffer { return &GenericRingBuffer{ + ctx: ctx, items: make([]Sample, 0, size), selectRange: selectRange, offset: offset, @@ -103,8 +106,9 @@ func (r *GenericRingBuffer) Reset(mint int64, evalt int64) { r.items = r.items[:keep] } -func (r *GenericRingBuffer) Eval(scalarArg float64, metricAppearedTs *int64) (float64, *histogram.FloatHistogram, bool, error) { +func (r *GenericRingBuffer) Eval(ctx context.Context, scalarArg float64, metricAppearedTs *int64) (*float64, *histogram.FloatHistogram, bool, error) { return r.call(FunctionArgs{ + ctx: ctx, Samples: r.items, StepTime: r.currentStep, SelectRange: r.selectRange, diff --git a/ringbuffer/rate.go b/ringbuffer/rate.go index 4eadcd26..c58cebc2 100644 --- a/ringbuffer/rate.go +++ b/ringbuffer/rate.go @@ -4,6 +4,7 @@ package ringbuffer import ( + "context" "math" "slices" @@ -17,7 +18,7 @@ type Buffer interface { MaxT() int64 Push(t int64, v Value) Reset(mint int64, evalt int64) - Eval(_ float64, _ *int64) (float64, *histogram.FloatHistogram, bool, error) + Eval(ctx context.Context, _ float64, _ *int64) (*float64, *histogram.FloatHistogram, bool, error) ReadIntoLast(f func(*Sample)) } @@ -25,6 +26,7 @@ type Buffer interface { // series in a streaming manner, calculating the value incrementally for each // step where the sample is used. type RateBuffer struct { + ctx context.Context // stepRanges contain the bounds and number of samples for each evaluation step. stepRanges []stepRange // firstSamples contains the first sample for each evaluation step. @@ -77,6 +79,7 @@ func NewRateBuffer(opts query.Options, isCounter, isRate bool, selectRange, offs } return &RateBuffer{ + ctx: ctx, isCounter: isCounter, isRate: isRate, selectRange: selectRange, @@ -168,7 +171,7 @@ func (r *RateBuffer) Reset(mint int64, evalt int64) { r.firstSamples[last].T = math.MaxInt64 } -func (r *RateBuffer) Eval(_ float64, _ *int64) (float64, *histogram.FloatHistogram, bool, error) { +func (r *RateBuffer) Eval(ctx context.Context, _ float64, _ *int64) (*float64, *histogram.FloatHistogram, bool, error) { if r.firstSamples[0].T == math.MaxInt64 || r.firstSamples[0].T == r.last.T { return 0, nil, false, nil } @@ -180,7 +183,7 @@ func (r *RateBuffer) Eval(_ float64, _ *int64) (float64, *histogram.FloatHistogr ) r.rateBuffer = slices.CompactFunc(r.rateBuffer, func(s1 Sample, s2 Sample) bool { return s1.T == s2.T }) numSamples := r.stepRanges[0].numSamples - f, h, err := extrapolatedRate(r.rateBuffer, numSamples, r.isCounter, r.isRate, r.evalTs, r.selectRange, r.offset) + f, h, err := extrapolatedRate(ctx, r.rateBuffer, numSamples, r.isCounter, r.isRate, r.evalTs, r.selectRange, r.offset) return f, h, true, err } diff --git a/storage/prometheus/matrix_selector.go b/storage/prometheus/matrix_selector.go index 1afd3dc9..20df3205 100644 --- a/storage/prometheus/matrix_selector.go +++ b/storage/prometheus/matrix_selector.go @@ -182,7 +182,7 @@ func (o *matrixSelector) Next(ctx context.Context) ([]model.StepVector, error) { // Also, allow operator to exist independently without being nested // under parser.Call by implementing new data model. // https://github.com/thanos-io/promql-engine/issues/39 - f, h, ok, err := scanner.buffer.Eval(o.scalarArg, scanner.metricAppearedTs) + f, h, ok, err := scanner.buffer.Eval(ctx, o.scalarArg, scanner.metricAppearedTs) if err != nil { return nil, err } @@ -217,6 +217,7 @@ func (o *matrixSelector) loadSeries(ctx context.Context) error { o.scanners = make([]matrixScanner, len(series)) o.series = make([]labels.Labels, len(series)) b := labels.ScratchBuilder{} + for i, s := range series { lbls := s.Labels() if o.functionName != "last_over_time" { @@ -232,7 +233,7 @@ func (o *matrixSelector) loadSeries(ctx context.Context) error { signature: s.Signature, iterator: s.Iterator(nil), lastSample: ringbuffer.Sample{T: math.MinInt64}, - buffer: o.newBuffer(), + buffer: o.newBuffer(ctx), } o.series[i] = lbls } @@ -245,20 +246,20 @@ func (o *matrixSelector) loadSeries(ctx context.Context) error { return err } -func (o *matrixSelector) newBuffer() ringbuffer.Buffer { +func (o *matrixSelector) newBuffer(ctx context.Context) ringbuffer.Buffer { switch o.functionName { case "rate": - return ringbuffer.NewRateBuffer(*o.opts, true, true, o.selectRange, o.offset) + return ringbuffer.NewRateBuffer(ctx, *o.opts, true, true, o.selectRange, o.offset) case "increase": - return ringbuffer.NewRateBuffer(*o.opts, true, false, o.selectRange, o.offset) + return ringbuffer.NewRateBuffer(ctx, *o.opts, true, false, o.selectRange, o.offset) case "delta": - return ringbuffer.NewRateBuffer(*o.opts, false, false, o.selectRange, o.offset) + return ringbuffer.NewRateBuffer(ctx, *o.opts, false, false, o.selectRange, o.offset) } if o.isExtFunction { - return ringbuffer.NewWithExtLookback(8, o.selectRange, o.offset, o.opts.ExtLookbackDelta.Milliseconds()-1, o.call) + return ringbuffer.NewWithExtLookback(ctx, 8, o.selectRange, o.offset, o.opts.ExtLookbackDelta.Milliseconds()-1, o.call) } - return ringbuffer.New(8, o.selectRange, o.offset, o.call) + return ringbuffer.New(ctx, 8, o.selectRange, o.offset, o.call) } From 753b09b12f16d1116adccd74896103c962a4257d Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:28:28 +0900 Subject: [PATCH 03/19] Add histogram address logic to stdDev, stdVar Signed-off-by: SungJin1212 --- execution/aggregate/accumulator.go | 60 ++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/execution/aggregate/accumulator.go b/execution/aggregate/accumulator.go index 57a5def4..6c7e073d 100644 --- a/execution/aggregate/accumulator.go +++ b/execution/aggregate/accumulator.go @@ -7,8 +7,13 @@ import ( "context" "math" + "github.com/efficientgo/core/errors" "github.com/prometheus/prometheus/model/histogram" + "github.com/prometheus/prometheus/promql/parser/posrange" + "github.com/prometheus/prometheus/util/annotations" "gonum.org/v1/gonum/floats" + + "github.com/thanos-io/promql-engine/execution/warnings" ) type ValueType int @@ -152,7 +157,6 @@ func (c *maxAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram return nil } -func (c *maxAcc) Add(v float64, h *histogram.FloatHistogram) error { if !c.hasValue { c.value = v c.hasValue = true @@ -499,11 +503,35 @@ type stdDevAcc struct { statAcc } -func newStdDevAcc() accumulator { +func newStdDevAcc() *stdDevAcc { return &stdDevAcc{} } +func (s *stdDevAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { + if h != nil { + // ignore native histogram for STDDEV. + warnings.AddToContext(annotations.NewHistogramIgnoredInAggregationInfo("stddev", posrange.PositionRange{}), ctx) + return nil + } + + s.hasValue = true + s.count++ + + if math.IsNaN(v) || math.IsInf(v, 0) { + s.value = math.NaN() + } else { + delta := v - s.mean + s.mean += delta / s.count + s.value += delta * (v - s.mean) + } + return nil +} + func (s *stdDevAcc) Value() (float64, *histogram.FloatHistogram) { + if math.IsNaN(s.value) { + return math.NaN(), nil + } + if s.count == 1 { return 0, nil } @@ -514,11 +542,35 @@ type stdVarAcc struct { statAcc } -func newStdVarAcc() accumulator { +func newStdVarAcc() *stdVarAcc { return &stdVarAcc{} } +func (s *stdVarAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { + if h != nil { + // ignore native histogram for STDVAR. + warnings.AddToContext(annotations.NewHistogramIgnoredInAggregationInfo("stdvar", posrange.PositionRange{}), ctx) + return nil + } + + s.hasValue = true + s.count++ + + if math.IsNaN(v) || math.IsInf(v, 0) { + s.value = math.NaN() + } else { + delta := v - s.mean + s.mean += delta / s.count + s.value += delta * (v - s.mean) + } + return nil +} + func (s *stdVarAcc) Value() (float64, *histogram.FloatHistogram) { + if math.IsNaN(s.value) { + return math.NaN(), nil + } + if s.count == 1 { return 0, nil } @@ -571,7 +623,7 @@ func newHistogramAvg() *histogramAvg { } } -func (acc *histogramAvg) Add(v float64, h *histogram.FloatHistogram) error { +func (acc *histogramAvg) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { if h == nil { acc.hasFloat = true } From 497f9f06f9c98087a48c932d93e54366982db190 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:29:18 +0900 Subject: [PATCH 04/19] Add HistogramIgnoredInAggregationInfo to quantile accumulator Signed-off-by: SungJin1212 --- execution/aggregate/accumulator.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/execution/aggregate/accumulator.go b/execution/aggregate/accumulator.go index 6c7e073d..2408cf16 100644 --- a/execution/aggregate/accumulator.go +++ b/execution/aggregate/accumulator.go @@ -587,7 +587,12 @@ func newQuantileAcc() accumulator { return &quantileAcc{} } -func (q *quantileAcc) Add(v float64, h *histogram.FloatHistogram) error { +func (q *quantileAcc) Add(ctx context.Context, v float64, h *histogram.FloatHistogram) error { + if h != nil { + warnings.AddToContext(annotations.NewHistogramIgnoredInAggregationInfo("quantile", posrange.PositionRange{}), ctx) + return nil + } + q.hasValue = true q.points = append(q.points, v) return nil From e6bd19bb829a937c4ea42184dc104c8f4b2469b0 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:29:48 +0900 Subject: [PATCH 05/19] Change count_values func applying histogram Signed-off-by: SungJin1212 --- execution/aggregate/count_values.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/execution/aggregate/count_values.go b/execution/aggregate/count_values.go index af956d4f..da10964c 100644 --- a/execution/aggregate/count_values.go +++ b/execution/aggregate/count_values.go @@ -171,6 +171,16 @@ func (c *countValuesOperator) initSeriesOnce(ctx context.Context) error { countPerHashbucket[hash][fStr]++ } + for j := range in[i].Histograms { + hash := inputIdToHashBucket[int(in[i].HistogramIDs[j])] + if _, ok := countPerHashbucket[hash]; !ok { + countPerHashbucket[hash] = make(map[string]int) + } + // Using string as the key to the map so that -0 and 0 are treated as separate values. + fStr := in[i].Histograms[j].String() + countPerHashbucket[hash][fStr]++ + } + countsPerOutputId := make(map[int]int) for hash, counts := range countPerHashbucket { b.Reset(hashToBucketLabels[hash]) From 9cc7f6cc8e7aa844e147c38fbf3996c2b6ad7cdc Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:30:18 +0900 Subject: [PATCH 06/19] Add warning to kAggregate Signed-off-by: SungJin1212 --- execution/aggregate/khashaggregate.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/execution/aggregate/khashaggregate.go b/execution/aggregate/khashaggregate.go index 524e7f06..1a21fdf5 100644 --- a/execution/aggregate/khashaggregate.go +++ b/execution/aggregate/khashaggregate.go @@ -13,12 +13,15 @@ import ( "time" "github.com/efficientgo/core/errors" + "github.com/prometheus/prometheus/promql/parser/posrange" + "github.com/prometheus/prometheus/util/annotations" "golang.org/x/exp/slices" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql/parser" "github.com/thanos-io/promql-engine/execution/model" + "github.com/thanos-io/promql-engine/execution/warnings" "github.com/thanos-io/promql-engine/query" ) @@ -130,6 +133,10 @@ func (a *kAggregate) Next(ctx context.Context) ([]model.StepVector, error) { result = append(result, a.GetPool().GetStepVector(vector.T)) continue } + if len(vector.Histograms) > 0 { + warnings.AddToContext(annotations.NewHistogramIgnoredInAggregationInfo(a.aggregation.String(), posrange.PositionRange{}), ctx) + } + a.aggregate(vector.T, &result, int(a.params[i]), vector.SampleIDs, vector.Samples) a.next.GetPool().PutStepVector(vector) } From 653803fb2d0bc85ff1b5c45a7c4846f476225dcc Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:30:48 +0900 Subject: [PATCH 07/19] Implement histogram binops Signed-off-by: SungJin1212 --- execution/binary/utils.go | 3 + execution/binary/vector.go | 266 ++++++++++++++++++++++++++----------- 2 files changed, 191 insertions(+), 78 deletions(-) diff --git a/execution/binary/utils.go b/execution/binary/utils.go index fed9467b..907d5d5e 100644 --- a/execution/binary/utils.go +++ b/execution/binary/utils.go @@ -11,8 +11,11 @@ import ( "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql/parser" + "github.com/prometheus/prometheus/promql/parser/posrange" + "github.com/prometheus/prometheus/util/annotations" "github.com/thanos-io/promql-engine/execution/parse" + "github.com/thanos-io/promql-engine/execution/warnings" ) type binOpSide string diff --git a/execution/binary/vector.go b/execution/binary/vector.go index f27eeb32..ebe15dcc 100644 --- a/execution/binary/vector.go +++ b/execution/binary/vector.go @@ -12,6 +12,8 @@ import ( "github.com/cespare/xxhash/v2" "github.com/efficientgo/core/errors" + "github.com/prometheus/prometheus/promql/parser/posrange" + "github.com/prometheus/prometheus/util/annotations" "github.com/zhangyunhao116/umap" "golang.org/x/exp/slices" @@ -20,13 +22,15 @@ import ( "github.com/prometheus/prometheus/promql/parser" "github.com/thanos-io/promql-engine/execution/model" + "github.com/thanos-io/promql-engine/execution/warnings" "github.com/thanos-io/promql-engine/query" ) type joinBucket struct { - ats, bts int64 - sid uint64 - val float64 + ats, bts int64 + sid uint64 + val float64 + histogramVal *histogram.FloatHistogram } // vectorOperator evaluates an expression between two step vectors. @@ -231,6 +235,17 @@ func (o *vectorOperator) execBinaryAnd(lhs, rhs model.StepVector) (model.StepVec step.AppendSample(o.pool, o.outputSeriesID(sampleID+1, jp.sid+1), lhs.Samples[i]) } } + + for _, histogramID := range rhs.HistogramIDs { + jp := o.lcJoinBuckets[histogramID] + jp.sid = histogramID + jp.ats = ts + } + for i, histogramID := range lhs.HistogramIDs { + if jp := o.hcJoinBuckets[histogramID]; jp.ats == ts { + step.AppendHistogram(o.pool, o.outputSeriesID(histogramID+1, jp.sid+1), lhs.Histograms[i]) + } + } return step, nil } @@ -294,10 +309,11 @@ func (o *vectorOperator) execBinaryArithmetic(ctx context.Context, lhs, rhs mode return step, errors.Newf("Unexpected matching cardinality: %s", o.matching.Card.String()) } - // shortcut: if we have no samples on the high card side we cannot compute pairings - if len(hcs.Samples) == 0 { + // shortcut: if we have no samples and histograms on the high card side we cannot compute pairings + if len(hcs.Samples) == 0 && len(hcs.Histograms) == 0 { return step, nil } + var lastErr error for i, sampleID := range lcs.SampleIDs { jp := o.lcJoinBuckets[sampleID] @@ -310,8 +326,19 @@ func (o *vectorOperator) execBinaryArithmetic(ctx context.Context, lhs, rhs mode jp.ats = ts } - for i, sampleID := range hcs.SampleIDs { - jp := o.hcJoinBuckets[sampleID] + for i, histogramID := range lcs.HistogramIDs { + jp := o.lcJoinBuckets[histogramID] + // Hash collisions on the low-card-side would imply a many-to-many relation. + if jp.ats == ts { + return model.StepVector{}, o.newManyToManyMatchErrorOnLowCardSide(jp.sid, histogramID) + } + jp.sid = histogramID + jp.histogramVal = lcs.Histograms[i] + jp.ats = ts + } + + for i, histogramID := range hcs.HistogramIDs { + jp := o.hcJoinBuckets[histogramID] if jp.ats != ts { continue } @@ -322,21 +349,88 @@ func (o *vectorOperator) execBinaryArithmetic(ctx context.Context, lhs, rhs mode } jp.bts = ts - val, keep, err := o.computeBinaryPairing(hcs.Samples[i], jp.val) + var h *histogram.FloatHistogram + var keep bool + var err error + + if jp.histogramVal != nil { + _, h, keep, err = o.computeBinaryPairing(ctx, 0, 0, hcs.Histograms[i], jp.histogramVal) + } else { + _, h, keep, err = o.computeBinaryPairing(ctx, 0, jp.val, hcs.Histograms[i], nil) + } if err != nil { - return model.StepVector{}, err + if errors.Is(err, annotations.PromQLInfo) || errors.Is(err, annotations.PromQLWarning) { + // just continue when the errors are info and warn + continue + } else { + lastErr = err + continue + } } - if o.returnBool { - val = 0 + + switch { + case o.returnBool: + h = nil if keep { - val = 1 + step.AppendSample(o.pool, jp.sid, 1.0) + } else { + step.AppendSample(o.pool, jp.sid, 0.0) } - } else if !keep { + case !keep: continue } - step.AppendSample(o.pool, o.outputSeriesID(sampleID+1, jp.sid+1), val) + + if h != nil { + step.AppendHistogram(o.pool, histogramID, h) + } } - return step, nil + + for i, sampleID := range hcs.SampleIDs { + jp := o.hcJoinBuckets[sampleID] + if jp.ats != ts { + continue + } + // Hash collisions on the high card side are expected except if a one-to-one + // matching was requested and we have an implicit many-to-one match instead. + if jp.bts == ts && o.matching.Card == parser.CardOneToOne { + return model.StepVector{}, o.newImplicitManyToOneError() + } + jp.bts = ts + var val float64 + var h *histogram.FloatHistogram + var keep bool + var err error + + if jp.histogramVal != nil { + _, h, _, err = o.computeBinaryPairing(ctx, hcs.Samples[i], 0, nil, jp.histogramVal) + if err != nil { + if errors.Is(err, annotations.PromQLInfo) || errors.Is(err, annotations.PromQLWarning) { + // just continue when the errors are info and warn + continue + } else { + lastErr = err + continue + } + } + step.AppendHistogram(o.pool, jp.sid, h) + } else { + val, _, keep, err = o.computeBinaryPairing(ctx, hcs.Samples[i], jp.val, nil, nil) + if err != nil { + return model.StepVector{}, err + } + if o.returnBool { + val = 0 + if keep { + val = 1 + } + } else if !keep { + continue + } + step.AppendSample(o.pool, o.outputSeriesID(sampleID+1, jp.sid+1), val) + } + + } + return step, lastErr } func (o *vectorOperator) newManyToManyMatchErrorOnLowCardSide(originalSampleId, duplicateSampleId uint64) error { side := rhBinOpSide @@ -506,78 +600,94 @@ func signatureFunc(on bool, names ...string) func(labels.Labels) uint64 { } } -// Lifted from: https://github.com/prometheus/prometheus/blob/a38179c4e183d9b50b271167bf90050eda8ec3d1/promql/engine.go#L2430. -// TODO: call with histogram values in followup PR. +// Lifted from: https://github.com/prometheus/prometheus/blob/v3.1.0/promql/engine.go#L2797. // nolint: unparam -func vectorElemBinop(op parser.ItemType, lhs, rhs float64, hlhs, hrhs *histogram.FloatHistogram) (float64, *histogram.FloatHistogram, bool, error) { - switch op { - case parser.ADD: - if hlhs != nil && hrhs != nil { - // The histogram being added must have the larger schema - // code (i.e. the higher resolution). - if hrhs.Schema >= hlhs.Schema { - sum, err := hlhs.Copy().Add(hrhs) - if err != nil { - return 0, nil, false, err - } - return 0, sum.Compact(0), true, nil +// vectorElemBinop evaluates a binary operation between two Vector elements. +func vectorElemBinop(ctx context.Context, op parser.ItemType, lhs, rhs float64, hlhs, hrhs *histogram.FloatHistogram) (float64, *histogram.FloatHistogram, bool, error) { + opName := parser.ItemTypeStr[op] + switch { + case hlhs == nil && hrhs == nil: + { + switch op { + case parser.ADD: + return lhs + rhs, nil, true, nil + case parser.SUB: + return lhs - rhs, nil, true, nil + case parser.MUL: + return lhs * rhs, nil, true, nil + case parser.DIV: + return lhs / rhs, nil, true, nil + case parser.POW: + return math.Pow(lhs, rhs), nil, true, nil + case parser.MOD: + return math.Mod(lhs, rhs), nil, true, nil + case parser.EQLC: + return lhs, nil, lhs == rhs, nil + case parser.NEQ: + return lhs, nil, lhs != rhs, nil + case parser.GTR: + return lhs, nil, lhs > rhs, nil + case parser.LSS: + return lhs, nil, lhs < rhs, nil + case parser.GTE: + return lhs, nil, lhs >= rhs, nil + case parser.LTE: + return lhs, nil, lhs <= rhs, nil + case parser.ATAN2: + return math.Atan2(lhs, rhs), nil, true, nil } - sum, err := hrhs.Copy().Add(hlhs) - if err != nil { + } + case hlhs == nil && hrhs != nil: + { + switch op { + case parser.MUL: + return 0, hrhs.Copy().Mul(lhs).Compact(0), true, nil + case parser.ADD, parser.SUB, parser.DIV, parser.POW, parser.MOD, parser.EQLC, parser.NEQ, parser.GTR, parser.LSS, parser.GTE, parser.LTE, parser.ATAN2: + err := annotations.NewIncompatibleTypesInBinOpInfo("float", opName, "histogram", posrange.PositionRange{}) + warnings.AddToContext(err, ctx) + return 0, nil, false, err + } + } + case hlhs != nil && hrhs == nil: + { + switch op { + case parser.MUL: + return 0, hlhs.Copy().Mul(rhs).Compact(0), true, nil + case parser.DIV: + return 0, hlhs.Copy().Div(rhs).Compact(0), true, nil + case parser.ADD, parser.SUB, parser.POW, parser.MOD, parser.EQLC, parser.NEQ, parser.GTR, parser.LSS, parser.GTE, parser.LTE, parser.ATAN2: + err := annotations.NewIncompatibleTypesInBinOpInfo("histogram", opName, "float", posrange.PositionRange{}) + warnings.AddToContext(err, ctx) return 0, nil, false, err } - return 0, sum.Compact(0), true, nil - } - return lhs + rhs, nil, true, nil - case parser.SUB: - if hlhs != nil && hrhs != nil { - // The histogram being subtracted must have the larger schema - // code (i.e. the higher resolution). - if hrhs.Schema >= hlhs.Schema { - diff, err := hlhs.Copy().Sub(hrhs) + } + case hlhs != nil && hrhs != nil: + { + switch op { + case parser.ADD: + res, err := hlhs.Copy().Add(hrhs) if err != nil { return 0, nil, false, err } - return 0, diff.Compact(0), true, nil - } - diff, err := hrhs.Copy().Mul(-1).Add(hlhs) - if err != nil { + return 0, res.Compact(0), true, nil + case parser.SUB: + res, err := hlhs.Copy().Sub(hrhs) + if err != nil { + return 0, nil, false, err + } + return 0, res.Compact(0), true, nil + case parser.EQLC: + // This operation expects that both histograms are compacted. + return 0, hlhs, hlhs.Equals(hrhs), nil + case parser.NEQ: + // This operation expects that both histograms are compacted. + return 0, hlhs, !hlhs.Equals(hrhs), nil + case parser.MUL, parser.DIV, parser.POW, parser.MOD, parser.GTR, parser.LSS, parser.GTE, parser.LTE, parser.ATAN2: + err := annotations.NewIncompatibleTypesInBinOpInfo("histogram", opName, "histogram", posrange.PositionRange{}) + warnings.AddToContext(err, ctx) return 0, nil, false, err } - return 0, diff.Compact(0), true, nil - } - return lhs - rhs, nil, true, nil - case parser.MUL: - if hlhs != nil && hrhs == nil { - return 0, hlhs.Copy().Mul(rhs), true, nil - } - if hlhs == nil && hrhs != nil { - return 0, hrhs.Copy().Mul(lhs), true, nil - } - return lhs * rhs, nil, true, nil - case parser.DIV: - if hlhs != nil && hrhs == nil { - return 0, hlhs.Copy().Div(rhs), true, nil - } - return lhs / rhs, nil, true, nil - case parser.POW: - return math.Pow(lhs, rhs), nil, true, nil - case parser.MOD: - return math.Mod(lhs, rhs), nil, true, nil - case parser.EQLC: - return lhs, nil, lhs == rhs, nil - case parser.NEQ: - return lhs, nil, lhs != rhs, nil - case parser.GTR: - return lhs, nil, lhs > rhs, nil - case parser.LSS: - return lhs, nil, lhs < rhs, nil - case parser.GTE: - return lhs, nil, lhs >= rhs, nil - case parser.LTE: - return lhs, nil, lhs <= rhs, nil - case parser.ATAN2: - return math.Atan2(lhs, rhs), nil, true, nil + } } panic(errors.Newf("operator %q not allowed for operations between Vectors", op)) } From 5fd39e206985a854dae5cbf39f5251dc6c38283d Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:31:17 +0900 Subject: [PATCH 08/19] Add NewPossibleNonCounterInfo Signed-off-by: SungJin1212 --- storage/prometheus/matrix_selector.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/storage/prometheus/matrix_selector.go b/storage/prometheus/matrix_selector.go index 20df3205..2c19724d 100644 --- a/storage/prometheus/matrix_selector.go +++ b/storage/prometheus/matrix_selector.go @@ -7,6 +7,7 @@ import ( "context" "fmt" "math" + "strings" "sync" "time" @@ -14,10 +15,13 @@ import ( "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/model/value" + "github.com/prometheus/prometheus/promql/parser/posrange" "github.com/prometheus/prometheus/tsdb/chunkenc" + "github.com/prometheus/prometheus/util/annotations" "github.com/thanos-io/promql-engine/execution/model" "github.com/thanos-io/promql-engine/execution/parse" + "github.com/thanos-io/promql-engine/execution/warnings" "github.com/thanos-io/promql-engine/extlabels" "github.com/thanos-io/promql-engine/query" "github.com/thanos-io/promql-engine/ringbuffer" @@ -65,6 +69,7 @@ type matrixSelector struct { // Lookback delta for extended range functions. extLookbackDelta int64 + inputSeries []SignedSeries } var ErrNativeHistogramsNotSupported = errors.New("native histograms are not supported in extended range functions") @@ -190,8 +195,21 @@ func (o *matrixSelector) Next(ctx context.Context) ([]model.StepVector, error) { vectors[currStep].T = seriesTs if h != nil { vectors[currStep].AppendHistogram(o.vectorPool, scanner.signature, h) - } else { - vectors[currStep].AppendSample(o.vectorPool, scanner.signature, f) + } else if f != nil { + if o.functionName == "rate" || o.functionName == "increase" { + if len(o.inputSeries) > 0 { + metricName := o.inputSeries[0].Labels().Get(labels.MetricName) + if metricName != "" && + !strings.HasSuffix(metricName, "_total") && + !strings.HasSuffix(metricName, "_sum") && + !strings.HasSuffix(metricName, "_count") && + !strings.HasSuffix(metricName, "_bucket") { + warnings.AddToContext(annotations.NewPossibleNonCounterInfo(metricName, posrange.PositionRange{}), ctx) + } + } + } + + vectors[currStep].AppendSample(o.vectorPool, scanner.signature, *f) } } o.IncrementSamplesAtTimestamp(scanner.buffer.Len(), seriesTs) @@ -214,6 +232,8 @@ func (o *matrixSelector) loadSeries(ctx context.Context) error { return } + o.inputSeries = series + o.scanners = make([]matrixScanner, len(series)) o.series = make([]labels.Labels, len(series)) b := labels.ScratchBuilder{} From ffc03e8255035b36c0ad159f208f7a4334411879 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:32:21 +0900 Subject: [PATCH 09/19] Add histogram address login to some funcs Signed-off-by: SungJin1212 --- execution/function/functions.go | 51 +++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/execution/function/functions.go b/execution/function/functions.go index a26546dd..c17e56ad 100644 --- a/execution/function/functions.go +++ b/execution/function/functions.go @@ -53,6 +53,10 @@ var instantVectorFuncs = map[string]functionCall{ return sign }), "round": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + if len(vargs) > 1 { return 0., false } @@ -71,6 +75,10 @@ var instantVectorFuncs = map[string]functionCall{ return f, true }, "clamp": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + if len(vargs) != 2 { return 0., false } @@ -86,6 +94,10 @@ var instantVectorFuncs = map[string]functionCall{ return math.Max(min, math.Min(max, v)), true }, "clamp_min": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + if len(vargs) != 1 { return 0., false } @@ -96,6 +108,10 @@ var instantVectorFuncs = map[string]functionCall{ return math.Max(min, v), true }, "clamp_max": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + if len(vargs) != 1 { return 0., false } @@ -131,27 +147,59 @@ var instantVectorFuncs = map[string]functionCall{ }, // variants of date time functions with an argument "days_in_month": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return daysInMonth(dateFromSampleValue(f)), true }, "day_of_month": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return dayOfMonth(dateFromSampleValue(f)), true }, "day_of_week": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return dayOfWeek(dateFromSampleValue(f)), true }, "day_of_year": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return dayOfYear(dateFromSampleValue(f)), true }, "hour": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return hour(dateFromSampleValue(f)), true }, "minute": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return minute(dateFromSampleValue(f)), true }, "month": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return month(dateFromSampleValue(f)), true }, "year": func(f float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } + return year(dateFromSampleValue(f)), true }, // hack we only have sort functions as argument for "timestamp" possibly so they dont actually @@ -209,6 +257,9 @@ var noArgFuncs = map[string]noArgFunctionCall{ func simpleFunc(f func(float64) float64) functionCall { return func(v float64, h *histogram.FloatHistogram, vargs ...float64) (float64, bool) { + if h != nil { + return 0., false + } return f(v), true } } From 2be039d93d0a31a26503019468e8561bbb79901b Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:32:35 +0900 Subject: [PATCH 10/19] Add NewHistogramQuantileForcedMonotonicityInfo Signed-off-by: SungJin1212 --- execution/function/histogram.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/execution/function/histogram.go b/execution/function/histogram.go index a0d4aaee..98d5ef40 100644 --- a/execution/function/histogram.go +++ b/execution/function/histogram.go @@ -189,8 +189,11 @@ func (o *histogramOperator) processInputSeries(ctx context.Context, vectors []mo continue } - val := bucketQuantile(o.scalarPoints[stepIndex], stepBuckets) + val, forcedMonotonicity, _ := bucketQuantile(o.scalarPoints[stepIndex], stepBuckets) step.AppendSample(o.pool, uint64(i), val) + if forcedMonotonicity { + warnings.AddToContext(annotations.NewHistogramQuantileForcedMonotonicityInfo("", posrange.PositionRange{}), ctx) + } } out = append(out, step) From 50708181174d790242e2daec1c1d6fdbb41a8181 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:33:37 +0900 Subject: [PATCH 11/19] Change bucketQuantile to return forcedMonotonic Signed-off-by: SungJin1212 --- execution/function/quantile.go | 110 +++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 40 deletions(-) diff --git a/execution/function/quantile.go b/execution/function/quantile.go index e2cc6dd5..4a78629e 100644 --- a/execution/function/quantile.go +++ b/execution/function/quantile.go @@ -15,8 +15,28 @@ import ( "sort" "github.com/prometheus/prometheus/model/histogram" + "github.com/prometheus/prometheus/util/almost" ) +// smallDeltaTolerance is the threshold for relative deltas between classic +// histogram buckets that will be ignored by the histogram_quantile function +// because they are most likely artifacts of floating point precision issues. +// Testing on 2 sets of real data with bugs arising from small deltas, +// the safe ranges were from: +// - 1e-05 to 1e-15 +// - 1e-06 to 1e-15 +// Anything to the left of that would cause non-query-sharded data to have +// small deltas ignored (unnecessary and we should avoid this), and anything +// to the right of that would cause query-sharded data to not have its small +// deltas ignored (so the problem won't be fixed). +// For context, query sharding triggers these float precision errors in Mimir. +// To illustrate, with a relative deviation of 1e-12, we need to have 1e12 +// observations in the bucket so that the change of one observation is small +// enough to get ignored. With the usual observation rate even of very busy +// services, this will hardly be reached in timeframes that matters for +// monitoring. +const smallDeltaTolerance = 1e-12 + type le struct { upperBound float64 count float64 @@ -55,39 +75,39 @@ func (b buckets) Less(i, j int) bool { return b[i].upperBound < b[j].upperBound // If q<0, -Inf is returned. // // If q>1, +Inf is returned. -func bucketQuantile(q float64, buckets buckets) float64 { +func bucketQuantile(q float64, buckets buckets) (float64, bool, bool) { if math.IsNaN(q) { - return math.NaN() + return math.NaN(), false, false } if q < 0 { - return math.Inf(-1) + return math.Inf(-1), false, false } if q > 1 { - return math.Inf(+1) + return math.Inf(+1), false, false } sort.Sort(buckets) if !math.IsInf(buckets[len(buckets)-1].upperBound, +1) { - return math.NaN() + return math.NaN(), false, false } buckets = coalesceBuckets(buckets) - ensureMonotonic(buckets) + forcedMonotonic, fixedPrecision := ensureMonotonicAndIgnoreSmallDeltas(buckets, smallDeltaTolerance) if len(buckets) < 2 { - return math.NaN() + return math.NaN(), false, false } observations := buckets[len(buckets)-1].count if observations == 0 { - return math.NaN() + return math.NaN(), false, false } rank := q * observations b := sort.Search(len(buckets)-1, func(i int) bool { return buckets[i].count >= rank }) if b == len(buckets)-1 { - return buckets[len(buckets)-2].upperBound + return buckets[len(buckets)-2].upperBound, forcedMonotonic, fixedPrecision } if b == 0 && buckets[0].upperBound <= 0 { - return buckets[0].upperBound + return buckets[0].upperBound, forcedMonotonic, fixedPrecision } var ( bucketStart float64 @@ -99,7 +119,7 @@ func bucketQuantile(q float64, buckets buckets) float64 { count -= buckets[b-1].count rank -= buckets[b-1].count } - return bucketStart + (bucketEnd-bucketStart)*(rank/count) + return bucketStart + (bucketEnd-bucketStart)*(rank/count), forcedMonotonic, fixedPrecision } // coalesceBuckets merges buckets with the same upper bound. @@ -124,46 +144,56 @@ func coalesceBuckets(buckets buckets) buckets { // The assumption that bucket counts increase monotonically with increasing // upperBound may be violated during: // -// * Recording rule evaluation of histogram_quantile, especially when rate() -// has been applied to the underlying bucket timeseries. -// * Evaluation of histogram_quantile computed over federated bucket -// timeseries, especially when rate() has been applied. -// -// This is because scraped data is not made available to rule evaluation or -// federation atomically, so some buckets are computed with data from the -// most recent scrapes, but the other buckets are missing data from the most -// recent scrape. +// - Circumstances where data is already inconsistent at the target's side. +// - Ingestion via the remote write receiver that Prometheus implements. +// - Optimisation of query execution where precision is sacrificed for other +// benefits, not by Prometheus but by systems built on top of it. +// - Circumstances where floating point precision errors accumulate. // // Monotonicity is usually guaranteed because if a bucket with upper bound // u1 has count c1, then any bucket with a higher upper bound u > u1 must -// have counted all c1 observations and perhaps more, so that c >= c1. -// -// Randomly interspersed partial sampling breaks that guarantee, and rate() -// exacerbates it. Specifically, suppose bucket le=1000 has a count of 10 from -// 4 samples but the bucket with le=2000 has a count of 7 from 3 samples. The -// monotonicity is broken. It is exacerbated by rate() because under normal -// operation, cumulative counting of buckets will cause the bucket counts to -// diverge such that small differences from missing samples are not a problem. -// rate() removes this divergence.) +// have counted all c1 observations and perhaps more, so that c >= c1. // // bucketQuantile depends on that monotonicity to do a binary search for the // bucket with the φ-quantile count, so breaking the monotonicity // guarantee causes bucketQuantile() to return undefined (nonsense) results. // -// As a somewhat hacky solution until ingestion is atomic per scrape, we -// calculate the "envelope" of the histogram buckets, essentially removing -// any decreases in the count between successive buckets. - -func ensureMonotonic(buckets buckets) { - max := buckets[0].count +// As a somewhat hacky solution, we first silently ignore any numerically +// insignificant (relative delta below the requested tolerance and likely to +// be from floating point precision errors) differences between successive +// buckets regardless of the direction. Then we calculate the "envelope" of +// the histogram buckets, essentially removing any decreases in the count +// between successive buckets. +// +// We return a bool to indicate if this monotonicity was forced or not, and +// another bool to indicate if small deltas were ignored or not. +func ensureMonotonicAndIgnoreSmallDeltas(buckets buckets, tolerance float64) (bool, bool) { + var forcedMonotonic, fixedPrecision bool + prev := buckets[0].count for i := 1; i < len(buckets); i++ { - switch { - case buckets[i].count > max: - max = buckets[i].count - case buckets[i].count < max: - buckets[i].count = max + curr := buckets[i].count // Assumed always positive. + if curr == prev { + // No correction needed if the counts are identical between buckets. + continue + } + if almost.Equal(prev, curr, tolerance) { + // Silently correct numerically insignificant differences from floating + // point precision errors, regardless of direction. + // Do not update the 'prev' value as we are ignoring the difference. + buckets[i].count = prev + fixedPrecision = true + continue + } + if curr < prev { + // Force monotonicity by removing any decreases regardless of magnitude. + // Do not update the 'prev' value as we are ignoring the decrease. + buckets[i].count = prev + forcedMonotonic = true + continue } + prev = curr } + return forcedMonotonic, fixedPrecision } // histogramQuantile calculates the quantile 'q' based on the given histogram. From d5ee087b0f42ef41fad75dca00c7e2f35fab562f Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:33:52 +0900 Subject: [PATCH 12/19] Add labelReplaceDst validation Signed-off-by: SungJin1212 --- execution/function/relabel.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/execution/function/relabel.go b/execution/function/relabel.go index f3aa0d34..66052271 100644 --- a/execution/function/relabel.go +++ b/execution/function/relabel.go @@ -150,6 +150,11 @@ func (o *relabelOperator) loadSeriesForLabelReplace(series []labels.Labels) erro if err != nil { return errors.Newf("invalid regular expression in label_replace(): %s", labelReplaceRegexVal) } + + if !prommodel.LabelNameRE.MatchString(labelReplaceDst) { + return errors.Newf("invalid destination label name in label_replace(): %s", labelReplaceDst) + } + for i, s := range series { lbls := s From 3208215d9b015827508d29480d0fe04bc7d2969a Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:36:52 +0900 Subject: [PATCH 13/19] Change float64 to pointer to append nothing Signed-off-by: SungJin1212 --- execution/scan/subquery.go | 4 +- ringbuffer/functions.go | 202 ++++++++++++++++++++++--------------- ringbuffer/rate.go | 4 +- 3 files changed, 123 insertions(+), 87 deletions(-) diff --git a/execution/scan/subquery.go b/execution/scan/subquery.go index 1237d20e..310009e3 100644 --- a/execution/scan/subquery.go +++ b/execution/scan/subquery.go @@ -176,8 +176,8 @@ func (o *subqueryOperator) Next(ctx context.Context) ([]model.StepVector, error) if ok { if h != nil { sv.AppendHistogram(o.pool, uint64(sampleId), h) - } else { - sv.AppendSample(o.pool, uint64(sampleId), f) + } else if f != nil { + sv.AppendSample(o.pool, uint64(sampleId), *f) } o.IncrementSamplesAtTimestamp(rangeSamples.Len(), sv.T) } diff --git a/ringbuffer/functions.go b/ringbuffer/functions.go index a371a570..76ea6f38 100644 --- a/ringbuffer/functions.go +++ b/ringbuffer/functions.go @@ -7,10 +7,13 @@ import ( "context" "math" + "github.com/efficientgo/core/errors" "github.com/prometheus/prometheus/model/histogram" + "github.com/prometheus/prometheus/util/annotations" "github.com/thanos-io/promql-engine/execution/aggregate" "github.com/thanos-io/promql-engine/execution/parse" + "github.com/thanos-io/promql-engine/execution/warnings" ) type SamplesBuffer GenericRingBuffer @@ -28,7 +31,7 @@ type FunctionArgs struct { ScalarPoint float64 } -type FunctionCall func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) +type FunctionCall func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) func instantValue(samples []Sample, isRate bool) (float64, bool) { lastSample := samples[len(samples)-1] @@ -57,188 +60,209 @@ func instantValue(samples []Sample, isRate bool) (float64, bool) { } var rangeVectorFuncs = map[string]FunctionCall{ - "sum_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "sum_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return sumOverTime(f.Samples), nil, true, nil + v := sumOverTime(f.Samples) + return &v, nil, true, nil }, - "max_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "max_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return maxOverTime(f.Samples), nil, true, nil + v := maxOverTime(f.Samples) + return &v, nil, true, nil }, - "min_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "min_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return minOverTime(f.Samples), nil, true, nil + v := minOverTime(f.Samples) + return &v, nil, true, nil }, - "avg_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "avg_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return avgOverTime(f.Samples), nil, true, nil + + v := avgOverTime(f.Samples) + return &v, nil, true, nil }, - "stddev_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "stddev_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return stddevOverTime(f.Samples), nil, true, nil + v := stddevOverTime(f.Samples) + return &v, nil, true, nil }, - "stdvar_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "stdvar_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return stdvarOverTime(f.Samples), nil, true, nil + v := stdvarOverTime(f.Samples) + return &v, nil, true, nil }, - "count_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "count_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return countOverTime(f.Samples), nil, true, nil + v := countOverTime(f.Samples) + return &v, nil, true, nil }, - "last_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "last_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } if f.Samples[0].V.H != nil { - return 0, f.Samples[len(f.Samples)-1].V.H.Copy(), true, nil + return nil, f.Samples[len(f.Samples)-1].V.H.Copy(), true, nil } - return f.Samples[len(f.Samples)-1].V.F, nil, true, nil + v := f.Samples[len(f.Samples)-1].V.F + return &v, nil, true, nil }, - "present_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "present_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return 1., nil, true, nil + v := 1. + return &v, nil, true, nil }, - "quantile_over_time": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "quantile_over_time": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } floats := make([]float64, len(f.Samples)) for i, sample := range f.Samples { floats[i] = sample.V.F } - return aggregate.Quantile(f.ScalarPoint, floats), nil, true, nil + v := aggregate.Quantile(f.ScalarPoint, floats) + return &v, nil, true, nil }, - "changes": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "changes": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return changes(f.Samples), nil, true, nil + v := changes(f.Samples) + return &v, nil, true, nil }, - "resets": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "resets": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } - return resets(f.Samples), nil, true, nil + v := resets(f.Samples) + return &v, nil, true, nil }, - "deriv": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "deriv": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) < 2 { - return 0., nil, false, nil + return nil, nil, false, nil } - return deriv(f.Samples), nil, true, nil + + if f.Samples[0].V.H != nil { + // deriv should ignore histograms. + return nil, nil, false, nil + } + + v := deriv(f.Samples) + return &v, nil, true, nil }, - "irate": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "irate": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { f.Samples = filterFloatOnlySamples(f.Samples) if len(f.Samples) < 2 { - return 0., nil, false, nil + return nil, nil, false, nil } val, ok := instantValue(f.Samples, true) if !ok { - return 0., nil, false, nil + return nil, nil, false, nil } - return val, nil, true, nil + return &val, nil, true, nil }, - "idelta": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "idelta": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { f.Samples = filterFloatOnlySamples(f.Samples) if len(f.Samples) < 2 { - return 0., nil, false, nil + return nil, nil, false, nil } val, ok := instantValue(f.Samples, false) if !ok { - return 0., nil, false, nil + return nil, nil, false, nil } - return val, nil, true, nil + return &val, nil, true, nil }, - "rate": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "rate": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) < 2 { - return 0., nil, false, nil + return nil, nil, false, nil } v, h, err := extrapolatedRate(f.ctx, f.Samples, len(f.Samples), true, true, f.StepTime, f.SelectRange, f.Offset) if err != nil { - return 0, nil, false, err + return nil, nil, false, err } + return v, h, true, nil }, - "delta": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "delta": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) < 2 { - return 0., nil, false, nil + return nil, nil, false, nil } v, h, err := extrapolatedRate(f.ctx, f.Samples, len(f.Samples), false, false, f.StepTime, f.SelectRange, f.Offset) if err != nil { - return 0, nil, false, err + return nil, nil, false, err } return v, h, true, nil }, - "increase": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "increase": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) < 2 { - return 0., nil, false, nil + return nil, nil, false, nil } v, h, err := extrapolatedRate(f.ctx, f.Samples, len(f.Samples), true, false, f.StepTime, f.SelectRange, f.Offset) if err != nil { - return 0, nil, false, err + return nil, nil, false, err } return v, h, true, nil }, - "xrate": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "xrate": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } if f.MetricAppearedTs == nil { panic("BUG: we got some Samples but metric still hasn't appeared") } - v, h, err := extendedRate(f.Samples, true, true, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) + v, h, err := extendedRate(f.ctx, f.Samples, true, true, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) if err != nil { - return 0, nil, false, err + return nil, nil, false, err } - return v, h, true, nil + return &v, h, true, nil }, - "xdelta": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "xdelta": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } if f.MetricAppearedTs == nil { panic("BUG: we got some Samples but metric still hasn't appeared") } v, h, err := extendedRate(f.ctx, f.Samples, false, false, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) if err != nil { - return 0, nil, false, err + return nil, nil, false, err } - return v, h, true, nil + return &v, h, true, nil }, - "xincrease": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "xincrease": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) == 0 { - return 0., nil, false, nil + return nil, nil, false, nil } if f.MetricAppearedTs == nil { panic("BUG: we got some Samples but metric still hasn't appeared") } v, h, err := extendedRate(f.ctx, f.Samples, true, false, f.StepTime, f.SelectRange, f.Offset, *f.MetricAppearedTs) if err != nil { - return 0, nil, false, err + return nil, nil, false, err } - return v, h, true, nil + return &v, h, true, nil }, - "predict_linear": func(f FunctionArgs) (float64, *histogram.FloatHistogram, bool, error) { + "predict_linear": func(f FunctionArgs) (*float64, *histogram.FloatHistogram, bool, error) { if len(f.Samples) < 2 { - return 0., nil, false, nil + return nil, nil, false, nil } v := predictLinear(f.Samples, f.ScalarPoint, f.StepTime) - return v, nil, true, nil + return &v, nil, true, nil }, } @@ -266,7 +290,7 @@ func extrapolatedRate(ctx context.Context, samples []Sample, numSamples int, isC if samples[0].V.H != nil { resultHistogram, err = histogramRate(ctx, samples, isCounter) if err != nil { - return 0, nil, err + return nil, nil, err } } else { resultValue = samples[len(samples)-1].V.F - samples[0].V.F @@ -335,10 +359,14 @@ func extrapolatedRate(ctx context.Context, samples []Sample, numSamples int, isC resultValue *= factor } else { resultHistogram.Mul(factor) + } + if samples[0].V.H != nil && resultHistogram == nil { + // to prevent appending sample with 0 + return nil, nil, nil } - return resultValue, resultHistogram, nil + return &resultValue, resultHistogram, nil } // extendedRate is a utility function for xrate/xincrease/xdelta. @@ -604,15 +632,23 @@ func stdvarOverTime(points []Sample) float64 { } func changes(points []Sample) float64 { - var count float64 - prev := points[0].V.F - count = 0 - for _, sample := range points[1:] { - current := sample.V.F - if current != prev && !(math.IsNaN(current) && math.IsNaN(prev)) { + count := 0. + + prevSample := points[0] + for _, curSample := range points[1:] { + switch { + case prevSample.V.H == nil && curSample.V.H == nil: + if curSample.V.F != prevSample.V.F && !(math.IsNaN(curSample.V.F) && math.IsNaN(prevSample.V.F)) { + count++ + } + case prevSample.V.H != nil && curSample.V.H == nil, prevSample.V.H == nil && curSample.V.H != nil: count++ + case prevSample.V.H != nil && curSample.V.H != nil: + if !curSample.V.H.Equals(prevSample.V.H) { + count++ + } } - prev = current + prevSample = curSample } return count } diff --git a/ringbuffer/rate.go b/ringbuffer/rate.go index c58cebc2..ce600094 100644 --- a/ringbuffer/rate.go +++ b/ringbuffer/rate.go @@ -56,7 +56,7 @@ type stepRange struct { } // NewRateBuffer creates a new RateBuffer. -func NewRateBuffer(opts query.Options, isCounter, isRate bool, selectRange, offset int64) *RateBuffer { +func NewRateBuffer(ctx context.Context, opts query.Options, isCounter, isRate bool, selectRange, offset int64) *RateBuffer { var ( step = max(1, opts.Step.Milliseconds()) numSteps = min( @@ -173,7 +173,7 @@ func (r *RateBuffer) Reset(mint int64, evalt int64) { func (r *RateBuffer) Eval(ctx context.Context, _ float64, _ *int64) (*float64, *histogram.FloatHistogram, bool, error) { if r.firstSamples[0].T == math.MaxInt64 || r.firstSamples[0].T == r.last.T { - return 0, nil, false, nil + return nil, nil, false, nil } r.rateBuffer = append(append( From 4074f075b107cef4053c8b4856d14a92adcc0f17 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:37:35 +0900 Subject: [PATCH 14/19] Add histogram address logic to sum, max over time Signed-off-by: SungJin1212 --- ringbuffer/functions.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/ringbuffer/functions.go b/ringbuffer/functions.go index 76ea6f38..7158305c 100644 --- a/ringbuffer/functions.go +++ b/ringbuffer/functions.go @@ -64,6 +64,21 @@ var rangeVectorFuncs = map[string]FunctionCall{ if len(f.Samples) == 0 { return nil, nil, false, nil } + + if f.Samples[0].V.H != nil { + // histogram + sum := f.Samples[0].V.H.Copy() + for _, sample := range f.Samples[1:] { + h := sample.V.H + _, err := sum.Add(h) + if err != nil { + return nil, sum, true, nil + } + } + + return nil, sum, true, nil + } + v := sumOverTime(f.Samples) return &v, nil, true, nil }, @@ -86,6 +101,26 @@ var rangeVectorFuncs = map[string]FunctionCall{ return nil, nil, false, nil } + if f.Samples[0].V.H != nil { + // histogram + count := 1 + mean := f.Samples[0].V.H.Copy() + for _, sample := range f.Samples[1:] { + count++ + left := sample.V.H.Copy().Div(float64(count)) + right := mean.Copy().Div(float64(count)) + toAdd, err := left.Sub(right) + if err != nil { + return nil, mean, true, nil + } + _, err = mean.Add(toAdd) + if err != nil { + return nil, mean, true, nil + } + } + return nil, mean, true, nil + } + v := avgOverTime(f.Samples) return &v, nil, true, nil }, From e6dd9e6ef3497d8516bcf9da4fd1e61481af6155 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:38:04 +0900 Subject: [PATCH 15/19] Add histogram address logic to linearRegression Signed-off-by: SungJin1212 --- ringbuffer/functions.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ringbuffer/functions.go b/ringbuffer/functions.go index 7158305c..0423bec3 100644 --- a/ringbuffer/functions.go +++ b/ringbuffer/functions.go @@ -728,6 +728,11 @@ func linearRegression(Samples []Sample, interceptTime int64) (slope, intercept f initY = Samples[0].V.F constY = true for i, sample := range Samples { + if sample.V.H != nil { + // should ignore histograms + continue + } + // Set constY to false if any new y values are encountered. if constY && i > 0 && sample.V.F != initY { constY = false From d094a474ef4e7e24791663553a8301d9d7e1217d Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:38:34 +0900 Subject: [PATCH 16/19] Add histogram address logic to resets Signed-off-by: SungJin1212 --- ringbuffer/functions.go | 45 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/ringbuffer/functions.go b/ringbuffer/functions.go index 0423bec3..9b8e9d9f 100644 --- a/ringbuffer/functions.go +++ b/ringbuffer/functions.go @@ -702,14 +702,49 @@ func predictLinear(points []Sample, duration float64, stepTime int64) float64 { } func resets(points []Sample) float64 { + var histogramPoints []Sample + var floatPoints []Sample + + for _, p := range points { + if p.V.H != nil { + histogramPoints = append(histogramPoints, p) + } else { + floatPoints = append(floatPoints, p) + } + } + count := 0 - prev := points[0].V.F - for _, sample := range points[1:] { - current := sample.V.F - if current < prev { + var prevSample, curSample Sample + for iFloat, iHistogram := 0, 0; iFloat < len(floatPoints) || iHistogram < len(histogramPoints); { + switch { + // Process a float sample if no histogram sample remains or its timestamp is earlier. + // Process a histogram sample if no float sample remains or its timestamp is earlier. + case iHistogram >= len(histogramPoints) || iFloat < len(floatPoints) && floatPoints[iFloat].T < histogramPoints[iHistogram].T: + curSample.V.F = floatPoints[iFloat].V.F + curSample.V.H = nil + iFloat++ + case iFloat >= len(floatPoints) || iHistogram < len(histogramPoints) && floatPoints[iFloat].T > histogramPoints[iHistogram].T: + curSample.V.H = histogramPoints[iHistogram].V.H + iHistogram++ + } + // Skip the comparison for the first sample, just initialize prevSample. + if iFloat+iHistogram == 1 { + prevSample = curSample + continue + } + switch { + case prevSample.V.H == nil && curSample.V.H == nil: + if curSample.V.F < prevSample.V.F { + count++ + } + case prevSample.V.H != nil && curSample.V.H == nil, prevSample.V.H == nil && curSample.V.H != nil: count++ + case prevSample.V.H != nil && curSample.V.H != nil: + if curSample.V.H.DetectReset(prevSample.V.H) { + count++ + } } - prev = current + prevSample = curSample } return float64(count) From f99e6dbd8230a900e0fed7188ea6c79b9edbc3f2 Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Tue, 14 Jan 2025 11:39:00 +0900 Subject: [PATCH 17/19] Add warning to histogramRate Signed-off-by: SungJin1212 --- ringbuffer/functions.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/ringbuffer/functions.go b/ringbuffer/functions.go index 9b8e9d9f..6f07c6b3 100644 --- a/ringbuffer/functions.go +++ b/ringbuffer/functions.go @@ -507,8 +507,10 @@ func histogramRate(ctx context.Context, points []Sample, isCounter bool) (*histo } prev := points[0].V.H // We already know that this is a histogram. + usingCustomBuckets := prev.UsesCustomBuckets() last := points[len(points)-1].V.H if last == nil { + warnings.AddToContext(annotations.MixedFloatsHistogramsWarning, ctx) return nil, nil // Range contains a mix of histograms and floats. } minSchema := prev.Schema @@ -516,6 +518,17 @@ func histogramRate(ctx context.Context, points []Sample, isCounter bool) (*histo minSchema = last.Schema } + if last.UsesCustomBuckets() != usingCustomBuckets { + warnings.AddToContext(annotations.MixedExponentialCustomHistogramsWarning, ctx) + return nil, nil + } + + // We check for gauge type histograms in the loop below, but the loop below does not run on the first and last point, + // so check the first and last point now. + if isCounter && (prev.CounterResetHint == histogram.GaugeType || last.CounterResetHint == histogram.GaugeType) { + warnings.AddToContext(annotations.NativeHistogramNotCounterWarning, ctx) + } + // https://github.com/prometheus/prometheus/blob/ccea61c7bf1e6bce2196ba8189a209945a204c5b/promql/functions.go#L183 // First iteration to find out two things: // - What's the smallest relevant schema? @@ -524,18 +537,31 @@ func histogramRate(ctx context.Context, points []Sample, isCounter bool) (*histo for _, currPoint := range points[1 : len(points)-1] { curr := currPoint.V.H if curr == nil { + warnings.AddToContext(annotations.MixedFloatsHistogramsWarning, ctx) return nil, nil // Range contains a mix of histograms and floats. } if !isCounter { continue } + if curr.CounterResetHint == histogram.GaugeType { + warnings.AddToContext(annotations.NativeHistogramNotCounterWarning, ctx) + } if curr.Schema < minSchema { minSchema = curr.Schema } + if curr.UsesCustomBuckets() != usingCustomBuckets { + warnings.AddToContext(annotations.MixedExponentialCustomHistogramsWarning, ctx) + return nil, nil + } } h := last.CopyToSchema(minSchema) if _, err := h.Sub(prev); err != nil { + if errors.Is(err, histogram.ErrHistogramsIncompatibleSchema) { + warnings.AddToContext(annotations.MixedExponentialCustomHistogramsWarning, ctx) + } else if errors.Is(err, histogram.ErrHistogramsIncompatibleBounds) { + warnings.AddToContext(annotations.IncompatibleCustomBucketsHistogramsWarning, ctx) + } return nil, err } @@ -545,12 +571,20 @@ func histogramRate(ctx context.Context, points []Sample, isCounter bool) (*histo curr := currPoint.V.H if curr.DetectReset(prev) { if _, err := h.Add(prev); err != nil { + if errors.Is(err, histogram.ErrHistogramsIncompatibleSchema) { + warnings.AddToContext(annotations.MixedExponentialCustomHistogramsWarning, ctx) + } else if errors.Is(err, histogram.ErrHistogramsIncompatibleBounds) { + warnings.AddToContext(annotations.IncompatibleCustomBucketsHistogramsWarning, ctx) + } return nil, err } } prev = curr } + } else if points[0].V.H.CounterResetHint != histogram.GaugeType || points[len(points)-1].V.H.CounterResetHint != histogram.GaugeType { + warnings.AddToContext(annotations.NativeHistogramNotGaugeWarning, ctx) } + h.CounterResetHint = histogram.GaugeType return h.Compact(0), nil } From 85b9e94fdd79a22f05f08732a7e24dcab9778ded Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Thu, 16 Jan 2025 11:20:19 +0900 Subject: [PATCH 18/19] group prometheus imports Signed-off-by: SungJin1212 --- engine/enginefuzz_test.go | 3 ++- execution/aggregate/accumulator.go | 3 ++- execution/aggregate/hashaggregate.go | 4 ++-- execution/aggregate/khashaggregate.go | 4 ++-- execution/binary/vector.go | 4 ++-- logicalplan/codec_test.go | 1 + logicalplan/passthrough_test.go | 1 - logicalplan/propagate_selectors.go | 3 +-- storage/prometheus/pool.go | 1 + 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/engine/enginefuzz_test.go b/engine/enginefuzz_test.go index d15c294b..a325a3e7 100644 --- a/engine/enginefuzz_test.go +++ b/engine/enginefuzz_test.go @@ -15,13 +15,14 @@ import ( "github.com/efficientgo/core/errors" "github.com/efficientgo/core/testutil" "github.com/google/go-cmp/cmp" + "github.com/stretchr/testify/require" + "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql" "github.com/prometheus/prometheus/promql/parser" "github.com/prometheus/prometheus/promql/promqltest" "github.com/prometheus/prometheus/storage" "github.com/prometheus/prometheus/util/teststorage" - "github.com/stretchr/testify/require" "github.com/thanos-io/promql-engine/api" "github.com/thanos-io/promql-engine/engine" diff --git a/execution/aggregate/accumulator.go b/execution/aggregate/accumulator.go index 2408cf16..784c6827 100644 --- a/execution/aggregate/accumulator.go +++ b/execution/aggregate/accumulator.go @@ -8,10 +8,11 @@ import ( "math" "github.com/efficientgo/core/errors" + "gonum.org/v1/gonum/floats" + "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/promql/parser/posrange" "github.com/prometheus/prometheus/util/annotations" - "gonum.org/v1/gonum/floats" "github.com/thanos-io/promql-engine/execution/warnings" ) diff --git a/execution/aggregate/hashaggregate.go b/execution/aggregate/hashaggregate.go index ec49f387..d4d9df3f 100644 --- a/execution/aggregate/hashaggregate.go +++ b/execution/aggregate/hashaggregate.go @@ -11,12 +11,12 @@ import ( "time" "github.com/efficientgo/core/errors" - "github.com/prometheus/prometheus/promql/parser/posrange" - "github.com/prometheus/prometheus/util/annotations" "golang.org/x/exp/slices" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql/parser" + "github.com/prometheus/prometheus/promql/parser/posrange" + "github.com/prometheus/prometheus/util/annotations" "github.com/thanos-io/promql-engine/execution/model" "github.com/thanos-io/promql-engine/execution/parse" diff --git a/execution/aggregate/khashaggregate.go b/execution/aggregate/khashaggregate.go index 1a21fdf5..4f734878 100644 --- a/execution/aggregate/khashaggregate.go +++ b/execution/aggregate/khashaggregate.go @@ -13,12 +13,12 @@ import ( "time" "github.com/efficientgo/core/errors" - "github.com/prometheus/prometheus/promql/parser/posrange" - "github.com/prometheus/prometheus/util/annotations" "golang.org/x/exp/slices" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql/parser" + "github.com/prometheus/prometheus/promql/parser/posrange" + "github.com/prometheus/prometheus/util/annotations" "github.com/thanos-io/promql-engine/execution/model" "github.com/thanos-io/promql-engine/execution/warnings" diff --git a/execution/binary/vector.go b/execution/binary/vector.go index ebe15dcc..ea77d951 100644 --- a/execution/binary/vector.go +++ b/execution/binary/vector.go @@ -12,14 +12,14 @@ import ( "github.com/cespare/xxhash/v2" "github.com/efficientgo/core/errors" - "github.com/prometheus/prometheus/promql/parser/posrange" - "github.com/prometheus/prometheus/util/annotations" "github.com/zhangyunhao116/umap" "golang.org/x/exp/slices" "github.com/prometheus/prometheus/model/histogram" "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql/parser" + "github.com/prometheus/prometheus/promql/parser/posrange" + "github.com/prometheus/prometheus/util/annotations" "github.com/thanos-io/promql-engine/execution/model" "github.com/thanos-io/promql-engine/execution/warnings" diff --git a/logicalplan/codec_test.go b/logicalplan/codec_test.go index 5ec2d0fd..1334c796 100644 --- a/logicalplan/codec_test.go +++ b/logicalplan/codec_test.go @@ -9,6 +9,7 @@ import ( "github.com/cortexproject/promqlsmith" "github.com/efficientgo/core/testutil" + "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/promql/parser" diff --git a/logicalplan/passthrough_test.go b/logicalplan/passthrough_test.go index 95698839..93ca0df1 100644 --- a/logicalplan/passthrough_test.go +++ b/logicalplan/passthrough_test.go @@ -10,7 +10,6 @@ import ( "github.com/efficientgo/core/testutil" "github.com/prometheus/prometheus/model/labels" - "github.com/prometheus/prometheus/promql/parser" "github.com/thanos-io/promql-engine/api" diff --git a/logicalplan/propagate_selectors.go b/logicalplan/propagate_selectors.go index 9c8b175d..0be318ad 100644 --- a/logicalplan/propagate_selectors.go +++ b/logicalplan/propagate_selectors.go @@ -7,9 +7,8 @@ import ( "sort" "github.com/prometheus/prometheus/model/labels" - "github.com/prometheus/prometheus/util/annotations" - "github.com/prometheus/prometheus/promql/parser" + "github.com/prometheus/prometheus/util/annotations" "github.com/thanos-io/promql-engine/query" ) diff --git a/storage/prometheus/pool.go b/storage/prometheus/pool.go index e6e71a24..30efcb42 100644 --- a/storage/prometheus/pool.go +++ b/storage/prometheus/pool.go @@ -8,6 +8,7 @@ import ( "strings" "github.com/cespare/xxhash/v2" + "github.com/prometheus/prometheus/model/labels" "github.com/prometheus/prometheus/storage" ) From 5d75bd37d3b78970af2af8eb07986783bd28970e Mon Sep 17 00:00:00 2001 From: SungJin1212 Date: Thu, 16 Jan 2025 20:35:30 +0900 Subject: [PATCH 19/19] Refactor vector.go to merge annotations Signed-off-by: SungJin1212 --- execution/binary/vector.go | 71 ++++++++++++++++------------------- execution/warnings/context.go | 14 +++++++ 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/execution/binary/vector.go b/execution/binary/vector.go index ea77d951..e5026e8c 100644 --- a/execution/binary/vector.go +++ b/execution/binary/vector.go @@ -282,13 +282,13 @@ func (o *vectorOperator) execBinaryUnless(lhs, rhs model.StepVector) (model.Step return step, nil } -func (o *vectorOperator) computeBinaryPairing(ctx context.Context, hval, lval float64, hlhs, hrhs *histogram.FloatHistogram) (float64, *histogram.FloatHistogram, bool, error) { +func (o *vectorOperator) computeBinaryPairing(hval, lval float64, hlhs, hrhs *histogram.FloatHistogram, annos *annotations.Annotations) (float64, *histogram.FloatHistogram, bool, error) { // operand is not commutative so we need to address potential swapping if o.matching.Card == parser.CardOneToMany { - v, h, keep, err := vectorElemBinop(ctx, o.opType, lval, hval, hlhs, hrhs) + v, h, keep, err := vectorElemBinop(o.opType, lval, hval, hlhs, hrhs, annos) return v, h, keep, err } - v, h, keep, err := vectorElemBinop(ctx, o.opType, hval, lval, hlhs, hrhs) + v, h, keep, err := vectorElemBinop(o.opType, hval, lval, hlhs, hrhs, annos) return v, h, keep, err } @@ -298,6 +298,10 @@ func (o *vectorOperator) execBinaryArithmetic(ctx context.Context, lhs, rhs mode var ( hcs, lcs model.StepVector + annos annotations.Annotations + h *histogram.FloatHistogram + keep bool + err error ) switch o.matching.Card { @@ -349,23 +353,17 @@ func (o *vectorOperator) execBinaryArithmetic(ctx context.Context, lhs, rhs mode } jp.bts = ts - var h *histogram.FloatHistogram - var keep bool - var err error - if jp.histogramVal != nil { - _, h, keep, err = o.computeBinaryPairing(ctx, 0, 0, hcs.Histograms[i], jp.histogramVal) + _, h, keep, err = o.computeBinaryPairing(0, 0, hcs.Histograms[i], jp.histogramVal, &annos) } else { - _, h, keep, err = o.computeBinaryPairing(ctx, 0, jp.val, hcs.Histograms[i], nil) + _, h, keep, err = o.computeBinaryPairing(0, jp.val, hcs.Histograms[i], nil, &annos) + } + if countWarnings, countInfo := annos.CountWarningsAndInfo(); countWarnings > 0 || countInfo > 0 { + warnings.MergeToContext(annos, ctx) + continue } if err != nil { - if errors.Is(err, annotations.PromQLInfo) || errors.Is(err, annotations.PromQLWarning) { - // just continue when the errors are info and warn - continue - } else { - lastErr = err - continue - } + return model.StepVector{}, err } switch { @@ -397,24 +395,23 @@ func (o *vectorOperator) execBinaryArithmetic(ctx context.Context, lhs, rhs mode } jp.bts = ts var val float64 - var h *histogram.FloatHistogram - var keep bool - var err error if jp.histogramVal != nil { - _, h, _, err = o.computeBinaryPairing(ctx, hcs.Samples[i], 0, nil, jp.histogramVal) + _, h, _, err = o.computeBinaryPairing(hcs.Samples[i], 0, nil, jp.histogramVal, &annos) + if countWarnings, countInfo := annos.CountWarningsAndInfo(); countWarnings > 0 || countInfo > 0 { + warnings.MergeToContext(annos, ctx) + continue + } if err != nil { - if errors.Is(err, annotations.PromQLInfo) || errors.Is(err, annotations.PromQLWarning) { - // just continue when the errors are info and warn - continue - } else { - lastErr = err - continue - } + return model.StepVector{}, err } step.AppendHistogram(o.pool, jp.sid, h) } else { - val, _, keep, err = o.computeBinaryPairing(ctx, hcs.Samples[i], jp.val, nil, nil) + val, _, keep, err = o.computeBinaryPairing(hcs.Samples[i], jp.val, nil, nil, &annos) + if countWarnings, countInfo := annos.CountWarningsAndInfo(); countWarnings > 0 || countInfo > 0 { + warnings.MergeToContext(annos, ctx) + continue + } if err != nil { return model.StepVector{}, err } @@ -603,8 +600,9 @@ func signatureFunc(on bool, names ...string) func(labels.Labels) uint64 { // Lifted from: https://github.com/prometheus/prometheus/blob/v3.1.0/promql/engine.go#L2797. // nolint: unparam // vectorElemBinop evaluates a binary operation between two Vector elements. -func vectorElemBinop(ctx context.Context, op parser.ItemType, lhs, rhs float64, hlhs, hrhs *histogram.FloatHistogram) (float64, *histogram.FloatHistogram, bool, error) { +func vectorElemBinop(op parser.ItemType, lhs, rhs float64, hlhs, hrhs *histogram.FloatHistogram, annos *annotations.Annotations) (float64, *histogram.FloatHistogram, bool, error) { opName := parser.ItemTypeStr[op] + switch { case hlhs == nil && hrhs == nil: { @@ -643,9 +641,8 @@ func vectorElemBinop(ctx context.Context, op parser.ItemType, lhs, rhs float64, case parser.MUL: return 0, hrhs.Copy().Mul(lhs).Compact(0), true, nil case parser.ADD, parser.SUB, parser.DIV, parser.POW, parser.MOD, parser.EQLC, parser.NEQ, parser.GTR, parser.LSS, parser.GTE, parser.LTE, parser.ATAN2: - err := annotations.NewIncompatibleTypesInBinOpInfo("float", opName, "histogram", posrange.PositionRange{}) - warnings.AddToContext(err, ctx) - return 0, nil, false, err + annos.Add(annotations.NewIncompatibleTypesInBinOpInfo("float", opName, "histogram", posrange.PositionRange{})) + return 0, nil, false, nil } } case hlhs != nil && hrhs == nil: @@ -656,9 +653,8 @@ func vectorElemBinop(ctx context.Context, op parser.ItemType, lhs, rhs float64, case parser.DIV: return 0, hlhs.Copy().Div(rhs).Compact(0), true, nil case parser.ADD, parser.SUB, parser.POW, parser.MOD, parser.EQLC, parser.NEQ, parser.GTR, parser.LSS, parser.GTE, parser.LTE, parser.ATAN2: - err := annotations.NewIncompatibleTypesInBinOpInfo("histogram", opName, "float", posrange.PositionRange{}) - warnings.AddToContext(err, ctx) - return 0, nil, false, err + annos.Add(annotations.NewIncompatibleTypesInBinOpInfo("histogram", opName, "float", posrange.PositionRange{})) + return 0, nil, false, nil } } case hlhs != nil && hrhs != nil: @@ -683,9 +679,8 @@ func vectorElemBinop(ctx context.Context, op parser.ItemType, lhs, rhs float64, // This operation expects that both histograms are compacted. return 0, hlhs, !hlhs.Equals(hrhs), nil case parser.MUL, parser.DIV, parser.POW, parser.MOD, parser.GTR, parser.LSS, parser.GTE, parser.LTE, parser.ATAN2: - err := annotations.NewIncompatibleTypesInBinOpInfo("histogram", opName, "histogram", posrange.PositionRange{}) - warnings.AddToContext(err, ctx) - return 0, nil, false, err + annos.Add(annotations.NewIncompatibleTypesInBinOpInfo("histogram", opName, "histogram", posrange.PositionRange{})) + return 0, nil, false, nil } } } diff --git a/execution/warnings/context.go b/execution/warnings/context.go index 1ac5830c..3a9e785c 100644 --- a/execution/warnings/context.go +++ b/execution/warnings/context.go @@ -35,6 +35,12 @@ func (w *warnings) get() annotations.Annotations { return w.warns } +func (w *warnings) merge(anno annotations.Annotations) { + w.mu.Lock() + defer w.mu.Unlock() + w.warns = w.warns.Merge(anno) +} + func NewContext(ctx context.Context) context.Context { return context.WithValue(ctx, key, newWarnings()) } @@ -47,6 +53,14 @@ func AddToContext(warn error, ctx context.Context) { w.add(warn) } +func MergeToContext(annos annotations.Annotations, ctx context.Context) { + w, ok := ctx.Value(key).(*warnings) + if !ok { + return + } + w.merge(annos) +} + func FromContext(ctx context.Context) annotations.Annotations { return ctx.Value(key).(*warnings).get() }