Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import useProjects from 'sentry/utils/useProjects';
import type {TraceResult} from 'sentry/views/explore/hooks/useTraces';
import {BREAKDOWN_SLICES} from 'sentry/views/explore/hooks/useTraces';
import type {SpanResult} from 'sentry/views/explore/hooks/useTraceSpans';
import type {EAPSpanResponse, SpanFields} from 'sentry/views/insights/types';
import type {SpanFields, SpanResponse} from 'sentry/views/insights/types';
import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHeader/breadcrumbs';
import {getTraceDetailsUrl} from 'sentry/views/performance/traceDetails/utils';

Expand Down Expand Up @@ -482,7 +482,7 @@ export function SpanTimeRenderer({
);
}

type SpanStatus = EAPSpanResponse[SpanFields.SPAN_STATUS];
type SpanStatus = SpanResponse[SpanFields.SPAN_STATUS];

const STATUS_TO_TAG_TYPE: Record<SpanStatus, keyof Theme['tag']> = {
ok: 'success',
Expand Down
6 changes: 3 additions & 3 deletions static/app/views/insights/agentMonitoring/utils/query.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// These are the span op we are currently ingesting.

import {type EAPSpanProperty, SpanFields} from 'sentry/views/insights/types';
import {SpanFields, type SpanProperty} from 'sentry/views/insights/types';

// AI Runs - equivalent to OTEL Invoke Agent span
// https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-agent-spans.md#invoke-agent-span
Expand Down Expand Up @@ -53,9 +53,9 @@ export const AI_TOKEN_USAGE_ATTRIBUTE_SUM = `sum(${SpanFields.GEN_AI_USAGE_TOTAL
export const AI_INPUT_TOKENS_ATTRIBUTE_SUM = `sum(${SpanFields.GEN_AI_USAGE_INPUT_TOKENS})`;
export const AI_OUTPUT_TOKENS_ATTRIBUTE_SUM = `sum(${SpanFields.GEN_AI_USAGE_OUTPUT_TOKENS})`;
export const AI_OUTPUT_TOKENS_REASONING_ATTRIBUTE_SUM =
`sum(tags[${SpanFields.GEN_AI_USAGE_OUTPUT_TOKENS_REASONING}, number])` as EAPSpanProperty;
`sum(tags[${SpanFields.GEN_AI_USAGE_OUTPUT_TOKENS_REASONING}, number])` as SpanProperty;
export const AI_INPUT_TOKENS_CACHED_ATTRIBUTE_SUM =
`sum(tags[${SpanFields.GEN_AI_USAGE_INPUT_TOKENS_CACHED}, number])` as EAPSpanProperty;
`sum(tags[${SpanFields.GEN_AI_USAGE_INPUT_TOKENS_CACHED}, number])` as SpanProperty;
export const AI_COST_ATTRIBUTE_SUM = `sum(${SpanFields.GEN_AI_USAGE_TOTAL_COST})`;

export const legacyAttributeKeys = new Map<string, string[]>([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import ResourceSize from 'sentry/views/insights/browser/resources/components/res
import {useResourceModuleFilters} from 'sentry/views/insights/browser/resources/utils/useResourceFilters';
import ChartPanel from 'sentry/views/insights/common/components/chartPanel';
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
import type {EAPSpanResponse} from 'sentry/views/insights/types';
import type {SpanResponse} from 'sentry/views/insights/types';
import {SpanFields} from 'sentry/views/insights/types';
import {usePerformanceGeneralProjectSettings} from 'sentry/views/performance/utils';

Expand Down Expand Up @@ -97,7 +97,7 @@ function SampleImages({groupId, projectId}: Props) {
}

type ImageSpan = Pick<
EAPSpanResponse,
SpanResponse,
| 'span.group'
| 'raw_domain'
| 'span.description'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
DataTitles,
getThroughputTitle,
} from 'sentry/views/insights/common/views/spans/types';
import {type EAPSpanResponse, ModuleName, SpanFields} from 'sentry/views/insights/types';
import {ModuleName, SpanFields, type SpanResponse} from 'sentry/views/insights/types';

const {
RESOURCE_RENDER_BLOCKING_STATUS,
Expand All @@ -41,7 +41,7 @@ const {
} = SpanFields;

type Row = Pick<
EAPSpanResponse,
SpanResponse,
| 'avg(http.response_content_length)'
| 'avg(span.self_time)'
| 'epm()'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
DataTitles,
getThroughputTitle,
} from 'sentry/views/insights/common/views/spans/types';
import type {EAPSpanResponse} from 'sentry/views/insights/types';
import type {SpanResponse} from 'sentry/views/insights/types';
import {ModuleName, SpanFields, SpanFunction} from 'sentry/views/insights/types';

const {
Expand All @@ -58,7 +58,7 @@ const RESOURCE_SIZE_ALERT = t(
);

type Row = Pick<
EAPSpanResponse,
SpanResponse,
| 'avg(http.response_content_length)'
| 'avg(span.self_time)'
| 'epm()'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import type {
ProjectScore,
WebVitals,
} from 'sentry/views/insights/browser/webVitals/types';
import type {EAPSpanResponse} from 'sentry/views/insights/types';
import type {SpanResponse} from 'sentry/views/insights/types';

type PerformanceScores = Pick<
EAPSpanResponse,
SpanResponse,
| 'performance_score(measurements.score.cls)'
| 'performance_score(measurements.score.fcp)'
| 'performance_score(measurements.score.inp)'
Expand All @@ -14,7 +14,7 @@ type PerformanceScores = Pick<
>;

type CountScores = Pick<
EAPSpanResponse,
SpanResponse,
| 'count_scores(measurements.score.cls)'
| 'count_scores(measurements.score.fcp)'
| 'count_scores(measurements.score.inp)'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import type {BrowserType} from 'sentry/views/insights/browser/webVitals/utils/qu
import {useWebVitalsSort} from 'sentry/views/insights/browser/webVitals/utils/useWebVitalsSort';
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
import {
type EAPSpanProperty,
SpanFields,
type SpanProperty,
type SubregionCode,
} from 'sentry/views/insights/types';

Expand Down Expand Up @@ -44,7 +44,7 @@ export const useTransactionWebVitalsScoresQuery = ({
const sort = useWebVitalsSort({sortName, defaultSort});

const totalOpportunityScoreField =
'opportunity_score(measurements.score.total)' satisfies EAPSpanProperty;
'opportunity_score(measurements.score.total)' satisfies SpanProperty;

if (sort !== undefined) {
if (sort.field === 'avg(measurements.score.total)') {
Expand Down
4 changes: 2 additions & 2 deletions static/app/views/insights/browser/webVitals/settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {t} from 'sentry/locale';
import type {EAPSpanProperty} from 'sentry/views/insights/types';
import type {SpanProperty} from 'sentry/views/insights/types';

export const MODULE_TITLE = t('Web Vitals');
export const BASE_URL = 'pageloads';
Expand All @@ -20,4 +20,4 @@ export const FIELD_ALIASES = {
'p75(measurements.inp)': 'INP',
'p75(measurements.cls)': 'CLS',
'p75(measurements.ttfb)': 'TTFB',
} satisfies Partial<Record<EAPSpanProperty, string>>;
} satisfies Partial<Record<SpanProperty, string>>;
7 changes: 2 additions & 5 deletions static/app/views/insights/cache/components/samplePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
getThroughputTitle,
} from 'sentry/views/insights/common/views/spans/types';
import {InsightsSpanTagProvider} from 'sentry/views/insights/pages/insightsSpanTagProvider';
import type {EAPSpanResponse, SpanQueryFilters} from 'sentry/views/insights/types';
import type {SpanQueryFilters, SpanResponse} from 'sentry/views/insights/types';
import {ModuleName, SpanFields, SpanFunction} from 'sentry/views/insights/types';

// This is similar to http sample table, its difficult to use the generic span samples sidebar as we require a bunch of custom things.
Expand Down Expand Up @@ -115,10 +115,7 @@ export function CacheSamplePanel() {
['project.id']: query.project,
};

const useIndexedCacheSpans = (
isCacheHit: EAPSpanResponse['cache.hit'],
limit: number
) =>
const useIndexedCacheSpans = (isCacheHit: SpanResponse['cache.hit'], limit: number) =>
useSpans(
{
search: MutableSearch.fromQueryObject({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import useOrganization from 'sentry/utils/useOrganization';
import {CacheHitMissCell} from 'sentry/views/insights/cache/components/tables/cacheHitMissCell';
import {renderHeadCell} from 'sentry/views/insights/common/components/tableCells/renderHeadCell';
import {SpanIdCell} from 'sentry/views/insights/common/components/tableCells/spanIdCell';
import type {EAPSpanResponse} from 'sentry/views/insights/types';
import type {SpanResponse} from 'sentry/views/insights/types';
import {ModuleName, SpanFields} from 'sentry/views/insights/types';
import {TraceViewSources} from 'sentry/views/performance/newTraceDetails/traceHeader/breadcrumbs';

Expand All @@ -36,7 +36,7 @@ type ColumnKeys =
| SpanFields.CACHE_ITEM_SIZE
| 'transaction.duration';

type DataRow = Pick<EAPSpanResponse, DataRowKeys> & {
type DataRow = Pick<SpanResponse, DataRowKeys> & {
'cache.hit': '' | 'true' | 'false';
'transaction.duration': number; // TODO: this should be a boolean
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ import {renderHeadCell} from 'sentry/views/insights/common/components/tableCells
import {QueryParameterNames} from 'sentry/views/insights/common/views/queryParameters';
import {DataTitles} from 'sentry/views/insights/common/views/spans/types';
import {
type EAPSpanResponse,
ModuleName,
SpanFields,
SpanFunction,
type SpanResponse,
} from 'sentry/views/insights/types';

const {CACHE_MISS_RATE, EPM} = SpanFunction;
const {CACHE_ITEM_SIZE} = SpanFields;

type Row = Pick<
EAPSpanResponse,
SpanResponse,
| 'project'
| 'project.id'
| 'transaction'
Expand All @@ -41,7 +41,7 @@ type Row = Pick<
| 'sum(span.self_time)'
| 'avg(cache.item_size)'
> &
Pick<EAPSpanResponse, 'avg(span.duration)'>;
Pick<SpanResponse, 'avg(span.duration)'>;

type Column = GridColumnHeader<
| 'transaction'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import {
isValidJson,
prettyPrintJsonString,
} from 'sentry/views/insights/database/utils/jsonUtils';
import type {EAPSpanResponse} from 'sentry/views/insights/types';
import type {SpanResponse} from 'sentry/views/insights/types';
import {SpanFields} from 'sentry/views/insights/types';

interface Props {
groupId: EAPSpanResponse[SpanFields.SPAN_GROUP];
op: EAPSpanResponse[SpanFields.SPAN_OP];
groupId: SpanResponse[SpanFields.SPAN_GROUP];
op: SpanResponse[SpanFields.SPAN_OP];
preliminaryDescription?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {useQueryClient} from 'sentry/utils/queryClient';
import type {Flatten} from 'sentry/utils/types/flatten';
import useProjects from 'sentry/utils/useProjects';
import {useStarredSegment} from 'sentry/views/insights/common/utils/useStarredSegment';
import type {EAPSpanResponse} from 'sentry/views/insights/types';
import type {SpanResponse} from 'sentry/views/insights/types';

interface Props {
isStarred: boolean;
Expand All @@ -16,8 +16,7 @@ interface Props {
}

type TableRow = Flatten<
Partial<EAPSpanResponse> &
Pick<EAPSpanResponse, 'is_starred_transaction' | 'transaction'>
Partial<SpanResponse> & Pick<SpanResponse, 'is_starred_transaction' | 'transaction'>
>;

type TableResponse = [{confidence: any; data: TableRow[]; meta: EventsMetaType}];
Expand Down
10 changes: 5 additions & 5 deletions static/app/views/insights/common/queries/useDiscover.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {useLocation} from 'sentry/utils/useLocation';
import usePageFilters from 'sentry/utils/usePageFilters';
import {SAMPLING_MODE} from 'sentry/views/explore/hooks/useProgressiveQuery';
import {useSpans} from 'sentry/views/insights/common/queries/useDiscover';
import type {EAPSpanProperty} from 'sentry/views/insights/types';
import type {SpanProperty} from 'sentry/views/insights/types';
import {SpanFields} from 'sentry/views/insights/types';
import {OrganizationContext} from 'sentry/views/organizationContext';

Expand Down Expand Up @@ -51,7 +51,7 @@ describe('useDiscover', () => {
{
wrapper: Wrapper,
initialProps: {
fields: ['epm()'] as EAPSpanProperty[],
fields: ['epm()'] as SpanProperty[],
enabled: false,
},
}
Expand Down Expand Up @@ -97,7 +97,7 @@ describe('useDiscover', () => {
release: '0.0.1',
environment: undefined,
},
fields: ['epm()'] as EAPSpanProperty[],
fields: ['epm()'] as SpanProperty[],
sorts: [{field: 'epm()', kind: 'desc' as const}],
limit: 10,
referrer: 'api-spec',
Expand Down Expand Up @@ -178,7 +178,7 @@ describe('useDiscover', () => {
{
wrapper: Wrapper,
initialProps: {
fields: [SpanFields.SPAN_DESCRIPTION] as EAPSpanProperty[],
fields: [SpanFields.SPAN_DESCRIPTION] as SpanProperty[],
enabled: false,
},
}
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('useDiscover', () => {
SpanFields.SPAN_OP,
SpanFields.SPAN_GROUP,
SpanFields.SPAN_DESCRIPTION,
] as EAPSpanProperty[],
] as SpanProperty[],
sorts: [{field: 'span.group', kind: 'desc' as const}],
limit: 10,
referrer: 'api-spec',
Expand Down
11 changes: 4 additions & 7 deletions static/app/views/insights/common/queries/useDiscover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {MutableSearch} from 'sentry/utils/tokenizeSearch';
import usePageFilters from 'sentry/utils/usePageFilters';
import type {SamplingMode} from 'sentry/views/explore/hooks/useProgressiveQuery';
import {useWrappedDiscoverQuery} from 'sentry/views/insights/common/queries/useSpansQuery';
import type {EAPSpanProperty, EAPSpanResponse} from 'sentry/views/insights/types';
import type {SpanProperty, SpanResponse} from 'sentry/views/insights/types';

interface UseDiscoverQueryOptions {
additonalQueryKey?: string[];
Expand Down Expand Up @@ -34,11 +34,11 @@ interface UseDiscoverOptions<Fields> {
// The default sampling mode for eap queries
export const DEFAULT_SAMPLING_MODE: SamplingMode = 'NORMAL';

export const useSpans = <Fields extends EAPSpanProperty[]>(
export const useSpans = <Fields extends SpanProperty[]>(
options: UseDiscoverOptions<Fields> = {},
referrer: string
) => {
return useDiscover<Fields, EAPSpanResponse>(
return useDiscover<Fields, SpanResponse>(
options,
DiscoverDatasets.SPANS_EAP_RPC,
referrer
Expand All @@ -64,9 +64,6 @@ const useDiscover = <T extends Array<Extract<keyof ResponseType, string>>, Respo
useQueryOptions,
} = options;

// TODO: remove this check with eap
const shouldSetSamplingMode = dataset === DiscoverDatasets.SPANS_EAP_RPC;

const pageFilters = usePageFilters();

const eventView = getEventView(
Expand All @@ -87,7 +84,7 @@ const useDiscover = <T extends Array<Extract<keyof ResponseType, string>>, Respo
referrer,
cursor,
noPagination,
samplingMode: shouldSetSamplingMode ? samplingMode : undefined,
samplingMode,
additionalQueryKey: useQueryOptions?.additonalQueryKey,
keepPreviousData: options.keepPreviousData,
});
Expand Down
Loading
Loading