ref: Use defaults for start and end times to Snuba#14289
Conversation
tkaemming
left a comment
There was a problem hiding this comment.
Looks good, thanks — hard to believe nobody did this earlier. 😬
| values_by_key = snuba.query( | ||
| start, end, ['tags_key', 'tags_value'], conditions, filters, aggregations, | ||
| kwargs.get('start'), kwargs.get('end'), [ | ||
| 'tags_key', 'tags_value'], conditions, filters, aggregations, |
There was a problem hiding this comment.
Using kwargs like this is kind of an anti-pattern but since you didn't introduce it, it is probably better to remain consistent with the existing code and not increase the scope of the change, so this is okay. Mostly pointing this out to say please don't take this as an example of good coding practice
There was a problem hiding this comment.
Good to know! When I do want to extract arguments from kwargs, is it better to extract it in the params?
get_group_tag_keys_and_top_values(...start=None, end=None)
There was a problem hiding this comment.
Yes — for example in this case, if end=xyz was accidentally replaced with stop=xyz or some other invalid argument, the method would accept the invalid keyword argument, but not use it. This makes it difficult to identify incorrect usage, especially when refactoring
We have the following logic in a few places:
However, we have some pretty reasonable defaults for
startandend, so, let's use them.