Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emaringolo/seaside-server-timing
HTTP Server-Timing support for Seaside
https://github.com/emaringolo/seaside-server-timing
performance-analysis seaside smalltalk web-development
Last synced: 16 days ago
JSON representation
HTTP Server-Timing support for Seaside
- Host: GitHub
- URL: https://github.com/emaringolo/seaside-server-timing
- Owner: eMaringolo
- Created: 2020-07-10T03:46:23.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-28T01:52:52.000Z (over 3 years ago)
- Last Synced: 2024-10-09T13:25:10.937Z (about 1 month ago)
- Topics: performance-analysis, seaside, smalltalk, web-development
- Language: Smalltalk
- Homepage:
- Size: 65.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Introduction
Implements a request filter that automatically collects performance notifications
during a request and adds them to the `Server-Timing` heading in the response, this enables the web development tools to show server timing information to
better analyze the timing of a request/response cycle.![Server Timing Screenshot](img/server-timing-screenshot.png)
# How to use
Add a `WAPerformanceTimingFilter` to your request handler as follows:
```smalltalk
myApp := (WADispatcher default handlerAt: 'myApp')
addFilter: WAPerformanceTimingFilter new
```Then in your code you signal performance notifications as follows:
```smalltalk
(WAPerformanceTiming name: 'callback' description: 'Callback procesing' duration: 80 milliseconds) signal
```You can also do:
```smalltalk
WAPerformanceTiming measure: 'metricName' during: aBlock
```# Installation
```smalltalk
Metacello new
baseline: 'SeasidePerformanceTiming';
repository: 'github://eMaringolo/seaside-server-timing/src';
onConflictUseLoaded; "Just in case you have an older version of Seaside Installed"
load.
```# Remarks
## Header combination
Seaside's `WAHeaderFields` object corectly supports adding multiple values for the same header name via `aWAHeaderFields at: key add: value` or via `aWAResponse headerAt: key append: value`.
But the `ZnZincServerAdaptor>>responseFrom: aRequestContext` iteration over such headers only adds the last one. For this reason the filter manually updates the header value each time, breaking somehow the the encapsulation of `WAHeaderFields`. Once this is solved at the `ZnZincServerAdaptor` side, this behavior should be removed from the `WAPerformanceTimingFilter`.
## Counter behavior
Each timing notification gets immediately added to the request header, so there is no _"counter"_ functionality of each indicator. It is, if you signal a `WAPerformanceTiming` with the same name twice, this will be added twice as well to the headers. So it doesn't work as a performance counter of any sort.# References
* [Server-Timing Working Draft](https://www.w3.org/TR/server-timing/)
* [Server-Timing MDN](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Server-Timing)