mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
[ dart:http ] Update HTTP client request logging to use filterKey TimelineTask constructor
Change-Id: Id99e102c455fade1165f650a4bcc4f7589a7f398 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/139685 Reviewed-by: Kenzie Schmoll <kenzieschmoll@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
90e32fe161
commit
2cfa00791a
3 changed files with 4 additions and 6 deletions
|
@ -201,6 +201,7 @@ void validateHttpStartEvent(Map event, String method) {
|
|||
final args = event['args'];
|
||||
expect(args.containsKey('method'), isTrue);
|
||||
expect(args['method'], method);
|
||||
expect(args['filterKey'], 'HTTP/client');
|
||||
if (!args.containsKey('error')) {
|
||||
expect(args.containsKey('requestHeaders'), isTrue);
|
||||
expect(args['requestHeaders'] != null, isTrue);
|
||||
|
@ -226,6 +227,7 @@ void validateHttpStartEvent(Map event, String method) {
|
|||
void validateHttpFinishEvent(Map event) {
|
||||
expect(event.containsKey('args'), isTrue);
|
||||
final args = event['args'];
|
||||
expect(args['filterKey'], 'HTTP/client');
|
||||
expect(args.containsKey('compressionState'), isTrue);
|
||||
expect(args.containsKey('connectionInfo'), isTrue);
|
||||
expect(args.containsKey('contentLength'), isTrue);
|
||||
|
|
|
@ -2257,8 +2257,6 @@ class _HttpClient implements HttpClient {
|
|||
static void _startRequestTimelineEvent(
|
||||
TimelineTask timeline, String method, Uri uri) {
|
||||
timeline?.start('HTTP CLIENT ${method.toUpperCase()}', arguments: {
|
||||
'filterKey':
|
||||
'HTTP/client', // key used to filter network requests from timeline
|
||||
'method': method.toUpperCase(),
|
||||
'uri': uri.toString(),
|
||||
});
|
||||
|
@ -2304,7 +2302,7 @@ class _HttpClient implements HttpClient {
|
|||
TimelineTask timeline;
|
||||
// TODO(bkonyi): do we want this to be opt-in?
|
||||
if (HttpClient.enableTimelineLogging) {
|
||||
timeline = TimelineTask();
|
||||
timeline = TimelineTask(filterKey: 'HTTP/client');
|
||||
_startRequestTimelineEvent(timeline, method, uri);
|
||||
}
|
||||
return _getConnection(uri.host, port, proxyConf, isSecure, timeline).then(
|
||||
|
|
|
@ -2257,8 +2257,6 @@ class _HttpClient implements HttpClient {
|
|||
static void _startRequestTimelineEvent(
|
||||
TimelineTask? timeline, String method, Uri uri) {
|
||||
timeline?.start('HTTP CLIENT ${method.toUpperCase()}', arguments: {
|
||||
'filterKey':
|
||||
'HTTP/client', // key used to filter network requests from timeline
|
||||
'method': method.toUpperCase(),
|
||||
'uri': uri.toString(),
|
||||
});
|
||||
|
@ -2305,7 +2303,7 @@ class _HttpClient implements HttpClient {
|
|||
TimelineTask? timeline;
|
||||
// TODO(bkonyi): do we want this to be opt-in?
|
||||
if (HttpClient.enableTimelineLogging) {
|
||||
timeline = TimelineTask();
|
||||
timeline = TimelineTask(filterKey: 'HTTP/client');
|
||||
_startRequestTimelineEvent(timeline, method, uri);
|
||||
}
|
||||
return _getConnection(uri.host, port, proxyConf, isSecure, timeline).then(
|
||||
|
|
Loading…
Reference in a new issue