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

Unified Diff: pkg/analysis_server/tool/instrumentation/page/log_page.dart

Issue 2891743002: Update the log viewer to understand the plugin entries (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
Index: pkg/analysis_server/tool/instrumentation/page/log_page.dart
diff --git a/pkg/analysis_server/tool/instrumentation/page/log_page.dart b/pkg/analysis_server/tool/instrumentation/page/log_page.dart
index 756b2f4a9f157c0fccfaa503b957433720bc8322..b53758015f5884f991b48e9d8e28cf7c605da546 100644
--- a/pkg/analysis_server/tool/instrumentation/page/log_page.dart
+++ b/pkg/analysis_server/tool/instrumentation/page/log_page.dart
@@ -45,11 +45,23 @@ class LogPage extends PageWriter {
int prefixLength;
/**
+ * A table mapping the ids of plugins to an index for the plugin.
+ */
+ Map<String, int> pluginIdMap = <String, int>{};
+
+ /**
* Initialize a newly created writer to write the content of the given
* [instrumentationLog].
*/
LogPage(this.log);
+ /**
+ * Return the encoding for the given [pluginId] that is used to build anchors.
+ */
+ int getPluginId(String pluginId) {
+ return pluginIdMap.putIfAbsent(pluginId, () => pluginIdMap.length);
+ }
+
@override
void writeBody(StringSink sink) {
entries = log.entriesInGroup(selectedGroup);
@@ -173,10 +185,43 @@ function selectEntryGroup(pageStart) {
}
}
}
+ } else if (entry is PluginRequestEntry) {
+ String entryId = entry.id;
+ int pluginId = getPluginId(entry.pluginId);
+ id = 'req$pluginId.$entryId';
+ clickHandler =
+ 'highlight(\'req$pluginId.$entryId\', \'res$pluginId.$entryId\')';
+ icon = '&rarr;';
+ description = '${entry.method} (${entry.shortPluginId})';
+ } else if (entry is PluginResponseEntry) {
+ String entryId = entry.id;
+ int pluginId = getPluginId(entry.pluginId);
+ PluginRequestEntry request = log.pluginRequestFor(entry);
+ id = 'res$pluginId.$entryId';
+ clickHandler =
+ 'highlight(\'req$pluginId.$entryId\', \'res$pluginId.$entryId\')';
+ icon = '&larr;';
+ if (request != null) {
+ int latency = entry.timeStamp - request.timeStamp;
+ description =
+ '${request.method} <span class="gray">($latency ms)</span> (${entry.shortPluginId})';
+ }
+ } else if (entry is PluginNotificationEntry) {
+ id = 'e${entry.index}';
+ LogEntry pairedEntry = log.pairedEntry(entry);
+ if (pairedEntry != null) {
+ String pairedId = 'e${pairedEntry.index}';
+ clickHandler = 'highlight(\'$id\', \'$pairedId\')';
+ }
+ icon = '&larr;';
+ description = '${entry.event} (${entry.shortPluginId})';
} else if (entry is TaskEntry) {
description = entry.description;
} else if (entry is ErrorEntry) {
description = '<span class="error">$description</span>';
+ } else if (entry is PluginErrorEntry) {
+ description =
+ '<span class="error">$description</span> (${entry.shortPluginId})';
} else if (entry is ExceptionEntry) {
description = '<span class="error">$description</span>';
} else if (entry is MalformedLogEntry) {
« no previous file with comments | « pkg/analysis_server/tool/instrumentation/log/log.dart ('k') | pkg/analysis_server/tool/instrumentation/page/stats_page.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698