Skip to content

chore(integrations): Add SLOs to finish_pipeline #94586

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Christinarlong
Copy link
Contributor

I dont think we have any SLOs for finish_pipeline despite being a major part of our integration installation pipeline

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jun 27, 2025
Copy link

codecov bot commented Jun 27, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #94586      +/-   ##
==========================================
- Coverage   87.95%   87.94%   -0.01%     
==========================================
  Files       10386    10393       +7     
  Lines      601771   602459     +688     
  Branches    23408    23408              
==========================================
+ Hits       529258   529809     +551     
- Misses      72057    72194     +137     
  Partials      456      456              

@Christinarlong Christinarlong marked this pull request as ready for review June 27, 2025 23:31
@Christinarlong Christinarlong requested review from a team as code owners June 27, 2025 23:31
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Permission Errors Masked as Success

Integration installation permission failures are incorrectly recorded as successful in SLO metrics. The finish_pipeline method returns early on permission errors without calling lifecycle.record_failure() or lifecycle.record_halt(). As the IntegrationPipelineViewEvent context manager defaults to assume_success=True, these failures are logged as successes, skewing reliability metrics. This is inconsistent with how other errors (e.g., IntegrationError) are handled.

src/sentry/integrations/pipeline.py#L139-L155

if (
org_context
and (not org_context.member or "org:integrations" not in org_context.member.scopes)
and not superuser_has_permission(self.request, ["org:integrations"])
):
error_message = "You must be an organization owner, manager or admin to install this integration."
logger.info(
"build-integration.permission_error",
extra={
"error_message": error_message,
"organization_id": self.organization.id if self.organization else None,
"user_id": self.request.user.id,
"provider_key": self.provider.key,
},
)
return self.error(error_message)

Fix in Cursor


Bug: SLO Metrics Misreport Integration Failures

The IntegrationPipelineViewEvent context manager incorrectly records IntegrationProviderError cases as successful in SLO metrics. When an IntegrationProviderError occurs, the finish_pipeline method returns early via self.render_warning() without calling lifecycle.record_failure() or lifecycle.record_halt(). This causes the context manager, which defaults to assume_success=True, to log these errors as successes, skewing SLOs. This behavior is inconsistent with how IntegrationError is handled, which correctly records failures.

src/sentry/integrations/pipeline.py#L169-L180

return self.error(str(e))
except IntegrationProviderError as e:
self.get_logger().info(
"build-integration.provider-error",
extra={
"error_message": str(e),
"error_status": getattr(e, "code", None),
"organization_id": self.organization.id if self.organization else None,
"provider_key": self.provider.key,
},
)
return self.render_warning(str(e))

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 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.

1 participant