Skip to content

Commit

Permalink
Profile proto serialization with slice reused (#2159)
Browse files Browse the repository at this point in the history
* Experiment profile proto serialization with slice reused

* make reference-help

* Switch to Grafana fork

* fmt
  • Loading branch information
cyriltovena authored Jul 24, 2023
1 parent 3ee46b9 commit ec55ea2
Show file tree
Hide file tree
Showing 20 changed files with 210 additions and 27 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ $(BIN)/protoc-gen-connect-go-mux: Makefile go.mod

$(BIN)/protoc-gen-go-vtproto: Makefile go.mod
@mkdir -p $(@D)
GOBIN=$(abspath $(@D)) $(GO) install github.com/planetscale/vtprotobuf/cmd/protoc-gen-go-vtproto@v0.4.0
GOBIN=$(abspath $(@D)) $(GO) install github.com/grafana/vtprotobuf/cmd/protoc-gen-go-vtproto@69fa34dad3472084bcae0b557e8813e6d4678f2b

$(BIN)/protoc-gen-openapiv2: Makefile go.mod
@mkdir -p $(@D)
Expand Down
5 changes: 5 additions & 0 deletions api/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ plugins:
- features=marshal+unmarshal+size+pool+grpc+pool+clone
- pool=github.com/grafana/pyroscope/api/gen/proto/go/google/v1.Profile
- pool=github.com/grafana/pyroscope/api/gen/proto/go/google/v1.Sample
- pool=github.com/grafana/pyroscope/api/gen/proto/go/google/v1.Mapping
- pool=github.com/grafana/pyroscope/api/gen/proto/go/google/v1.Function
- pool=github.com/grafana/pyroscope/api/gen/proto/go/google/v1.Location
- pool=github.com/grafana/pyroscope/api/gen/proto/go/google/v1.Label
- pool=github.com/grafana/pyroscope/api/gen/proto/go/google/v1.Line

- name: connect-go
out: gen/proto/go
Expand Down
2 changes: 1 addition & 1 deletion api/gen/proto/go/agent/v1/agent_vtproto.pb.go

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

146 changes: 140 additions & 6 deletions api/gen/proto/go/google/v1/profile_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion api/gen/proto/go/ingester/v1/ingester_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion api/gen/proto/go/push/v1/push_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion api/gen/proto/go/querier/v1/querier_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion api/gen/proto/go/status/v1/status_vtproto.pb.go

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

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

2 changes: 1 addition & 1 deletion api/gen/proto/go/types/v1/types_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion cmd/pyroscope/help-all.txt.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Usage of ./phlare:
Usage of ./pyroscope:
-api.base-url string
base URL for when the server is behind a reverse proxy with a different path
-auth.multitenancy-enabled
Expand Down
2 changes: 1 addition & 1 deletion cmd/pyroscope/help.txt.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Usage of ./phlare:
Usage of ./pyroscope:
-api.base-url string
base URL for when the server is behind a reverse proxy with a different path
-auth.multitenancy-enabled
Expand Down
2 changes: 1 addition & 1 deletion cmd/pyroscope/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestHelp(t *testing.T) {

co := test.CaptureOutput(t)

const cmd = "./phlare"
const cmd = "./pyroscope"
os.Args = []string{cmd, tc.arg}

// reset default flags
Expand Down
2 changes: 1 addition & 1 deletion pkg/frontend/frontendpb/frontend_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion pkg/og/convert/jfr/jfr_labels_vtproto.pb.go

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

35 changes: 30 additions & 5 deletions pkg/og/storage/tree/profile_vtproto.pb.go

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

19 changes: 19 additions & 0 deletions pkg/pprof/pprof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package pprof

import (
"math/rand"
"os"
"testing"
"time"

Expand Down Expand Up @@ -183,3 +184,21 @@ func countSampleDuplicates(p *Profile) int {
}
return totalDupe
}

var prof *profilev1.Profile

func BenchmarkFromRawBytes(b *testing.B) {
data, err := os.ReadFile("testdata/heap")
require.NoError(b, err)
b.ResetTimer()
b.ReportAllocs()
for i := 0; i < b.N; i++ {
err := FromBytes(data, func(p *profilev1.Profile, i int) error {
prof = p
return nil
})
if err != nil {
b.Fatal(err)
}
}
}
2 changes: 1 addition & 1 deletion pkg/querier/stats/stats_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion pkg/scheduler/schedulerpb/scheduler_vtproto.pb.go

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

2 changes: 1 addition & 1 deletion pkg/util/httpgrpc/httpgrpc_vtproto.pb.go

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

0 comments on commit ec55ea2

Please sign in to comment.