The plugin emits events of performance stats from the browser on initial page loads - with the following API when avaliable: (see https://developer.mozilla.org/en-US/docs/Web/API/Window/performance)
- Navigation Timing API
Navigation Timing Processing Model
- Resource Timing API
Resource Timing Processing Model
On the server-side, it calculate performance opinionate metrics from the stats emitted from the browser, then re-emits a new event. Refer to Events section for a list of events emitted.
yarn add fusion-plugin-browser-performance-emitter
To consume the calculated stats, listen to browser-performance-emitter:stats
event on the server-side.
import {createPlugin} from 'fusion-core';
import {UniversalEventsToken} from 'fusion-plugin-universal-events';
export default createPlugin({
deps: { emitter: UniversalEventsToken },
provides: deps => {
const emitter = deps.emitter;
emitter.on('browser-performance-emitter:stats', e => {
console.log(e); // log events to console
});
}
});
// src/main.js
import App from 'fusion-react';
import UniversalEvents, {UniversalEventsToken} from 'fusion-plugin-universal-events';
import BrowserPerformanceEmitter from 'fusion-plugin-browser-performance-emitter';
import PerformanceLogging from './performance-logging';
export default () => {
const app = new App();
// ...
app.register(UniversalEventsToken, UniversalEvents);
app.register(BrowserPerformanceEmitter);
// (optional) a plugin to consume browser performance events
app.register(PerformanceLogging);
// ...
return app;
}
import BrowserPerformanceEmitter from 'fusion-plugin-browser-performance-emitter';
The browser performance emitter plugin. Typically, it doesn't need to be associated with a token.
import UniversalEvents, {UniversalEventsToken} from 'fusion-plugin-universal-events';
app.register(UniversalEventsToken, UniversalEvents);
An event emitter plugin to emit stats to, such as the one provided by fusion-plugin-universal-events
.
This package has no public API methods. To consume performance events, add an event listener for the browser-performance-emitter:stats
event on the server-side.
{
calculatedStats: {
// Metrics
},
timingValues: {
// "Raw" timing values from `window.performance.timing`
},
resourceEntries: {
// An array of serialized Resource Timing entries
}
}
name | calculation |
---|---|
redirection_time |
fetchStart - navigationStart |
time_to_first_byte |
responseStart - navigationStart |
dom_content_loaded |
domContentLoadedEventEnd - fetchStart |
full_page_load |
loadEventEnd - fetchStart |
dns |
domainLookupEnd - domainLookupStart |
tcp_connection_time |
connectEnd - connectStart |
browser_request_time |
responseEnd - responseStart |
browser_request_first_byte |
responseStart - requestStart |
browser_request_response_time |
responseEnd - responseStart |
dom_interactive_time |
domInteractive - responseEnd |
total_resource_load_time |
loadEventStart - responseEnd |
total_blocking_resource_load_time |
domContentLoadedEventStart - responseEnd |
resources_avg_load_time |
One metric per resource type (e.g. CSS/JS/Image) that represents the mean time for resources of that type to be loaded. Example: {js: 154, image: 405} |
see https://www.w3.org/TR/navigation-timing/#sec-navigation-timing-interface for a complete list of properties
see https://w3c.github.io/resource-timing/#sec-performanceresourcetiming for a complete list of properties
[
{
name: 'http://localhost:3000/_static/client-main.js',
entryType: 'resource',
// ...other resource timing properties
},
// more entries
]
fusion-plugin-browser-performance-emitter's People
Forkers
kevingrandon ganemone rtsao nadiia lhorie dennisgl koulmomo derekjuber mlmorg uberopensourcebot angus-c albertywu rajeshsegufusion-plugin-browser-performance-emitter's Issues
Update dependency create-universal-package to v3.4.0
Fix flow types
Log emitter version
Send the version of the browser-performance-emitter to heatpipe logger
Add an initial implementation of the browser performance emitter plugin
chrome.loadTimes() is deprecated in Chrome 64
Replace
window.chrome.loadTimes().firstPaintTime
with
window.performance.getEntriesByType('paint')
Migrate fusion-plugin-browser-performance-emitter to DI
Log html size and load time
We have static asset resource load times/size but not HTML itself
Action Required: Fix Renovate Configuration
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: Preset name not found within published preset config (monorepo:angularmaterial). Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
Update dependencies
Augment data collected by fusion-plugin-browser-performance-emitter
Add missing performance data
Fusion perf data does not include url and other navigation meta data
Add enhanced metrics (for use by web perf dashboard et al)
Use Buildkite for CI
Add Token dependencies to readme
Problem/Rationale
Documentation regarding Fusion API is out of date given recent changes to leverage new Dependency Injection architecture.
Solution/Change/Deliverable
Update documentation
Make network and memory data JSON serializable
They weren't getting added to the POST's form data because the interesting data was in proto
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.