Skip to content

Commit

Permalink
flamechart: Stack Merging (#5478)
Browse files Browse the repository at this point in the history
* wip: stack merging initial implementation

* pkg/query: Fix grouping by timestamps and durations

* ui/profile/ProfileIcicleGraph: Read duration and timestamp from column

We expose these two columns in the table now and therefore can read the values directly.

* Fixing the groupby field name and some UI fixes

* [pre-commit.ci lite] apply automatic fixes

* Brought back the group by timestamp field

* Linter fix

---------

Co-authored-by: Matthias Loibl <[email protected]>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Feb 12, 2025
1 parent fb92f9a commit 6ad4a58
Show file tree
Hide file tree
Showing 12 changed files with 264 additions and 161 deletions.
14 changes: 7 additions & 7 deletions gen/proto/go/google/api/http.pb.go

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

8 changes: 6 additions & 2 deletions pkg/parcacol/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -971,14 +971,18 @@ func (q *Querier) SymbolizeArrowRecord(

indices = schema.FieldIndices(profile.ColumnTimestamp)
var timestampColumn *array.Int64
if len(indices) != 1 {
if len(indices) == 1 {
timestampColumn = r.Column(indices[0]).(*array.Int64)
} else {
timestampColumn = arrowutils.MakeNullArray(q.pool, arrow.PrimitiveTypes.Int64, valueColumn.Len()).(*array.Int64)
defer timestampColumn.Release()
}

indices = schema.FieldIndices(profile.ColumnDuration)
var durationColumn *array.Int64
if len(indices) != 1 {
if len(indices) == 1 {
durationColumn = r.Column(indices[0]).(*array.Int64)
} else {
durationColumn = arrowutils.MakeNullArray(q.pool, arrow.PrimitiveTypes.Int64, valueColumn.Len()).(*array.Int64)
defer durationColumn.Release()
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/profile/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type RecordReader struct {
Locations *array.List
Location *array.Struct
Address *array.Uint64
TimeNanos *array.Int64
Timestamp *array.Int64
Duration *array.Int64
MappingStart *array.Uint64
MappingLimit *array.Uint64
Expand Down Expand Up @@ -122,7 +122,7 @@ func NewRecordReader(ar arrow.Record) *RecordReader {
lineFunctionStartLine := line.Field(4).(*array.Int64)
valueColumn := ar.Column(labelNum + 1).(*array.Int64)
diffColumn := ar.Column(labelNum + 2).(*array.Int64)
timeNanos := ar.Column(labelNum + 3).(*array.Int64)
timestamp := ar.Column(labelNum + 3).(*array.Int64)
duration := ar.Column(labelNum + 4).(*array.Int64)

return &RecordReader{
Expand Down Expand Up @@ -151,7 +151,7 @@ func NewRecordReader(ar arrow.Record) *RecordReader {
LineFunctionStartLine: lineFunctionStartLine,
Value: valueColumn,
Diff: diffColumn,
TimeNanos: timeNanos,
Timestamp: timestamp,
Duration: duration,
}
}
8 changes: 4 additions & 4 deletions pkg/query/columnquery.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,16 @@ func (q *ColumnQueryAPI) Query(ctx context.Context, req *pb.QueryRequest) (*pb.Q

groupBy := req.GetGroupBy().GetFields()
allowedGroupBy := map[string]struct{}{
profile.ColumnTimeNanos: {},
profile.ColumnDuration: {},
FlamegraphFieldDuration: {},
FlamegraphFieldFunctionFileName: {},
FlamegraphFieldFunctionName: {},
FlamegraphFieldLocationAddress: {},
FlamegraphFieldMappingFile: {},
FlamegraphFieldFunctionFileName: {},
FlamegraphFieldTimestamp: {},
}

if req.GetReportType() == pb.QueryRequest_REPORT_TYPE_FLAMECHART {
groupBy = append(groupBy, profile.ColumnTimeNanos, profile.ColumnDuration)
groupBy = append(groupBy, FlamegraphFieldTimestamp, FlamegraphFieldDuration)
}

groupByLabels := make([]string, 0, len(groupBy))
Expand Down
Loading

0 comments on commit 6ad4a58

Please sign in to comment.