question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to use Profiler server side?

See original GitHub issue

I’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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
lazopmcommented, Sep 19, 2018

@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.

1reaction
bvaughncommented, Sep 19, 2018

Despite its name, the onRender callback is called on commit and there is no “commit” phase on the server– so the Profiler was 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found