Skip to content

Commit b207bc3

Browse files
committed
fix merge conflicts
1 parent 3a63d73 commit b207bc3

File tree

4 files changed

+19
-299
lines changed

4 files changed

+19
-299
lines changed

src/sentry/seer/explorer/index_data.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def get_trace_for_transaction(transaction_name: str, project_id: int) -> TraceDa
146146
auto_fields=True,
147147
)
148148

149-
# Step 1: Get a trace ID for the transaction
149+
# Step 1: Get a random trace ID for the transaction
150150
escaped_transaction_name = UNESCAPED_QUOTE_RE.sub('\\"', transaction_name)
151151
traces_result = Spans.run_table_query(
152152
params=snuba_params,
@@ -196,7 +196,7 @@ def get_trace_for_transaction(transaction_name: str, project_id: int) -> TraceDa
196196
)
197197

198198
# Step 3: Build span objects
199-
spans: list[Span] = []
199+
spans = []
200200
for row in spans_result.get("data", []):
201201
span_id = row.get("span_id")
202202
parent_span_id = row.get("parent_span")

src/sentry/tasks/llm_issue_detection.py

Lines changed: 0 additions & 287 deletions
This file was deleted.

src/sentry/tasks/llm_issue_detection/detection.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from django.conf import settings
1010
from pydantic import BaseModel
1111

12-
from sentry import options
12+
from sentry import features, options
1313
from sentry.issues.grouptype import LLMDetectedExperimentalGroupType
1414
from sentry.issues.issue_occurrence import IssueEvidence, IssueOccurrence
1515
from sentry.issues.producer import PayloadType, produce_occurrence_to_kafka
@@ -181,7 +181,14 @@ def detect_llm_issues_for_project(project_id: int) -> None:
181181
Process a single project for LLM issue detection.
182182
"""
183183
project = Project.objects.get_from_cache(id=project_id)
184-
organization_id = project.organization_id
184+
organization = project.organization
185+
organization_id = organization.id
186+
187+
has_access = features.has("organizations:gen-ai-features", organization) and not bool(
188+
organization.get_option("sentry:hide_ai_features")
189+
)
190+
if not has_access:
191+
return
185192

186193
transactions = get_transactions_for_project(
187194
project_id, limit=50, start_time_delta={"minutes": 30}

tests/sentry/tasks/test_llm_issue_detection.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_detect_llm_issues_no_transactions(self, mock_get_transactions):
4747
)
4848

4949
@with_feature("organizations:gen-ai-features")
50-
@patch("sentry.tasks.llm_issue_detection.detection.get_trace_for_transaction")
50+
@patch("sentry.tasks.llm_issue_detection.detection.get_evidence_trace_for_llm_detection")
5151
@patch("sentry.tasks.llm_issue_detection.detection.get_transactions_for_project")
5252
@patch("sentry.tasks.llm_issue_detection.detection.random.shuffle")
5353
def test_detect_llm_issues_no_traces(self, mock_shuffle, mock_get_transactions, mock_get_trace):
@@ -157,14 +157,14 @@ def test_create_issue_occurrence_without_missing_telemetry(self, mock_produce_oc
157157
assert evidence_names == {"Explanation", "Impact", "Evidence"}
158158

159159
@with_feature("organizations:gen-ai-features")
160-
@patch("sentry.tasks.llm_issue_detection.produce_occurrence_to_kafka")
161-
@patch("sentry.tasks.llm_issue_detection.make_signed_seer_api_request")
162-
@patch("sentry.tasks.llm_issue_detection.get_trace_for_transaction")
163-
@patch("sentry.tasks.llm_issue_detection.get_transactions_for_project")
164-
@patch("sentry.tasks.llm_issue_detection.random.sample")
160+
@patch("sentry.tasks.llm_issue_detection.detection.produce_occurrence_to_kafka")
161+
@patch("sentry.tasks.llm_issue_detection.detection.make_signed_seer_api_request")
162+
@patch("sentry.tasks.llm_issue_detection.detection.get_evidence_trace_for_llm_detection")
163+
@patch("sentry.tasks.llm_issue_detection.detection.get_transactions_for_project")
164+
@patch("sentry.tasks.llm_issue_detection.detection.random.shuffle")
165165
def test_detect_llm_issues_full_flow(
166166
self,
167-
mock_sample,
167+
mock_shuffle,
168168
mock_get_transactions,
169169
mock_get_trace,
170170
mock_seer_request,
@@ -175,7 +175,7 @@ def test_detect_llm_issues_full_flow(
175175
mock_transaction.name = "api/users/list"
176176
mock_transaction.project_id = self.project.id
177177
mock_get_transactions.return_value = [mock_transaction]
178-
mock_sample.side_effect = lambda x, n: x
178+
mock_shuffle.return_value = None
179179

180180
mock_span = EvidenceSpan(
181181
span_id="span123",

0 commit comments

Comments
 (0)