Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(insights): explore link from http module #82036

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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 @@ -46,6 +46,7 @@ import {
import {useSampleScatterPlotSeries} from 'sentry/views/insights/common/views/spanSummaryPage/sampleList/durationChart/useSampleScatterPlotSeries';
import {DurationChart} from 'sentry/views/insights/http/components/charts/durationChart';
import {ResponseCodeCountChart} from 'sentry/views/insights/http/components/charts/responseCodeCountChart';
import {OpenInExploreButton} from 'sentry/views/insights/http/components/openInDiscoverButton';
import {SpanSamplesTable} from 'sentry/views/insights/http/components/tables/spanSamplesTable';
import {HTTP_RESPONSE_STATUS_CODES} from 'sentry/views/insights/http/data/definitions';
import {useSpanSamples} from 'sentry/views/insights/http/queries/useSpanSamples';
Expand Down Expand Up @@ -518,6 +519,7 @@ export function HTTPSamplesPanel() {
>
{t('Try Different Samples')}
</Button>
<OpenInExploreButton query={search} />
</ModuleLayout.Full>
</Fragment>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as qs from 'query-string';

import {LinkButton} from 'sentry/components/button';
import {t} from 'sentry/locale';
import type {MutableSearch} from 'sentry/utils/tokenizeSearch';
import normalizeUrl from 'sentry/utils/url/normalizeUrl';
import useOrganization from 'sentry/utils/useOrganization';
import type {EAPSpanProperty} from 'sentry/views/insights/types';

export function OpenInExploreButton({query}: {query: MutableSearch}) {
const organization = useOrganization();

const queryObj = {
query: query.formatString(),
groupBy: 'span.description' satisfies EAPSpanProperty,
visualize: {
chartType: 1,
yAxes: ['avg(span.duration)', 'count(span.duration)'] satisfies EAPSpanProperty[],
},
mode: 'aggregate',
};
const url = normalizeUrl(
`/organizations/${organization.slug}/traces/?${qs.stringify(queryObj)}`
);

return <LinkButton to={url}>{t('Go to Explore')}</LinkButton>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import {ResponseRateChart} from 'sentry/views/insights/http/components/charts/re
import {ThroughputChart} from 'sentry/views/insights/http/components/charts/throughputChart';
import {DomainStatusLink} from 'sentry/views/insights/http/components/domainStatusLink';
import {HTTPSamplesPanel} from 'sentry/views/insights/http/components/httpSamplesPanel';
import {OpenInExploreButton} from 'sentry/views/insights/http/components/openInDiscoverButton';
import {
DomainTransactionsTable,
isAValidSort,
Expand Down Expand Up @@ -196,6 +197,7 @@ export function HTTPDomainSummaryPage() {
},
],
module: ModuleName.HTTP,
headerActions: <OpenInExploreButton query={MutableSearch.fromQueryObject(filters)} />,
};

return (
Expand Down
4 changes: 4 additions & 0 deletions static/app/views/insights/http/views/httpLandingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import SubregionSelector from 'sentry/views/insights/common/views/spans/selector
import {DurationChart} from 'sentry/views/insights/http/components/charts/durationChart';
import {ResponseRateChart} from 'sentry/views/insights/http/components/charts/responseRateChart';
import {ThroughputChart} from 'sentry/views/insights/http/components/charts/throughputChart';
import {OpenInExploreButton} from 'sentry/views/insights/http/components/openInDiscoverButton';
import {
DomainsTable,
isAValidSort,
Expand Down Expand Up @@ -172,6 +173,9 @@ export function HTTPLandingPage() {
const headerProps = {
headerTitle,
module: ModuleName.HTTP,
headerActions: (
<OpenInExploreButton query={MutableSearch.fromQueryObject(tableFilters)} />
),
};

return (
Expand Down
2 changes: 1 addition & 1 deletion static/app/views/insights/types.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export type SpanIndexedQueryFilters = {

export type SpanStringArrayFields = 'span.domain';

export const COUNTER_AGGREGATES = ['sum', 'avg', 'min', 'max', 'p100'] as const;
export const COUNTER_AGGREGATES = ['sum', 'avg', 'min', 'max', 'p100', 'count'] as const;
export const DISTRIBUTION_AGGREGATES = ['p50', 'p75', 'p95', 'p99'] as const;

export const AGGREGATES = [...COUNTER_AGGREGATES, ...DISTRIBUTION_AGGREGATES] as const;
Expand Down
Loading