Skip to content

Commit 11065c2

Browse files
korniltsevaleks-pkorniltsev-grafanista
authored
Cherry pick Aleksandar readpath patches (#4404)
* Switch to swiss map for profile merges * Add support for disabling profile sanitization in the read path * fmt --------- Co-authored-by: Aleksandar Petrov <[email protected]> Co-authored-by: Tolya Korniltsev <[email protected]>
1 parent 661762e commit 11065c2

File tree

25 files changed

+405
-267
lines changed

25 files changed

+405
-267
lines changed

api/gen/proto/go/query/v1/query.pb.go

Lines changed: 220 additions & 206 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/gen/proto/go/query/v1/query_vtproto.pb.go

Lines changed: 37 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapiv2/gen/phlare.swagger.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,12 @@
13281328
},
13291329
"v1InvokeOptions": {
13301330
"type": "object",
1331-
"description": "Query workers might not have access to the tenant\n overrides, therefore all the necessary options should\n be listed in the request explicitly."
1331+
"properties": {
1332+
"sanitizeOnMerge": {
1333+
"type": "boolean",
1334+
"description": "Query workers might not have access to the tenant\noverrides, therefore all the necessary options should\nbe listed in the request explicitly."
1335+
}
1336+
}
13321337
},
13331338
"v1InvokeResponse": {
13341339
"type": "object",

api/query/v1/query.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ message InvokeOptions {
4040
// Query workers might not have access to the tenant
4141
// overrides, therefore all the necessary options should
4242
// be listed in the request explicitly.
43+
bool sanitize_on_merge = 1;
4344
}
4445

4546
message InvokeRequest {

cmd/pyroscope/help-all.txt.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,8 @@ Usage of ./pyroscope:
591591
Whether the series portion of query analysis is enabled. If disabled, no series data (e.g., series count) will be calculated by the /AnalyzeQuery endpoint.
592592
-querier.query-store-after duration
593593
The time after which a metric should be queried from storage and not just ingesters. 0 means all queries are sent to store. If this option is enabled, the time range of the query sent to the store-gateway will be manipulated to ensure the query end is not more recent than 'now - query-store-after'. (default 4h0m0s)
594+
-querier.sanitize-on-merge
595+
Whether profiles should be sanitized when merging. (default true)
594596
-querier.split-queries-by-interval duration
595597
Split queries by a time interval and execute in parallel. The value 0 disables splitting by time
596598
-query-frontend.grpc-client-config.backoff-max-period duration

cmd/pyroscope/help.txt.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,8 @@ Usage of ./pyroscope:
171171
Whether query analysis is enabled in the query frontend. If disabled, the /AnalyzeQuery endpoint will return an empty response. (default true)
172172
-querier.query-analysis-series-enabled
173173
Whether the series portion of query analysis is enabled. If disabled, no series data (e.g., series count) will be calculated by the /AnalyzeQuery endpoint.
174+
-querier.sanitize-on-merge
175+
Whether profiles should be sanitized when merging. (default true)
174176
-querier.split-queries-by-interval duration
175177
Split queries by a time interval and execute in parallel. The value 0 disables splitting by time
176178
-query-scheduler.max-outstanding-requests-per-tenant int

docs/sources/configure-server/reference-configuration-parameters/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,6 +2312,10 @@ distributor_usage_groups:
23122312
# CLI flag: -querier.split-queries-by-interval
23132313
[split_queries_by_interval: <duration> | default = 0s]
23142314
2315+
# Whether profiles should be sanitized when merging.
2316+
# CLI flag: -querier.sanitize-on-merge
2317+
[query_sanitize_on_merge: <boolean> | default = true]
2318+
23152319
# Delete blocks containing samples older than the specified retention period. 0
23162320
# to disable.
23172321
# CLI flag: -compactor.blocks-retention-period

pkg/distributor/distributor.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ func mergeProfile(profile *profilev1.Profile) aggregator.AggregateFn[*pprof.Prof
748748
if m == nil {
749749
m = new(pprof.ProfileMerge)
750750
}
751-
if err := m.Merge(profile); err != nil {
751+
if err := m.Merge(profile, true); err != nil {
752752
return nil, connect.NewError(connect.CodeInvalidArgument, err)
753753
}
754754
return m, nil

pkg/frontend/frontend.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ type Limits interface {
113113
MaxQueryLookback(tenantID string) time.Duration
114114
QueryAnalysisEnabled(string) bool
115115
SymbolizerEnabled(string) bool
116+
QuerySanitizeOnMerge(string) bool
116117
validation.FlameGraphLimits
117118
}
118119

pkg/frontend/frontend_diff_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ func (m *mockLimits) QuerySplitDuration(_ string) time.Duration {
2323
return time.Hour
2424
}
2525

26+
func (m *mockLimits) QuerySanitizeOnMerge(_ string) bool {
27+
return true
28+
}
29+
2630
func (m *mockLimits) MaxQueryParallelism(_ string) int {
2731
return 100
2832
}

0 commit comments

Comments
 (0)