community-plugins
community-plugins copied to clipboard
🐛 Grafana: Plugin Fails to Retrieve Tags for Dashboards Beyond 1000
Workspace
grafana
📜 Description
The Grafana plugin is encountering an issue where it fails to read tags correctly when the number of dashboards exceeds 1000. Grafana's query mechanism returns only the first 1000 results in one go, necessitating the use of a loop to fetch additional results. This limitation causes a problem where tags associated with dashboards beyond the initial 1000 are not retrieved. For instance, if there are 10 dashboards with the tag "abc" and some of these dashboards are not included in the first 1000 results, the tag "abc" will not appear in Backstage.
👍 Expected behavior
When the Grafana plugin queries for dashboards, it should retrieve all dashboards regardless of the total number. Specifically, if there are more than 1000 dashboards, the plugin should use a loop to fetch additional results beyond the initial 1000. This ensures that all tags, including those associated with dashboards beyond the first 1000, are accurately retrieved and displayed in Backstage.
Key Points:
All dashboards should be fetched, not just the first 1000. Tags from all dashboards should be displayed in Backstage. Users should see complete and accurate tag information for all dashboards.
👎 Actual Behavior with Screenshots
only 1000 results
👟 Reproduction steps
Setup Grafana:
Ensure Grafana is installed and running. Create more than 1000 dashboards in Grafana. Assign Tags:
Assign the tag "abc" to 10 dashboards, ensuring some of these dashboards are beyond the first 1000 in the list. Query Dashboards:
Use the Grafana plugin to query for dashboards. Observe that the query returns only the first 1000 dashboards. Check Tags in Backstage:
Verify the tags displayed in Backstage. Notice that the tag "abc" is missing for dashboards beyond the first 1000.
📃 Provide the context for the Bug.
Is there a possibilty rather we using search API we can use another parameter in the API which can filter specific dashboard rather fetching using search PI
👀 Have you spent some time to check if this bug has been raised before?
- [x] I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- [x] I have read the Code of Conduct
Are you willing to submit PR?
No, but I'm happy to collaborate on a PR with someone else
Looking for contributions for this one, please!
Ran into this as well recently: There is a dashboardsByTag function that searches by tag, but that is not directly compatible with the query evaluator.
One caveat is the upstream Grafana /api/search does not return any markers to say if there are more pages of results.
Partial solution parts:
- pass higher limit (5000 is the max)
- explicitly pass limit and manually paginate if it returns N == limit; join results
- extract tags from the filter, pass those to the search API
Either the extract or higher limit partial solutions run into issues on their own, so need all 3 together for a reliable fix.
- the match is on something OTHER than
tags[e.g.title,url,folderTitle,folderUrl] - More than $MAXLIMIT dashboards match the tag in question
My fix is in https://github.com/backstage/community-plugins/pull/3909 - needs approvals
can you share the version of grafana you are using?
Grafana 10.4.19 [also commented in the PR]
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.