grafana / sqlds

A package that assists writing SQL-driven datasources
Apache License 2.0
17 stars 12 forks source link

forward headers #90

Closed scottlepp closed 1 year ago

scottlepp commented 1 year ago

forward headers for sql datasources. this allows pass through oauth tokens

this was a bit hard to do without breaking compatibility

when a sql ds first connects, it happens before queryData/checkHealth. so it will not have the headers yet since those are applied as middleware on queryData and checkHealth. so the first "ping" will fail. sqlds allows retries and defining what errors to retry on, so the datasource can retry on "bad token" or whatever the underlying database returns. then retry will then reconnect and will have the headers available and a new connection is established with the headers