Skip to content

Commit

Permalink
Merge pull request apache#5256: [BEAM-4224] Update perf.go: only trig…
Browse files Browse the repository at this point in the history
…ger on processing bundles

[BEAM-4224] Update perf.go: only trigger on processing bundles
  • Loading branch information
jasonkuster committed May 2, 2018
2 parents a08e6b0 + 09be3af commit 5e995f7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sdks/go/pkg/beam/x/hooks/perf/perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ func init() {
enabled := len(enabledProfCaptureHooks) > 0
var cpuProfBuf bytes.Buffer
return hooks.Hook{
Req: func(ctx context.Context, _ *fnpb.InstructionRequest) (context.Context, error) {
if !enabled {
Req: func(ctx context.Context, req *fnpb.InstructionRequest) (context.Context, error) {
if !enabled || req.GetProcessBundle() == nil {
return ctx, nil
}
cpuProfBuf.Reset()
return ctx, pprof.StartCPUProfile(&cpuProfBuf)
},
Resp: func(ctx context.Context, req *fnpb.InstructionRequest, _ *fnpb.InstructionResponse) error {
if !enabled {
if !enabled || req.GetProcessBundle() == nil {
return nil
}
pprof.StopCPUProfile()
Expand Down

0 comments on commit 5e995f7

Please sign in to comment.