-
Notifications
You must be signed in to change notification settings - Fork 106
Move timezone and utils to separate package #2015
Conversation
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.
in master, the timezone is considered an api level configuration, as various of the api methods - before involving expr - call getFromTo, and thus need access to the default timezone configured.
I'm not sure why linearRegression would need to access that variable. Is it because from/to can be any 'at' style expression, which allows specifying a timezone? wouldn't that timezone then be scoped to that function call only? it has no bearing on the request-scoped from/to, correct? do you envision needing only read access or also writing to the timezone variable?
also, while i never particularly liked the idea of bringing all api models together in one 'models' package, that is how it is, and moving just a single model ( FromTo ) elsewhere is definitely counter to our current code structure.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'll be taking over reviewing this for now |
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.
Yes, we are slightly departing from our traditional layout of Metrictank files / models / separation of code, however I think we should just move forward with this. If it becomes a problem in the future we can always change it.
Can we get @djedruszczak to agree to the CLA? |
Signed! |
This PR moves the
api.timeZone
var and certain utilities from theapi
package into a newtz
package. TheGetFromTo
function is exported for use in a future native implementation of thelinearRegression
function.Some encapsulation of the
api.timeZone
var (nowtz.TimeZone
) is lost so that it can continue to be set fromapi.ConfigSetup
, maintaining backwards compatibility. Theapi
package is highly dependent on theexpr
package, making the export ofapi.getFromTo
from theapi
package for use in native function implementations (theexpr
package) difficult due to import cycles.