Skip to content

Commit ff195b8

Browse files
committed
Merge branch 'master' into tkdodo/ref/releases-endpoint-to-apiOptions
2 parents 607fb1f + 26dd06e commit ff195b8

File tree

10 files changed

+50
-23
lines changed

10 files changed

+50
-23
lines changed

migrations_lockfile.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ replays: 0007_organizationmember_replay_access
3131

3232
seer: 0005_delete_seerorganizationsettings
3333

34-
sentry: 1064_eventattachment_date_expires_now
34+
sentry: 1065_delete_customdynamicsamplingrule
3535

3636
social_auth: 0003_social_auth_json_field
3737

src/sentry/db/router.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class SiloRouter:
7676
"sentry_alertruleactivations": SiloMode.CELL,
7777
"sentry_alertruleactivationcondition": SiloMode.CELL,
7878
"sentry_code_review_event": SiloMode.CELL,
79+
"sentry_customdynamicsamplingrule": SiloMode.CELL,
80+
"sentry_customdynamicsamplingruleproject": SiloMode.CELL,
7981
"sentry_dashboardwidgetsnapshot": SiloMode.CELL,
8082
"sentry_datasecrecywaiver": SiloMode.CELL,
8183
"sentry_incidentseen": SiloMode.CELL,

src/sentry/hybridcloud/apigateway_async/proxy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import httpx
1313
from asgiref.sync import sync_to_async
1414
from django.conf import settings
15-
from django.core.exceptions import RequestAborted
1615
from django.http import HttpRequest, HttpResponse, JsonResponse, StreamingHttpResponse
1716
from django.http.response import HttpResponseBase
1817

@@ -199,7 +198,7 @@ async def proxy_cell_request(
199198
return _adapt_response(resp, target_url)
200199
except asyncio.CancelledError:
201200
metrics.incr("apigateway.proxy.request_aborted", tags=metric_tags)
202-
raise RequestAborted()
201+
raise
203202
except httpx.TimeoutException:
204203
metrics.incr("apigateway.proxy.request_timeout", tags=metric_tags)
205204
circuitbreaker.incr_failures()
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from sentry.new_migrations.migrations import CheckedMigration
2+
from sentry.new_migrations.monkey.models import SafeDeleteModel
3+
from sentry.new_migrations.monkey.state import DeletionAction
4+
5+
6+
class Migration(CheckedMigration):
7+
is_post_deployment = False
8+
9+
dependencies = [
10+
("sentry", "1064_eventattachment_date_expires_now"),
11+
]
12+
13+
operations = [
14+
SafeDeleteModel(
15+
name="CustomDynamicSamplingRuleProject",
16+
deletion_action=DeletionAction.DELETE,
17+
),
18+
SafeDeleteModel(
19+
name="CustomDynamicSamplingRule",
20+
deletion_action=DeletionAction.DELETE,
21+
),
22+
]

src/sentry/utils/sdk.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,10 @@ def before_send(event: Event, hint: Hint) -> Event | None:
255255
if settings.SENTRY_LOCAL_CELL:
256256
event["tags"]["sentry_region"] = settings.SENTRY_LOCAL_CELL
257257

258-
if hint.get("exc_info", [None])[0] == OperationalError:
258+
event_exc: type[BaseException] | None = hint.get("exc_info", [None])[0]
259+
if event_exc == asyncio.CancelledError:
260+
return None
261+
if event_exc == OperationalError:
259262
event["level"] = "warning"
260263

261264
return event

static/app/views/dashboards/utils/prebuiltConfigs/ai/aiAgentsModels.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ export const AI_AGENTS_MODELS_PREBUILT_CONFIG: PrebuiltDashboard = {
164164
{
165165
dataset: WidgetType.SPANS,
166166
tag: {
167-
key: 'gen_ai.response.model',
168-
name: 'gen_ai.response.model',
167+
key: SpanFields.GEN_AI_RESPONSE_MODEL,
168+
name: SpanFields.GEN_AI_RESPONSE_MODEL,
169169
kind: FieldKind.TAG,
170170
},
171171
value: '',

static/app/views/insights/pages/agents/components/llmCallsWidget.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function LLMCallsWidget() {
4242

4343
const generationsRequest = useSpans(
4444
{
45-
fields: ['gen_ai.request.model', 'count()'],
45+
fields: [SpanFields.GEN_AI_RESPONSE_MODEL, 'count()'],
4646
sorts: [{field: 'count()', kind: 'desc'}],
4747
search: fullQuery,
4848
limit: 3,
@@ -54,7 +54,7 @@ export function LLMCallsWidget() {
5454
{
5555
...pageFilterChartParams,
5656
query: fullQuery,
57-
groupBy: [SpanFields.GEN_AI_REQUEST_MODEL],
57+
groupBy: [SpanFields.GEN_AI_RESPONSE_MODEL],
5858
yAxis: ['count(span.duration)'],
5959
sort: {field: 'count(span.duration)', kind: 'desc'},
6060
topEvents: 3,
@@ -109,7 +109,7 @@ export function LLMCallsWidget() {
109109
const footer = hasData && (
110110
<WidgetFooterTable>
111111
{models?.map((item, index) => {
112-
const modelId = item['gen_ai.request.model'];
112+
const modelId = item[SpanFields.GEN_AI_RESPONSE_MODEL];
113113
return (
114114
<Fragment key={modelId}>
115115
<div>
@@ -149,7 +149,7 @@ export function LLMCallsWidget() {
149149
yAxes: ['count(span.duration)'],
150150
},
151151
],
152-
groupBy: ['gen_ai.request.model'],
152+
groupBy: [SpanFields.GEN_AI_RESPONSE_MODEL],
153153
query: fullQuery,
154154
sort: '-count(span.duration)',
155155
interval: pageFilterChartParams.interval,

static/app/views/insights/pages/agents/components/modelCostWidget.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export function ModelCostWidget() {
4141

4242
const tokensRequest = useSpans(
4343
{
44-
fields: ['gen_ai.request.model', 'sum(gen_ai.cost.total_tokens)'],
44+
fields: [SpanFields.GEN_AI_RESPONSE_MODEL, 'sum(gen_ai.cost.total_tokens)'],
4545
sorts: [{field: 'sum(gen_ai.cost.total_tokens)', kind: 'desc'}],
4646
search: fullQuery,
4747
limit: 3,
@@ -53,7 +53,7 @@ export function ModelCostWidget() {
5353
{
5454
...pageFilterChartParams,
5555
query: fullQuery,
56-
groupBy: [SpanFields.GEN_AI_REQUEST_MODEL],
56+
groupBy: [SpanFields.GEN_AI_RESPONSE_MODEL],
5757
yAxis: ['sum(gen_ai.cost.total_tokens)'],
5858
sort: {field: 'sum(gen_ai.cost.total_tokens)', kind: 'desc'},
5959
topEvents: 3,
@@ -111,7 +111,7 @@ export function ModelCostWidget() {
111111
const footer = hasData && (
112112
<WidgetFooterTable>
113113
{tokens?.map((item, index) => {
114-
const modelId = `${item['gen_ai.request.model']}`;
114+
const modelId = `${item[SpanFields.GEN_AI_RESPONSE_MODEL]}`;
115115
return (
116116
<Fragment key={modelId}>
117117
<div>
@@ -149,7 +149,7 @@ export function ModelCostWidget() {
149149
yAxes: ['sum(gen_ai.cost.total_tokens)'],
150150
},
151151
],
152-
groupBy: ['gen_ai.request.model'],
152+
groupBy: [SpanFields.GEN_AI_RESPONSE_MODEL],
153153
query: fullQuery,
154154
sort: '-sum(gen_ai.cost.total_tokens)',
155155
interval: pageFilterChartParams.interval,

static/app/views/insights/pages/agents/components/modelsTable.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import {getAIGenerationsFilter} from 'sentry/views/insights/pages/agents/utils/q
3838
import {Referrer} from 'sentry/views/insights/pages/agents/utils/referrers';
3939
import {DurationCell} from 'sentry/views/insights/pages/platform/shared/table/DurationCell';
4040
import {NumberCell} from 'sentry/views/insights/pages/platform/shared/table/NumberCell';
41+
import {SpanFields} from 'sentry/views/insights/types';
4142

4243
interface TableData {
4344
avg: number;
@@ -100,7 +101,7 @@ export function ModelsTable() {
100101
const modelsRequest = useSpans(
101102
{
102103
fields: [
103-
'gen_ai.request.model',
104+
SpanFields.GEN_AI_RESPONSE_MODEL,
104105
'sum(gen_ai.usage.input_tokens)',
105106
'sum(gen_ai.usage.output_tokens)',
106107
'sum(gen_ai.usage.output_tokens.reasoning)',
@@ -126,7 +127,7 @@ export function ModelsTable() {
126127
}
127128

128129
return modelsRequest.data.map(span => ({
129-
model: span['gen_ai.request.model'],
130+
model: span[SpanFields.GEN_AI_RESPONSE_MODEL],
130131
requests: span['count()'] ?? 0,
131132
avg: span['avg(span.duration)'] ?? 0,
132133
p95: span['p95(span.duration)'] ?? 0,
@@ -223,9 +224,9 @@ const BodyCell = memo(function BodyCell({
223224
yAxes: ['avg(span.duration)'],
224225
},
225226
],
226-
query: `gen_ai.request.model:${dataRow.model}`,
227+
query: `${SpanFields.GEN_AI_RESPONSE_MODEL}:${dataRow.model}`,
227228
field: [
228-
'gen_ai.request.model',
229+
SpanFields.GEN_AI_RESPONSE_MODEL,
229230
'gen_ai.operation.name',
230231
'gen_ai.usage.input_tokens',
231232
'gen_ai.usage.output_tokens',
@@ -268,7 +269,7 @@ const BodyCell = memo(function BodyCell({
268269
<ErrorCell
269270
value={dataRow.errors}
270271
target={getExploreUrl({
271-
query: `${query} span.status:internal_error gen_ai.request.model:"${dataRow.model}"`,
272+
query: `${query} span.status:internal_error ${SpanFields.GEN_AI_RESPONSE_MODEL}:"${dataRow.model}"`,
272273
organization,
273274
selection,
274275
referrer: Referrer.MODELS_TABLE,

static/app/views/insights/pages/agents/components/tokenUsageWidget.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function TokenUsageWidget() {
4242

4343
const tokensRequest = useSpans(
4444
{
45-
fields: ['gen_ai.request.model', 'sum(gen_ai.usage.total_tokens)'],
45+
fields: [SpanFields.GEN_AI_RESPONSE_MODEL, 'sum(gen_ai.usage.total_tokens)'],
4646
sorts: [{field: 'sum(gen_ai.usage.total_tokens)', kind: 'desc'}],
4747
search: fullQuery,
4848
limit: 3,
@@ -54,7 +54,7 @@ export function TokenUsageWidget() {
5454
{
5555
...pageFilterChartParams,
5656
query: fullQuery,
57-
groupBy: [SpanFields.GEN_AI_REQUEST_MODEL],
57+
groupBy: [SpanFields.GEN_AI_RESPONSE_MODEL],
5858
yAxis: ['sum(gen_ai.usage.total_tokens)'],
5959
sort: {field: 'sum(gen_ai.usage.total_tokens)', kind: 'desc'},
6060
topEvents: 3,
@@ -112,7 +112,7 @@ export function TokenUsageWidget() {
112112
const footer = hasData && (
113113
<WidgetFooterTable>
114114
{tokens?.map((item, index) => {
115-
const modelId = `${item['gen_ai.request.model']}`;
115+
const modelId = `${item[SpanFields.GEN_AI_RESPONSE_MODEL]}`;
116116
return (
117117
<Fragment key={modelId}>
118118
<div>
@@ -152,7 +152,7 @@ export function TokenUsageWidget() {
152152
yAxes: ['sum(gen_ai.usage.total_tokens)'],
153153
},
154154
],
155-
groupBy: ['gen_ai.request.model'],
155+
groupBy: [SpanFields.GEN_AI_RESPONSE_MODEL],
156156
query: fullQuery,
157157
sort: '-sum(gen_ai.usage.total_tokens)',
158158
interval: pageFilterChartParams.interval,

0 commit comments

Comments
 (0)