Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Version 0.6 of Serinus and update all related packages #60

Merged
merged 88 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
fcd5fe3
feat(#32): initial implementation for tracing system
francescovallone Jun 16, 2024
cfba4f2
feat(#32): block works on tracer for now
francescovallone Jun 18, 2024
d5aef3b
feat(#48): initial implementation
francescovallone Jul 3, 2024
b8ef285
feat(#48): wip resources generation
francescovallone Jul 3, 2024
408dc49
tests: fix test and add workflow for serinus_cli
francescovallone Jul 4, 2024
7ab3b7e
tests: fix test and add workflow for serinus_cli
francescovallone Jul 4, 2024
fe9b70d
chore(#48): analyze and format files
francescovallone Jul 4, 2024
c5969a1
chore(#48): code clean up
francescovallone Jul 4, 2024
224d546
fix(#48): improve code readability and fix getters replacement error
francescovallone Jul 4, 2024
ae1c2b7
perf: improve response finalization performance
francescovallone Jul 6, 2024
0685004
feat(#39): add metadatas to Serinus
francescovallone Jul 7, 2024
cccf692
docs(#49): start documentation rewriting
francescovallone Jul 7, 2024
1a5313c
docs(#49): redesign home
francescovallone Jul 7, 2024
2a1350f
test(#39): add tests
francescovallone Jul 8, 2024
19f9bf4
docs(#49): remove old code
francescovallone Jul 8, 2024
d6629b9
feat(#39): prepare for preview release
francescovallone Jul 8, 2024
196b2cd
feat(#39): add 'canUse' and 'canStat' methods to check if provider or…
francescovallone Jul 13, 2024
a18c79c
chore(#39): prepare for preview release
francescovallone Jul 13, 2024
5648820
fix(#39): fix canUse to use the correct type instead of dynamic
francescovallone Jul 13, 2024
62f9d7a
chore(#39): prepare for preview release
francescovallone Jul 13, 2024
e4829e4
chore(#39): format files
francescovallone Jul 13, 2024
cc386f6
chore(#39): update pub version
francescovallone Jul 13, 2024
f7b8e10
refactor: unify contexts implementation, allow to send message to ws …
francescovallone Jul 15, 2024
9918bb8
chore: format and analyze
francescovallone Jul 15, 2024
1e733c8
chore: add files to ignore
francescovallone Jul 15, 2024
d991ced
Merge pull request #51 from francescovallone/feat/48
francescovallone Jul 15, 2024
65ce5a0
chore(#39): prepare for release 0.6.0-dev.4
francescovallone Jul 15, 2024
77e7f67
docs(#49): small style changes to the components
francescovallone Jul 16, 2024
ba50c23
docs(#49): change index title
francescovallone Jul 16, 2024
1951440
docs(#49): change components to align to the new design
francescovallone Jul 18, 2024
0e47180
docs(#49): change structure of the documentation
francescovallone Jul 18, 2024
d1b3df3
chore: add melos to the project
francescovallone Jul 18, 2024
09353aa
docs(#49): add view_engine_example to examples list
francescovallone Jul 18, 2024
4330b81
Merge pull request #53 from francescovallone/feat/39
francescovallone Jul 18, 2024
c8223b0
feat(#52): first implementation
francescovallone Jul 18, 2024
41c9d8d
docs(#49): working on the new documentation
francescovallone Jul 19, 2024
61acc80
feat(lab): change response approach
francescovallone Jul 19, 2024
c760c9b
feat(lab): a value can be passed without the need to use the Response…
francescovallone Jul 19, 2024
c46c2e7
feat(lab): change end method for response, add documentation comments…
francescovallone Jul 21, 2024
1c57adf
Merge pull request #54 from francescovallone/feat/lab
francescovallone Jul 21, 2024
7403eb3
Merge branch 'feat/52' into develop
francescovallone Jul 21, 2024
21125ef
chore: update spanner version 🎢
francescovallone Jul 21, 2024
3abd66c
chore: change generate command for controllers to align it to serinus…
francescovallone Jul 21, 2024
7847b99
chore: update bin file
francescovallone Jul 21, 2024
a08486f
Merge branch 'develop' into feat/32
francescovallone Jul 21, 2024
2198566
feat(#32): second version of tracers, still to be polished
francescovallone Jul 21, 2024
b1929dc
feat: improve json serialization
francescovallone Jul 22, 2024
0ff845d
docs(#49): increase documentation on foundamentals of Serinus
francescovallone Jul 22, 2024
e8e0024
docs(#49): add new component, new mesuraments, change hero and commun…
francescovallone Jul 22, 2024
9c70170
docs(#49): change id href
francescovallone Jul 22, 2024
b03a429
feat(#32): working on make the tracing more logical and less verbose
francescovallone Jul 22, 2024
776562e
feat(#56): integrate static jaspr websites
francescovallone Jul 23, 2024
b9eabb1
feat(#57): abstract parse schema, tests must be fixed
francescovallone Jul 23, 2024
1195e11
feat(#57): fix tests
francescovallone Jul 23, 2024
7f9023c
feat(#57): analyze and format
francescovallone Jul 23, 2024
1e05931
feat(#57): prepare for dev release
francescovallone Jul 23, 2024
a96241d
docs(#49): add tables to explicit more the properties, change schema.…
francescovallone Jul 23, 2024
520ec93
Merge pull request #58 from francescovallone/feat/57
francescovallone Jul 23, 2024
11d730a
feat(#32): finalize implementation
francescovallone Jul 23, 2024
c6114d7
feat(#32): analyze and format
francescovallone Jul 23, 2024
b028ad8
Merge branch 'feat/32' into develop
francescovallone Jul 23, 2024
7be1c2e
feat(#56): add serinus_sse to manage server sent events
francescovallone Jul 24, 2024
f9b2837
docs(#49): improve docs
francescovallone Jul 24, 2024
803de22
chore: fix typos in tracer
francescovallone Jul 24, 2024
eb34554
Merge pull request #59 from francescovallone/docs/49
francescovallone Jul 24, 2024
5483fb1
chore: fix pipelines
francescovallone Jul 24, 2024
86b84c3
docs(#49): add tracer to the documentation
francescovallone Jul 25, 2024
ee77147
perf: add a more performant decoder for json bodies
francescovallone Jul 26, 2024
e9b06cf
perf: improve performance of parse schema
francescovallone Jul 26, 2024
10e8fd9
chore: analyze and format
francescovallone Jul 26, 2024
8ba5860
docs(#49): fix dead links
francescovallone Jul 28, 2024
d81371c
docs(#49): fix styling
francescovallone Jul 28, 2024
8809589
docs(#49): change radius for discord and fix color error
francescovallone Jul 28, 2024
b759b87
feat(#56): sse_implementation (not yet finished), improve extensibili…
francescovallone Jul 31, 2024
1d617c2
Merge branch 'feat/56' into develop
francescovallone Jul 31, 2024
80c87c7
chore: format and analyze
francescovallone Jul 31, 2024
ed73202
docs: update shelf_interop documentation
francescovallone Jul 31, 2024
4884b57
perf: improved request handling time by 0.4±0.1 seconds
francescovallone Jul 31, 2024
ab8ad04
perf(correct): perf: improved request handling time by 40±10 millisec…
francescovallone Jul 31, 2024
03cc0e9
chore: prepare for release (0.6)
francescovallone Aug 1, 2024
365ec8e
docs: update request_lifecycle
francescovallone Aug 1, 2024
4ddecf8
chore: organize better the projects in a monorepo
francescovallone Aug 1, 2024
b20d00f
chore: fix serinus_config version
francescovallone Aug 1, 2024
ba41d94
fix: version of examples
francescovallone Aug 1, 2024
6c7e332
fix(serinus, serinus_config, rate_limiter): fix to exported providers
francescovallone Aug 1, 2024
c7826af
chore: analyzer
francescovallone Aug 1, 2024
ba8809a
chore: finalize release
francescovallone Aug 1, 2024
c769a0e
cicd: update workflows
francescovallone Aug 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(#32): block works on tracer for now
  • Loading branch information
francescovallone committed Jun 18, 2024
commit cfba4f226f15e6e1b71c48c5d696f093731f48e2
3 changes: 2 additions & 1 deletion packages/serinus/lib/src/core/application.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,9 @@ class SerinusApplication extends Application {
_logger.info('Hook ${hook.runtimeType} added to application');
}

/// The [trace] method is used to add a tracer to the application.
void trace(Tracer tracer) {
config.tracers.add(tracer);
config.addTracer(tracer);
_logger.info('Tracer ${tracer.name}(${tracer.runtimeType}) added to application');
}
}
10 changes: 9 additions & 1 deletion packages/serinus/lib/src/core/application_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,21 @@ final class ApplicationConfig {
final Set<Hook> hooks = {};

/// The tracer for the application
final Set<Tracer> tracers = {};
Tracer? _tracer;

/// The tracer for the application
Tracer? get tracer => _tracer;

/// Add a hook to the application
void addHook(Hook hook) {
hooks.add(hook);
}

/// Add a tracer to the application
void addTracer(Tracer tracer) {
_tracer = tracer;
}

/// The application config constructor
ApplicationConfig({
required this.host,
Expand Down
77 changes: 35 additions & 42 deletions packages/serinus/lib/src/handlers/request_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,55 +34,27 @@ class RequestHandler extends Handler {
@override
Future<void> handleRequest(
InternalRequest request, InternalResponse response) async {
for(final tracer in config.tracers){
tracer.startTracing();
}
config.tracer?.startTracing();
final Request wrappedRequest = Request(request);
await onRequest(wrappedRequest, response);
await wrappedRequest.parseBody();
Response result;
final specifications = getRoute(wrappedRequest);
final context = specifications.context;
final route = specifications.route;
final handler = specifications.handler;
final middlewares = specifications.middlewares;
await onTransformAndParse(context, route);
if (middlewares.isNotEmpty) {
await handleMiddlewares(
context,
response,
middlewares,
);
for(final tracer in config.tracers){
tracer.onMiddlewares(context);
}
}
for (final hook in config.hooks) {
await onMiddlewares(context, response, middlewares);
if (response.isClosed) {
return;
}
await hook.beforeHandle(context);
}
await route.beforeHandle(context);
for(final tracer in config.tracers){
tracer.onBeforeHandle(context);
}
result = await handler.call(context);
for(final tracer in config.tracers){
tracer.onHandle(context);
}
await route.afterHandle(context, result);
for (final hook in config.hooks) {
if (response.isClosed) {
return;
}
await hook.afterHandle(context, result);
}
for(final tracer in config.tracers){
tracer.onAfterHandle(context);
}
await onBeforeHandle(context, route);
final Response result = await onHandle(context, route, handler);
await onAfterHandle(context, route, result);
await response.finalize(result,
viewEngine: config.viewEngine, hooks: config.hooks, tracers: config.tracers);
viewEngine: config.viewEngine, hooks: config.hooks, tracer: config.tracer);
}

/// Handles the middlewares
Expand Down Expand Up @@ -112,21 +84,42 @@ class RequestHandler extends Handler {
}
await hook.onRequest(request, response);
}
for (final tracer in config.tracers){
tracer.onRequest(request);
}
await config.tracer?.onRequest(request);
}

/// Transforms and parses the request
Future<void> onTransformAndParse(RequestContext context, Route route) async {
await route.transform(context);
for (final tracer in config.tracers){
tracer.onTranform(context);
}
await config.tracer?.onTranform(context);
await route.parse(context);
for (final tracer in config.tracers){
tracer.onParse(context);
await config.tracer?.onParse(context);
}

Future<void> onMiddlewares(RequestContext context, InternalResponse response, Iterable<Middleware> middlewares) async {
await handleMiddlewares(context, response, middlewares);
await config.tracer?.onMiddlewares(context);
}

Future<void> onBeforeHandle(RequestContext context, Route route) async {
for (final hook in config.hooks) {
await hook.beforeHandle(context);
}
await route.beforeHandle(context);
await config.tracer?.onBeforeHandle(context);
}

Future<Response> onHandle(RequestContext context, Route route, ReqResHandler handler) async {
final result = await handler.call(context);
await config.tracer?.onHandle(context);
return result;
}

Future<void> onAfterHandle(RequestContext context, Route route, Response response) async {
await route.afterHandle(context, response);
for (final hook in config.hooks) {
await hook.afterHandle(context, response);
}
await config.tracer?.onAfterHandle(context);
}

/// Gets the route data from the [Router] and the controller from the [ModulesContainer]
Expand Down
14 changes: 4 additions & 10 deletions packages/serinus/lib/src/http/internal_response.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class InternalResponse {
Future<void> finalize(Response result,
{ViewEngine? viewEngine,
VersioningOptions? versioning,
Set<Hook> hooks = const {}, Set<Tracer> tracers = const {}}) async {
Set<Hook> hooks = const {}, Tracer? tracer}) async {
_events.add(ResponseEvent.beforeSend);
status(result.statusCode);
if (result.shouldRedirect) {
Expand All @@ -127,9 +127,7 @@ class InternalResponse {
for (final hook in hooks) {
await hook.onResponse(result);
}
for(final tracer in tracers){
tracer.onResponse(result);
}
await tracer?.onResponse(result);
headers(result.headers);
return send(utf8.encode(rendered));
}
Expand All @@ -148,9 +146,7 @@ class InternalResponse {
for (final hook in hooks) {
await hook.onResponse(result);
}
for(final tracer in tracers){
tracer.onResponse(result);
}
await tracer?.onResponse(result);
headers(result.headers);
final readPipe = data.openRead();
await sendStream(readPipe);
Expand All @@ -176,9 +172,7 @@ class InternalResponse {
for (final hook in hooks) {
await hook.onResponse(result);
}
for(final tracer in tracers){
tracer.onResponse(result);
}
await tracer?.onResponse(result);
headers(result.headers);
return send(utf8.encode(data.toString()));
}
Expand Down
Loading