Capture time to render a report

2 Answers 26 Views
Report Viewer - ASP.NET
Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
Scott Waye asked on 05 May 2025, 02:37 PM

Hi,

Are the methods in the ReportsControllerBase that I can use to capture the time taken to render a report and the size of the report?   I want to log all requests for reports with this information.  Using the HTML5 viewer and the WPF viewer.

 

Thanks,

2 Answers, 1 is accepted

Sort by
0
Ivet
Telerik team
answered on 08 May 2025, 12:00 PM

Hello, Scott,

Thank you for reaching out.

To capture the time taken to render a report, you can use the Trace log. In it you will see that it states exactly how long the report was rendered. You can use it for both the HTML5 viewer and the WPF viewer.

Also, as a second option, there are exposed events that indicate when a report rendering is started and ended. For example, you can use the renderingBegin() and renderingEnd() events, which are events of the HTML5 Report Viewer - Report Viewer Initialization. 

The paper size of the report is controlled by the selected paper kind in the PageSettings property of the report - Pagination Explained - Telerik Reporting. You may choose a bigger paper kind from the available ones, or you may use "Custom" which would allow you to define the height and width of the paper.

If by size you were referring to the size of the generated document, you can check that manually using the exportEnd(e, args) event since, in the args object, it contains a URL to the produced file.

I hope the above information will be useful. Let me know if you have other questions.

Regards,
Ivet
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
commented on 09 May 2025, 02:31 PM | edited

Hi,

Tracing has a few issues.  The input is just a string so its expensive to parse for each trace message just to identify the start and end messages.  It is also not possible to get the parameters nor the executing user.  Matching the end trace with the start trace message is not possible.

For the HTML 5 renderer the java script events would work but does cover the WPF viewer, plus it would require another request to the server in order to log the report run in a database for example.

Can you convert this thread into a feature request please:

Make it easy to capture the details of a report run:

Parameters

Report Name

Size of document

TIme to run.

Executing HTTP context (so we can get the user, could also be used for the parameters)

 

Perhaps by providing hooks from `RenderReportDocument` ?

 

Thanks very much.

Dimitar
Telerik team
commented on 14 May 2025, 11:40 AM

Hi Scott,

Let me start by mentioning that the WPF Report Viewer exposes the same events as the HTML5 Report Viewer - RenderingBegin, RenderingEnd, etc.

With that being said, it is true that, at least with the web report viewers, an HTTP request would be needed to save the information to the database.

Regarding the request for more rendering information, please note that some of the requested pieces are already accessible. For example, the parameters and the name of the report can be accessed through the viewers' ReportSource properties.

The size of the document and the time to run can be extracted from the "export" related events as well. The time can also be extracted from the log which could also be made to log into the database rather than in a file. You may take a look at the Custom Listener for Trace Logs for an example of how to implement a custom trace listener.

Regarding the executing HTTP context, you should be able to access that in the ReportsController by overriding the methods. For example, you can override the GetParameters(String, ClientReportSource) endpoint and in the second argument, you would have access to the parameters and report name plus since this is inside the controller, the HTTP context will be available as well.

You can do so with the rest of the methods as they are overridable as well, you can write to the trace with the custom trace listener in the overridden methods the needed info.

I hope that the suggested approaches will help you achieve the desired results.

 

0
Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
answered on 16 May 2025, 05:27 PM
Thanks, that is helpful.  GetParameters looks good for logging the start of the operation, the problem is going to be tying the trace event for the end to correct call to GetParameters.  An end method that I can override, and the ability to add some context to ClientReportSource would work?
Dimitar
Telerik team
commented on 20 May 2025, 02:18 PM

If you need to log the end, you may try overriding the Get Document method of the ReportsController, it should be executed after the document finishes rendering, and before it is sent as an attachment to the client.

 

   
Tags
Report Viewer - ASP.NET
Asked by
Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
Answers by
Ivet
Telerik team
Scott Waye
Top achievements
Rank 2
Iron
Iron
Veteran
Share this question
or