Skip to content

Commit

Permalink
Defer profile creation until encoding phase
Browse files Browse the repository at this point in the history
  • Loading branch information
szegedi committed Oct 14, 2024
1 parent 0904549 commit ffc736c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/dd-trace/src/profiling/profilers/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,13 +330,13 @@ class EventsProfiler {
if (!restart) {
this.stop()
}
const profile = this.eventSerializer.createProfile(startDate, endDate)
const thatEventSerializer = this.eventSerializer
this.eventSerializer = new EventSerializer()
return profile
return () => thatEventSerializer.createProfile(startDate, endDate)
}

encode (profile) {
return pprof.encode(profile)
return pprof.encode(profile())
}
}

Expand Down

0 comments on commit ffc736c

Please sign in to comment.