add timestamp to inspector request stats (#25667)

* add timestamp to inspector request stats

* remove if wrapper, internationalize
This commit is contained in:
Nathan Reese 2018-11-26 08:04:43 -07:00 committed by GitHub
parent 8f871f941c
commit 13eccd522a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@
* under the License.
*/
import { i18n } from '@kbn/i18n';
import { Request, RequestStatistics, RequestStatus, Response } from './types';
/**
@ -43,6 +44,18 @@ export class RequestResponder {
...(this.request.stats || {}),
...stats,
};
const startDate = new Date(this.request.startTime);
const timestampKey = i18n.translate('common.ui.inspector.reqTimestampKey', {
defaultMessage: 'Request timestamp',
});
this.request.stats[timestampKey] = {
value: startDate.toISOString(),
description: i18n.translate('common.ui.inspector.reqTimestampDescription', {
defaultMessage: 'Time when the start of the request has been logged',
}),
};
this.onChange();
return this;
}