grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
60.95k stars 11.63k forks source link

transform lookup field raises an exception : Uncaught missing frame in gazetteer #55826

Open amarant opened 1 year ago

amarant commented 1 year ago

What happened: An exception is raised using the transform lookup field, and no fields are added to the dataframe.

What you expected to happen: No exception and the corresponding field matched from the key of the field

How to reproduce it (as minimally and precisely as possible):

Create a static datasource countries containing a single field code2letters with a single value FR. Add a lookup field transform, using the code2letters field and countries, it should add corresponding field from FR (France) value, but it raises and execption. The json model might be incomplete due to the exception.

JSON Model

```json { "annotations": { "list": [] }, "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, "id": 889, "links": [], "liveNow": false, "panels": [ { "datasource": { "type": "marcusolsson-static-datasource", "uid": "j_w3s5fMk" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "auto", "displayMode": "auto", "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [] }, "gridPos": { "h": 8, "w": 12, "x": 0, "y": 0 }, "id": 4, "options": { "footer": { "fields": "", "reducer": [ "sum" ], "show": false }, "showHeader": true }, "pluginVersion": "9.1.5-0100a6a", "targets": [ { "datasource": { "type": "marcusolsson-static-datasource", "uid": "j_w3s5fMk" }, "frame": { "fields": [ { "config": {}, "name": "code2letters", "type": "string", "values": [ "FR" ] } ], "meta": { "preferredVisualisationType": "table" }, "name": "countries" }, "refId": "A" } ], "title": "Panel Title", "transformations": [ { "id": "fieldLookup", "options": { "lookupField": "code2letters" } } ], "type": "table" } ], "schemaVersion": 37, "style": "dark", "tags": [], "templating": { "list": [] }, "time": { "from": "now-6h", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Transform organize fields", "uid": "o1LGEWZGz", "version": 1, "weekStart": "" } ```

Anything else we need to know?: None

Environment:

dprokop commented 1 year ago

@amarant thanks for opening the issue, I can easily reproduce it with the attached dashboard[1].

The exception being thrown is:

reportUnhandledError.js:10 Uncaught missing frame in gazetteer

thrown from https://github.com/grafana/grafana/blob/main/public/app/features/transformers/lookupGazetteer/fieldLookup.ts#L35

Apparently the gazeteer returned by https://github.com/grafana/grafana/blob/main/public/app/features/geo/gazetteer/worldmap.ts#L14-L15 does not have frame property what causes the exception. @ryantxu - I'm not familiar with this transformation implementation, and I'm not sure what frame should be here - can you give some advice?

[1] dashboard.json ```json { "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "target": { "limit": 100, "matchAny": false, "tags": [], "type": "dashboard" }, "type": "dashboard" } ] }, "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, "id": 1761, "links": [], "liveNow": false, "panels": [ { "datasource": { "type": "testdata", "uid": "PD8C576611E62080A" }, "fieldConfig": { "defaults": { "color": { "mode": "thresholds" }, "custom": { "align": "auto", "displayMode": "auto", "inspect": false }, "mappings": [], "thresholds": { "mode": "absolute", "steps": [ { "color": "green", "value": null }, { "color": "red", "value": 80 } ] } }, "overrides": [] }, "gridPos": { "h": 9, "w": 12, "x": 0, "y": 0 }, "id": 2, "options": { "footer": { "fields": "", "reducer": [ "sum" ], "show": false }, "showHeader": true }, "pluginVersion": "9.3.0-pre", "targets": [ { "csvContent": "code2letters\nAL", "datasource": { "type": "testdata", "uid": "PD8C576611E62080A" }, "refId": "A", "scenarioId": "csv_content" } ], "title": "Panel Title", "transformations": [ { "id": "fieldLookup", "options": { "gazetteer": "public/gazetteer/countries.json", "lookupField": "code2letters" } } ], "type": "table" } ], "schemaVersion": 37, "style": "dark", "tags": [], "templating": { "list": [] }, "time": { "from": "now-6h", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Lookup field", "uid": "pECpTMV4z", "version": 4, "weekStart": "" } ```
github-actions[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

github-actions[bot] commented 3 months ago

This issue has been automatically closed because it has not had any further activity in the last 30 days. Thank you for your contributions!

yosiasz commented 2 weeks ago

still an issue. please reopen

21stcaveman commented 2 weeks ago

Definitely still an issue