Skip to content

Conversation

@nora-shap
Copy link
Member

Summary

Connects the task to the new Seer endpoint - enables sending performance data to Seer to analyze.
Currently just logging the results, next step is to create Issues from the data returned by Seer.

Changes

  • Add detect_llm_issues_for_project task implementation
    • Fetches recent transactions for enabled projects
    • Retrieves trace data and sends to Seer /v1/automation/issue-detection/analyze endpoint
    • Handles HTTP errors and JSON parsing failures with structured error reporting
  • Create Pydantic models for API request/response validation
  • Add dedicated connection pool for issue detection endpoints
  • Implement comprehensive error handling with LLMIssueDetectionError
  • Add structured logging for success and failure cases

The task is behind feature flags and project allowlists, ready for controlled rollout.

@linear
Copy link

linear bot commented Oct 27, 2025

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Oct 27, 2025
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@nora-shap nora-shap marked this pull request as ready for review October 28, 2025 00:32
@nora-shap nora-shap requested a review from a team as a code owner October 28, 2025 00:32
assert log_extra["num_issues"] == 1
assert "trace_id" in log_extra

def test_detect_llm_issues_no_transactions(self, mock_seer_api):
Copy link
Member

Choose a reason for hiding this comment

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

Do we need all these tests? there are quite a few validation ones, but im concerned they outnumber ones that actually test behavior which could make this file less readable

Copy link
Member Author

Choose a reason for hiding this comment

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

but then I wouldn't have 100% coverage 😭

trace = get_trace_for_transaction(transaction.name, transaction.project_id)
if trace:
logger.info("Found trace for LLM issue detection", extra={"trace_id": trace.trace_id})
trace: TraceData | None = get_trace_for_transaction(
Copy link
Member

Choose a reason for hiding this comment

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

do we need the explicit typing here for trace?

Copy link
Member Author

Choose a reason for hiding this comment

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

I like it - saves me a click or two

logger.info("Found trace for LLM issue detection", extra={"trace_id": trace.trace_id})

seer_request = {
"telemetry": [{**trace.dict(), "kind": "trace"}],
Copy link
Member

Choose a reason for hiding this comment

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

might be worth filtering for tags here like we do in the PoC

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a great suggestion, esp since I can add "kind": "trace" in a better way (I don't really like the way I'm doing it here)
I'm going to make an additional function to clean/format the response from get_trace_for_transaction in a subsequent pr

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Oct 28, 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   #102188       +/-   ##
============================================
+ Coverage   66.62%    80.95%   +14.33%     
============================================
  Files        8739      8746        +7     
  Lines      388845    389323      +478     
  Branches    24706     24706               
============================================
+ Hits       259050    315183    +56133     
+ Misses     129440     73785    -55655     
  Partials      355       355               

@nora-shap nora-shap merged commit d87c79f into master Oct 29, 2025
68 of 69 checks passed
@nora-shap nora-shap deleted the nora/ID-1008 branch October 29, 2025 19:28
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.

3 participants