Closed kevinmstephens closed 6 years ago
I would like to still have the time of the tail when the log is on the tail event though...
@AdriVanHoudt I think we should add a new flag for that. Could be tailTime
and be the same logic as what responseTime
currently is.
Does that work or do you have any other suggestions?
I'd be OK with that.... that's technically a breaking change though since we're changing what responseTime
means... maybe add a new field for request.info.responded
and leave responseTime
alone for now and then in a subsequent major release, change it around?
And then document that responseTime
includes tail time when enabled? Works for me.
And why not just a major with all the PR's that are open @arb?
@arb glad to leave that field alone but actually I would recommend we change responseTime
to be what it seems like it should be (the actual response time).
As-is it's not intuitively named and I as well as my peers have been confused here and had to look into the code to figure out that oh, it's really the time including tail. Why is it named responseTime
?
I'll fix the PR to be non-breaking for now. If you end up deciding to do a major please give me a chance to switch the flag names though.
I've added the breaking change here. I will open another PR with the non-breaking alternative.
Hey @kevinmstephens are you still interested in landing this? I'd like to have it part of the 8.0.0-rc1
release.
@arb So I see in V17 of Hapi that tail is no longer supported. Does that render the tailTime
feature N/A or should we support hapi releases < 17?
The change of using the more accurate this.responseTime = request.info.responded - request.info.received;
seems relevant so I would still like to make that change.
If you can let me know on the support for tails I can fix this PR up accordingly.
I'm really not planning on supporting < 17 anymore only security updates. You're right though, hapi 17 lost tails, so that change we can just nix.
@arb Ready for review.
I was checking to be sure request.responded
would always be set and from what I can tell - yes. There is only one place in the hapi code that emits the response event and you can see here that responded is set right before this event is emitted.
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
Hapi 15 docs:
responded - request response timestamp (0 is not responded yet).
This will use the diff of responded to received as the response event
responseTime
. Fallback toDate.now()
behavior when responded=0 or just in case any old Hapi versions don't set this.No test added b/c I didn't see any similar testing of event flags. Glad to add one if needed.