OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.instrumentation.instrumentation; | 5 library analyzer.instrumentation.instrumentation; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 | 9 |
10 import 'package:analyzer/task/model.dart'; | 10 import 'package:analyzer/task/model.dart'; |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 List<String> fields = <String>[ | 228 List<String> fields = <String>[ |
229 TAG_PLUGIN_EXCEPTION, | 229 TAG_PLUGIN_EXCEPTION, |
230 _toString(exception), | 230 _toString(exception), |
231 _toString(stackTrace) | 231 _toString(stackTrace) |
232 ]; | 232 ]; |
233 plugin.addToFields(fields); | 233 plugin.addToFields(fields); |
234 _instrumentationServer.log(_join(fields)); | 234 _instrumentationServer.log(_join(fields)); |
235 } | 235 } |
236 } | 236 } |
237 | 237 |
238 void logPluginNotification(Uri pluginUri, String notification) { | 238 void logPluginNotification(String pluginId, String notification) { |
239 if (_instrumentationServer != null) { | 239 if (_instrumentationServer != null) { |
240 _instrumentationServer.log( | 240 _instrumentationServer |
241 _join([TAG_PLUGIN_NOTIFICATION, _toString(pluginUri), notification])); | 241 .log(_join([TAG_PLUGIN_NOTIFICATION, pluginId, notification])); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 void logPluginRequest(Uri pluginUri, String request) { | 245 void logPluginRequest(String pluginId, String request) { |
246 if (_instrumentationServer != null) { | 246 if (_instrumentationServer != null) { |
247 _instrumentationServer | 247 _instrumentationServer |
248 .log(_join([TAG_PLUGIN_REQUEST, _toString(pluginUri), request])); | 248 .log(_join([TAG_PLUGIN_REQUEST, pluginId, request])); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 void logPluginResponse(Uri pluginUri, String response) { | 252 void logPluginResponse(String pluginId, String response) { |
253 if (_instrumentationServer != null) { | 253 if (_instrumentationServer != null) { |
254 _instrumentationServer | 254 _instrumentationServer |
255 .log(_join([TAG_PLUGIN_RESPONSE, _toString(pluginUri), response])); | 255 .log(_join([TAG_PLUGIN_RESPONSE, pluginId, response])); |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 /** | 259 /** |
260 * Log that the given [plugin] took too long to execute the given [request]. | 260 * Log that the given [plugin] took too long to execute the given [request]. |
261 */ | 261 */ |
262 void logPluginTimeout(PluginData plugin, String request) { | 262 void logPluginTimeout(PluginData plugin, String request) { |
263 if (_instrumentationServer != null) { | 263 if (_instrumentationServer != null) { |
264 List<String> fields = <String>[TAG_PLUGIN_TIMEOUT, request]; | 264 List<String> fields = <String>[TAG_PLUGIN_TIMEOUT, request]; |
265 plugin.addToFields(fields); | 265 plugin.addToFields(fields); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
469 await server.shutdown(); | 469 await server.shutdown(); |
470 } | 470 } |
471 } | 471 } |
472 } | 472 } |
473 | 473 |
474 /** | 474 /** |
475 * Information about a plugin. | 475 * Information about a plugin. |
476 */ | 476 */ |
477 class PluginData { | 477 class PluginData { |
478 /** | 478 /** |
479 * The path to the plugin. | 479 * The id used to uniquely identify the plugin. |
480 */ | 480 */ |
481 final String path; | 481 final String pluginId; |
482 | 482 |
483 /** | 483 /** |
484 * The name of the plugin. | 484 * The name of the plugin. |
485 */ | 485 */ |
486 final String name; | 486 final String name; |
487 | 487 |
488 /** | 488 /** |
489 * The version of the plugin. | 489 * The version of the plugin. |
490 */ | 490 */ |
491 final String version; | 491 final String version; |
492 | 492 |
493 /** | 493 /** |
494 * Initialize a newly created set of data about a plugin. | 494 * Initialize a newly created set of data about a plugin. |
495 */ | 495 */ |
496 PluginData(this.path, this.name, this.version); | 496 PluginData(this.pluginId, this.name, this.version); |
497 | 497 |
498 /** | 498 /** |
499 * Add the information about the plugin to the list of [fields] to be sent to | 499 * Add the information about the plugin to the list of [fields] to be sent to |
500 * the instrumentation server. | 500 * the instrumentation server. |
501 */ | 501 */ |
502 void addToFields(List<String> fields) { | 502 void addToFields(List<String> fields) { |
503 fields.add(path); | 503 fields.add(pluginId); |
504 if (name != null) { | 504 if (name != null) { |
505 fields.add(name); | 505 fields.add(name); |
506 } | 506 } |
507 if (version != null) { | 507 if (version != null) { |
508 fields.add(version); | 508 fields.add(version); |
509 } | 509 } |
510 } | 510 } |
511 } | 511 } |
OLD | NEW |