Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: pkg/analysis_server/tool/instrumentation/log/log.dart

Issue 2890193002: Make instrumentation data structure more regular (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/lib/instrumentation/instrumentation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/tool/instrumentation/log/log.dart
diff --git a/pkg/analysis_server/tool/instrumentation/log/log.dart b/pkg/analysis_server/tool/instrumentation/log/log.dart
index 70c23db220ef49e5ba67b28fec3d63d5cb5650c0..544013cd027993a1778d0e24799443f90caa1f39 100644
--- a/pkg/analysis_server/tool/instrumentation/log/log.dart
+++ b/pkg/analysis_server/tool/instrumentation/log/log.dart
@@ -162,6 +162,23 @@ class GenericEntry extends LogEntry {
}
/**
+ * A log entry representing an PluginErr entry.
+ */
+class GenericPluginEntry extends GenericEntry with PluginEntryMixin {
+ /**
+ * The components describing the plugin associated with this entry.
+ */
+ final List<String> pluginData;
+
+ /**
+ * Initialize a newly created log entry.
+ */
+ GenericPluginEntry(int index, int timeStamp, String entryKind,
+ List<String> components, this.pluginData)
+ : super(index, timeStamp, entryKind, components);
+}
+
+/**
* A representation of an instrumentation log.
*/
class InstrumentationLog {
@@ -551,6 +568,26 @@ abstract class JsonBasedEntry extends LogEntry {
}
/**
+ * A log entry representing a communication between the server and a plugin.
+ */
+abstract class JsonBasedPluginEntry extends JsonBasedEntry
+ with PluginEntryMixin {
+ /**
+ * The components describing the plugin associated with this entry.
+ */
+ final List<String> pluginData;
+
+ /**
+ * Initialize a newly created entry to have the given [timeStamp] and
+ * [notificationData] and to be associated with the plugin with the given
+ * [pluginData].
+ */
+ JsonBasedPluginEntry(
+ int index, int timeStamp, Map notificationData, this.pluginData)
+ : super(index, timeStamp, notificationData);
+}
+
+/**
* A single entry in an instrumentation log.
*/
abstract class LogEntry {
@@ -639,26 +676,26 @@ abstract class LogEntry {
} else if (entryKind == InstrumentationService.TAG_PERFORMANCE) {
// Fall through
} else if (entryKind == InstrumentationService.TAG_PLUGIN_ERROR) {
- return new PluginErrorEntry(
- index, timeStamp, entryKind, components[2], components.sublist(3));
+ return new PluginErrorEntry(index, timeStamp, entryKind,
+ components.sublist(2, 4), components.sublist(4));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_EXCEPTION) {
- return new PluginExceptionEntry(
- index, timeStamp, entryKind, components[2], components.sublist(3));
+ return new PluginExceptionEntry(index, timeStamp, entryKind,
+ components.sublist(2, 5), components.sublist(5));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_NOTIFICATION) {
- Map requestData = JSON.decode(components[3]);
+ Map requestData = JSON.decode(components[2]);
return new PluginNotificationEntry(
- index, timeStamp, components[2], requestData);
+ index, timeStamp, requestData, components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_REQUEST) {
- Map requestData = JSON.decode(components[3]);
+ Map requestData = JSON.decode(components[2]);
return new PluginRequestEntry(
- index, timeStamp, components[2], requestData);
+ index, timeStamp, requestData, components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_RESPONSE) {
- Map responseData = JSON.decode(components[3]);
+ Map responseData = JSON.decode(components[2]);
return new PluginResponseEntry(
- index, timeStamp, components[2], responseData);
+ index, timeStamp, responseData, components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_TIMEOUT) {
- return new PluginErrorEntry(
- index, timeStamp, entryKind, components[2], components.sublist(3));
+ return new PluginErrorEntry(index, timeStamp, entryKind,
+ components.sublist(2, 3), components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_REQUEST) {
Map requestData = JSON.decode(components[2]);
return new RequestEntry(index, timeStamp, requestData);
@@ -833,29 +870,26 @@ class NotificationEntry extends JsonBasedEntry {
/**
* A log entry representing a communication between the server and a plugin.
*/
-abstract class PluginEntry extends JsonBasedEntry with PluginEntryMixin {
+abstract class PluginEntryMixin {
/**
- * The id of the plugin being communicated with.
+ * The components describing the plugin associated with this entry.
*/
- final String pluginId;
+ List<String> get pluginData;
/**
- * Initialize a newly created entry to have the given [timeStamp] and
- * [notificationData] and to be associated with the plugin with the given
- * [pluginId].
+ * The id of the plugin associated with this entry.
*/
- PluginEntry(int index, int timeStamp, this.pluginId, Map notificationData)
- : super(index, timeStamp, notificationData);
-}
+ String get pluginId => pluginData[0];
+
+ /**
+ * The name of the plugin associated with this entry.
+ */
+ String get pluginName => pluginData[1];
-/**
- * A log entry representing a communication between the server and a plugin.
- */
-abstract class PluginEntryMixin {
/**
- * The id of the plugin being communicated with.
+ * The version of the plugin associated with this entry.
*/
- String get pluginId;
+ String get pluginVersion => pluginData[2];
/**
* Return a shortened version of the plugin id.
@@ -872,49 +906,39 @@ abstract class PluginEntryMixin {
/**
* A log entry representing an PluginErr entry.
*/
-class PluginErrorEntry extends GenericEntry with PluginEntryMixin {
- /**
- * The id of the plugin that generated the error.
- */
- final String pluginId;
-
+class PluginErrorEntry extends GenericPluginEntry {
/**
* Initialize a newly created log entry.
*/
- PluginErrorEntry(int index, int timeStamp, String entryKind, this.pluginId,
- List<String> components)
- : super(index, timeStamp, entryKind, components);
+ PluginErrorEntry(int index, int timeStamp, String entryKind,
+ List<String> components, List<String> pluginData)
+ : super(index, timeStamp, entryKind, components, pluginData);
}
/**
* A log entry representing an PluginEx entry.
*/
-class PluginExceptionEntry extends GenericEntry with PluginEntryMixin {
- /**
- * The id of the plugin that generated the exception.
- */
- final String pluginId;
-
+class PluginExceptionEntry extends GenericPluginEntry {
/**
* Initialize a newly created log entry.
*/
PluginExceptionEntry(int index, int timeStamp, String entryKind,
- this.pluginId, List<String> components)
- : super(index, timeStamp, entryKind, components);
+ List<String> components, List<String> pluginData)
+ : super(index, timeStamp, entryKind, components, pluginData);
}
/**
* A log entry representing a notification that was sent from a plugin to the
* server.
*/
-class PluginNotificationEntry extends PluginEntry {
+class PluginNotificationEntry extends JsonBasedPluginEntry {
/**
* Initialize a newly created notification to have the given [timeStamp] and
* [notificationData].
*/
PluginNotificationEntry(
- int index, int timeStamp, String pluginId, Map notificationData)
- : super(index, timeStamp, pluginId, notificationData);
+ int index, int timeStamp, Map notificationData, List<String> pluginData)
+ : super(index, timeStamp, notificationData, pluginData);
/**
* Return the event field of the notification.
@@ -940,13 +964,14 @@ class PluginNotificationEntry extends PluginEntry {
/**
* A log entry representing a request that was sent from the server to a plugin.
*/
-class PluginRequestEntry extends PluginEntry {
+class PluginRequestEntry extends JsonBasedPluginEntry {
/**
* Initialize a newly created response to have the given [timeStamp] and
* [requestData].
*/
- PluginRequestEntry(int index, int timeStamp, String pluginId, Map requestData)
- : super(index, timeStamp, pluginId, requestData);
+ PluginRequestEntry(
+ int index, int timeStamp, Map requestData, List<String> pluginData)
+ : super(index, timeStamp, requestData, pluginData);
/**
* Return the id field of the request.
@@ -978,14 +1003,14 @@ class PluginRequestEntry extends PluginEntry {
* A log entry representing a response that was sent from a plugin to the
* server.
*/
-class PluginResponseEntry extends PluginEntry {
+class PluginResponseEntry extends JsonBasedPluginEntry {
/**
* Initialize a newly created response to have the given [timeStamp] and
* [responseData].
*/
PluginResponseEntry(
- int index, int timeStamp, String pluginId, Map responseData)
- : super(index, timeStamp, pluginId, responseData);
+ int index, int timeStamp, Map responseData, List<String> pluginData)
+ : super(index, timeStamp, responseData, pluginData);
/**
* Return the id field of the response.
« no previous file with comments | « no previous file | pkg/analyzer/lib/instrumentation/instrumentation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698