Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-12468 Mongo plan summary and full scan. #3496

Merged
merged 33 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
7aad647
PMM-12468 Mongo plan summary and full scan.
JiriCtvrtka Jan 23, 2025
01eedf7
PMM-12468 Fix agent tests.
JiriCtvrtka Jan 23, 2025
e4ec526
Merge branch 'v3' into PMM-12468-mongo-plan-summary
JiriCtvrtka Jan 24, 2025
2ca8f05
PMM-12468 Another changes.
JiriCtvrtka Jan 24, 2025
aa791de
Merge branch 'v3' into PMM-12468-mongo-plan-summary
JiriCtvrtka Jan 26, 2025
de6f04b
PMM-12468 Fix decode into ExtendedSystemProfile.
JiriCtvrtka Jan 26, 2025
3d02c7f
PMM-12468 Changes.
JiriCtvrtka Jan 26, 2025
c254270
PMM-12468 Tidy, format.
JiriCtvrtka Jan 26, 2025
f8c9d06
PMM-12468 Another fields.
JiriCtvrtka Jan 26, 2025
afdf1e9
PMM-12468 Plan_summary as dimension.
JiriCtvrtka Jan 26, 2025
1519713
PMM-12468 Lint, private structs.
JiriCtvrtka Jan 26, 2025
1f3d4f8
PMM-12468 Handle IXSCAN on agent side.
JiriCtvrtka Jan 26, 2025
c70d09f
PMM-12468 Format.
JiriCtvrtka Jan 26, 2025
1b6021c
PMM-12468 Perfschema unhandled version digest.
JiriCtvrtka Jan 26, 2025
096ea6b
PMM-12468 Another fix.
JiriCtvrtka Jan 26, 2025
f543aba
PMM-12468 Fix.
JiriCtvrtka Jan 26, 2025
2cf2c97
PMM-12468 Handle new MySQL Oracle 9.2.
JiriCtvrtka Jan 26, 2025
fab2f5a
PMM-12468 Remove unnecessary metric name.
JiriCtvrtka Jan 27, 2025
13c3bde
Update agent/agents/mongodb/internal/profiler/aggregator/extended.go
JiriCtvrtka Jan 28, 2025
44c0221
Revert "Update agent/agents/mongodb/internal/profiler/aggregator/exte…
JiriCtvrtka Jan 28, 2025
bc335d1
PMM-12468 Move extended changes to Percona Toolkit.
JiriCtvrtka Jan 29, 2025
1c3a4eb
Merge branch 'v3' into PMM-12468-mongo-plan-summary
JiriCtvrtka Jan 29, 2025
e62b224
PMM-12468 Format.
JiriCtvrtka Jan 29, 2025
cc6d96e
Merge remote-tracking branch 'origin/PMM-12468-mongo-plan-summary' in…
JiriCtvrtka Jan 29, 2025
5a62285
Merge branch 'v3' into PMM-12468-mongo-plan-summary
JiriCtvrtka Jan 31, 2025
a0c1430
PMM-12468 Fix comment (collection instead table).
JiriCtvrtka Feb 3, 2025
9e7f00b
Merge branch 'mainv3' into main_PMM-12468-mongo-plan-summary
JiriCtvrtka Feb 3, 2025
f0b7b0c
Merge branch 'v3' into PMM-12468-mongo-plan-summary
JiriCtvrtka Feb 4, 2025
17a1f77
Merge branch 'v3' into PMM-12468-mongo-plan-summary
JiriCtvrtka Feb 4, 2025
5e011b4
Merge branch 'v3' into PMM-12468-mongo-plan-summary
JiriCtvrtka Feb 4, 2025
b597ed3
Merge branch 'mainv3' into main_PMM-12468-mongo-plan-summary
JiriCtvrtka Feb 5, 2025
a111fdb
PMM-12468 Gen.
JiriCtvrtka Feb 5, 2025
367adb7
PMM-12468 Gen.
JiriCtvrtka Feb 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (a *Aggregator) newInterval(ts time.Time) {
a.timeEnd = a.timeStart.Add(a.d)
}

func (a *Aggregator) createResult(ctx context.Context) *report.Result {
func (a *Aggregator) createResult(_ context.Context) *report.Result {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unused there.

queries := a.mongostats.Queries()
queryStats := queries.CalcQueriesStats(int64(DefaultInterval))
var buckets []*agentv1.MetricsBucket
Expand Down Expand Up @@ -300,6 +300,10 @@ func (a *Aggregator) createResult(ctx context.Context) *report.Result {
bucket.Mongodb.MResponseLengthP99 = float32(v.ResponseLength.Pct99)
bucket.Mongodb.MResponseLengthSum = float32(v.ResponseLength.Total)

bucket.Mongodb.MFullScanCnt = float32(v.CollScanCount)
bucket.Mongodb.MFullScanSum = float32(v.CollScanSum) / 1000
bucket.Mongodb.PlanSummary = v.PlanSummary

buckets = append(buckets, bucket)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestAggregator(t *testing.T) {
t.Run("Add", func(t *testing.T) {
t.Run("error if aggregator is not running", func(t *testing.T) {
a := New(time.Now(), "test-agent", logrus.WithField("component", "test"), truncate.GetMongoDBDefaultMaxQueryLength())
err := a.Add(nil, proto.SystemProfile{})
err := a.Add(context.TODO(), proto.SystemProfile{})
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Context should not be nil.

assert.EqualError(t, err, "aggregator is not running")
})
})
Expand Down
404 changes: 219 additions & 185 deletions api/agent/v1/collector.pb.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions api/agent/v1/collector.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions api/agent/v1/collector.proto
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,11 @@ message MetricsBucket {
float m_docs_scanned_min = 13;
float m_docs_scanned_max = 14;
float m_docs_scanned_p99 = 15;
// The query performed a full collection scan (COLLSCAN).
float m_full_scan_cnt = 16;
float m_full_scan_sum = 17;
// Plan summary type (COLLSCAN, IXSCAN, etc).
string plan_summary = 18;
}
// PostgreSQL contains metrics for PostgreSQL.
message PostgreSQL {
Expand Down
399 changes: 205 additions & 194 deletions api/qan/v1/collector.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions api/qan/v1/collector.pb.validate.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions api/qan/v1/collector.proto
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,9 @@ message MetricsBucket {
float m_docs_scanned_min = 202;
float m_docs_scanned_max = 203;
float m_docs_scanned_p99 = 204;
// Plan summary type (COLLSCAN, IXSCAN, etc).
string plan_summary = 205;

//
// PostgreSQL metrics.
//
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/percona/pmm

go 1.23.2
go 1.23.4

// Update saas with
// go get -v github.com/percona/saas@latest
Expand Down Expand Up @@ -53,7 +53,7 @@ require (
github.com/minio/minio-go/v7 v7.0.55
github.com/percona/exporter_shared v0.7.5
github.com/percona/go-mysql v0.0.0-20210427141028-73d29c6da78c
github.com/percona/percona-toolkit v3.2.1+incompatible
github.com/percona/percona-toolkit v0.0.0-20250129114007-6c2dec8502c1
github.com/percona/promconfig v0.2.5
github.com/percona/saas v0.0.0-20240923141535-da19f6682c6e
github.com/pganalyze/pg_query_go/v5 v5.1.0
Expand All @@ -68,7 +68,7 @@ require (
github.com/stretchr/objx v0.5.2
github.com/stretchr/testify v1.10.0
github.com/tink-crypto/tink-go v0.0.0-20230613075026-d6de17e3f164
go.mongodb.org/mongo-driver v1.17.1
go.mongodb.org/mongo-driver v1.17.2
go.starlark.net v0.0.0-20230717150657-8a3343210976
golang.org/x/crypto v0.32.0
golang.org/x/sync v0.10.0
Expand Down Expand Up @@ -98,13 +98,12 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/golang/mock v1.4.4 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/btree v1.0.1 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-msgpack/v2 v2.1.1 // indirect
github.com/kr/fs v0.1.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/miekg/dns v1.1.26 // indirect
github.com/moby/docker-image-spec v1.3.1 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand All @@ -120,6 +119,7 @@ require (
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/time v0.7.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect
)

require (
Expand Down
20 changes: 12 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2V
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc=
github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
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=
Expand Down Expand Up @@ -339,10 +339,12 @@ github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i
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.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
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.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
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/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
Expand Down Expand Up @@ -414,8 +416,8 @@ github.com/percona/exporter_shared v0.7.5 h1:sIhdDtKOfH0jsqtTAi41C7wm1R42yXYeAkK
github.com/percona/exporter_shared v0.7.5/go.mod h1:P8ZHDzveyJRGD4ZIRNiEMuAdDexBpQWf2mAVwtyVcYU=
github.com/percona/go-mysql v0.0.0-20210427141028-73d29c6da78c h1:1SZ7nS+kSaO63IpaKspf/gf8602QcgP2eXNPMNOIc0M=
github.com/percona/go-mysql v0.0.0-20210427141028-73d29c6da78c/go.mod h1:/SGLf9OMxlnK6jq4mkFiImBcJXXk5jwD+lDrwDaGXcw=
github.com/percona/percona-toolkit v3.2.1+incompatible h1:5jLvtZKcu9fDmaLRB8qA4bLR727t5iYyguHJJQTk9w0=
github.com/percona/percona-toolkit v3.2.1+incompatible/go.mod h1:netQWdWMaF1cnmwiIS+i5uyaqNXz46yNeM6HKkR6yeI=
github.com/percona/percona-toolkit v0.0.0-20250129114007-6c2dec8502c1 h1:PcxNtc+EWjdl3ru82jsi5RFZSIcZWOxBab8qoE9b7n8=
github.com/percona/percona-toolkit v0.0.0-20250129114007-6c2dec8502c1/go.mod h1:SOEgMF9Ay1wS6kjSGp9x51IxexTjLZWE2DntUoVl2gY=
github.com/percona/promconfig v0.2.5 h1:f/HN/CbECQs7d9RIB6MKVkuXstsrsqEDxRvf6yigquc=
github.com/percona/promconfig v0.2.5/go.mod h1:Y2uXi5QNk71+ceJHuI9poank+0S1kjxd3K105fXKVkg=
github.com/percona/saas v0.0.0-20240923141535-da19f6682c6e h1:xhk5ivxlTPat0SwLBqU1UdfqJb+2R3x4yAhjCf6WMEU=
Expand Down Expand Up @@ -527,8 +529,8 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
go.mongodb.org/mongo-driver v1.17.1 h1:Wic5cJIwJgSpBhe3lx3+/RybR5PiYRMpVFgO7cOHyIM=
go.mongodb.org/mongo-driver v1.17.1/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
go.mongodb.org/mongo-driver v1.17.2 h1:gvZyk8352qSfzyZ2UMWcpDpMSGEr1eqE4T793SqyhzM=
go.mongodb.org/mongo-driver v1.17.2/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 h1:TT4fX+nBOA/+LUkobKGW1ydGcn+G3vRw9+g5HwCphpk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0/go.mod h1:L7UH0GbB0p47T4Rri3uHjbpCFYrVrwc1I25QhNPiGK8=
go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U=
Expand Down Expand Up @@ -636,6 +638,7 @@ golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -671,7 +674,6 @@ golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGm
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-20190424220101-1e8e1cfdf96b/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
Expand Down Expand Up @@ -735,6 +737,8 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
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/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw=
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/reform.v1 v1.5.1 h1:7vhDFW1n1xAPC6oDSvIvVvpRkaRpXlxgJ4QB4s3aDdo=
gopkg.in/reform.v1 v1.5.1/go.mod h1:AIv0CbDRJ0ljQwptGeaIXfpDRo02uJwTq92aMFELEeU=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
5 changes: 5 additions & 0 deletions managed/services/qan/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,11 @@ func fillMongoDB(mb *qanv1.MetricsBucket, bm *agentv1.MetricsBucket_MongoDB) {
mb.MDocsScannedMin = bm.MDocsScannedMin
mb.MDocsScannedMax = bm.MDocsScannedMax
mb.MDocsScannedP99 = bm.MDocsScannedP99

mb.MFullScanCnt = bm.MFullScanCnt
mb.MFullScanSum = bm.MFullScanSum

mb.PlanSummary = bm.PlanSummary
}

func fillPostgreSQL(mb *qanv1.MetricsBucket, bp *agentv1.MetricsBucket_PostgreSQL) {
Expand Down
2 changes: 2 additions & 0 deletions qan-api2/migrations/sql/19_plan_summary.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE metrics
DROP COLUMN `plan_summary`;
2 changes: 2 additions & 0 deletions qan-api2/migrations/sql/19_plan_summary.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE metrics
ADD COLUMN `plan_summary` LowCardinality(String);
6 changes: 4 additions & 2 deletions qan-api2/models/data_ingestion.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ const insertSQL = `
application_name,
planid,
query_plan,
histogram_items
histogram_items,
plan_summary
)
VALUES (
:queryid,
Expand Down Expand Up @@ -495,7 +496,8 @@ const insertSQL = `
:application_name,
:planid,
:query_plan,
:histogram_items
:histogram_items,
:plan_summary
)
`

Expand Down
1 change: 1 addition & 0 deletions qan-api2/models/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ var (
"top_queryid": queryDimensionTmpl,
"application_name": queryDimensionTmpl,
"planid": queryDimensionTmpl,
"plan_summary": queryDimensionTmpl,
}
)

Expand Down
2 changes: 2 additions & 0 deletions qan-api2/services/analytics/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ var standartDimensions = map[string]struct{}{
"application_name": {},
"top_queryid": {},
"planid": {},
"plan_summary": {},
}

var sumColumnNames = map[string]struct{}{
Expand Down Expand Up @@ -183,6 +184,7 @@ func isDimension(name string) bool {
"application_name": {},
"top_queryid": {},
"planid": {},
"plan_summary": {},
}

_, ok := dimensionColumnNames[name]
Expand Down
1 change: 1 addition & 0 deletions qan-api2/services/analytics/filters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func TestService_GetFilters(t *testing.T) {
{Key: "top_queryid", Value: []string{"top_queryid1"}},
{Key: "application_name", Value: []string{"psql"}},
{Key: "planid", Value: []string{"planid1"}},
{Key: "plan_summary", Value: []string{"COLLSCAN", "IXSCAN"}},
},
},
&want,
Expand Down
Loading
Loading