From 2cfa00791ad6dd56b0a3c14e0554343a7c091468 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 16 Mar 2020 19:38:51 +0000 Subject: [PATCH] [ 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 Commit-Queue: Ben Konyi --- .../observatory/tests/service/verify_http_timeline_test.dart | 2 ++ sdk/lib/_http/http_impl.dart | 4 +--- sdk_nnbd/lib/_http/http_impl.dart | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/runtime/observatory/tests/service/verify_http_timeline_test.dart b/runtime/observatory/tests/service/verify_http_timeline_test.dart index dfd6ad88df4..f7809c87a13 100644 --- a/runtime/observatory/tests/service/verify_http_timeline_test.dart +++ b/runtime/observatory/tests/service/verify_http_timeline_test.dart @@ -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); diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart index 336c6d0d844..890a570fa12 100644 --- a/sdk/lib/_http/http_impl.dart +++ b/sdk/lib/_http/http_impl.dart @@ -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( diff --git a/sdk_nnbd/lib/_http/http_impl.dart b/sdk_nnbd/lib/_http/http_impl.dart index a63bf64f30b..5b9782a8ebb 100644 --- a/sdk_nnbd/lib/_http/http_impl.dart +++ b/sdk_nnbd/lib/_http/http_impl.dart @@ -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(