Deprecated AngelMetrics
This commit is contained in:
parent
25dc29e126
commit
14f2b5d807
3 changed files with 74 additions and 140 deletions
|
@ -3,7 +3,8 @@
|
|||
<component name="ChangeListManager">
|
||||
<list default="true" id="7b89ff1e-1260-4dcf-9c3d-345de0471ea1" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/http/response_context.dart" afterPath="$PROJECT_DIR$/lib/src/http/response_context.dart" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/CHANGELOG.md" afterPath="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/lib/src/stats/metric_server.dart" afterPath="$PROJECT_DIR$/lib/src/stats/metric_server.dart" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.tmp/" />
|
||||
<ignored path="$PROJECT_DIR$/temp/" />
|
||||
|
@ -25,27 +26,25 @@
|
|||
<favorites_list name="framework" />
|
||||
</component>
|
||||
<component name="FileEditorManager">
|
||||
<splitter split-orientation="horizontal" split-proportion="0.5">
|
||||
<splitter split-orientation="horizontal" split-proportion="0.50834596">
|
||||
<split-first>
|
||||
<leaf>
|
||||
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="response_context.dart" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/http/response_context.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="231">
|
||||
<caret line="26" column="28" lean-forward="true" selection-start-line="26" selection-start-column="28" selection-end-line="26" selection-end-column="28" />
|
||||
<state relative-caret-position="315">
|
||||
<caret line="30" column="18" lean-forward="true" selection-start-line="30" selection-start-column="18" selection-end-line="30" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="metric_server.dart" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/stats/metric_server.dart">
|
||||
<file leaf-file-name="main.dart" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="12" column="43" lean-forward="true" selection-start-line="12" selection-start-column="43" selection-end-line="12" selection-end-column="43" />
|
||||
<folding>
|
||||
<marker date="1512571506000" expanded="true" signature="675:868" ph="..." />
|
||||
</folding>
|
||||
<state relative-caret-position="233">
|
||||
<caret line="29" column="12" lean-forward="true" selection-start-line="29" selection-start-column="12" selection-end-line="29" selection-end-column="12" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -57,8 +56,8 @@
|
|||
<file leaf-file-name="http_response_context.dart" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="437">
|
||||
<caret line="108" column="0" lean-forward="true" selection-start-line="108" selection-start-column="0" selection-end-line="108" selection-end-column="0" />
|
||||
<state relative-caret-position="1305">
|
||||
<caret line="87" column="9" lean-forward="true" selection-start-line="87" selection-start-column="9" selection-end-line="87" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -191,13 +190,11 @@
|
|||
<option value="$PROJECT_DIR$/lib/src/util.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/http/routable.dart" />
|
||||
<option value="$PROJECT_DIR$/test/di_test.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/stats/metric_server.dart" />
|
||||
<option value="$PROJECT_DIR$/performance/hello/main.dart" />
|
||||
<option value="$PROJECT_DIR$/test/all.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/http/service.dart" />
|
||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/lib/src/http/map_service.dart" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/lib/src/http/http.dart" />
|
||||
<option value="$PROJECT_DIR$/test/extension_test.dart" />
|
||||
<option value="$PROJECT_DIR$/test/accepts_test.dart" />
|
||||
|
@ -215,6 +212,8 @@
|
|||
<option value="$PROJECT_DIR$/lib/src/http/server.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/http/http_response_context.dart" />
|
||||
<option value="$PROJECT_DIR$/lib/src/http/response_context.dart" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/lib/src/stats/metric_server.dart" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
|
@ -628,14 +627,7 @@
|
|||
<workItem from="1513103483207" duration="18000" />
|
||||
<workItem from="1513103506825" duration="139000" />
|
||||
<workItem from="1517332581856" duration="858000" />
|
||||
<workItem from="1517973177718" duration="7703000" />
|
||||
</task>
|
||||
<task id="LOCAL-00016" summary="1.0.4">
|
||||
<created>1497837231709</created>
|
||||
<option name="number" value="00016" />
|
||||
<option name="presentableId" value="LOCAL-00016" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1497837231709</updated>
|
||||
<workItem from="1517973177718" duration="7942000" />
|
||||
</task>
|
||||
<task id="LOCAL-00017" summary="Patch">
|
||||
<created>1497985995955</created>
|
||||
|
@ -973,7 +965,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1517980874143</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="65" />
|
||||
<task id="LOCAL-00065" summary="Removed `HttpHeaders` in `ResponseContext`">
|
||||
<created>1517980935063</created>
|
||||
<option name="number" value="00065" />
|
||||
<option name="presentableId" value="LOCAL-00065" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1517980935063</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="66" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TestHistory">
|
||||
|
@ -1009,7 +1008,7 @@
|
|||
</history-entry>
|
||||
</component>
|
||||
<component name="TimeTrackingManager">
|
||||
<option name="totallyTimeSpent" value="125739000" />
|
||||
<option name="totallyTimeSpent" value="125978000" />
|
||||
</component>
|
||||
<component name="TodoView">
|
||||
<todo-panel id="selected-file">
|
||||
|
@ -1028,7 +1027,7 @@
|
|||
<window_info id="Tool Output" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.34188035" sideWeight="0.5035524" order="7" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Dart Analysis" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.31196582" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Dart Analysis" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.31196582" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
|
@ -1068,7 +1067,6 @@
|
|||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||
<MESSAGE value="autoIdAndDateFields in MapService" />
|
||||
<MESSAGE value="+8" />
|
||||
<MESSAGE value="+9" />
|
||||
<MESSAGE value="1.0.11" />
|
||||
|
@ -1093,7 +1091,8 @@
|
|||
<MESSAGE value="Create HttpRequestContextImpl" />
|
||||
<MESSAGE value="Change return type of `AngelHttp.createRequestContext`" />
|
||||
<MESSAGE value="Deprecated `ResponseContext.io`, added HTTP equivalent" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Deprecated `ResponseContext.io`, added HTTP equivalent" />
|
||||
<MESSAGE value="Removed `HttpHeaders` in `ResponseContext`" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Removed `HttpHeaders` in `ResponseContext`" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
@ -1218,13 +1217,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="158">
|
||||
<caret line="24" column="17" lean-forward="false" selection-start-line="24" selection-start-column="17" selection-end-line="24" selection-end-column="17" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/tool/travis.sh">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="45">
|
||||
|
@ -1251,19 +1243,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<marker date="1506049250000" expanded="true" signature="588:776" ph="{...}" />
|
||||
</folding>
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/test/services_test.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="82">
|
||||
|
@ -1301,17 +1280,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="120">
|
||||
<caret line="8" column="3" lean-forward="true" selection-start-line="8" selection-start-column="3" selection-end-line="8" selection-end-column="3" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/http/http.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="263">
|
||||
|
@ -1497,30 +1465,62 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/stats/metric_server.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="135">
|
||||
<caret line="12" column="43" lean-forward="true" selection-start-line="12" selection-start-column="43" selection-end-line="12" selection-end-column="43" />
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="300">
|
||||
<caret line="20" column="19" lean-forward="true" selection-start-line="20" selection-start-column="19" selection-end-line="20" selection-end-column="19" />
|
||||
<folding>
|
||||
<marker date="1512571506000" expanded="true" signature="675:868" ph="..." />
|
||||
<marker date="1506049250000" expanded="true" signature="588:776" ph="{...}" />
|
||||
</folding>
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
|
||||
<state split_layout="SPLIT">
|
||||
<first_editor relative-caret-position="105">
|
||||
<caret line="7" column="92" lean-forward="false" selection-start-line="7" selection-start-column="92" selection-end-line="7" selection-end-column="92" />
|
||||
<folding />
|
||||
</first_editor>
|
||||
<second_editor />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/http/http_response_context.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="437">
|
||||
<caret line="108" column="0" lean-forward="true" selection-start-line="108" selection-start-column="0" selection-end-line="108" selection-end-column="0" />
|
||||
<state relative-caret-position="1305">
|
||||
<caret line="87" column="9" lean-forward="true" selection-start-line="87" selection-start-column="9" selection-end-line="87" selection-end-column="9" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/stats/metric_server.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="227">
|
||||
<caret line="93" column="25" lean-forward="true" selection-start-line="93" selection-start-column="25" selection-end-line="93" selection-end-column="25" />
|
||||
<folding>
|
||||
<marker date="1517981159000" expanded="true" signature="370:563" ph="..." />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/src/http/response_context.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="231">
|
||||
<caret line="26" column="28" lean-forward="true" selection-start-line="26" selection-start-column="28" selection-end-line="26" selection-end-column="28" />
|
||||
<state relative-caret-position="315">
|
||||
<caret line="30" column="18" lean-forward="true" selection-start-line="30" selection-start-column="18" selection-end-line="30" selection-end-column="18" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/performance/hello/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="233">
|
||||
<caret line="29" column="12" lean-forward="true" selection-start-line="29" selection-start-column="12" selection-end-line="29" selection-end-column="12" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
|
|
@ -5,6 +5,7 @@ empty string.
|
|||
* Deprecated `Angel.createZoneForRequest`.
|
||||
* Deprecated all `Angel` methods that directly touch an `HttpServer` or `HttpRequest`.
|
||||
* Created the `AngelHttp` class.
|
||||
* Removed explicit dependence on `dart:io` for `Angel`, `RequestContext`, `ResponseContext`.
|
||||
|
||||
# 1.1.0+3
|
||||
* Modified `ResponseContext#isOpen` to also return `false` if streaming is being used.
|
||||
|
|
|
@ -3,21 +3,12 @@ import 'dart:io';
|
|||
import '../http/http.dart';
|
||||
import 'stats.dart';
|
||||
|
||||
/// A variant of an [Angel] server that records performance metrics.
|
||||
@deprecated
|
||||
class AngelMetrics extends Angel {
|
||||
Angel _inner;
|
||||
HttpServer _server;
|
||||
StreamSubscription<HttpRequest> _sub;
|
||||
|
||||
AngelMetrics() : super() {
|
||||
var zoneBuilder = createZoneForRequest;
|
||||
createZoneForRequest = (request, req, res) async {
|
||||
var spec = await zoneBuilder(request, req, res);
|
||||
return new ZoneSpecification.from(
|
||||
spec,
|
||||
);
|
||||
};
|
||||
|
||||
get('/metrics', (req, res) {
|
||||
res.contentType = ContentType.HTML;
|
||||
|
||||
|
@ -63,31 +54,8 @@ class AngelMetrics extends Angel {
|
|||
});
|
||||
}
|
||||
|
||||
factory AngelMetrics.custom(ServerGenerator serverGenerator) {
|
||||
return new AngelMetrics().._inner = new Angel.custom(serverGenerator);
|
||||
}
|
||||
|
||||
@override
|
||||
HttpServer get httpServer => _server ?? super.httpServer;
|
||||
|
||||
final AngelMetricsStats stats = new AngelMetricsStats._();
|
||||
|
||||
@override
|
||||
Future<HttpServer> startServer([address, int port]) async {
|
||||
if (_inner == null) return await super.startServer(address, port);
|
||||
|
||||
var host = address ?? InternetAddress.LOOPBACK_IP_V4;
|
||||
_server = await _inner.serverGenerator(host, port ?? 0);
|
||||
|
||||
for (var configurer in startupHooks) {
|
||||
await configure(configurer);
|
||||
}
|
||||
|
||||
optimizeForProduction();
|
||||
_sub = _server.listen(handleRequest);
|
||||
return _server;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<HttpServer> close() async {
|
||||
_sub?.cancel();
|
||||
|
@ -95,31 +63,11 @@ class AngelMetrics extends Angel {
|
|||
return await super.close();
|
||||
}
|
||||
|
||||
@override
|
||||
Future<RequestContext> createRequestContext(HttpRequest request) {
|
||||
return stats.createRequestContext
|
||||
.run<RequestContext>(() => super.createRequestContext(request));
|
||||
}
|
||||
|
||||
@override
|
||||
Future<ResponseContext> createResponseContext(HttpResponse response,
|
||||
[RequestContext correspondingRequest]) {
|
||||
return stats.createResponseContext.run<ResponseContext>(
|
||||
() => super.createResponseContext(response, correspondingRequest));
|
||||
}
|
||||
|
||||
@override
|
||||
Iterable<RoutingResult> resolveAll(String absolute, String relative,
|
||||
{String method: 'GET', bool strip: true}) {
|
||||
return stats.resolveAll.run(() =>
|
||||
super.resolveAll(absolute, relative, method: method, strip: strip));
|
||||
}
|
||||
|
||||
@override
|
||||
Future handleRequest(HttpRequest request) {
|
||||
return stats.handleRequest.run(() async {
|
||||
await super.handleRequest(request);
|
||||
});
|
||||
_inner.resolveAll(absolute, relative, method: method, strip: strip));
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -140,37 +88,22 @@ class AngelMetrics extends Angel {
|
|||
Function handler, RequestContext req, ResponseContext res) {
|
||||
return stats.runContained.run(() => super.runContained(handler, req, res));
|
||||
}
|
||||
|
||||
@override
|
||||
Future sendResponse(
|
||||
HttpRequest request, RequestContext req, ResponseContext res,
|
||||
{bool ignoreFinalizers: false}) {
|
||||
return stats.sendResponse.run(() => super.sendResponse(request, req, res));
|
||||
}
|
||||
}
|
||||
|
||||
class AngelMetricsStats {
|
||||
AngelMetricsStats._() {
|
||||
all = [
|
||||
createRequestContext,
|
||||
createResponseContext,
|
||||
resolveAll,
|
||||
executeHandler,
|
||||
getHandlerResult,
|
||||
runContained,
|
||||
sendResponse,
|
||||
handleRequest,
|
||||
];
|
||||
}
|
||||
|
||||
final Stats createRequestContext = new Stats('createRequestContext');
|
||||
final Stats createResponseContext = new Stats('createResponseContext');
|
||||
final Stats resolveAll = new Stats('resolveAll');
|
||||
final Stats handleRequest = new Stats('handleRequest');
|
||||
final Stats executeHandler = new Stats('executeHandler');
|
||||
final Stats getHandlerResult = new Stats('getHandlerResult');
|
||||
final Stats runContained = new Stats('runContained');
|
||||
final Stats sendResponse = new Stats('sendResponse');
|
||||
|
||||
List<Stats> all;
|
||||
|
||||
|
|
Loading…
Reference in a new issue