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 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(String pluginId, String notification) { | 238 void logPluginNotification(String pluginId, String notification) { |
239 if (_instrumentationServer != null) { | 239 if (_instrumentationServer != null) { |
240 _instrumentationServer | 240 _instrumentationServer.log( |
241 .log(_join([TAG_PLUGIN_NOTIFICATION, pluginId, notification])); | 241 _join([TAG_PLUGIN_NOTIFICATION, notification, pluginId, '', ''])); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 void logPluginRequest(String pluginId, 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, pluginId, request])); | 248 .log(_join([TAG_PLUGIN_REQUEST, request, pluginId, '', ''])); |
249 } | 249 } |
250 } | 250 } |
251 | 251 |
252 void logPluginResponse(String pluginId, 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, pluginId, response])); | 255 .log(_join([TAG_PLUGIN_RESPONSE, response, pluginId, '', ''])); |
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 * This doesn't necessarily imply that there is a problem with the plugin, |
| 262 * only that this particular response was not included in the data returned |
| 263 * to the client. |
261 */ | 264 */ |
262 void logPluginTimeout(PluginData plugin, String request) { | 265 void logPluginTimeout(PluginData plugin, String request) { |
263 if (_instrumentationServer != null) { | 266 if (_instrumentationServer != null) { |
264 List<String> fields = <String>[TAG_PLUGIN_TIMEOUT, request]; | 267 List<String> fields = <String>[TAG_PLUGIN_TIMEOUT, request]; |
265 plugin.addToFields(fields); | 268 plugin.addToFields(fields); |
266 _instrumentationServer.log(_join(fields)); | 269 _instrumentationServer.log(_join(fields)); |
267 } | 270 } |
268 } | 271 } |
269 | 272 |
270 /** | 273 /** |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 * Initialize a newly created set of data about a plugin. | 497 * Initialize a newly created set of data about a plugin. |
495 */ | 498 */ |
496 PluginData(this.pluginId, this.name, this.version); | 499 PluginData(this.pluginId, this.name, this.version); |
497 | 500 |
498 /** | 501 /** |
499 * Add the information about the plugin to the list of [fields] to be sent to | 502 * Add the information about the plugin to the list of [fields] to be sent to |
500 * the instrumentation server. | 503 * the instrumentation server. |
501 */ | 504 */ |
502 void addToFields(List<String> fields) { | 505 void addToFields(List<String> fields) { |
503 fields.add(pluginId); | 506 fields.add(pluginId); |
504 if (name != null) { | 507 fields.add(name ?? ''); |
505 fields.add(name); | 508 fields.add(version ?? ''); |
506 } | |
507 if (version != null) { | |
508 fields.add(version); | |
509 } | |
510 } | 509 } |
511 } | 510 } |
OLD | NEW |