Hello,
I’m trying to create a datasource plugin and trying to integrate tsdb API in the frontend. I’m using Grafana 7.5.X. The response dataframe of tsdb API is encoded. Need help to decode this in frontend which is typescript. Can anyone help related to it.
API response:
{
“results”:{
“A”:{
“refId”:“A”,
“series”:null,
“tables”:null,
“dataframes”:[
“QVJST1cxAAD/////gAEAABAAAAAAAAoADgAMAAsABAAKAAAAFAAAAAAAAAEDAAoADAAAAAgABAAKAAAACAAAAFgAAAACAAAAKAAAAAQAAAAQ////CAAAAAwAAAABAAAAQQAAAAUAAAByZWZJZAAAADD///8IAAAAFAAAAAgAAAByZXNwb25zZQAAAAAEAAAAbmFtZQAAAAACAAAAhAAAAAQAAACW////FAAAADwAAABEAAAAAAAAAkgAAAABAAAABAAAAIT///8IAAAAEAAAAAYAAAB2YWx1ZXMAAAQAAABuYW1lAAAAAAAAAAAIAAwACAAHAAgAAAAAAAABQAAAAAYAAAB2YWx1ZXMAAAAAEgAYABQAAAATAAwAAAAIAAQAEgAAABQAAABEAAAATAAAAAAAAApMAAAAAQAAAAwAAAAIAAwACAAEAAgAAAAIAAAAEAAAAAQAAAB0aW1lAAAAAAQAAABuYW1lAAAAAAAAAAAAAAYACAAGAAYAAAAAAAMABAAAAHRpbWUAAAAAAAAAAP////+4AAAAFAAAAAAAAAAMABYAFAATAAwABAAMAAAAUAAAAAAAAAAUAAAAAAAAAwMACgAYAAwACAAEAAoAAAAUAAAAWAAAAAUAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAoAAAAAAAAACgAAAAAAAAAAAAAAAIAAAAFAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAPgGDjOdwL4W+EZ/lCnHvhb4hrV75+e+FvhGRBpb4b4W+EZEGlvhvhb0AQAAAAAAACwBAAAAAAAAWAIAAAAAAABkAAAAAAAAAMgAAAAAAAAAEAAAAAwAFAASAAwACAAEAAwAAAAQAAAALAAAADgAAAAAAAMAAQAAAJABAAAAAAAAwAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAKAAwAAAAIAAQACgAAAAgAAABYAAAAAgAAACgAAAAEAAAAEP///wgAAAAMAAAAAQAAAEEAAAAFAAAAcmVmSWQAAAAw////CAAAABQAAAAIAAAAcmVzcG9uc2UAAAAABAAAAG5hbWUAAAAAAgAAAIQAAAAEAAAAlv///xQAAAA8AAAARAAAAAAAAAJIAAAAAQAAAAQAAACE////CAAAABAAAAAGAAAAdmFsdWVzAAAEAAAAbmFtZQAAAAAAAAAACAAMAAgABwAIAAAAAAAAAUAAAAAGAAAAdmFsdWVzAAAAABIAGAAUAAAAEwAMAAAACAAEABIAAAAUAAAARAAAAEwAAAAAAAAKTAAAAAEAAAAMAAAACAAMAAgABAAIAAAACAAAABAAAAAEAAAAdGltZQAAAAAEAAAAbmFtZQAAAAAAAAAAAAAGAAgABgAGAAAAAAADAAQAAAB0aW1lAAAAAKgBAABBUlJPVzE=”
]
}
}
}
Tried using apache-arrow - npm but when tried using this getting the below error:
Error: Expected to read 1397380689 metadata bytes, but only read 1472.
Please anyone if there is any solution let me know. Stuck at this point.
Thanks
Could you share an example of what you’d like to use the tsdb API for? For most cases, you shouldn’t need to decode the data frames yourself.
Hey @marcusolsson , I am having a similar issue. The /api/tsdb/query
endpoint using the PostgreSQL datasource plugin now returns base64 encoded arrow table responses in Grafana 8.4. In Grafana 7.5 it returns normal table data. I cannot find any mention of how to rectify this breaking change in the docs. Any help is much appreciated.
I have tried to recreate this function however the apache-arrow
package has breaking changes since this code was written. I have tried the old versions of apache-arrow without success.
Since /api/tsdb/query
is deprecated, I’d encourage you to look at the newer /api/ds/query
.
For more information, check out the related issues:
grafana:main
← grafana:deprecate-tsdb-query
opened 01:43PM - 10 Feb 22 UTC
<!--
Thank you for sending a pull request! Here are some tips:
1. If this … is your first time, please read our contribution guide at https://github.com/grafana/grafana/blob/main/CONTRIBUTING.md
2. Ensure you include and run the appropriate tests as part of your Pull Request.
3. In a new feature or configuration option, an update to the documentation is necessary. Everything related to the documentation is under the docs folder in the root of the repository.
4. If the Pull Request is a work in progress, make use of GitHub's "Draft PR" feature and mark it as such.
5. If you can not merge your Pull Request due to a merge conflict, Rebase it. This gets it in sync with the main branch.
6. Name your PR as "<FeatureArea>: Describe your change", e.g. Alerting: Prevent race condition. If it's a fix or feature relevant for the changelog describe the user impact in the title. The PR title is used to auto-generate the changelog for issues marked with the "add to changelog" label.
-->
**What this PR does / why we need it**:
This PR ensures references to `/api/tsdb/query` are marked as deprecated, and includes recommendations to use the newer `/api/ds/query` in its place.
# Deprecation notice
`/api/tsdb/query` API has been deprecated and will be removed in a future release. Use [/api/ds/query](https://grafana.com/docs/grafana/latest/http_api/data_source/#query-a-data-source) instead.
opened 12:01PM - 08 Apr 22 UTC
type/docs
type/chore
area/backend
area/frontend
Since v9 is a major version we should take the opportunity to do breaking change… s and remove old/legacy/deprecated things.
**Tasks:**
- Remove deprecation warning/support for legacy `login_maximum_inactive_lifetime_days` and `login_maximum_lifetime_days` introduce in Grafana v7.2 via #27150
- Remove deprecation warning/support for `ldap_sync_ttl` introduced in Grafana v6.5 via #20191
- Remove deprecation warning/support for `max_idle_connections_per_host` introduced in Grafana v8.1 via #36621
- `"ngalert feature flag is deprecated: use unified alerting enabled setting instead` introduced in Grafana v8.3 via #42200.
- https://github.com/grafana/grafana/pull/45238 - will follow up with code removal for v9.0.0
- Stop automatically parsing numbers-as-strings to numbers in some text visualisations https://github.com/grafana/grafana/pull/46035
- Loki datasource:
- do not replace `NaN` with `null` https://github.com/grafana/grafana/pull/45389
- change dataframe-format used for logs: https://github.com/grafana/grafana/pull/47153
- Instrumentation:
- Remove support for request metric summaries/counters in favor of the default which is histograms. Introduced in Grafana v8 via #33921 - do we want to do this @bergquist ?