Is it possible to use Profiler server side?
See original GitHub issueI’m trying to use the Profiler server side rendering with renderToString but the onRender callbacks are not getting called.
Is there a way to do it? I’m using 16.5.1, NODE_ENV === “development”.
My code looks like this, works fine client side:
import React, { unstable_Profiler } from 'react';
const profilerCallback = (id, phase, actualTime, baseTime, startTime, commitTime) => {
console.log(`${id}'s ${phase} phase:`);
console.log(`Actual time: ${actualTime}`);
console.log(`Base time: ${baseTime}`);
console.log(`Start time: ${startTime}`);
console.log(`Commit time: ${commitTime}`);
};
const MyComponent = () => (
<Profiler id="card" onRender={profilerCallback}>
...
</Profiler>
)
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Profiler and Server Side Traces - MS SQL Tips
Server Side traces and the use of Profiler will allow you to quickly find poorly performing queries.
Read more >Use SQL Server Profiler to Monitor Analysis Services
Learn how to use the SQL Server Profiler to monitor Analysis Services to track engine process events.
Read more >Using the profiler - Cfx.re Docs
A guide to using the built-in resource profiler. ... This can be used both server side, to help find hitch warnings, or client...
Read more >What is Server Side Trace and how to use it - SQL Land
Well, one way to go is using a Server Side Trace! Basically it's SQL Trace as everyone has seen running in Profiler, where...
Read more >SQL Server Profiler or Server-Side Trace? | ITPro Today
Did you know that using SQL Server Profiler can have an impact on the performance of your production servers? Check out these test...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@bvaughn thanks for the info! Also thanks for working on Profiler, it has helped us so much to find which components are slowing down rendering.
For us server side render speed is much more important than client side. Right now I am only tracking the entire renderToString call using Node perf_hooks. It would be really nice to be able to use Profiler in Node to track performance more granularly.
I would be happy to try to work on this if someone could point me in the right direction.
Despite its name, the
onRendercallback is called on commit and there is no “commit” phase on the server– so theProfilerwas implemented as a no-op for the server renderer. (It won’t break the app, but it won’t collect or log any metrics either.)I don’t feel strongly about this either way, just offering some additional context.