feat(apm): Heartbeat - #2478
Conversation
| clearTimeout(Tracing._heartbeat); | ||
| const keys = Object.keys(Tracing._activities); | ||
| if (keys.length) { | ||
| const heartbeatString = keys.reduce((prev: string, current: string) => prev + current); |
There was a problem hiding this comment.
Won't it be too fragile?
There was a problem hiding this comment.
Not sure was looking for something reasonable of "hashing" this whole thing
There was a problem hiding this comment.
Oooh, it's based on keys, so id, not type of activity. It shooooould be good enough for now then.
There was a problem hiding this comment.
This can be unnecessarily large (it is a string of unbounded length). Plus it sort of relies on key order. Looking for something better...
There was a problem hiding this comment.
Also, isn't this generating a lot of garbage for the GC every 5s?
There was a problem hiding this comment.
Co-Authored-By: Kamil Ogórek <kamil.ogorek@gmail.com>
| if (active) { | ||
| logger.log('[Tracing] finishIdleTransaction', active.transaction); | ||
| Tracing._addPerformanceEntries(active); | ||
| logger.log('[Tracing] finishIdleTransaction', active.transaction); |
There was a problem hiding this comment.
Why is this moving down?
There was a problem hiding this comment.
So debug prints are not confusing, that finish is the last thing we print before flushing the transaction.
| logger.log( | ||
| "[Tracing] Heartbeat safeguard kicked in, finishing transaction since activities content hasn't changed for 3 beats", | ||
| ); | ||
| Tracing._activeTransaction.setStatus(SpanStatus.DeadlineExceeded); |
There was a problem hiding this comment.
This status is the same as set by fromHttpCode for responses with 504 code.
Does it make sense to reuse the same status here?
There was a problem hiding this comment.
Won't it be confusing the UI?
There was a problem hiding this comment.
Hmm, you are not wrong but I thought we need to mark this transaction somehow and we also do it already for spans where autopop kicks in
Co-Authored-By: Rodolfo Carvalho <rodolfo.carvalho@sentry.io>
rhcarvalho
left a comment
There was a problem hiding this comment.
Just FTR I'm okay with this going in, it is a neat idea. As we other things tracing, we iterate and refine it.
Looking forward to see what heartbeat can do to traces.
Add a simple heartbeat check, if
activitiesdon't change in 3 beats, finish the transaction.