-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Long Running Queries #61
Conversation
|
go.mod
Outdated
) | ||
|
||
replace github.com/grafana/sqlds/v2 => ../sqlds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a temporary change to be able to test locally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! Just added a few questions.
It's a shame external plugins can't expose prometheus metrics because it would have been interesting to count the frequence of a status so we could monitor the query cycle.
pkg/awsds/asyncDatasource.go
Outdated
} | ||
|
||
if driverSettings.Timeout != 0 { | ||
tctx, cancel := context.WithTimeout(ctx, driverSettings.Timeout) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure how much sense it makes to make use of the timeout when async mode is enabled. Maybe we should deprecate this feature once the long running queries becomes the default way (or only way) of querying this backend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's a little weird because its the time out for individual operations here instead of the whole data retrieval, which is what it means in sync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's remove it from the async flow then. It will only add confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/awsds/asyncDatasource.go
Outdated
}, nil | ||
} | ||
|
||
conn, err := ds.driver.Connect(ds.connSettings, q.ConnectionArgs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to use getDBConnectionFromQuery
here, like in sqlds?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to test this manually and make sure this works as expected. You can for example add two query rows in a panel and make sure they use different regions. Then each of the query rows should have one connection each.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked into it, but from what I can tell there aren't configurable query options for redshift that would force different connections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! Just a few minor comments. Feel free to ignore
*sqlds.SQLDatasource | ||
asyncDB AsyncDB |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is why I think this is not an "async datasource" but an "async sql data source" since we are still tied to the database architecture of sqlds
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair, but I think the naming linking it to AWS is specific enough? Also, for context, we're currently discussing removing sqlds and replacing it with a bunch of utility functions so we aren't as stuck with the sqlds architecture.
if err != nil { | ||
return nil, err | ||
} | ||
_, err = ds.SQLDatasource.NewDatasource(settings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit weird, you are creating a data source using sqlds but not using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It initializes the sqlds.SQLDatasource
that AsyncAWSDatasource is wrapping. Added a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, I think we got the naming there wrong. It should be func (ds *SQLDatasource) Init(settings backend.DataSourceInstanceSettings) (error)
, also because we already have a NewDatasource
that is really generating a new data source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's badly named 😞 Unfortunately I don't think the sqlds
function can be renamed at this point without a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, you just released that so nobody is using it but here so you have some flexibility if you want to modify it. In any case releases are free and numbers are infinite so there is no problem doing breaking changes :) (at least for things like this)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it was already being exported NewDatasource
before the long running queries changes 😞 I could deprecate it, but again, if we're planning on just not using it in the future there doesn't seem to be that much of a point.
Part of #64