Skip to content

Commit 99900ab

Browse files
DominikB2014andrewshie-sentry
authored andcommitted
ref(insights): rename useEapSpans to useSpans (#95460)
Renames `useEAPSpans` to `useSpans` and `useEapSeries` to `useSpanSeries` There's no reason to distinguish this as the eap hook now that there is only one dataset being used. At the end of the day this is the hook you use to fetch spans, no need to expose underlying details here.
1 parent 60d1f54 commit 99900ab

37 files changed

+80
-80
lines changed

static/app/components/charts/chartWidgetLoader-unmocked-imports.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ jest.mock('sentry/views/insights/common/queries/useDiscover', () => ({
173173
isPending: false,
174174
error: null,
175175
})),
176-
useEAPSpans: jest.fn(() => ({
176+
useSpans: jest.fn(() => ({
177177
data: [
178178
{
179179
'avg(span.duration)': 123,
@@ -201,7 +201,7 @@ jest.mock('sentry/views/insights/common/queries/useTopNDiscoverSeries', () => ({
201201
})),
202202
}));
203203
jest.mock('sentry/views/insights/common/queries/useDiscoverSeries', () => ({
204-
useEAPSeries: jest.fn(() => ({
204+
useSpanSeries: jest.fn(() => ({
205205
data: {
206206
'count(span.duration)': mockDiscoverSeries('count(span.duration)'),
207207
'avg(span.duration)': mockDiscoverSeries('avg(span.duration)'),

static/app/views/alerts/rules/uptime/uptimeChecksGrid.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {space} from 'sentry/styles/space';
1515
import {getShortEventId} from 'sentry/utils/events';
1616
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
1717
import type {UptimeCheck, UptimeRule} from 'sentry/views/alerts/rules/uptime/types';
18-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
18+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
1919
import {
2020
reasonToText,
2121
statusToText,
@@ -36,7 +36,7 @@ const EMPTY_TRACE = '00000000000000000000000000000000';
3636
export function UptimeChecksGrid({uptimeRule, uptimeChecks}: Props) {
3737
const traceIds = uptimeChecks?.map(check => check.traceId) ?? [];
3838

39-
const {data: spanCounts, isPending: spanCountLoading} = useEAPSpans(
39+
const {data: spanCounts, isPending: spanCountLoading} = useSpans(
4040
{
4141
limit: 10,
4242
enabled: traceIds.length > 0,

static/app/views/insights/agentMonitoring/components/aiSpanList.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {
2828
} from 'sentry/views/insights/agentMonitoring/utils/query';
2929
import {Referrer} from 'sentry/views/insights/agentMonitoring/utils/referrers';
3030
import type {AITraceSpanNode} from 'sentry/views/insights/agentMonitoring/utils/types';
31-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
31+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
3232
import {
3333
isEAPSpanNode,
3434
isSpanNode,
@@ -201,7 +201,7 @@ function useEAPSpanAttributes(nodes: Array<TraceTreeNode<TraceTree.NodeValue>>)
201201
...spans.map(span => new Date(span.value.end_timestamp * 1000).getTime())
202202
);
203203

204-
const spanAttributesRequest = useEAPSpans(
204+
const spanAttributesRequest = useSpans(
205205
{
206206
search: `span_id:[${spans.map(span => `"${span.value.event_id}"`).join(',')}]`,
207207
fields: [

static/app/views/insights/agentMonitoring/components/llmGenerationsWidget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
} from 'sentry/views/insights/agentMonitoring/utils/query';
2020
import {Referrer} from 'sentry/views/insights/agentMonitoring/utils/referrers';
2121
import {ChartType} from 'sentry/views/insights/common/components/chart';
22-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
22+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
2323
import {useTopNSpanEAPSeries} from 'sentry/views/insights/common/queries/useTopNDiscoverSeries';
2424
import {convertSeriesToTimeseries} from 'sentry/views/insights/common/utils/convertSeriesToTimeseries';
2525
import {usePageFilterChartParams} from 'sentry/views/insights/pages/platform/laravel/utils';
@@ -42,7 +42,7 @@ export default function LLMGenerationsWidget() {
4242
const theme = useTheme();
4343
const fullQuery = useCombinedQuery(getAIGenerationsFilter());
4444

45-
const generationsRequest = useEAPSpans(
45+
const generationsRequest = useSpans(
4646
{
4747
fields: [AI_MODEL_ID_ATTRIBUTE, 'count()'],
4848
sorts: [{field: 'count()', kind: 'desc'}],

static/app/views/insights/agentMonitoring/components/modelsTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import {
3636
} from 'sentry/views/insights/agentMonitoring/utils/query';
3737
import {Referrer} from 'sentry/views/insights/agentMonitoring/utils/referrers';
3838
import {ChartType} from 'sentry/views/insights/common/components/chart';
39-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
39+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
4040
import {DurationCell} from 'sentry/views/insights/pages/platform/shared/table/DurationCell';
4141
// import {ErrorRateCell} from 'sentry/views/insights/pages/platform/shared/table/ErrorRateCell';
4242
import {NumberCell} from 'sentry/views/insights/pages/platform/shared/table/NumberCell';
@@ -95,7 +95,7 @@ export function ModelsTable() {
9595

9696
const {sortField, sortOrder} = useTableSortParams();
9797

98-
const modelsRequest = useEAPSpans(
98+
const modelsRequest = useSpans(
9999
{
100100
fields: [
101101
AI_MODEL_ID_ATTRIBUTE,

static/app/views/insights/agentMonitoring/components/tokenUsageWidget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
} from 'sentry/views/insights/agentMonitoring/utils/query';
2121
import {Referrer} from 'sentry/views/insights/agentMonitoring/utils/referrers';
2222
import {ChartType} from 'sentry/views/insights/common/components/chart';
23-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
23+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
2424
import {useTopNSpanEAPSeries} from 'sentry/views/insights/common/queries/useTopNDiscoverSeries';
2525
import {convertSeriesToTimeseries} from 'sentry/views/insights/common/utils/convertSeriesToTimeseries';
2626
import {usePageFilterChartParams} from 'sentry/views/insights/pages/platform/laravel/utils';
@@ -43,7 +43,7 @@ export default function TokenUsageWidget() {
4343

4444
const fullQuery = useCombinedQuery(getAIGenerationsFilter());
4545

46-
const tokensRequest = useEAPSpans(
46+
const tokensRequest = useSpans(
4747
{
4848
fields: [AI_MODEL_ID_ATTRIBUTE, AI_TOKEN_USAGE_ATTRIBUTE_SUM],
4949
sorts: [{field: AI_TOKEN_USAGE_ATTRIBUTE_SUM, kind: 'desc'}],

static/app/views/insights/agentMonitoring/components/toolUsageWidget.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {
1818
} from 'sentry/views/insights/agentMonitoring/utils/query';
1919
import {Referrer} from 'sentry/views/insights/agentMonitoring/utils/referrers';
2020
import {ChartType} from 'sentry/views/insights/common/components/chart';
21-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
21+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
2222
import {useTopNSpanEAPSeries} from 'sentry/views/insights/common/queries/useTopNDiscoverSeries';
2323
import {convertSeriesToTimeseries} from 'sentry/views/insights/common/utils/convertSeriesToTimeseries';
2424
import {usePageFilterChartParams} from 'sentry/views/insights/pages/platform/laravel/utils';
@@ -42,7 +42,7 @@ export default function ToolUsageWidget() {
4242

4343
const fullQuery = useCombinedQuery(getAIToolCallsFilter());
4444

45-
const toolsRequest = useEAPSpans(
45+
const toolsRequest = useSpans(
4646
{
4747
fields: [AI_TOOL_NAME_ATTRIBUTE, 'count()'],
4848
sorts: [{field: 'count()', kind: 'desc'}],

static/app/views/insights/agentMonitoring/components/toolsTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ import {
3232
} from 'sentry/views/insights/agentMonitoring/utils/query';
3333
import {Referrer} from 'sentry/views/insights/agentMonitoring/utils/referrers';
3434
import {ChartType} from 'sentry/views/insights/common/components/chart';
35-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
35+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
3636
import {DurationCell} from 'sentry/views/insights/pages/platform/shared/table/DurationCell';
3737
// import {ErrorRateCell} from 'sentry/views/insights/pages/platform/shared/table/ErrorRateCell';
3838
import {NumberCell} from 'sentry/views/insights/pages/platform/shared/table/NumberCell';
@@ -86,7 +86,7 @@ export function ToolsTable() {
8686

8787
const {sortField, sortOrder} = useTableSortParams();
8888

89-
const toolsRequest = useEAPSpans(
89+
const toolsRequest = useSpans(
9090
{
9191
fields: [
9292
AI_TOOL_NAME_ATTRIBUTE,

static/app/views/insights/agentMonitoring/components/tracesTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
OverflowEllipsisTextContainer,
3535
TextAlignRight,
3636
} from 'sentry/views/insights/common/components/textAlign';
37-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
37+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
3838
import {DurationCell} from 'sentry/views/insights/pages/platform/shared/table/DurationCell';
3939
import {NumberCell} from 'sentry/views/insights/pages/platform/shared/table/NumberCell';
4040

@@ -96,7 +96,7 @@ export function TracesTable() {
9696

9797
const pageLinks = tracesRequest.getResponseHeader?.('Link') ?? undefined;
9898

99-
const spansRequest = useEAPSpans(
99+
const spansRequest = useSpans(
100100
{
101101
// Exclude agent runs as they include aggregated data which would lead to double counting e.g. token usage
102102
search: `${getAgentRunsFilter({negated: true})} trace:[${tracesRequest.data?.data.map(span => span.trace).join(',')}]`,

static/app/views/insights/agentMonitoring/views/onboarding.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import useOrganization from 'sentry/utils/useOrganization';
4242
import usePageFilters from 'sentry/utils/usePageFilters';
4343
import useProjects from 'sentry/utils/useProjects';
4444
import {Referrer} from 'sentry/views/insights/agentMonitoring/utils/referrers';
45-
import {useEAPSpans} from 'sentry/views/insights/common/queries/useDiscover';
45+
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
4646

4747
function useOnboardingProject() {
4848
const {projects} = useProjects();
@@ -65,7 +65,7 @@ function useAiSpanWaiter(project: Project) {
6565
const {selection} = usePageFilters();
6666
const [refetchKey, setRefetchKey] = useState(0);
6767

68-
const request = useEAPSpans(
68+
const request = useSpans(
6969
{
7070
search: 'span.op:"gen_ai.*"',
7171
fields: ['id'],

0 commit comments

Comments
 (0)