Skip to content

Commit

Permalink
fix(trace-explorer): Date range narrowing condition is backwards (#70496
Browse files Browse the repository at this point in the history
)

This was changing the end timestamp to be too narrow and missing some
spans.
  • Loading branch information
Zylphrex committed May 8, 2024
1 parent fc8b666 commit 4623b5d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/sentry/api/endpoints/organization_traces.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,17 @@ def get_traces_matching_metric_conditions(
return min_timestamp, max_timestamp, [], []
else:
# No user queries so take the first N trace ids as our list
min_timestamp = snuba_params.end
max_timestamp = snuba_params.start
assert min_timestamp is not None
assert max_timestamp is not None

trace_ids = trace_ids[: self.limit]
timestamps = timestamps[: self.limit]
for timestamp in timestamps:
if timestamp < min_timestamp:
min_timestamp = timestamp
if timestamp < max_timestamp:
if timestamp > max_timestamp:
max_timestamp = timestamp

self.refine_params(min_timestamp, max_timestamp)
Expand Down
6 changes: 3 additions & 3 deletions src/sentry/sentry_metrics/querying/samples_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def get_matching_spans_from_traces(
# This also means we cannot order by any columns or paginate.
orderby=None,
limit=len(trace_ids) * max_spans_per_trace,
limitby=("trace", 1),
limitby=("trace", max_spans_per_trace),
)

trace_id_condition = Condition(Column("trace_id"), Op.IN, trace_ids)
Expand Down Expand Up @@ -609,7 +609,7 @@ def get_matching_spans_from_traces(
# This also means we cannot order by any columns or paginate.
orderby=None,
limit=len(trace_ids) * max_spans_per_trace,
limitby=("trace", 1),
limitby=("trace", max_spans_per_trace),
)

trace_id_condition = Condition(Column("trace_id"), Op.IN, trace_ids)
Expand Down Expand Up @@ -943,7 +943,7 @@ def get_matching_spans_from_traces(
# This also means we cannot order by any columns or paginate.
orderby=None,
limit=len(trace_ids) * max_spans_per_trace,
limitby=("trace", 1),
limitby=("trace", max_spans_per_trace),
)

trace_id_condition = Condition(Column("trace_id"), Op.IN, trace_ids)
Expand Down

0 comments on commit 4623b5d

Please sign in to comment.