Open svet-b opened 3 years ago
FWIW, this PR has some more details on what Grafana expects to receive - looks like there were some changes around v7.2: https://github.com/grafana/grafana/pull/27186. In this context, config.displayNameFromDS
may be the correct way to pass the label.
Thanks for digging into this issue. I agree that it does look like config.displayNameFromDS
is the right field to set now.
Hm...unfortunately field.config.displayNameFromDS
still appears to lead to the same issue. (tried it in this fork branch https://github.com/ammpio/graphql-datasource/tree/ammp_v1.3.0a). I guess it would be good get some input on best practices from the Grafana devs. My best guess is still field.name
When multiple queries are used in a panel, and yield data series with the same name, Grafana normally takes care of this by appending "1", "2", "3", etc to the names. However, this does not appear to work correctly for data from the GraphQL data source. I've described the situation, and how to reproduce it, in this comment on a related (but now closed) Grafana issue: https://github.com/grafana/grafana/issues/31104#issuecomment-830302528.
From what I can tell, this is due to the fact that
config.displayName
is set here: https://github.com/fifemon/graphql-datasource/blob/master/src/DataSource.ts#L207, while Grafana does not expect it to be set by the datasource. Other datasources do not appear to do things this way, so I suspect the implementation in the GraphQL datasource is somehow non-standard.