Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: table panel height #72

Closed
SindhujaSoundarapandian opened this issue Jul 20, 2018 · 9 comments
Closed

Feature request: table panel height #72

SindhujaSoundarapandian opened this issue Jul 20, 2018 · 9 comments

Comments

@SindhujaSoundarapandian

Hi,

I tried the below steps

  1. Installed go lang and started the grafana reporter
  2. Installed PDFLatex and created environment variable path
  3. Provided api url as 'http://localhost:8686/api/v5/report/IUjOhkNik' in grafana dashboard and created link as document in grafana dashboard
  4. when i tried to click on the doc link it throws the below error

error fetching dashboard IUjOhkNik: error obtaining dashboard from http://localhost:3000/api/dashboards/uid/IUjOhkNik?var-Suite=Suite2&var-TestTitle1=JMeter+Test&var-aggregation=30s&var-application=MyTest5&var-data_source=jmeter&var-measurement_name=jmeter&var-send_interval=5&var-transaction=Access. Got Status 401 Unauthorized, message: {"message":"Unauthorized"}

  1. I tried hitting the url seperately in browser where it retrieves the dashboard json data successfully but from grafana dashboard its always throwing 401- Unauthorized error
  2. No such restrictions to access the dashboard , it has the required viewer permissions
  3. Below is the log file generated in go console

2018/07/20 16:33:44 grafana reporter, version: 2.0-1 hash: 098683c
2018/07/20 16:33:44 serving at ':8686' and using grafana at 'localhost:3000'
2018/07/20 16:33:45 Reporter called
2018/07/20 16:33:45 Called with api Token:
2018/07/20 16:33:45 Called with variable: var-TestTitle1 [JMeter Test]
2018/07/20 16:33:45 Called with variable: var-aggregation [30s]
2018/07/20 16:33:45 Called with variable: var-transaction [Access]
2018/07/20 16:33:45 Called with variable: var-measurement_name [jmeter]
2018/07/20 16:33:45 Called with variable: var-send_interval [5]
2018/07/20 16:33:45 Called with variable: var-Suite [Suite2]
2018/07/20 16:33:45 Called with variable: var-data_source [jmeter]
2018/07/20 16:33:45 Called with variable: var-application [MyTest5]
2018/07/20 16:33:45 Called with dashboard: IUjOhkNik
2018/07/20 16:33:45 Called with time range: {1528966160000 1528966499000}
2018/07/20 16:33:45 Connecting to dashboard at http://localhost:3000/api/dashboards/uid/IUjOhkNik?var-Suite=Suite2&var-TestTitle1=JMeter+Test&var-aggregation=30s&var-application=MyTest5&var-data_source=jmeter&var-measurement_name=jmeter&var-send_interval=5&var-transaction=Access
2018/07/20 16:33:45 Error generating report: error fetching dashboard IUjOhkNik: error obtaining dashboard from http://localhost:3000/api/dashboards/uid/IUjOhkNik?var-Suite=Suite2&var-TestTitle1=JMeter+Test&var-aggregation=30s&var-application=MyTest5&var-data_source=jmeter&var-measurement_name=jmeter&var-send_interval=5&var-transaction=Access. Got Status 401 Unauthorized, message: {"message":"Unauthorized"}

Any help would be appreciated.

Thanks,
Sindhuja

@IzakMarais
Copy link
Owner

You should generate an authorisation apitoken in the grafana user interface and pass that along as described in the readme here.

@SindhujaSoundarapandian
Copy link
Author

SindhujaSoundarapandian commented Jul 23, 2018

Thanks for your response !

It worked successfully but after generating PDF i could see some unwanted spaces in PDF and also if i have 4 tables with single row each means it was generating dashboard with 4 pages , one table per page, is there a way to reduce the page sizing or reducing the width/height to display in a proper format ?
Please help us to resolve this issue.

@IzakMarais
Copy link
Owner

If you want finer control over the layout, you can write your own custom LaTeX template.

See the 'template' section under Query paramters in the readme.

Here is an example issue where someone used a template to create landscape mode reports.

@SindhujaSoundarapandian
Copy link
Author

I could see height and width are hardcorded in your code, and from your clarifications i tried to update the height and width in json data but it was not reflected in PDF. Is there a way to edit the panel size ? can you please share your thoughts on it.https://github.com/IzakMarais/reporter/blob/master/grafana/api.go#L160

@IzakMarais
Copy link
Owner

Great, so after resolving the authentication problem, it seems your remaining issue is related to (perhaps a duplicate of) #52? If so, that is nice since this adds another +1 for that planned enhancement.

@IzakMarais IzakMarais changed the title Cannot create PDF report from grafana dashboard Single row tables too large Jul 23, 2018
@IzakMarais
Copy link
Owner

OK, so unfortunately the fix for #52 doesn't work here for Tables with scrolling enabled. If the table doesn't have scrolling enabled, requesting a small, say 100 pixel high, render works: it actually renders the table high enough to fit in all the rows that need to be displayed. For tables with scrolling it will actually adhere to the requested height, which means the table will be rendered without adequate height in all cases. Since scrolling is on by default, this is not sufficient.

A possible fix is to interrogate the table json and decide how high to render it based on more than just the panel type.

@IzakMarais IzakMarais changed the title Single row tables too large Feature request: table panel height Mar 7, 2019
@IzakMarais
Copy link
Owner

This feature might also help for very tall tables where the height has been modified in the dashboard to allow many rows to be displayed on a single page.

@IzakMarais
Copy link
Owner

A more concise summary of the problem from #142:

When you do a report which contains a table, then only the visible part of the table is exported to pdf. The entire result of the table query are split on many sheets that you access with clicking on number below table. The pdf report has only this visible part, not the entire table.

@IzakMarais
Copy link
Owner

Partially addressed by enabling new grid-layout flag (-grid-layout=1), which will allow all the rows visible on the dashboard table panel's first page to be captured in the report PNG.

See #162 (comment) for an example.

For tables that span multiple pages, I don't see any way to add support for those.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants