You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it is confusing that each label has to be distinct across multiple instances of ServerTiming.
Steps to reproduce
'use strict'constServerTiming=require('servertiming')functiontime(label,promise){returnnewPromise((resolve,reject)=>{consttiming=newServerTiming()timing.startTimer(label)promise.then(value=>{timing.stopTimer(label)resolve([value,{"Server-Timing":timing.generateHeader()}])})})}functionheavyComputation(value){returnnewPromise((resolve,reject)=>{setTimeout(()=>{resolve(value)},500)})}Promise.all([time('Multiple ServerTiming instances should not share labels',heavyComputation(1)),time('Multiple ServerTiming instances should not share labels',heavyComputation(2)),time('Multiple ServerTiming instances should not share labels',heavyComputation(3)),]).then(timings=>{timings.map(([value,header])=>console.log(value,header['Server-Timing']))}).catch(console.error)
The above will output:
1 multiple-servertiming-instances-should-not-share-labels; dur=500.8789; desc="Multiple ServerTiming instances should not share labels"
2 multiple-servertiming-instances-should-not-share-labels; dur=0; desc="Multiple ServerTiming instances should not share labels"
3 multiple-servertiming-instances-should-not-share-labels; dur=0; desc="Multiple ServerTiming instances should not share labels"
Obviously the duration is not correct.
node-servertiming: 1.5.0
node: v14.16.1
The text was updated successfully, but these errors were encountered:
I think it is confusing that each label has to be distinct across multiple instances of
ServerTiming
.Steps to reproduce
The above will output:
Obviously the duration is not correct.
node-servertiming: 1.5.0
node: v14.16.1
The text was updated successfully, but these errors were encountered: