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

Unified Diff: pkg/analysis_server/lib/src/status/get_handler2.dart

Issue 2717253002: Add instrumentation data to the analysis server diagnostics page. (Closed)
Patch Set: html escape descriptions and convert url references to anchors Created 3 years, 9 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/file_instrumentation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/status/get_handler2.dart
diff --git a/pkg/analysis_server/lib/src/status/get_handler2.dart b/pkg/analysis_server/lib/src/status/get_handler2.dart
index 78a39989e7232c35cf239dec9dba6a5e406fae75..233323d6d5600a5149c03068f6c4d8bb359dd3e1 100644
--- a/pkg/analysis_server/lib/src/status/get_handler2.dart
+++ b/pkg/analysis_server/lib/src/status/get_handler2.dart
@@ -16,6 +16,7 @@ import 'package:analysis_server/src/socket_server.dart';
import 'package:analysis_server/src/status/get_handler.dart';
import 'package:analyzer/exception/exception.dart';
import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/instrumentation/instrumentation.dart';
import 'package:analyzer/source/error_processor.dart';
import 'package:analyzer/source/sdk_ext.dart';
import 'package:analyzer/src/context/source.dart';
@@ -140,7 +141,9 @@ class GetHandler2 implements AbstractGetHandler {
*/
void handleGetRequest(HttpRequest request) {
String path = request.uri.path;
- if (path == '/' || path == STATUS_PATH) {
+ if (path == '/') {
+ _returnRedirect(request, STATUS_PATH);
+ } else if (path == STATUS_PATH) {
_returnServerStatus(request);
} else if (path == ANALYSIS_PERFORMANCE_PATH) {
_returnAnalysisPerformance(request);
@@ -604,6 +607,11 @@ class GetHandler2 implements AbstractGetHandler {
});
}
+ void _returnRedirect(HttpRequest request, String pathFragment) {
+ HttpResponse response = request.response;
+ response.redirect(request.uri.resolve(pathFragment));
+ }
+
/**
* Return an error in response to an unrecognized request received by the HTTP
* server.
@@ -1090,9 +1098,9 @@ class GetHandler2 implements AbstractGetHandler {
buffer.write('<br>');
buffer.write('Instrumentation: ');
if (AnalysisEngine.instance.instrumentationService.isActive) {
- buffer.write('<span style="color:red">Active</span>');
+ buffer.write('<strong>active</strong>');
} else {
- buffer.write('Inactive');
+ buffer.write('inactive');
}
buffer.write('<br>');
buffer.write('Process ID: ');
@@ -1101,6 +1109,21 @@ class GetHandler2 implements AbstractGetHandler {
buffer.write('<p><b>Performance Data</b></p>');
buffer.write(makeLink(
COMMUNICATION_PERFORMANCE_PATH, {}, 'Communication performance'));
+
+ if (AnalysisEngine.instance.instrumentationService.isActive) {
+ buffer.write('<p><b>Instrumentation</b></p>');
+ InstrumentationServer instrumentationServer = AnalysisEngine
+ .instance.instrumentationService.instrumentationServer;
+ String description = instrumentationServer.describe;
+ HtmlEscape htmlEscape = new HtmlEscape(HtmlEscapeMode.ELEMENT);
+ description = htmlEscape.convert(description);
+ // Convert http(s): references to hyperlinks.
+ final RegExp urlRegExp = new RegExp(r'[http|https]+:\/*(\S+)');
+ description = description.replaceAllMapped(urlRegExp, (Match match) {
+ return '<a href="${match.group(0)}">${match.group(1)}</a>';
+ });
+ buffer.write(description.replaceAll('\n', '<br>'));
+ }
}, (StringBuffer buffer) {
_writeSubscriptionList(buffer, ServerService.VALUES, services);
buffer.write('<p><b>Versions</b></p>');
« no previous file with comments | « no previous file | pkg/analyzer/lib/instrumentation/file_instrumentation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698