Skip to content

feat(uptime): Allow uptime spans to be fetched from the organiation_trace endpoint. #96821

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

Merged
merged 4 commits into from
Aug 5, 2025

Conversation

wedamija
Copy link
Member

This adds the include_uptime param to this endpoint. When this is passed, we'll fetch uptime results and make the main request the root span for all other items in the trace.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 31, 2025
@wedamija wedamija force-pushed the danf/organization-uptime-trace branch from 92ec3fe to f23c3d9 Compare July 31, 2025 00:37
@wedamija wedamija changed the base branch from master to danf/uptime-columns-fix July 31, 2025 00:37
@getsentry getsentry deleted a comment from codecov bot Jul 31, 2025
Comment on lines -10 to +11
public_alias="trace_id",
internal_name="trace_id",
public_alias="trace",
internal_name="sentry.trace_id",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this break anything else or was this just a fix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a fix - we aren't relying on this id anywhere else in the ui, afaik.

Worst case it breaks something only in the sentry org where we have reading from EAP enabled. But I doubt it will even break anything there.

Base automatically changed from danf/uptime-columns-fix to master July 31, 2025 18:03
…trace` endpoint.

This adds the `include_uptime` param to this endpoint. When this is passed, we'll fetch uptime results and make the main request the root span for all other items in the trace.
@wedamija wedamija marked this pull request as ready for review August 1, 2025 19:53
@wedamija wedamija requested review from a team as code owners August 1, 2025 19:53
row_dict["check_duration_us"].val_int if "check_duration_us" in row_dict else 0
)
project_id = row_dict["sentry.project_id"].val_int
project_slug = project_slugs[project_id]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Uptime Serialization Null Handling

The _serialize_columnar_uptime_item function has two bugs:

  1. http_status_code and check_duration_us are directly accessed via .val_int on AttributeValue objects without checking is_null. This can result in incorrect non-null values (e.g., 0) or errors when the field is actually null, bypassing the get_value helper's null handling.
  2. Accessing project_slugs[project_id] can raise a KeyError if a project is deleted, as project_id from uptime results might not be present in the project_slugs map.
Fix in Cursor Fix in Web

wedamija added a commit that referenced this pull request Aug 1, 2025
…meta`

This adds `include_uptime` to the meta endpoint as well. When it's passed, we'll include the number of uptime spans in the meta as well

Relies on #96821
Comment on lines +390 to +404
def get_value(attr_name: str, attr_value: AttributeValue):
if attr_value.is_null:
return None
resolved_column = columns_by_name[attr_name]
if resolved_column.search_type == "integer":
return attr_value.val_int
elif resolved_column.search_type == "string":
return attr_value.val_str
elif resolved_column.search_type == "number":
return attr_value.val_double
elif resolved_column.search_type == "boolean":
return attr_value.val_bool
elif resolved_column.search_type == "byte":
return attr_value.val_int
raise ValueError("Unknown column type")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels like this should be a helper util somewhere else

kwargs.setdefault("response_body_size_bytes", None)
return self.create_eap_uptime_result(**kwargs)

def assert_expected_results(self, response_data, input_trace_items, expected_children_ids=None):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be useful in other tests?

@wedamija
Copy link
Member Author

wedamija commented Aug 5, 2025

I'll address feedback in a follow up pr so we can get this merged

@wedamija wedamija merged commit 07e0bf7 into master Aug 5, 2025
65 checks passed
@wedamija wedamija deleted the danf/organization-uptime-trace branch August 5, 2025 18:22
wedamija added a commit that referenced this pull request Aug 5, 2025
…meta`

This adds `include_uptime` to the meta endpoint as well. When it's passed, we'll include the number of uptime spans in the meta as well

Relies on #96821
wedamija added a commit that referenced this pull request Aug 5, 2025
…meta` (#97022)

This adds `include_uptime` to the meta endpoint as well. When it's
passed, we'll include the number of uptime spans in the meta as well

Relies on #96821
Copy link

sentry-io bot commented Aug 6, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

Did you find this useful? React with a 👍 or 👎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scope: Backend Automatically applied to PRs that change backend components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants