Skip to content

Commit

Permalink
chore: make trace item attribute list permissive like values is
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-sentry committed Sep 17, 2024
1 parent 26d5e85 commit 97dfc60
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions snuba/web/rpc/trace_item_attribute_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ def trace_item_attribute_list_query(
if request.limit > 1000:
raise BadSnubaRPCRequestException("Limit can be at most 1000")

# this table stores timestamp as toStartOfDay(x) in UTC, so if you request 4PM - 8PM on a specific day, nada
start_timestamp = datetime.utcfromtimestamp(request.meta.start_timestamp.seconds)
if start_timestamp.day >= datetime.utcnow().day and start_timestamp.hour != 0:
raise BadSnubaRPCRequestException(
"Tags' timestamps are stored per-day, you probably want to set start_timestamp to UTC 00:00 today or a time yesterday."
end_timestamp = datetime.utcfromtimestamp(request.meta.end_timestamp.seconds)
if start_timestamp.day == end_timestamp.day:
start_timestamp = start_timestamp.replace(
day=start_timestamp.day - 1, hour=0, minute=0, second=0, microsecond=0
)
end_timestamp = end_timestamp.replace(day=end_timestamp.day + 1)
request.meta.start_timestamp.seconds = int(start_timestamp.timestamp())
request.meta.end_timestamp.seconds = int(end_timestamp.timestamp())

query = f"""
SELECT DISTINCT attr_key, timestamp
Expand Down

0 comments on commit 97dfc60

Please sign in to comment.