hash
stringlengths 40
40
| date
stringdate 2017-08-30 22:37:25
2025-03-22 03:08:47
| author
stringclasses 173
values | commit_message
stringlengths 15
151
| is_merge
bool 1
class | masked_commit_message
stringlengths 6
126
| type
stringclasses 17
values | git_diff
stringlengths 182
1.51M
⌀ |
|---|---|---|---|---|---|---|---|
d38b99b29ca1b18e56096e1451b4f3a5366722ad
|
2024-01-02 23:51:30
|
Evan Purkhiser
|
ref(ts): Fix types for updateMonitor (#62060)
| false
|
Fix types for updateMonitor (#62060)
|
ref
|
diff --git a/static/app/actionCreators/monitors.tsx b/static/app/actionCreators/monitors.tsx
index a265408017cd70..ca1af442e9e1e3 100644
--- a/static/app/actionCreators/monitors.tsx
+++ b/static/app/actionCreators/monitors.tsx
@@ -49,7 +49,7 @@ export async function updateMonitor(
orgId: string,
monitorSlug: string,
data: Partial<Monitor>
-) {
+): Promise<Monitor | null> {
addLoadingMessage();
try {
diff --git a/static/app/views/monitors/components/monitorHeaderActions.tsx b/static/app/views/monitors/components/monitorHeaderActions.tsx
index 2cada74b87ca2a..0f9001f55133a0 100644
--- a/static/app/views/monitors/components/monitorHeaderActions.tsx
+++ b/static/app/views/monitors/components/monitorHeaderActions.tsx
@@ -44,7 +44,10 @@ function MonitorHeaderActions({monitor, orgId, onUpdate}: Props) {
const handleUpdate = async (data: Partial<Monitor>) => {
const resp = await updateMonitor(api, orgId, monitor.slug, data);
- onUpdate?.(resp);
+
+ if (resp !== null) {
+ onUpdate?.(resp);
+ }
};
const toggleMute = () => handleUpdate({isMuted: !monitor.isMuted});
diff --git a/static/app/views/monitors/details.tsx b/static/app/views/monitors/details.tsx
index 437e3f1f69a2bb..ee895a0090ab77 100644
--- a/static/app/views/monitors/details.tsx
+++ b/static/app/views/monitors/details.tsx
@@ -81,7 +81,10 @@ function MonitorDetails({params, location}: Props) {
return;
}
const resp = await updateMonitor(api, organization.slug, monitor.slug, data);
- onUpdate(resp);
+
+ if (resp !== null) {
+ onUpdate(resp);
+ }
};
if (!monitor) {
|
403fb32c74272a77e684179889d01f679894219d
|
2024-06-06 23:21:51
|
Tony Xiao
|
fix(trace-explorer): Do not adjust slice when it overflows (#72229)
| false
|
Do not adjust slice when it overflows (#72229)
|
fix
|
diff --git a/src/sentry/api/endpoints/organization_traces.py b/src/sentry/api/endpoints/organization_traces.py
index f6a07b7a6f2b1d..a201dff2c009b0 100644
--- a/src/sentry/api/endpoints/organization_traces.py
+++ b/src/sentry/api/endpoints/organization_traces.py
@@ -1064,7 +1064,7 @@ def convert_to_slice(timestamp, trace_range, left_bound=None) -> int:
idx = round((timestamp - trace_start) * slices / trace_duration)
- if left_bound is not None and left_bound >= idx:
+ if idx < slices and left_bound is not None and left_bound >= idx:
idx = left_bound + 1
return idx
@@ -1091,6 +1091,7 @@ def quantize_range(span_start, span_end, trace_range):
with sentry_sdk.push_scope() as scope:
scope.set_extra("slice start", {"raw": raw_start_index, "clipped": start_index})
sentry_sdk.capture_message("Slice start was adjusted", level="warning")
+
if raw_end_index != end_index:
with sentry_sdk.push_scope() as scope:
scope.set_extra("slice end", {"raw": raw_end_index, "clipped": end_index})
@@ -1247,7 +1248,7 @@ def stack_clear(trace, until=None):
trace_start = trace_range["start"]
trace_end = trace_range["end"]
- # convert_to_slice the intervals os that it is within range of the trace
+ # clip the intervals os that it is within range of the trace
precise_start = clip(precise_start, trace_start, trace_end)
precise_end = clip(precise_end, trace_start, trace_end)
|
e07e4bed0b61ce2e5553c13ce43f4c627478da28
|
2020-03-25 01:00:08
|
Anton Ovchinnikov
|
fix(symbolicator): Reduce hard timeout to 10 minutes (#17883)
| false
|
Reduce hard timeout to 10 minutes (#17883)
|
fix
|
diff --git a/src/sentry/conf/server.py b/src/sentry/conf/server.py
index 82a5430c4bf891..4feea5d75c7d15 100644
--- a/src/sentry/conf/server.py
+++ b/src/sentry/conf/server.py
@@ -1774,7 +1774,7 @@ def get_sentry_sdk_config():
# Log error and abort processing (without dropping event) when process_event is
# taking more than n seconds to process event
-SYMBOLICATOR_PROCESS_EVENT_HARD_TIMEOUT = 1800
+SYMBOLICATOR_PROCESS_EVENT_HARD_TIMEOUT = 600
# Log warning when process_event is taking more than n seconds to process event
SYMBOLICATOR_PROCESS_EVENT_WARN_TIMEOUT = 120
|
37a0208e11d4e106346f04accbbe05605684c75b
|
2021-07-27 22:14:41
|
Scott Cooper
|
fix(workflow): Manually end overview navigation transactions (#27767)
| false
|
Manually end overview navigation transactions (#27767)
|
fix
|
diff --git a/static/app/views/issueList/overview.tsx b/static/app/views/issueList/overview.tsx
index 9c69f58b390b2b..be45f156bd42a6 100644
--- a/static/app/views/issueList/overview.tsx
+++ b/static/app/views/issueList/overview.tsx
@@ -2,6 +2,7 @@ import * as React from 'react';
import {browserHistory, RouteComponentProps} from 'react-router';
import styled from '@emotion/styled';
import {withProfiler} from '@sentry/react';
+import * as Sentry from '@sentry/react';
import {Location} from 'history';
import Cookies from 'js-cookie';
import isEqual from 'lodash/isEqual';
@@ -463,6 +464,13 @@ class IssueListOverview extends React.Component<Props, State> {
},
complete: () => {
this._lastStatsRequest = null;
+
+ // End navigation transaction to prevent additional page requests from impacting page metrics.
+ // Other transactions include stacktrace preview request
+ const currentTransaction = Sentry.getCurrentHub().getScope()?.getTransaction();
+ if (currentTransaction?.op === 'navigation') {
+ currentTransaction.finish();
+ }
},
});
};
|
1e5c087f43a5aa183ecc49fc73ab3bdb68d0660a
|
2020-09-23 02:30:59
|
Scott Cooper
|
chore: Cleanup experiment variable (#20925)
| false
|
Cleanup experiment variable (#20925)
|
chore
|
diff --git a/tests/js/spec/views/projectInstall/createProject.spec.jsx b/tests/js/spec/views/projectInstall/createProject.spec.jsx
index 67390e45327496..c02b9b9701762b 100644
--- a/tests/js/spec/views/projectInstall/createProject.spec.jsx
+++ b/tests/js/spec/views/projectInstall/createProject.spec.jsx
@@ -154,7 +154,6 @@ describe('CreateProject', function() {
beforeEach(() => {
props = {
...baseProps,
- experimentAssignment: '2OptionsV1',
};
props.organization.teams = [{slug: 'test', id: '1', name: 'test', hasAccess: true}];
MockApiClient.addMockResponse({
|
7d707c1b452619d252039deb74386f0340bf703c
|
2024-11-02 05:00:00
|
Michelle Zhang
|
fix(flags): hide feature flag series legend if not under ff (#80165)
| false
|
hide feature flag series legend if not under ff (#80165)
|
fix
|
diff --git a/static/app/views/issueDetails/streamline/eventGraph.tsx b/static/app/views/issueDetails/streamline/eventGraph.tsx
index ed504d9099d70c..adf80130439bf6 100644
--- a/static/app/views/issueDetails/streamline/eventGraph.tsx
+++ b/static/app/views/issueDetails/streamline/eventGraph.tsx
@@ -70,6 +70,7 @@ export function EventGraph({group, event, ...styleProps}: EventGraphProps) {
EventGraphSeries.EVENT
);
const eventView = useIssueDetailsEventView({group});
+ const hasFeatureFlagFeature = organization.features.includes('feature-flag-ui');
const {
data: groupStats = {},
@@ -168,20 +169,28 @@ export function EventGraph({group, event, ...styleProps}: EventGraphProps) {
seriesData.push(releaseSeries as BarChartSeries);
}
- if (flagSeries.markLine) {
+ if (flagSeries.markLine && hasFeatureFlagFeature) {
seriesData.push(flagSeries as BarChartSeries);
}
return seriesData;
- }, [visibleSeries, userSeries, eventSeries, releaseSeries, flagSeries, theme]);
+ }, [
+ visibleSeries,
+ userSeries,
+ eventSeries,
+ releaseSeries,
+ flagSeries,
+ theme,
+ hasFeatureFlagFeature,
+ ]);
const bucketSize = eventSeries ? getBucketSize(series) : undefined;
const [legendSelected, setLegendSelected] = useLocalStorageState(
'issue-details-graph-legend',
{
- ['Releases']: true,
['Feature Flags']: true,
+ ['Releases']: true,
}
);
@@ -192,7 +201,7 @@ export function EventGraph({group, event, ...styleProps}: EventGraphProps) {
show: true,
top: 4,
right: 8,
- data: ['Releases', 'Feature Flags'],
+ data: hasFeatureFlagFeature ? ['Feature Flags', 'Releases'] : ['Releases'],
selected: legendSelected,
zlevel: 10,
});
|
0af1dece47f48807b6b3e610c09c362b01a61cae
|
2024-06-26 12:44:18
|
ArthurKnaus
|
feat(metrics-extraction): Hide custom metrics table (#73349)
| false
|
Hide custom metrics table (#73349)
|
feat
|
diff --git a/static/app/views/settings/projectMetrics/customMetricsTable.tsx b/static/app/views/settings/projectMetrics/customMetricsTable.tsx
index 19fd3b4706c690..e500c334567a38 100644
--- a/static/app/views/settings/projectMetrics/customMetricsTable.tsx
+++ b/static/app/views/settings/projectMetrics/customMetricsTable.tsx
@@ -14,12 +14,14 @@ import {space} from 'sentry/styles/space';
import type {MetricMeta} from 'sentry/types/metrics';
import type {Project} from 'sentry/types/project';
import {DEFAULT_METRICS_CARDINALITY_LIMIT} from 'sentry/utils/metrics/constants';
+import {hasCustomMetricsExtractionRules} from 'sentry/utils/metrics/features';
import {getReadableMetricType} from 'sentry/utils/metrics/formatters';
import {formatMRI} from 'sentry/utils/metrics/mri';
import {useBlockMetric} from 'sentry/utils/metrics/useBlockMetric';
import {useMetricsCardinality} from 'sentry/utils/metrics/useMetricsCardinality';
import {useMetricsMeta} from 'sentry/utils/metrics/useMetricsMeta';
import {middleEllipsis} from 'sentry/utils/string/middleEllipsis';
+import useOrganization from 'sentry/utils/useOrganization';
import {useAccess} from 'sentry/views/settings/projectMetrics/access';
import {BlockButton} from 'sentry/views/settings/projectMetrics/blockButton';
import {useSearchQueryParam} from 'sentry/views/settings/projectMetrics/utils/useSearchQueryParam';
@@ -36,6 +38,7 @@ enum BlockingStatusTab {
type MetricWithCardinality = MetricMeta & {cardinality: number};
export function CustomMetricsTable({project}: Props) {
+ const organiztion = useOrganization();
const [selectedTab, setSelectedTab] = useState(BlockingStatusTab.ACTIVE);
const [query, setQuery] = useSearchQueryParam('metricsQuery');
@@ -80,6 +83,12 @@ export function CustomMetricsTable({project}: Props) {
unit.includes(query)
);
+ // If we have custom metrics extraction rules,
+ // we only show the custom metrics table if the project has custom metrics
+ if (hasCustomMetricsExtractionRules(organiztion) && metricsMeta.data.length === 0) {
+ return null;
+ }
+
return (
<Fragment>
<SearchWrapper>
diff --git a/static/app/views/settings/projectMetrics/projectMetrics.tsx b/static/app/views/settings/projectMetrics/projectMetrics.tsx
index fcae0756b704f4..7b0d6081a4b3ba 100644
--- a/static/app/views/settings/projectMetrics/projectMetrics.tsx
+++ b/static/app/views/settings/projectMetrics/projectMetrics.tsx
@@ -65,9 +65,11 @@ function ProjectMetrics({project}: Props) {
<PermissionAlert project={project} />
- {hasExtractionRules && <MetricsExtractionRulesTable project={project} />}
+ {hasExtractionRules ? <MetricsExtractionRulesTable project={project} /> : null}
- <CustomMetricsTable project={project} />
+ {!hasExtractionRules || project.hasCustomMetrics ? (
+ <CustomMetricsTable project={project} />
+ ) : null}
</Fragment>
);
}
|
48b0a0c5aa0581ae9a81b7ee40119162ce3e15fd
|
2023-02-07 22:02:38
|
Tony Xiao
|
feat(profiling): Add flamechart preview for missing transaction instr… (#44183)
| false
|
Add flamechart preview for missing transaction instr… (#44183)
|
feat
|
diff --git a/static/app/components/events/interfaces/spans/gapSpanDetails.tsx b/static/app/components/events/interfaces/spans/gapSpanDetails.tsx
new file mode 100644
index 00000000000000..ac0e64c307bda6
--- /dev/null
+++ b/static/app/components/events/interfaces/spans/gapSpanDetails.tsx
@@ -0,0 +1,112 @@
+import styled from '@emotion/styled';
+
+import {Button} from 'sentry/components/button';
+import ExternalLink from 'sentry/components/links/externalLink';
+import {FlamegraphPreview} from 'sentry/components/profiling/flamegraph/flamegraphPreview';
+import {IconProfiling} from 'sentry/icons';
+import {t, tct} from 'sentry/locale';
+import {EventTransaction} from 'sentry/types/event';
+import trackAdvancedAnalyticsEvent from 'sentry/utils/analytics/trackAdvancedAnalyticsEvent';
+import {generateProfileFlamechartRoute} from 'sentry/utils/profiling/routes';
+import useOrganization from 'sentry/utils/useOrganization';
+import {useProfiles} from 'sentry/views/profiling/profilesProvider';
+
+import InlineDocs from './inlineDocs';
+import {GapSpanType} from './types';
+
+interface GapSpanDetailsProps {
+ event: Readonly<EventTransaction>;
+ resetCellMeasureCache: () => void;
+ span: Readonly<GapSpanType>;
+}
+
+export function GapSpanDetails({
+ event,
+ resetCellMeasureCache,
+ span,
+}: GapSpanDetailsProps) {
+ const organization = useOrganization();
+ const profiles = useProfiles();
+
+ if (profiles?.type !== 'resolved') {
+ return (
+ <InlineDocs
+ orgSlug={organization.slug}
+ platform={event.sdk?.name || ''}
+ projectSlug={event?.projectSlug ?? ''}
+ resetCellMeasureCache={resetCellMeasureCache}
+ />
+ );
+ }
+
+ const profileId = event.contexts.profile?.profile_id || '';
+
+ // TODO: target the span's time window
+ const target = generateProfileFlamechartRoute({
+ orgSlug: organization.slug,
+ projectSlug: event?.projectSlug ?? '',
+ profileId,
+ });
+
+ function handleGoToProfile() {
+ trackAdvancedAnalyticsEvent('profiling_views.go_to_flamegraph', {
+ organization,
+ source: 'missing_instrumentation',
+ });
+ }
+
+ return (
+ <Container>
+ <InstructionsContainer>
+ <Heading>{t('Requires Manual Instrumentation')}</Heading>
+ <p>
+ {tct(
+ `To manually instrument certain regions of your code, view [docLink:our documentation].`,
+ {
+ docLink: (
+ <ExternalLink href="https://docs.sentry.io/product/performance/getting-started/" />
+ ),
+ }
+ )}
+ </p>
+ <Heading>{t('A Profile is available for this transaction!')}</Heading>
+ <p>
+ {t(
+ 'We have a profile that can give you some additional context on which functions were sampled during this span.'
+ )}
+ </p>
+ <Button
+ icon={<IconProfiling />}
+ size="sm"
+ onClick={handleGoToProfile}
+ to={target}
+ >
+ {t('Go to Profile')}
+ </Button>
+ </InstructionsContainer>
+ <FlamegraphContainer>
+ <FlamegraphPreview
+ relativeStartTimestamp={span.start_timestamp - event.startTimestamp}
+ relativeStopTimestamp={span.timestamp - event.startTimestamp}
+ />
+ </FlamegraphContainer>
+ </Container>
+ );
+}
+
+const Container = styled('div')`
+ display: flex;
+ flex-direction: row;
+`;
+
+const Heading = styled('h4')`
+ font-size: ${p => p.theme.fontSizeLarge};
+`;
+
+const InstructionsContainer = styled('div')`
+ width: 300px;
+`;
+
+const FlamegraphContainer = styled('div')`
+ flex: auto;
+`;
diff --git a/static/app/components/events/interfaces/spans/spanBar.tsx b/static/app/components/events/interfaces/spans/spanBar.tsx
index 974ec3eb5f3eb9..0fff16416dd62f 100644
--- a/static/app/components/events/interfaces/spans/spanBar.tsx
+++ b/static/app/components/events/interfaces/spans/spanBar.tsx
@@ -20,6 +20,7 @@ import {
DividerLineGhostContainer,
EmbeddedTransactionBadge,
ErrorBadge,
+ ProfileBadge,
} from 'sentry/components/performance/waterfall/rowDivider';
import {
RowTitle,
@@ -55,6 +56,7 @@ import {
import {QuickTraceEvent, TraceError} from 'sentry/utils/performance/quickTrace/types';
import {isTraceFull} from 'sentry/utils/performance/quickTrace/utils';
import {PerformanceInteraction} from 'sentry/utils/performanceForSentry';
+import {ProfileContext} from 'sentry/views/profiling/profilesProvider';
import {
MINIMAP_CONTAINER_HEIGHT,
@@ -914,6 +916,29 @@ export class SpanBar extends Component<SpanBarProps, SpanBarState> {
return null;
}
+ renderMissingInstrumentationProfileBadge(): React.ReactNode {
+ const {organization, span} = this.props;
+
+ if (!organization.features.includes('profiling-previews')) {
+ return null;
+ }
+
+ if (!isGapSpan(span)) {
+ return null;
+ }
+
+ return (
+ <ProfileContext.Consumer>
+ {profiles => {
+ if (profiles?.type !== 'resolved') {
+ return null;
+ }
+ return <ProfileBadge />;
+ }}
+ </ProfileContext.Consumer>
+ );
+ }
+
renderWarningText() {
let warningText = this.getBounds().warning;
@@ -977,6 +1002,7 @@ export class SpanBar extends Component<SpanBarProps, SpanBarState> {
{this.renderDivider(dividerHandlerChildrenProps)}
{this.renderErrorBadge(errors)}
{this.renderEmbeddedTransactionsBadge(transactions)}
+ {this.renderMissingInstrumentationProfileBadge()}
</DividerContainer>
<RowCell
data-type="span-row-cell"
diff --git a/static/app/components/events/interfaces/spans/spanDetail.tsx b/static/app/components/events/interfaces/spans/spanDetail.tsx
index 343555a69f1fc4..fb1294f93814b3 100644
--- a/static/app/components/events/interfaces/spans/spanDetail.tsx
+++ b/static/app/components/events/interfaces/spans/spanDetail.tsx
@@ -45,6 +45,7 @@ import {spanDetailsRouteWithQuery} from 'sentry/views/performance/transactionSum
import {transactionSummaryRouteWithQuery} from 'sentry/views/performance/transactionSummary/utils';
import * as SpanEntryContext from './context';
+import {GapSpanDetails} from './gapSpanDetails';
import InlineDocs from './inlineDocs';
import {ParsedTraceType, ProcessedSpanType, rawSpanKeys, RawSpanType} from './types';
import {
@@ -343,12 +344,20 @@ function SpanDetail(props: Props) {
if (isGapSpan(span)) {
return (
<SpanDetails>
- <InlineDocs
- orgSlug={organization.slug}
- platform={event.sdk?.name || ''}
- projectSlug={event?.projectSlug ?? ''}
- resetCellMeasureCache={resetCellMeasureCache}
- />
+ {organization.features.includes('profiling-previews') ? (
+ <GapSpanDetails
+ event={event}
+ span={span}
+ resetCellMeasureCache={resetCellMeasureCache}
+ />
+ ) : (
+ <InlineDocs
+ orgSlug={organization.slug}
+ platform={event.sdk?.name || ''}
+ projectSlug={event?.projectSlug ?? ''}
+ resetCellMeasureCache={resetCellMeasureCache}
+ />
+ )}
</SpanDetails>
);
}
diff --git a/static/app/components/performance/waterfall/rowDivider.tsx b/static/app/components/performance/waterfall/rowDivider.tsx
index b1476b703e2c21..85d478d7c62962 100644
--- a/static/app/components/performance/waterfall/rowDivider.tsx
+++ b/static/app/components/performance/waterfall/rowDivider.tsx
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';
-import {IconAdd, IconFire, IconSubtract} from 'sentry/icons';
+import {IconAdd, IconFire, IconProfiling, IconSubtract} from 'sentry/icons';
import space from 'sentry/styles/space';
import {Aliases, Color} from 'sentry/utils/theme';
@@ -49,14 +49,17 @@ export const DividerLineGhostContainer = styled('div')`
height: 100%;
`;
-const BadgeBorder = styled('div')<{borderColor: Color | keyof Aliases}>`
+const BadgeBorder = styled('div')<{
+ color: Color | keyof Aliases;
+ fillBackground?: boolean;
+}>`
position: absolute;
margin: ${space(0.25)};
left: -11px;
- background: ${p => p.theme.background};
+ background: ${p => (p.fillBackground ? p.theme[p.color] : p.theme.background)};
width: ${space(3)};
height: ${space(3)};
- border: 1px solid ${p => p.theme[p.borderColor]};
+ border: 1px solid ${p => p.theme[p.color]};
border-radius: 50%;
z-index: ${p => p.theme.zIndex.traceView.dividerLine};
display: flex;
@@ -66,7 +69,7 @@ const BadgeBorder = styled('div')<{borderColor: Color | keyof Aliases}>`
export function ErrorBadge() {
return (
- <BadgeBorder borderColor="error">
+ <BadgeBorder color="error">
<IconFire color="errorText" size="xs" />
</BadgeBorder>
);
@@ -82,7 +85,7 @@ export function EmbeddedTransactionBadge({
return (
<BadgeBorder
data-test-id="embedded-transaction-badge"
- borderColor="border"
+ color="border"
onClick={event => {
event.stopPropagation();
event.preventDefault();
@@ -97,3 +100,11 @@ export function EmbeddedTransactionBadge({
</BadgeBorder>
);
}
+
+export function ProfileBadge() {
+ return (
+ <BadgeBorder data-test-id="profile-badge" color="activeText" fillBackground>
+ <IconProfiling color="background" size="xs" />
+ </BadgeBorder>
+ );
+}
diff --git a/static/app/components/profiling/flamegraph/flamegraph.tsx b/static/app/components/profiling/flamegraph/flamegraph.tsx
index fd3c1c81e9afb6..7075cf030194c4 100644
--- a/static/app/components/profiling/flamegraph/flamegraph.tsx
+++ b/static/app/components/profiling/flamegraph/flamegraph.tsx
@@ -377,7 +377,7 @@ function Flamegraph(): ReactElement {
const newView = new CanvasView({
canvas: flamegraphCanvas,
model: uiFrames,
- mode: 'cover',
+ mode: 'stretchToFit',
options: {
inverted: flamegraph.inverted,
minWidth: uiFrames.minFrameDuration,
diff --git a/static/app/components/profiling/flamegraph/flamegraphPreview.spec.tsx b/static/app/components/profiling/flamegraph/flamegraphPreview.spec.tsx
new file mode 100644
index 00000000000000..cce02d84ce774b
--- /dev/null
+++ b/static/app/components/profiling/flamegraph/flamegraphPreview.spec.tsx
@@ -0,0 +1,207 @@
+import {computePreviewConfigView} from 'sentry/components/profiling/flamegraph/flamegraphPreview';
+import {Flamegraph} from 'sentry/utils/profiling/flamegraph';
+import {Rect} from 'sentry/utils/profiling/gl/utils';
+import {SampledProfile} from 'sentry/utils/profiling/profile/sampledProfile';
+import {createFrameIndex} from 'sentry/utils/profiling/profile/utils';
+
+describe('computePreviewConfigView', function () {
+ it('uses early exit with 0', function () {
+ const rawProfile: Profiling.SampledProfile = {
+ name: 'profile',
+ startValue: 0,
+ endValue: 1000,
+ unit: 'milliseconds',
+ threadID: 0,
+ type: 'sampled',
+ weights: [1, 1],
+ samples: [
+ [0, 1],
+ [0, 1],
+ ],
+ };
+
+ const profile = SampledProfile.FromProfile(
+ rawProfile,
+ createFrameIndex('mobile', [{name: 'f0'}, {name: 'f1'}]),
+ {type: 'flamechart'}
+ );
+
+ const flamegraph = new Flamegraph(profile, 1, {});
+
+ // the view should be taller than the flamegraph
+ const configView = new Rect(0, 0, 2, 3);
+
+ // go from timestamps 0 to 2
+ const previewConfigView = computePreviewConfigView(flamegraph, configView, 0, 2);
+
+ // y is 0 here because the config view is taller than the flamegraph
+ expect(previewConfigView).toEqual(new Rect(0, 0, 2, 3));
+ });
+
+ it('uses max depth', function () {
+ const rawProfile: Profiling.SampledProfile = {
+ name: 'profile',
+ startValue: 0,
+ endValue: 1000,
+ unit: 'milliseconds',
+ threadID: 0,
+ type: 'sampled',
+ weights: [1, 1],
+ samples: [
+ [0, 1, 0],
+ [1, 0, 1],
+ ],
+ };
+
+ const profile = SampledProfile.FromProfile(
+ rawProfile,
+ createFrameIndex('mobile', [{name: 'f0'}, {name: 'f1'}]),
+ {type: 'flamechart'}
+ );
+
+ const flamegraph = new Flamegraph(profile, 1, {});
+
+ // limit the view to 2 rows tall
+ const configView = new Rect(0, 0, 2, 2);
+
+ // go from timestamps 0 to 2
+ const previewConfigView = computePreviewConfigView(flamegraph, configView, 0, 2);
+
+ // y is 1 here because the config view has height 2 so it can only
+ // show 2 frames and we show the inner most frames
+ expect(previewConfigView).toEqual(new Rect(0, 1, 2, 2));
+ });
+
+ it('uses max depth in window', function () {
+ const rawProfile: Profiling.SampledProfile = {
+ name: 'profile',
+ startValue: 0,
+ endValue: 1000,
+ unit: 'milliseconds',
+ threadID: 0,
+ type: 'sampled',
+ weights: [1, 1, 1],
+ samples: [
+ [0, 1, 0, 1],
+ [1, 0, 1],
+ [0, 1, 0],
+ ],
+ };
+
+ const profile = SampledProfile.FromProfile(
+ rawProfile,
+ createFrameIndex('mobile', [{name: 'f0'}, {name: 'f1'}]),
+ {type: 'flamechart'}
+ );
+
+ const flamegraph = new Flamegraph(profile, 1, {});
+
+ // limit the view to 2 rows talls
+ const configView = new Rect(0, 0, 3, 2);
+
+ // go from timestamps 1 to 3 to exclude the first stack
+ const previewConfigView = computePreviewConfigView(flamegraph, configView, 1, 3);
+
+ // y is 1 here because the config view has height 2 so it can only
+ // show 2 frames and we show the inner most frames
+ expect(previewConfigView).toEqual(new Rect(1, 1, 2, 2));
+ });
+
+ it('uses 0 when view is taller than profile', function () {
+ const rawProfile: Profiling.SampledProfile = {
+ name: 'profile',
+ startValue: 0,
+ endValue: 1000,
+ unit: 'milliseconds',
+ threadID: 0,
+ type: 'sampled',
+ weights: [1, 1],
+ samples: [
+ [0, 1],
+ [1, 0],
+ ],
+ };
+
+ const profile = SampledProfile.FromProfile(
+ rawProfile,
+ createFrameIndex('mobile', [{name: 'f0'}, {name: 'f1'}]),
+ {type: 'flamechart'}
+ );
+
+ const flamegraph = new Flamegraph(profile, 1, {});
+
+ // make taller than profile's deepest stack
+ const configView = new Rect(0, 0, 2, 3);
+
+ const previewConfigView = computePreviewConfigView(flamegraph, configView, 0, 2);
+
+ // y is 0 here because the config view has height 3
+ // so the whole flamechart fits
+ expect(previewConfigView).toEqual(new Rect(0, 0, 2, 3));
+ });
+
+ it('uses parent frame depth', function () {
+ const rawProfile: Profiling.SampledProfile = {
+ name: 'profile',
+ startValue: 0,
+ endValue: 1000,
+ unit: 'milliseconds',
+ threadID: 0,
+ type: 'sampled',
+ weights: [2, 2],
+ samples: [
+ [0, 1, 0, 1],
+ [0, 1, 1, 1],
+ ],
+ };
+
+ const profile = SampledProfile.FromProfile(
+ rawProfile,
+ createFrameIndex('mobile', [{name: 'f0'}, {name: 'f1'}]),
+ {type: 'flamechart'}
+ );
+
+ const flamegraph = new Flamegraph(profile, 1, {});
+
+ const configView = new Rect(0, 0, 4, 2);
+
+ const previewConfigView = computePreviewConfigView(flamegraph, configView, 1, 3);
+
+ // y is 1 here because we found a frame `f1` that is wraps
+ // around the window at depth 1
+ expect(previewConfigView).toEqual(new Rect(1, 1, 2, 2));
+ });
+
+ it('uses max depth because there is room above parent to show more', function () {
+ const rawProfile: Profiling.SampledProfile = {
+ name: 'profile',
+ startValue: 0,
+ endValue: 1000,
+ unit: 'milliseconds',
+ threadID: 0,
+ type: 'sampled',
+ weights: [2, 2],
+ samples: [
+ [0, 1, 0],
+ [0, 1, 1],
+ ],
+ };
+
+ const profile = SampledProfile.FromProfile(
+ rawProfile,
+ createFrameIndex('mobile', [{name: 'f0'}, {name: 'f1'}]),
+ {type: 'flamechart'}
+ );
+
+ const flamegraph = new Flamegraph(profile, 1, {});
+
+ const configView = new Rect(0, 0, 4, 3);
+
+ const previewConfigView = computePreviewConfigView(flamegraph, configView, 1, 3);
+
+ // y is 0 here because the config view has height 3
+ // so the whole flamechart fits even though the parent
+ // is at depth 1
+ expect(previewConfigView).toEqual(new Rect(1, 0, 2, 3));
+ });
+});
diff --git a/static/app/components/profiling/flamegraph/flamegraphPreview.tsx b/static/app/components/profiling/flamegraph/flamegraphPreview.tsx
new file mode 100644
index 00000000000000..4bc00c78cc4cab
--- /dev/null
+++ b/static/app/components/profiling/flamegraph/flamegraphPreview.tsx
@@ -0,0 +1,271 @@
+import {CSSProperties, useEffect, useMemo, useState} from 'react';
+import styled from '@emotion/styled';
+import {vec2} from 'gl-matrix';
+
+import ConfigStore from 'sentry/stores/configStore';
+import {useLegacyStore} from 'sentry/stores/useLegacyStore';
+import {defined} from 'sentry/utils';
+import {
+ CanvasPoolManager,
+ useCanvasScheduler,
+} from 'sentry/utils/profiling/canvasScheduler';
+import {CanvasView} from 'sentry/utils/profiling/canvasView';
+import {Flamegraph as FlamegraphModel} from 'sentry/utils/profiling/flamegraph';
+import {
+ DarkFlamegraphTheme,
+ LightFlamegraphTheme,
+} from 'sentry/utils/profiling/flamegraph/flamegraphTheme';
+import {FlamegraphCanvas} from 'sentry/utils/profiling/flamegraphCanvas';
+import {FlamegraphFrame} from 'sentry/utils/profiling/flamegraphFrame';
+import {Rect, useResizeCanvasObserver} from 'sentry/utils/profiling/gl/utils';
+import {FlamegraphRenderer2D} from 'sentry/utils/profiling/renderers/flamegraphRenderer2D';
+import {FlamegraphTextRenderer} from 'sentry/utils/profiling/renderers/flamegraphTextRenderer';
+import {formatTo} from 'sentry/utils/profiling/units/units';
+import {useProfileGroup} from 'sentry/views/profiling/profileGroupProvider';
+
+interface FlamegraphPreviewProps {
+ relativeStartTimestamp: number;
+ relativeStopTimestamp: number;
+}
+
+export function FlamegraphPreview({
+ relativeStartTimestamp,
+ relativeStopTimestamp,
+}: FlamegraphPreviewProps) {
+ const canvasPoolManager = useMemo(() => new CanvasPoolManager(), []);
+ const scheduler = useCanvasScheduler(canvasPoolManager);
+
+ const {theme} = useLegacyStore(ConfigStore);
+ const flamegraphTheme = theme === 'light' ? LightFlamegraphTheme : DarkFlamegraphTheme;
+ const profileGroup = useProfileGroup();
+
+ const threadId = useMemo(
+ () => profileGroup.profiles[profileGroup.activeProfileIndex]?.threadId,
+ [profileGroup]
+ );
+
+ const profile = useMemo(() => {
+ if (!defined(threadId)) {
+ return null;
+ }
+ return profileGroup.profiles.find(p => p.threadId === threadId) ?? null;
+ }, [profileGroup.profiles, threadId]);
+
+ const flamegraph = useMemo(() => {
+ if (!defined(threadId) || !defined(profile)) {
+ return FlamegraphModel.Empty();
+ }
+
+ return new FlamegraphModel(profile, threadId, {});
+ }, [profile, threadId]);
+
+ const [flamegraphCanvasRef, setFlamegraphCanvasRef] =
+ useState<HTMLCanvasElement | null>(null);
+
+ const flamegraphCanvas = useMemo(() => {
+ if (!flamegraphCanvasRef) {
+ return null;
+ }
+ return new FlamegraphCanvas(flamegraphCanvasRef, vec2.fromValues(0, 0));
+ }, [flamegraphCanvasRef]);
+
+ const flamegraphView = useMemo(() => {
+ if (!flamegraphCanvas) {
+ return null;
+ }
+
+ const canvasView = new CanvasView({
+ canvas: flamegraphCanvas,
+ model: flamegraph,
+ options: {barHeight: flamegraphTheme.SIZES.BAR_HEIGHT},
+ mode: 'anchorBottom',
+ });
+
+ canvasView.setConfigView(
+ computePreviewConfigView(
+ flamegraph,
+ canvasView.configView,
+ formatTo(relativeStartTimestamp, 'second', 'nanosecond'),
+ formatTo(relativeStopTimestamp, 'second', 'nanosecond')
+ )
+ );
+
+ return canvasView;
+ }, [
+ flamegraph,
+ flamegraphCanvas,
+ flamegraphTheme,
+ relativeStartTimestamp,
+ relativeStopTimestamp,
+ ]);
+
+ const flamegraphCanvases = useMemo(() => [flamegraphCanvasRef], [flamegraphCanvasRef]);
+
+ useResizeCanvasObserver(
+ flamegraphCanvases,
+ canvasPoolManager,
+ flamegraphCanvas,
+ flamegraphView
+ );
+
+ const flamegraphRenderer = useMemo(() => {
+ if (!flamegraphCanvasRef) {
+ return null;
+ }
+
+ return new FlamegraphRenderer2D(flamegraphCanvasRef, flamegraph, flamegraphTheme, {
+ draw_border: true,
+ });
+ }, [flamegraph, flamegraphCanvasRef, flamegraphTheme]);
+
+ const textRenderer = useMemo(() => {
+ if (!flamegraphCanvasRef) {
+ return null;
+ }
+ return new FlamegraphTextRenderer(flamegraphCanvasRef, flamegraphTheme, flamegraph);
+ }, [flamegraph, flamegraphCanvasRef, flamegraphTheme]);
+
+ useEffect(() => {
+ if (!flamegraphCanvas || !flamegraphView || !flamegraphRenderer || !textRenderer) {
+ return undefined;
+ }
+
+ const clearOverlayCanvas = () => {
+ textRenderer.context.clearRect(
+ 0,
+ 0,
+ textRenderer.canvas.width,
+ textRenderer.canvas.height
+ );
+ };
+
+ const drawRectangles = () => {
+ flamegraphRenderer.draw(
+ flamegraphView.fromTransformedConfigView(flamegraphCanvas.physicalSpace)
+ );
+ };
+
+ const drawText = () => {
+ textRenderer.draw(
+ flamegraphView.toOriginConfigView(flamegraphView.configView),
+ flamegraphView.fromTransformedConfigView(flamegraphCanvas.physicalSpace)
+ );
+ };
+
+ scheduler.registerBeforeFrameCallback(clearOverlayCanvas);
+ scheduler.registerBeforeFrameCallback(drawRectangles);
+ scheduler.registerBeforeFrameCallback(drawText);
+
+ scheduler.draw();
+
+ return () => {
+ scheduler.unregisterBeforeFrameCallback(clearOverlayCanvas);
+ scheduler.unregisterBeforeFrameCallback(drawRectangles);
+ scheduler.unregisterBeforeFrameCallback(drawText);
+ };
+ }, [flamegraphRenderer, flamegraphView, flamegraphCanvas, scheduler, textRenderer]);
+
+ return (
+ <CanvasContainer>
+ <Canvas ref={setFlamegraphCanvasRef} />
+ </CanvasContainer>
+ );
+}
+
+/**
+ * When generating a preview, a relative start/stop timestamp is used to specify
+ * the x position of the flamechart to render. This function tries to pick the
+ * best y position based on the x in order to show the most useful part of the
+ * flamechart.
+ *
+ * It works as follows:
+ * - If there are frames that wrap the time window (a parent frame), we will pick
+ * the inner most parent frame's depth and start rendering from there.
+ * - Otherwise, we will pick based on the maximum depth of the flamechart within
+ * the specified window and show as many rows as that will fit. We do not rely
+ * on using the maximum depth of the whole flamechart and adjusting the config
+ * view because the window selected may be shallower and would result in the
+ * preview to show a lot of whitespace.
+ */
+export function computePreviewConfigView(
+ flamegraph: FlamegraphModel,
+ configView: Rect,
+ relativeStartNs: number,
+ relativeStopNs: number
+): Rect {
+ if (flamegraph.depth < configView.height) {
+ // if the flamegraph height is less than the config view height,
+ // the whole flamechart will fit on the view so we can just use y = 0
+ return new Rect(
+ relativeStartNs,
+ 0,
+ relativeStopNs - relativeStartNs,
+ configView.height
+ );
+ }
+
+ const frames: FlamegraphFrame[] = flamegraph.root.children.slice();
+ let maxDepthInWindow = 0;
+ let innerMostParentFrame: FlamegraphFrame | null = null;
+
+ while (frames.length > 0) {
+ const frame = frames.pop()!;
+
+ if (frame.start >= relativeStopNs || frame.end <= relativeStartNs) {
+ continue;
+ }
+
+ maxDepthInWindow = Math.max(maxDepthInWindow, frame.depth);
+
+ if (frame.start <= relativeStartNs && frame.end >= relativeStopNs) {
+ if ((innerMostParentFrame?.depth ?? -1) < frame.depth) {
+ innerMostParentFrame = frame;
+ }
+ }
+
+ for (let i = 0; i < frame.children.length; i++) {
+ frames.push(frame.children[i]);
+ }
+ }
+
+ // By default, we show the inner most frames.
+ let depth = Math.max(0, Math.ceil(maxDepthInWindow - configView.height + 1));
+
+ // If we were able to find a frame that is likely the parent of the span,
+ // we should bias towards that frame.
+ if (defined(innerMostParentFrame)) {
+ depth = Math.min(depth, innerMostParentFrame.depth);
+ }
+
+ return new Rect(
+ relativeStartNs,
+ depth,
+ relativeStopNs - relativeStartNs,
+ configView.height
+ );
+}
+
+const CanvasContainer = styled('div')`
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+ position: relative;
+`;
+
+const Canvas = styled('canvas')<{
+ cursor?: CSSProperties['cursor'];
+ pointerEvents?: CSSProperties['pointerEvents'];
+}>`
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+ user-select: none;
+ position: absolute;
+ pointer-events: ${p => p.pointerEvents || 'auto'};
+ cursor: ${p => p.cursor || 'default'};
+
+ &:focus {
+ outline: none;
+ }
+`;
diff --git a/static/app/utils/analytics/profilingAnalyticsEvents.tsx b/static/app/utils/analytics/profilingAnalyticsEvents.tsx
index 8c35e30a3855c4..a734b9a509464a 100644
--- a/static/app/utils/analytics/profilingAnalyticsEvents.tsx
+++ b/static/app/utils/analytics/profilingAnalyticsEvents.tsx
@@ -1,6 +1,7 @@
import {PlatformKey} from 'sentry/data/platformCategories';
type ProfilingEventSource =
+ | 'missing_instrumentation'
| 'slowest_transaction_panel'
| 'transaction_details'
| 'transaction_hovercard.trigger'
diff --git a/static/app/utils/profiling/canvasView.tsx b/static/app/utils/profiling/canvasView.tsx
index 4b25a2a7c3f26b..64c113fb1423c5 100644
--- a/static/app/utils/profiling/canvasView.tsx
+++ b/static/app/utils/profiling/canvasView.tsx
@@ -19,7 +19,7 @@ export class CanvasView<T extends {configSpace: Rect}> {
model: T;
canvas: FlamegraphCanvas;
- mode: 'contain' | 'cover' = 'contain';
+ mode: 'anchorTop' | 'anchorBottom' | 'stretchToFit' = 'anchorTop';
constructor({
canvas,
@@ -36,7 +36,7 @@ export class CanvasView<T extends {configSpace: Rect}> {
inverted?: boolean;
minWidth?: number;
};
- mode?: 'contain' | 'cover';
+ mode?: CanvasView<T>['mode'];
}) {
this.mode = mode || this.mode;
this.inverted = !!options.inverted;
@@ -74,35 +74,53 @@ export class CanvasView<T extends {configSpace: Rect}> {
}
private _initConfigSpace(canvas: FlamegraphCanvas): void {
- if (this.mode === 'cover') {
- this.configSpace = new Rect(
- 0,
- 0,
- this.model.configSpace.width,
- this.model.configSpace.height + this.depthOffset
- );
- return;
+ switch (this.mode) {
+ case 'stretchToFit': {
+ this.configSpace = new Rect(
+ 0,
+ 0,
+ this.model.configSpace.width,
+ this.model.configSpace.height + this.depthOffset
+ );
+ return;
+ }
+ case 'anchorBottom':
+ case 'anchorTop':
+ default: {
+ this.configSpace = new Rect(
+ 0,
+ 0,
+ this.model.configSpace.width,
+ Math.max(
+ this.model.configSpace.height + this.depthOffset,
+ canvas.physicalSpace.height / this.barHeight
+ )
+ );
+ }
}
-
- this.configSpace = new Rect(
- 0,
- 0,
- this.model.configSpace.width,
- Math.max(
- this.model.configSpace.height + this.depthOffset,
- canvas.physicalSpace.height / this.barHeight
- )
- );
}
private _initConfigView(canvas: FlamegraphCanvas, space: Rect): void {
- if (this.mode === 'cover') {
- this.configView = Rect.From(space);
- return;
+ switch (this.mode) {
+ case 'stretchToFit': {
+ this.configView = Rect.From(space);
+ return;
+ }
+ case 'anchorBottom': {
+ const newHeight = canvas.physicalSpace.height / this.barHeight;
+ const newY = Math.max(0, Math.ceil(space.y - (newHeight - space.height)));
+ this.configView = Rect.From(space).withHeight(newHeight).withY(newY);
+ return;
+ }
+ case 'anchorTop': {
+ this.configView = Rect.From(space).withHeight(
+ canvas.physicalSpace.height / this.barHeight
+ );
+ return;
+ }
+ default:
+ throw new Error(`Unknown CanvasView mode: ${this.mode}`);
}
- this.configView = Rect.From(space).withHeight(
- canvas.physicalSpace.height / this.barHeight
- );
}
initConfigSpace(canvas: FlamegraphCanvas): void {
diff --git a/static/app/utils/profiling/renderers/flamegraphRenderer2D.tsx b/static/app/utils/profiling/renderers/flamegraphRenderer2D.tsx
index 1de9aedf92f952..c7ddf8a9a8573b 100644
--- a/static/app/utils/profiling/renderers/flamegraphRenderer2D.tsx
+++ b/static/app/utils/profiling/renderers/flamegraphRenderer2D.tsx
@@ -1,7 +1,6 @@
import {mat3, vec2} from 'gl-matrix';
import {Flamegraph} from 'sentry/utils/profiling/flamegraph';
-import {FlamegraphSearch} from 'sentry/utils/profiling/flamegraph/flamegraphStateProvider/reducers/flamegraphSearch';
import {FlamegraphTheme} from 'sentry/utils/profiling/flamegraph/flamegraphTheme';
import {FlamegraphFrame} from 'sentry/utils/profiling/flamegraphFrame';
import {Rect} from 'sentry/utils/profiling/gl/utils';
@@ -13,7 +12,7 @@ function colorComponentsToRgba(color: number[]): string {
)}, ${color[3] ?? 1})`;
}
-export class FlamegraphRenderer2d {
+export class FlamegraphRenderer2D {
canvas: HTMLCanvasElement | null;
flamegraph: Flamegraph;
theme: FlamegraphTheme;
@@ -57,7 +56,7 @@ export class FlamegraphRenderer2d {
return null;
}
- draw(configViewToPhysicalSpace: mat3, _searchResults: FlamegraphSearch['results']) {
+ draw(configViewToPhysicalSpace: mat3) {
if (!this.canvas) {
throw new Error('No canvas to draw on');
}
diff --git a/static/app/utils/profiling/renderers/flamegraphTextRenderer.tsx b/static/app/utils/profiling/renderers/flamegraphTextRenderer.tsx
index c727b8b35a31c0..fdd8e6c5afd469 100644
--- a/static/app/utils/profiling/renderers/flamegraphTextRenderer.tsx
+++ b/static/app/utils/profiling/renderers/flamegraphTextRenderer.tsx
@@ -35,7 +35,7 @@ class FlamegraphTextRenderer extends TextRenderer {
draw(
configView: Rect,
configViewToPhysicalSpace: mat3,
- flamegraphSearchResults: FlamegraphSearch['results']['frames']
+ flamegraphSearchResults?: FlamegraphSearch['results']['frames']
): void {
// Make sure we set font size before we measure text for the first draw
const FONT_SIZE = this.theme.SIZES.BAR_FONT_SIZE * window.devicePixelRatio;
@@ -57,7 +57,8 @@ class FlamegraphTextRenderer extends TextRenderer {
const TOP_BOUNDARY = configView.top - 1;
const BOTTOM_BOUNDARY = configView.bottom + 1;
- const HAS_SEARCH_RESULTS = flamegraphSearchResults.size > 0;
+ const HAS_SEARCH_RESULTS =
+ flamegraphSearchResults && flamegraphSearchResults.size > 0;
const TEXT_Y_POSITION = FONT_SIZE / 2 - BASELINE_OFFSET;
// We start by iterating over root frames, so we draw the call stacks top-down.
diff --git a/static/app/views/discover/eventDetails/content.tsx b/static/app/views/discover/eventDetails/content.tsx
index 1cafa07aa66d1e..4c1618847ae17a 100644
--- a/static/app/views/discover/eventDetails/content.tsx
+++ b/static/app/views/discover/eventDetails/content.tsx
@@ -37,10 +37,15 @@ import TraceMetaQuery, {
TraceMetaQueryChildrenProps,
} from 'sentry/utils/performance/quickTrace/traceMetaQuery';
import {QuickTraceQueryChildrenProps} from 'sentry/utils/performance/quickTrace/types';
-import {getTraceTimeRangeFromEvent} from 'sentry/utils/performance/quickTrace/utils';
+import {
+ getTraceTimeRangeFromEvent,
+ isTransaction,
+} from 'sentry/utils/performance/quickTrace/utils';
import Projects from 'sentry/utils/projects';
import EventMetas from 'sentry/views/performance/transactionDetails/eventMetas';
import {transactionSummaryRouteWithQuery} from 'sentry/views/performance/transactionSummary/utils';
+import {ProfileGroupProvider} from 'sentry/views/profiling/profileGroupProvider';
+import {ProfileContext, ProfilesProvider} from 'sentry/views/profiling/profilesProvider';
import DiscoverBreadcrumb from '../breadcrumb';
import {generateTitle, getExpandedResults} from '../utils';
@@ -147,6 +152,10 @@ class EventDetailsContent extends AsyncComponent<Props, State> {
const eventJsonUrl = `/api/0/projects/${organization.slug}/${this.projectId}/events/${event.eventID}/json/`;
const hasProfilingFeature = organization.features.includes('profiling');
+ const hasProfilingPreviewsFeature =
+ hasProfilingFeature && organization.features.includes('profiling-previews');
+
+ const profileId = isTransaction(event) ? event.contexts?.profile?.profile_id : null;
const renderContent = (
results?: QuickTraceQueryChildrenProps,
@@ -242,13 +251,41 @@ class EventDetailsContent extends AsyncComponent<Props, State> {
}}
>
<QuickTraceContext.Provider value={results}>
- <BorderlessEventEntries
- organization={organization}
- event={event}
- project={projects[0] as Project}
- location={location}
- showTagSummary={false}
- />
+ {hasProfilingPreviewsFeature && profileId ? (
+ <ProfilesProvider
+ orgSlug={organization.slug}
+ projectSlug={this.projectId}
+ profileId={profileId}
+ >
+ <ProfileContext.Consumer>
+ {profiles => (
+ <ProfileGroupProvider
+ type="flamechart"
+ input={
+ profiles?.type === 'resolved' ? profiles.data : null
+ }
+ traceID={profileId}
+ >
+ <BorderlessEventEntries
+ organization={organization}
+ event={event}
+ project={projects[0] as Project}
+ location={location}
+ showTagSummary={false}
+ />
+ </ProfileGroupProvider>
+ )}
+ </ProfileContext.Consumer>
+ </ProfilesProvider>
+ ) : (
+ <BorderlessEventEntries
+ organization={organization}
+ event={event}
+ project={projects[0] as Project}
+ location={location}
+ showTagSummary={false}
+ />
+ )}
</QuickTraceContext.Provider>
</SpanEntryContext.Provider>
) : (
diff --git a/static/app/views/performance/transactionDetails/content.tsx b/static/app/views/performance/transactionDetails/content.tsx
index 5e0607eaa1b9f0..74d17d4fb976d8 100644
--- a/static/app/views/performance/transactionDetails/content.tsx
+++ b/static/app/views/performance/transactionDetails/content.tsx
@@ -23,7 +23,7 @@ import {TagsTable} from 'sentry/components/tagsTable';
import {IconOpen} from 'sentry/icons';
import {t} from 'sentry/locale';
import {Organization, Project} from 'sentry/types';
-import {Event, EventTag} from 'sentry/types/event';
+import {Event, EventTag, EventTransaction} from 'sentry/types/event';
import {trackAnalyticsEvent} from 'sentry/utils/analytics';
import {formatTagKey} from 'sentry/utils/discover/fields';
import {QuickTraceContext} from 'sentry/utils/performance/quickTrace/quickTraceContext';
@@ -34,6 +34,8 @@ import {getTransactionDetailsUrl} from 'sentry/utils/performance/urls';
import Projects from 'sentry/utils/projects';
import {appendTagCondition, decodeScalar} from 'sentry/utils/queryString';
import Breadcrumb from 'sentry/views/performance/breadcrumb';
+import {ProfileGroupProvider} from 'sentry/views/profiling/profileGroupProvider';
+import {ProfileContext, ProfilesProvider} from 'sentry/views/profiling/profilesProvider';
import {transactionSummaryRouteWithQuery} from '../transactionSummary/utils';
import {getSelectedProjectPlatforms} from '../utils';
@@ -144,6 +146,10 @@ class EventDetailsContent extends AsyncComponent<Props, State> {
const {start, end} = getTraceTimeRangeFromEvent(event);
const hasProfilingFeature = organization.features.includes('profiling');
+ const hasProfilingPreviewsFeature =
+ hasProfilingFeature && organization.features.includes('profiling-previews');
+
+ const profileId = (event as EventTransaction).contexts?.profile?.profile_id ?? null;
return (
<TraceMetaQuery
@@ -226,13 +232,43 @@ class EventDetailsContent extends AsyncComponent<Props, State> {
}}
>
<QuickTraceContext.Provider value={results}>
- <BorderlessEventEntries
- organization={organization}
- event={event}
- project={_projects[0] as Project}
- showTagSummary={false}
- location={location}
- />
+ {hasProfilingPreviewsFeature && profileId ? (
+ <ProfilesProvider
+ orgSlug={organization.slug}
+ projectSlug={this.projectId}
+ profileId={profileId}
+ >
+ <ProfileContext.Consumer>
+ {profiles => (
+ <ProfileGroupProvider
+ type="flamechart"
+ input={
+ profiles?.type === 'resolved'
+ ? profiles.data
+ : null
+ }
+ traceID={profileId}
+ >
+ <BorderlessEventEntries
+ organization={organization}
+ event={event}
+ project={_projects[0] as Project}
+ showTagSummary={false}
+ location={location}
+ />
+ </ProfileGroupProvider>
+ )}
+ </ProfileContext.Consumer>
+ </ProfilesProvider>
+ ) : (
+ <BorderlessEventEntries
+ organization={organization}
+ event={event}
+ project={_projects[0] as Project}
+ showTagSummary={false}
+ location={location}
+ />
+ )}
</QuickTraceContext.Provider>
</SpanEntryContext.Provider>
)}
diff --git a/static/app/views/profiling/profilesProvider.tsx b/static/app/views/profiling/profilesProvider.tsx
index 5483f1ae1265b9..d6a98bd1232972 100644
--- a/static/app/views/profiling/profilesProvider.tsx
+++ b/static/app/views/profiling/profilesProvider.tsx
@@ -16,12 +16,12 @@ import {isSchema} from '../../utils/profiling/guards/profile';
function fetchFlamegraphs(
api: Client,
eventId: string,
- projectId: Project['id'],
- organization: Organization
+ projectSlug: Project['slug'],
+ orgSlug: Organization['slug']
): Promise<Profiling.ProfileInput> {
return api
.requestPromise(
- `/projects/${organization.slug}/${projectId}/profiling/profiles/${eventId}/`,
+ `/projects/${orgSlug}/${projectSlug}/profiling/profiles/${eventId}/`,
{
method: 'GET',
includeAllArgs: true,
@@ -45,7 +45,7 @@ type ProfileProviderValue = RequestState<Profiling.ProfileInput>;
type SetProfileProviderValue = React.Dispatch<
React.SetStateAction<RequestState<Profiling.ProfileInput>>
>;
-const ProfileContext = createContext<ProfileProviderValue | null>(null);
+export const ProfileContext = createContext<ProfileProviderValue | null>(null);
const SetProfileProvider = createContext<SetProfileProviderValue | null>(null);
export function useProfiles() {
@@ -77,8 +77,7 @@ export function useProfileTransaction() {
return context;
}
-function ProfileProvider(props: FlamegraphViewProps): React.ReactElement {
- const api = useApi();
+function ProfileProviderWrapper(props: FlamegraphViewProps): React.ReactElement {
const organization = useOrganization();
const params = useParams();
@@ -92,44 +91,75 @@ function ProfileProvider(props: FlamegraphViewProps): React.ReactElement {
profiles.type === 'resolved' ? getTransactionId(profiles.data) : null
);
+ return (
+ <ProfilesProvider
+ onUpdateProfiles={setProfiles}
+ orgSlug={organization.slug}
+ profileId={params.eventId}
+ projectSlug={params.projectId}
+ >
+ <SetProfileProvider.Provider value={setProfiles}>
+ <ProfileTransactionContext.Provider value={profileTransaction}>
+ <ProfileHeader
+ eventId={params.eventId}
+ projectId={params.projectId}
+ transaction={
+ profileTransaction.type === 'resolved' ? profileTransaction.data : null
+ }
+ />
+ {props.children}
+ </ProfileTransactionContext.Provider>
+ </SetProfileProvider.Provider>
+ </ProfilesProvider>
+ );
+}
+
+interface ProfilesProviderProps {
+ children: React.ReactNode;
+ orgSlug: Organization['slug'];
+ profileId: string;
+ projectSlug: Project['slug'];
+ onUpdateProfiles?: (any) => void;
+}
+
+export function ProfilesProvider({
+ children,
+ onUpdateProfiles,
+ orgSlug,
+ projectSlug,
+ profileId,
+}: ProfilesProviderProps) {
+ const api = useApi();
+
+ const [profiles, setProfiles] = useState<RequestState<Profiling.ProfileInput>>({
+ type: 'initial',
+ });
+
useEffect(() => {
- if (!params.eventId || !params.projectId) {
+ if (!profileId || !projectSlug || !orgSlug) {
return undefined;
}
setProfiles({type: 'loading'});
- fetchFlamegraphs(api, params.eventId, params.projectId, organization)
+ fetchFlamegraphs(api, profileId, projectSlug, orgSlug)
.then(p => {
setProfiles({type: 'resolved', data: p});
+ onUpdateProfiles?.({type: 'resolved', data: p});
})
.catch(err => {
const message = err.toString() || t('Error: Unable to load profiles');
setProfiles({type: 'errored', error: message});
+ onUpdateProfiles?.({type: 'errored', error: message});
Sentry.captureException(err);
});
return () => {
api.clear();
};
- }, [params.eventId, params.projectId, api, organization]);
+ }, [api, onUpdateProfiles, orgSlug, projectSlug, profileId]);
- return (
- <ProfileContext.Provider value={profiles}>
- <SetProfileProvider.Provider value={setProfiles}>
- <ProfileTransactionContext.Provider value={profileTransaction}>
- <ProfileHeader
- eventId={params.eventId}
- projectId={params.projectId}
- transaction={
- profileTransaction.type === 'resolved' ? profileTransaction.data : null
- }
- />
- {props.children}
- </ProfileTransactionContext.Provider>
- </SetProfileProvider.Provider>
- </ProfileContext.Provider>
- );
+ return <ProfileContext.Provider value={profiles}>{children}</ProfileContext.Provider>;
}
-export default ProfileProvider;
+export default ProfileProviderWrapper;
|
d826fc909882f147d668a1f7419d29332d4ccc0c
|
2018-05-17 00:37:34
|
Billy Vong
|
ref(js): Move and code split admin views (#8459)
| false
|
Move and code split admin views (#8459)
|
ref
|
diff --git a/src/sentry/static/sentry/app/routes.jsx b/src/sentry/static/sentry/app/routes.jsx
index 028098275bb9cf..0d96f924981106 100644
--- a/src/sentry/static/sentry/app/routes.jsx
+++ b/src/sentry/static/sentry/app/routes.jsx
@@ -3,16 +3,6 @@ import React from 'react';
import AccountAuthorizations from 'app/views/accountAuthorizations';
import AccountLayout from 'app/views/accountLayout';
-import AdminBuffer from 'app/views/adminBuffer';
-import AdminLayout from 'app/views/adminLayout';
-import AdminOrganizations from 'app/views/adminOrganizations';
-import AdminOverview from 'app/views/adminOverview';
-import AdminProjects from 'app/views/adminProjects';
-import AdminQueue from 'app/views/adminQueue';
-import AdminQuotas from 'app/views/adminQuotas';
-import AdminRelays from 'app/views/adminRelays';
-import AdminSettings from 'app/views/adminSettings';
-import AdminUsers from 'app/views/adminUsers';
import ApiApplicationDetails from 'app/views/apiApplicationDetails';
import ApiApplications from 'app/views/apiApplications';
import ApiLayout from 'app/views/apiLayout';
@@ -640,16 +630,65 @@ function routes() {
<Route path="/api/new-token/" component={errorHandler(ApiNewToken)} />
- <Route path="/manage/" component={errorHandler(AdminLayout)}>
- <IndexRoute component={errorHandler(AdminOverview)} />
- <Route path="buffer/" component={errorHandler(AdminBuffer)} />
- <Route path="relays/" component={errorHandler(AdminRelays)} />
- <Route path="organizations/" component={errorHandler(AdminOrganizations)} />
- <Route path="projects/" component={errorHandler(AdminProjects)} />
- <Route path="queue/" component={errorHandler(AdminQueue)} />
- <Route path="quotas/" component={errorHandler(AdminQuotas)} />
- <Route path="settings/" component={errorHandler(AdminSettings)} />
- <Route path="users/" component={errorHandler(AdminUsers)} />
+ <Route
+ path="/manage/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminLayout"*/ 'app/views/admin/adminLayout')}
+ component={errorHandler(LazyLoad)}
+ >
+ <IndexRoute
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminOverview"*/ 'app/views/admin/adminOverview')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="buffer/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminBuffer"*/ 'app/views/admin/adminBuffer')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="relays/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminRelays"*/ 'app/views/admin/adminRelays')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="organizations/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminOrganizations"*/ 'app/views/admin/adminOrganizations')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="projects/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminProjects"*/ 'app/views/admin/adminProjects')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="queue/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminQueue"*/ 'app/views/admin/adminQueue')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="quotas/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminQuotas"*/ 'app/views/admin/adminQuotas')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="settings/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminSettings"*/ 'app/views/admin/adminSettings')}
+ component={errorHandler(LazyLoad)}
+ />
+ <Route
+ path="users/"
+ componentPromise={() =>
+ import(/*webpackChunkName:"AdminUsers"*/ 'app/views/admin/adminUsers')}
+ component={errorHandler(LazyLoad)}
+ />
{hooksAdminRoutes}
</Route>
diff --git a/src/sentry/static/sentry/app/views/adminBuffer.jsx b/src/sentry/static/sentry/app/views/admin/adminBuffer.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminBuffer.jsx
rename to src/sentry/static/sentry/app/views/admin/adminBuffer.jsx
diff --git a/src/sentry/static/sentry/app/views/adminLayout.jsx b/src/sentry/static/sentry/app/views/admin/adminLayout.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminLayout.jsx
rename to src/sentry/static/sentry/app/views/admin/adminLayout.jsx
diff --git a/src/sentry/static/sentry/app/views/adminOrganizations.jsx b/src/sentry/static/sentry/app/views/admin/adminOrganizations.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminOrganizations.jsx
rename to src/sentry/static/sentry/app/views/admin/adminOrganizations.jsx
diff --git a/src/sentry/static/sentry/app/views/adminOverview/apiChart.jsx b/src/sentry/static/sentry/app/views/admin/adminOverview/apiChart.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminOverview/apiChart.jsx
rename to src/sentry/static/sentry/app/views/admin/adminOverview/apiChart.jsx
diff --git a/src/sentry/static/sentry/app/views/adminOverview/eventChart.jsx b/src/sentry/static/sentry/app/views/admin/adminOverview/eventChart.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminOverview/eventChart.jsx
rename to src/sentry/static/sentry/app/views/admin/adminOverview/eventChart.jsx
diff --git a/src/sentry/static/sentry/app/views/adminOverview/index.jsx b/src/sentry/static/sentry/app/views/admin/adminOverview/index.jsx
similarity index 89%
rename from src/sentry/static/sentry/app/views/adminOverview/index.jsx
rename to src/sentry/static/sentry/app/views/admin/adminOverview/index.jsx
index 01d56bb73298fd..f692ab92472b82 100644
--- a/src/sentry/static/sentry/app/views/adminOverview/index.jsx
+++ b/src/sentry/static/sentry/app/views/admin/adminOverview/index.jsx
@@ -1,10 +1,11 @@
/*eslint getsentry/jsx-needs-il8n:0*/
import React from 'react';
-import ApiChart from 'app/views/adminOverview/apiChart';
-import AsyncView from 'app/views/asyncView';
-import EventChart from 'app/views/adminOverview/eventChart';
import {t} from 'app/locale';
+import AsyncView from 'app/views/asyncView';
+
+import ApiChart from './apiChart';
+import EventChart from './eventChart';
export default class AdminOverview extends AsyncView {
getTitle() {
diff --git a/src/sentry/static/sentry/app/views/adminProjects.jsx b/src/sentry/static/sentry/app/views/admin/adminProjects.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminProjects.jsx
rename to src/sentry/static/sentry/app/views/admin/adminProjects.jsx
diff --git a/src/sentry/static/sentry/app/views/adminQueue.jsx b/src/sentry/static/sentry/app/views/admin/adminQueue.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminQueue.jsx
rename to src/sentry/static/sentry/app/views/admin/adminQueue.jsx
diff --git a/src/sentry/static/sentry/app/views/adminQuotas.jsx b/src/sentry/static/sentry/app/views/admin/adminQuotas.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminQuotas.jsx
rename to src/sentry/static/sentry/app/views/admin/adminQuotas.jsx
diff --git a/src/sentry/static/sentry/app/views/adminRelays.jsx b/src/sentry/static/sentry/app/views/admin/adminRelays.jsx
similarity index 93%
rename from src/sentry/static/sentry/app/views/adminRelays.jsx
rename to src/sentry/static/sentry/app/views/admin/adminRelays.jsx
index e725a1286b1d89..4b863bed84bdcd 100644
--- a/src/sentry/static/sentry/app/views/adminRelays.jsx
+++ b/src/sentry/static/sentry/app/views/admin/adminRelays.jsx
@@ -4,12 +4,12 @@ import React from 'react';
import moment from 'moment';
import createReactClass from 'create-react-class';
+import {t} from 'app/locale';
import ApiMixin from 'app/mixins/apiMixin';
import withEnvironment from 'app/utils/withEnvironment';
-import ResultGrid from '../components/resultGrid';
-import LinkWithConfirmation from '../components/linkWithConfirmation';
-import {t} from '../locale';
+import ResultGrid from 'app/components/resultGrid';
+import LinkWithConfirmation from 'app/components/linkWithConfirmation';
const prettyDate = function(x) {
return moment(x).format('ll LTS');
diff --git a/src/sentry/static/sentry/app/views/adminSettings.jsx b/src/sentry/static/sentry/app/views/admin/adminSettings.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminSettings.jsx
rename to src/sentry/static/sentry/app/views/admin/adminSettings.jsx
diff --git a/src/sentry/static/sentry/app/views/adminUsers.jsx b/src/sentry/static/sentry/app/views/admin/adminUsers.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/adminUsers.jsx
rename to src/sentry/static/sentry/app/views/admin/adminUsers.jsx
diff --git a/tests/js/spec/views/__snapshots__/adminBuffer.spec.jsx.snap b/tests/js/spec/views/admin/__snapshots__/adminBuffer.spec.jsx.snap
similarity index 100%
rename from tests/js/spec/views/__snapshots__/adminBuffer.spec.jsx.snap
rename to tests/js/spec/views/admin/__snapshots__/adminBuffer.spec.jsx.snap
diff --git a/tests/js/spec/views/__snapshots__/adminQueue.spec.jsx.snap b/tests/js/spec/views/admin/__snapshots__/adminQueue.spec.jsx.snap
similarity index 100%
rename from tests/js/spec/views/__snapshots__/adminQueue.spec.jsx.snap
rename to tests/js/spec/views/admin/__snapshots__/adminQueue.spec.jsx.snap
diff --git a/tests/js/spec/views/__snapshots__/adminQuotas.spec.jsx.snap b/tests/js/spec/views/admin/__snapshots__/adminQuotas.spec.jsx.snap
similarity index 100%
rename from tests/js/spec/views/__snapshots__/adminQuotas.spec.jsx.snap
rename to tests/js/spec/views/admin/__snapshots__/adminQuotas.spec.jsx.snap
diff --git a/tests/js/spec/views/__snapshots__/adminSettings.spec.jsx.snap b/tests/js/spec/views/admin/__snapshots__/adminSettings.spec.jsx.snap
similarity index 100%
rename from tests/js/spec/views/__snapshots__/adminSettings.spec.jsx.snap
rename to tests/js/spec/views/admin/__snapshots__/adminSettings.spec.jsx.snap
diff --git a/tests/js/spec/views/adminBuffer.spec.jsx b/tests/js/spec/views/admin/adminBuffer.spec.jsx
similarity index 89%
rename from tests/js/spec/views/adminBuffer.spec.jsx
rename to tests/js/spec/views/admin/adminBuffer.spec.jsx
index 95bd61c688359c..3a38744251e005 100644
--- a/tests/js/spec/views/adminBuffer.spec.jsx
+++ b/tests/js/spec/views/admin/adminBuffer.spec.jsx
@@ -1,7 +1,7 @@
import React from 'react';
import {shallow} from 'enzyme';
-import AdminBuffer from 'app/views/adminBuffer';
+import AdminBuffer from 'app/views/admin/adminBuffer';
// TODO(dcramer): this doesnt really test anything as we need to
// mock the API Response/wait on it
diff --git a/tests/js/spec/views/adminQueue.spec.jsx b/tests/js/spec/views/admin/adminQueue.spec.jsx
similarity index 97%
rename from tests/js/spec/views/adminQueue.spec.jsx
rename to tests/js/spec/views/admin/adminQueue.spec.jsx
index 486ecabe0e4b54..76012d4166e1bb 100644
--- a/tests/js/spec/views/adminQueue.spec.jsx
+++ b/tests/js/spec/views/admin/adminQueue.spec.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import {shallow} from 'enzyme';
import {Client} from 'app/api';
-import AdminQueue from 'app/views/adminQueue';
+import AdminQueue from 'app/views/admin/adminQueue';
// TODO(dcramer): this doesnt really test anything as we need to
// mock the API Response/wait on it
diff --git a/tests/js/spec/views/adminQuotas.spec.jsx b/tests/js/spec/views/admin/adminQuotas.spec.jsx
similarity index 93%
rename from tests/js/spec/views/adminQuotas.spec.jsx
rename to tests/js/spec/views/admin/adminQuotas.spec.jsx
index c70b55e13f543b..cf361107a83b19 100644
--- a/tests/js/spec/views/adminQuotas.spec.jsx
+++ b/tests/js/spec/views/admin/adminQuotas.spec.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import {shallow} from 'enzyme';
import {Client} from 'app/api';
-import AdminQuotas from 'app/views/adminQuotas';
+import AdminQuotas from 'app/views/admin/adminQuotas';
// TODO(dcramer): this doesnt really test anything as we need to
// mock the API Response/wait on it
diff --git a/tests/js/spec/views/adminSettings.spec.jsx b/tests/js/spec/views/admin/adminSettings.spec.jsx
similarity index 98%
rename from tests/js/spec/views/adminSettings.spec.jsx
rename to tests/js/spec/views/admin/adminSettings.spec.jsx
index 22c570d6af15dd..7ffec72d7fa22f 100644
--- a/tests/js/spec/views/adminSettings.spec.jsx
+++ b/tests/js/spec/views/admin/adminSettings.spec.jsx
@@ -2,7 +2,7 @@ import React from 'react';
import {shallow} from 'enzyme';
import {Client} from 'app/api';
-import AdminSettings from 'app/views/adminSettings';
+import AdminSettings from 'app/views/admin/adminSettings';
// TODO(dcramer): this doesnt really test anything as we need to
// mock the API Response/wait on it
|
f54deb0fa3ff274b50c33725f0b48e4ee1346156
|
2024-05-21 23:18:07
|
Ryan Albrecht
|
ci: Use eslint to track calls to @deprecated functions/components (#70184)
| false
|
Use eslint to track calls to @deprecated functions/components (#70184)
|
ci
|
diff --git a/.eslintrc.js b/.eslintrc.js
index a7ef8750538015..288e497b178120 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1,8 +1,19 @@
/* eslint-env node */
+const detectDeprecations = !!process.env.SENTRY_DETECT_DEPRECATIONS;
+
module.exports = {
root: true,
- extends: ['sentry-app/strict'],
+ extends: detectDeprecations
+ ? ['sentry-app/strict', 'plugin:deprecation/recommended']
+ : ['sentry-app/strict'],
+
+ parserOptions: detectDeprecations
+ ? {
+ project: './tsconfig.json',
+ }
+ : {},
+
globals: {
require: false,
expect: false,
diff --git a/.github/workflows/frontend-lint-burndown.yml b/.github/workflows/frontend-lint-burndown.yml
new file mode 100644
index 00000000000000..2a5d1af154e2e4
--- /dev/null
+++ b/.github/workflows/frontend-lint-burndown.yml
@@ -0,0 +1,33 @@
+name: frontend-lint-burndown
+
+on:
+ workflow_dispatch:
+ schedule:
+ - cron: '0 4 * * 1'
+
+env:
+ NODE_OPTIONS: '--max-old-space-size=4096'
+
+jobs:
+ deprecations:
+ name: Lint @deprecated callsites
+ timeout-minutes: 30
+ # Make sure this matches the runner that runs frontend tests
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
+
+ - name: Install dependencies & inject eslint-plugin-deprecation
+ id: dependencies
+ run: yarn add --dev eslint-plugin-deprecation
+
+ # Setup custom tsc matcher, see https://github.com/actions/setup-node/issues/97
+ - name: setup matchers
+ run: |
+ echo "::remove-matcher owner=masters::"
+ echo "::add-matcher::.github/eslint-stylish.json"
+
+ - name: ESLint
+ env:
+ SENTRY_DETECT_DEPRECATIONS: 1
+ run: yarn lint:js
diff --git a/tsconfig.json b/tsconfig.json
index 11fe76460096e3..5642318c15259e 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -4,6 +4,7 @@
"allowJs": true
},
"include": [
+ ".eslintrc.js",
"static/app",
"tests/js",
"fixtures/js-stubs",
|
f2b7cccf51b846dcef95f48e14d38191260c0f98
|
2022-10-19 22:04:12
|
Cathy Teng
|
fix(alerts): show correct spend allocation alert setting (#40213)
| false
|
show correct spend allocation alert setting (#40213)
|
fix
|
diff --git a/static/app/views/settings/account/notifications/notificationSettingsByType.tsx b/static/app/views/settings/account/notifications/notificationSettingsByType.tsx
index 249aed6011127f..2f3c5365f7772e 100644
--- a/static/app/views/settings/account/notifications/notificationSettingsByType.tsx
+++ b/static/app/views/settings/account/notifications/notificationSettingsByType.tsx
@@ -51,7 +51,13 @@ type State = {
} & AsyncComponent['state'];
const typeMappedChildren = {
- quota: ['quotaErrors', 'quotaTransactions', 'quotaAttachments', 'quotaWarnings'],
+ quota: [
+ 'quotaErrors',
+ 'quotaTransactions',
+ 'quotaAttachments',
+ 'quotaWarnings',
+ 'quotaSpendAllocations',
+ ],
};
const getQueryParams = (notificationType: string) => {
|
b4ba5f1dc79c58b716cb2c4c401eb253c67d7606
|
2022-10-11 03:35:36
|
Evan Purkhiser
|
test(js): Convert FormSource to RTL (#39843)
| false
|
Convert FormSource to RTL (#39843)
|
test
|
diff --git a/static/app/components/search/sources/formSource.spec.jsx b/static/app/components/search/sources/formSource.spec.jsx
index 60bc196897bc84..2ff76037f46b23 100644
--- a/static/app/components/search/sources/formSource.spec.jsx
+++ b/static/app/components/search/sources/formSource.spec.jsx
@@ -1,11 +1,10 @@
-import {mountWithTheme} from 'sentry-test/enzyme';
+import {render, waitFor} from 'sentry-test/reactTestingLibrary';
import * as ActionCreators from 'sentry/actionCreators/formSearch';
import FormSource from 'sentry/components/search/sources/formSource';
import FormSearchStore from 'sentry/stores/formSearchStore';
describe('FormSource', function () {
- let wrapper;
const searchMap = [
{
title: 'Test Field',
@@ -41,43 +40,42 @@ describe('FormSource', function () {
it('can find a form field', async function () {
const mock = jest.fn().mockReturnValue(null);
- wrapper = mountWithTheme(<FormSource query="te">{mock}</FormSource>);
+ render(<FormSource query="te">{mock}</FormSource>);
- await tick();
- await tick();
- wrapper.update();
- expect(mock).toHaveBeenLastCalledWith(
- expect.objectContaining({
- results: [
- expect.objectContaining({
- item: {
- field: {
- label: 'Test Field',
- name: 'test-field',
- help: 'test-help',
+ await waitFor(() =>
+ expect(mock).toHaveBeenLastCalledWith(
+ expect.objectContaining({
+ results: [
+ expect.objectContaining({
+ item: {
+ field: {
+ label: 'Test Field',
+ name: 'test-field',
+ help: 'test-help',
+ },
+ title: 'Test Field',
+ description: 'test-help',
+ route: '/route/',
+ resultType: 'field',
+ sourceType: 'field',
+ to: '/route/#test-field',
},
- title: 'Test Field',
- description: 'test-help',
- route: '/route/',
- resultType: 'field',
- sourceType: 'field',
- to: '/route/#test-field',
- },
- }),
- ],
- })
+ }),
+ ],
+ })
+ )
);
});
it('does not find any form field', async function () {
const mock = jest.fn().mockReturnValue(null);
- wrapper = mountWithTheme(<FormSource query="invalid">{mock}</FormSource>);
+ render(<FormSource query="invalid">{mock}</FormSource>);
- await tick();
- wrapper.update();
- expect(mock).toHaveBeenCalledWith({
- isLoading: false,
- results: [],
- });
+ await waitFor(() =>
+ expect(mock).toHaveBeenCalledWith({
+ isLoading: false,
+ results: [],
+ })
+ );
});
});
|
001bdb17f0b3e2d55ad63d431c4f7f7fedbc0faa
|
2025-03-12 01:30:40
|
Michelle Zhang
|
fix(replays): allow env filtering on selector endpoint (#86550)
| false
|
allow env filtering on selector endpoint (#86550)
|
fix
|
diff --git a/src/sentry/replays/blueprints/api.md b/src/sentry/replays/blueprints/api.md
index 3df4cbaa5396c6..03e58d4b06d019 100644
--- a/src/sentry/replays/blueprints/api.md
+++ b/src/sentry/replays/blueprints/api.md
@@ -266,6 +266,7 @@ Deletes a replay instance.
- w
- start (optional, string) - ISO 8601 format (`YYYY-MM-DDTHH:mm:ss.sssZ`)
- end (optional, string) - ISO 8601 format. Required if `start` is set.
+ - environment (optional, string)
- per_page (optional, number)
Default: 10
- offset (optional, number)
diff --git a/src/sentry/replays/endpoints/organization_replay_selector_index.py b/src/sentry/replays/endpoints/organization_replay_selector_index.py
index 8ca259004b7895..087c8a028a5a2b 100644
--- a/src/sentry/replays/endpoints/organization_replay_selector_index.py
+++ b/src/sentry/replays/endpoints/organization_replay_selector_index.py
@@ -137,6 +137,7 @@ def data_fn(offset, limit):
start=filter_params["start"],
end=filter_params["end"],
sort=filter_params.get("sort"),
+ environment=filter_params.get("environment"),
limit=limit,
offset=offset,
search_filters=search_filters,
@@ -157,6 +158,7 @@ def query_selector_collection(
sort: str | None,
limit: str | None,
offset: str | None,
+ environment: list[str],
search_filters: list[Condition],
organization: Organization,
) -> dict:
@@ -173,6 +175,7 @@ def query_selector_collection(
start=start,
end=end,
search_filters=search_filters,
+ environment=environment,
pagination=paginators,
sort=sort,
tenant_ids=tenant_ids,
@@ -185,6 +188,7 @@ def query_selector_dataset(
start: datetime,
end: datetime,
search_filters: list[SearchFilter | ParenExpression | str],
+ environment: list[str],
pagination: Paginators | None,
sort: str | None,
tenant_ids: dict[str, Any] | None = None,
@@ -229,6 +233,27 @@ def query_selector_dataset(
num_rows = result["data"][0]["count(replay_id)"]
sample_rate = (num_rows // 1_000_000) + 1
+ where_conditions = [
+ Condition(Column("project_id"), Op.IN, project_ids),
+ Condition(Column("timestamp"), Op.LT, end),
+ Condition(Column("timestamp"), Op.GTE, start),
+ Condition(Column("click_tag"), Op.NEQ, ""),
+ Condition(
+ Function(
+ "modulo",
+ parameters=[
+ Function("cityHash64", parameters=[Column("replay_id")]),
+ sample_rate,
+ ],
+ ),
+ Op.EQ,
+ 0,
+ ),
+ ]
+
+ if environment:
+ where_conditions.append(Condition(Column("environment"), Op.IN, environment))
+
snuba_request = SnubaRequest(
dataset="replays",
app_id="replay-backend-web",
@@ -258,23 +283,7 @@ def query_selector_dataset(
Function("sum", parameters=[Column("click_is_dead")], alias="count_dead_clicks"),
Function("sum", parameters=[Column("click_is_rage")], alias="count_rage_clicks"),
],
- where=[
- Condition(Column("project_id"), Op.IN, project_ids),
- Condition(Column("timestamp"), Op.LT, end),
- Condition(Column("timestamp"), Op.GTE, start),
- Condition(Column("click_tag"), Op.NEQ, ""),
- Condition(
- Function(
- "modulo",
- parameters=[
- Function("cityHash64", parameters=[Column("replay_id")]),
- sample_rate,
- ],
- ),
- Op.EQ,
- 0,
- ),
- ],
+ where=where_conditions,
having=conditions,
orderby=sorting,
groupby=[
diff --git a/src/sentry/replays/testutils.py b/src/sentry/replays/testutils.py
index 1bb818fa58d721..ea243dfbcf5a12 100644
--- a/src/sentry/replays/testutils.py
+++ b/src/sentry/replays/testutils.py
@@ -238,6 +238,7 @@ def mock_replay_click(
{
"type": "replay_actions",
"replay_id": replay_id,
+ "environment": kwargs.pop("environment", "production"),
"clicks": [
{
"node_id": kwargs["node_id"],
diff --git a/tests/sentry/replays/test_organization_selector_index.py b/tests/sentry/replays/test_organization_selector_index.py
index dcaf4365b222f4..57565b8b763141 100644
--- a/tests/sentry/replays/test_organization_selector_index.py
+++ b/tests/sentry/replays/test_organization_selector_index.py
@@ -171,3 +171,99 @@ def test_get_replays_filter_clicks(self):
assert response.status_code == 200, query
response_data = response.json()
assert len(response_data["data"]) == 0, query
+
+ def test_get_click_filter_environment(self):
+ """Test that clicks can be filtered by environment."""
+ prod_env = self.create_environment(name="prod", project=self.project)
+ dev_env = self.create_environment(name="dev", project=self.project)
+ staging_env = self.create_environment(name="staging", project=self.project)
+
+ timestamp = datetime.datetime.now() - datetime.timedelta(hours=1)
+ replay_id_prod = uuid.uuid4().hex
+ replay_id_dev = uuid.uuid4().hex
+ replay_id_staging = uuid.uuid4().hex
+
+ self.store_replays(
+ mock_replay(timestamp, self.project.id, replay_id_prod, environment=prod_env.name)
+ )
+ self.store_replays(
+ mock_replay_click(
+ timestamp,
+ self.project.id,
+ replay_id_prod,
+ environment=prod_env.name,
+ node_id=1,
+ tag="div",
+ id="myid",
+ class_=["class1"],
+ is_dead=True,
+ is_rage=False,
+ )
+ )
+
+ self.store_replays(
+ mock_replay(timestamp, self.project.id, replay_id_dev, environment=dev_env.name)
+ )
+ self.store_replays(
+ mock_replay_click(
+ timestamp,
+ self.project.id,
+ replay_id_dev,
+ environment=dev_env.name,
+ node_id=1,
+ tag="div",
+ id="myid",
+ class_=["class1"],
+ is_dead=True,
+ is_rage=True,
+ )
+ )
+
+ self.store_replays(
+ mock_replay(timestamp, self.project.id, replay_id_staging, environment=staging_env.name)
+ )
+ self.store_replays(
+ mock_replay_click(
+ timestamp,
+ self.project.id,
+ replay_id_staging,
+ environment=staging_env.name,
+ node_id=1,
+ tag="div",
+ id="myid",
+ class_=["class1"],
+ is_dead=True,
+ is_rage=False,
+ )
+ )
+
+ with self.feature(REPLAYS_FEATURES):
+ # Test single environment
+ response = self.client.get(self.url + f"?environment={prod_env.name}")
+ assert response.status_code == 200
+ response_data = response.json()
+ assert len(response_data["data"]) == 1
+ assert response_data["data"][0]["count_dead_clicks"] == 1
+ assert response_data["data"][0]["count_rage_clicks"] == 0
+
+ # Test multiple environments
+ response = self.client.get(
+ self.url + f"?environment={prod_env.name}&environment={dev_env.name}"
+ )
+ assert response.status_code == 200
+ response_data = response.json()
+ assert len(response_data["data"]) == 1
+ assert response_data["data"][0]["count_dead_clicks"] == 2
+ assert response_data["data"][0]["count_rage_clicks"] == 1
+
+ # Test all environments
+ response = self.client.get(self.url)
+ assert response.status_code == 200
+ response_data = response.json()
+ assert len(response_data["data"]) == 1
+ assert response_data["data"][0]["count_dead_clicks"] == 3
+ assert response_data["data"][0]["count_rage_clicks"] == 1
+
+ # Test non-existent environment
+ response = self.client.get(self.url + "?environment=nonexistent")
+ assert response.status_code == 404
|
9d70d169122b95bf4708b3d30f7896f478b4dc7f
|
2023-11-02 05:36:19
|
Scott Cooper
|
perf(issues): Move annotated text useProjects into subcomponent (#59246)
| false
|
Move annotated text useProjects into subcomponent (#59246)
|
perf
|
diff --git a/static/app/components/events/meta/annotatedText/annotatedTextValue.tsx b/static/app/components/events/meta/annotatedText/annotatedTextValue.tsx
index 2d2ada84fce24b..76790b5eb09f1f 100644
--- a/static/app/components/events/meta/annotatedText/annotatedTextValue.tsx
+++ b/static/app/components/events/meta/annotatedText/annotatedTextValue.tsx
@@ -1,7 +1,9 @@
import styled from '@emotion/styled';
import {Tooltip} from 'sentry/components/tooltip';
-import {Organization, Project} from 'sentry/types';
+import {useLocation} from 'sentry/utils/useLocation';
+import useOrganization from 'sentry/utils/useOrganization';
+import useProjects from 'sentry/utils/useProjects';
import {Redaction} from './redaction';
import {getTooltipText} from './utils';
@@ -10,11 +12,31 @@ import {ValueElement} from './valueElement';
type Props = {
value: React.ReactNode;
meta?: Record<any, any>;
- organization?: Organization;
- project?: Project;
};
-export function AnnotatedTextValue({value, meta, organization, project}: Props) {
+function RemovedAnnotatedTextValue({value, meta}: Required<Props>) {
+ const organization = useOrganization();
+ const location = useLocation();
+ const projectId = location.query.project;
+ const {projects} = useProjects();
+ const currentProject = projects.find(project => project.id === projectId);
+
+ return (
+ <Tooltip
+ title={getTooltipText({
+ rule_id: meta.rem[0][0],
+ remark: meta.rem[0][1],
+ organization,
+ project: currentProject,
+ })}
+ isHoverable
+ >
+ <ValueElement value={value} meta={meta} />
+ </Tooltip>
+ );
+}
+
+export function AnnotatedTextValue({value, meta}: Props) {
if (meta?.chunks?.length && meta.chunks.length > 1) {
return (
<ChunksSpan>
@@ -38,19 +60,7 @@ export function AnnotatedTextValue({value, meta, organization, project}: Props)
}
if (meta?.rem?.length) {
- return (
- <Tooltip
- title={getTooltipText({
- rule_id: meta.rem[0][0],
- remark: meta.rem[0][1],
- organization,
- project,
- })}
- isHoverable
- >
- <ValueElement value={value} meta={meta} />
- </Tooltip>
- );
+ return <RemovedAnnotatedTextValue value={value} meta={meta} />;
}
return <ValueElement value={value} meta={meta} />;
diff --git a/static/app/components/events/meta/annotatedText/index.tsx b/static/app/components/events/meta/annotatedText/index.tsx
index 327a43d687a01f..c35ad96afa07b4 100644
--- a/static/app/components/events/meta/annotatedText/index.tsx
+++ b/static/app/components/events/meta/annotatedText/index.tsx
@@ -1,7 +1,3 @@
-import {useLocation} from 'sentry/utils/useLocation';
-import useOrganization from 'sentry/utils/useOrganization';
-import useProjects from 'sentry/utils/useProjects';
-
import {AnnotatedTextErrors} from './annotatedTextErrors';
import {AnnotatedTextValue} from './annotatedTextValue';
@@ -12,20 +8,9 @@ type Props = {
};
export function AnnotatedText({value, meta, className, ...props}: Props) {
- const organization = useOrganization();
- const location = useLocation();
- const projectId = location.query.project;
- const {projects} = useProjects();
- const currentProject = projects.find(project => project.id === projectId);
-
return (
<span className={className} {...props}>
- <AnnotatedTextValue
- value={value}
- meta={meta}
- project={currentProject}
- organization={organization}
- />
+ <AnnotatedTextValue value={value} meta={meta} />
<AnnotatedTextErrors errors={meta?.err} />
</span>
);
|
dbf524c7b6ce8e27ebb5d07c18a85cd12b76040e
|
2024-05-08 04:28:22
|
Seiji Chew
|
fix(ui): Revert to using project release commmit API (#70485)
| false
|
Revert to using project release commmit API (#70485)
|
fix
|
diff --git a/static/app/views/releases/detail/commitsAndFiles/commits.spec.tsx b/static/app/views/releases/detail/commitsAndFiles/commits.spec.tsx
index bf0cd4e4cad276..c5da72862783be 100644
--- a/static/app/views/releases/detail/commitsAndFiles/commits.spec.tsx
+++ b/static/app/views/releases/detail/commitsAndFiles/commits.spec.tsx
@@ -68,7 +68,7 @@ describe('Commits', () => {
body: repos,
});
MockApiClient.addMockResponse({
- url: `/organizations/org-slug/releases/${encodeURIComponent(
+ url: `/projects/org-slug/project-slug/releases/${encodeURIComponent(
release.version
)}/commits/`,
body: [],
@@ -85,7 +85,7 @@ describe('Commits', () => {
body: repos,
});
MockApiClient.addMockResponse({
- url: `/organizations/org-slug/releases/${encodeURIComponent(
+ url: `/projects/org-slug/project-slug/releases/${encodeURIComponent(
release.version
)}/commits/`,
body: [CommitFixture()],
@@ -112,7 +112,7 @@ describe('Commits', () => {
],
});
MockApiClient.addMockResponse({
- url: `/organizations/org-slug/releases/${encodeURIComponent(
+ url: `/projects/org-slug/project-slug/releases/${encodeURIComponent(
release.version
)}/commits/`,
body: [CommitFixture()],
@@ -146,7 +146,7 @@ describe('Commits', () => {
body: [repos[0]!, otherRepo],
});
MockApiClient.addMockResponse({
- url: `/organizations/org-slug/releases/${encodeURIComponent(
+ url: `/projects/org-slug/project-slug/releases/${encodeURIComponent(
release.version
)}/commits/`,
body: [
diff --git a/static/app/views/releases/detail/commitsAndFiles/commits.tsx b/static/app/views/releases/detail/commitsAndFiles/commits.tsx
index 2377987dbd1c4f..c8c24dbae7d689 100644
--- a/static/app/views/releases/detail/commitsAndFiles/commits.tsx
+++ b/static/app/views/releases/detail/commitsAndFiles/commits.tsx
@@ -49,7 +49,7 @@ function Commits({activeReleaseRepo, releaseRepos, projectSlug}: CommitsProps) {
getResponseHeader,
} = useApiQuery<Commit[]>(
[
- `/organizations/${organization.slug}/releases/${encodeURIComponent(
+ `/projects/${organization.slug}/${projectSlug}/releases/${encodeURIComponent(
params.release
)}/commits/`,
{query},
@@ -58,7 +58,6 @@ function Commits({activeReleaseRepo, releaseRepos, projectSlug}: CommitsProps) {
staleTime: Infinity,
}
);
-
const commitsByRepository = getCommitsByRepository(commitList);
const reposToRender = getReposToRender(Object.keys(commitsByRepository));
const activeRepoName: string | undefined = activeReleaseRepo
|
eae768002dd6c9e0bfb15dff8610582b0a848c81
|
2022-11-09 21:29:01
|
Francesco Vigliaturo
|
fix(profiling): Fix stack (frame indices) regression (#41171)
| false
|
Fix stack (frame indices) regression (#41171)
|
fix
|
diff --git a/src/sentry/profiles/task.py b/src/sentry/profiles/task.py
index 61c7ce7f55c30a..9c6464c85087d8 100644
--- a/src/sentry/profiles/task.py
+++ b/src/sentry/profiles/task.py
@@ -304,9 +304,28 @@ def truncate_stack_needed(
) -> List[Any]:
return stack
+ if profile["platform"] in SHOULD_SYMBOLICATE:
+ idx_map = get_frame_index_map(profile["profile"]["frames"])
+
+ def get_stack(stack: List[int]) -> List[int]:
+ new_stack: List[int] = []
+ for index in stack:
+ # the new stack extends the older by replacing
+ # a specific frame index with the indices of
+ # the frames originated from the original frame
+ # should inlines be present
+ new_stack.extend(idx_map[index])
+ return new_stack
+
+ else:
+
+ def get_stack(stack: List[int]) -> List[int]:
+ return stack
+
for sample in profile["profile"]["samples"]:
stack_id = sample["stack_id"]
- stack = profile["profile"]["stacks"][stack_id]
+ stack = get_stack(profile["profile"]["stacks"][stack_id])
+ profile["profile"]["stacks"][stack_id] = stack
if len(stack) < 2:
continue
@@ -346,6 +365,46 @@ def _process_symbolicator_results_for_rust(profile: Profile, stacktraces: List[A
original["frames"] = symbolicated["frames"]
+"""
+This function returns a map {index: [indexes]} that will let us replace a specific
+frame index with (potentially) a list of frames indices that originated from that frame.
+
+The reason for this is that the frame from the SDK exists "physically",
+and symbolicator then synthesizes other frames for calls that have been inlined
+into the physical frame.
+
+Example:
+
+`
+fn a() {
+b()
+}
+fb b() {
+fn c_inlined() {}
+c_inlined()
+}
+`
+
+this would yield the following from the SDK:
+b -> a
+
+after symbolication you would have:
+c_inlined -> b -> a
+
+The sorting order is callee to caller (child to parent)
+"""
+
+
+def get_frame_index_map(frames: List[dict[str, Any]]) -> dict[int, List[int]]:
+ index_map: dict[int, List[int]] = {}
+ for i, frame in enumerate(frames):
+ original_idx = frame["original_index"]
+ idx_list = index_map.get(original_idx, [])
+ idx_list.append(i)
+ index_map[original_idx] = idx_list
+ return index_map
+
+
@metrics.wraps("process_profile.deobfuscate")
def _deobfuscate(profile: Profile, project: Project) -> None:
debug_file_id = profile.get("build_id")
|
e22733124424f767b8f433eb4633820d17ba0368
|
2019-09-02 19:38:36
|
Markus Unterwaditzer
|
fix: Update email snapshots (#14555)
| false
|
Update email snapshots (#14555)
|
fix
|
diff --git a/requirements-base.txt b/requirements-base.txt
index d39f2688daf60a..644bb7c1c70540 100644
--- a/requirements-base.txt
+++ b/requirements-base.txt
@@ -56,7 +56,7 @@ redis>=2.10.3,<2.10.6
requests-oauthlib==0.3.3
requests[security]>=2.20.0,<2.21.0
selenium==3.141.0
-semaphore>=0.4.42,<0.5.0
+semaphore>=0.4.43,<0.5.0
sentry-sdk>=0.11.0
setproctitle>=1.1.7,<1.2.0
simplejson>=3.2.0,<3.9.0
diff --git a/tests/fixtures/emails/alert.txt b/tests/fixtures/emails/alert.txt
index 9291b961d4d361..fd917aad65d882 100644
--- a/tests/fixtures/emails/alert.txt
+++ b/tests/fixtures/emails/alert.txt
@@ -16,11 +16,11 @@ Tags
* browser = Chrome 28.0.1500
* browser.name = Chrome
+* client_os.name = Windows 8
* device = Other
* environment = prod
* level = error
* logger = javascript
-* os.name = Windows 8
* sentry:user = id:1
* url = http://example.com/foo
|
3a1ab6811b7ba698855f048513b1b1e60e036110
|
2024-10-02 00:42:35
|
Malachi Willey
|
chore(query-builder): Remove flag check for project details search (#78414)
| false
|
Remove flag check for project details search (#78414)
|
chore
|
diff --git a/static/app/views/projectDetail/projectFilters.spec.tsx b/static/app/views/projectDetail/projectFilters.spec.tsx
index 277ea201e5b0fc..4a590f6a35d518 100644
--- a/static/app/views/projectDetail/projectFilters.spec.tsx
+++ b/static/app/views/projectDetail/projectFilters.spec.tsx
@@ -1,5 +1,3 @@
-import {OrganizationFixture} from 'sentry-fixture/organization';
-
import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
import ProjectFilters from 'sentry/views/projectDetail/projectFilters';
@@ -36,37 +34,6 @@ describe('ProjectDetail > ProjectFilters', () => {
screen.getByPlaceholderText('Search by release version, build, package, or stage')
);
- // Should suggest all semver tags
- await screen.findByText('release');
- expect(screen.getByText('.build')).toBeInTheDocument();
- expect(screen.getByText('.package')).toBeInTheDocument();
- expect(screen.getByText('.stage')).toBeInTheDocument();
- expect(screen.getByText('.version')).toBeInTheDocument();
-
- await userEvent.paste('release.version:');
-
- await screen.findByText('[email protected]');
- });
-
- it('recommends semver search tag (new search)', async () => {
- render(
- <ProjectFilters
- query=""
- onSearch={onSearch}
- tagValueLoader={tagValueLoader}
- relativeDateOptions={{}}
- />,
- {
- organization: OrganizationFixture({
- features: ['search-query-builder-project-details'],
- }),
- }
- );
-
- await userEvent.click(
- screen.getByPlaceholderText('Search by release version, build, package, or stage')
- );
-
// Should suggest all semver tags
await screen.findByRole('option', {name: 'release'});
expect(screen.getByRole('option', {name: 'release.build'})).toBeInTheDocument();
diff --git a/static/app/views/projectDetail/projectFilters.tsx b/static/app/views/projectDetail/projectFilters.tsx
index 5bac57a3d1b4d6..abbbca86cf898e 100644
--- a/static/app/views/projectDetail/projectFilters.tsx
+++ b/static/app/views/projectDetail/projectFilters.tsx
@@ -5,12 +5,10 @@ import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
import {SearchQueryBuilder} from 'sentry/components/searchQueryBuilder';
-import SmartSearchBar from 'sentry/components/smartSearchBar';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Tag} from 'sentry/types/group';
import {SEMVER_TAGS} from 'sentry/utils/discover/fields';
-import useOrganization from 'sentry/utils/useOrganization';
import type {TagValueLoader} from '../issueList/types';
@@ -30,8 +28,6 @@ const SUPPORTED_TAGS = {
};
function ProjectFilters({query, relativeDateOptions, tagValueLoader, onSearch}: Props) {
- const organization = useOrganization();
-
const getTagValues = useCallback(
async (tag: Tag, currentQuery: string): Promise<string[]> => {
const values = await tagValueLoader(tag.key, currentQuery);
@@ -46,28 +42,15 @@ function ProjectFilters({query, relativeDateOptions, tagValueLoader, onSearch}:
<EnvironmentPageFilter />
<DatePageFilter relativeOptions={relativeDateOptions} />
</PageFilterBar>
- {organization.features.includes('search-query-builder-project-details') ? (
- <SearchQueryBuilder
- searchSource="project_filters"
- initialQuery={query ?? ''}
- placeholder={t('Search by release version, build, package, or stage')}
- filterKeys={SUPPORTED_TAGS}
- onSearch={onSearch}
- getTagValues={getTagValues}
- showUnsubmittedIndicator
- />
- ) : (
- <SmartSearchBar
- searchSource="project_filters"
- query={query}
- placeholder={t('Search by release version, build, package, or stage')}
- hasRecentSearches={false}
- supportedTags={SUPPORTED_TAGS}
- maxMenuHeight={500}
- onSearch={onSearch}
- onGetTagValues={getTagValues}
- />
- )}
+ <SearchQueryBuilder
+ searchSource="project_filters"
+ initialQuery={query ?? ''}
+ placeholder={t('Search by release version, build, package, or stage')}
+ filterKeys={SUPPORTED_TAGS}
+ onSearch={onSearch}
+ getTagValues={getTagValues}
+ showUnsubmittedIndicator
+ />
</FiltersWrapper>
);
}
|
35e2018f230b91b58ca320fc034614fb486b3955
|
2019-02-05 02:00:33
|
Chris Clark
|
feat(global-header): clear time period button (#11853)
| false
|
clear time period button (#11853)
|
feat
|
diff --git a/src/sentry/static/sentry/app/components/organizations/timeRangeSelector/index.jsx b/src/sentry/static/sentry/app/components/organizations/timeRangeSelector/index.jsx
index 7f28ea5e7bdbd0..c86277fc9daee6 100644
--- a/src/sentry/static/sentry/app/components/organizations/timeRangeSelector/index.jsx
+++ b/src/sentry/static/sentry/app/components/organizations/timeRangeSelector/index.jsx
@@ -143,6 +143,18 @@ class TimeRangeSelector extends React.PureComponent {
this.handleUpdate(newDateTime);
};
+ handleClear = () => {
+ const {onChange} = this.props;
+ const newDateTime = {
+ relative: DEFAULT_STATS_PERIOD,
+ start: null,
+ end: null,
+ utc: this.state.utc,
+ };
+ callIfFunction(onChange, newDateTime);
+ this.handleUpdate(newDateTime);
+ };
+
handleSelectDateRange = ({start, end}) => {
const {onChange} = this.props;
@@ -209,9 +221,10 @@ class TimeRangeSelector extends React.PureComponent {
<StyledHeaderItem
icon={<StyledInlineSvg src="icon-calendar" />}
isOpen={isOpen}
- hasSelected={true}
+ hasSelected={this.props.relative !== DEFAULT_STATS_PERIOD}
hasChanges={this.state.hasChanges}
- allowClear={false}
+ onClear={this.handleClear}
+ allowClear={true}
onSubmit={this.handleCloseMenu}
{...getActorProps({isStyled: true})}
>
diff --git a/tests/js/spec/views/userFeedback/__snapshots__/organizationUserFeedback.spec.jsx.snap b/tests/js/spec/views/userFeedback/__snapshots__/organizationUserFeedback.spec.jsx.snap
index 06e11b9cb4c0f7..2fb9dad230d6e3 100644
--- a/tests/js/spec/views/userFeedback/__snapshots__/organizationUserFeedback.spec.jsx.snap
+++ b/tests/js/spec/views/userFeedback/__snapshots__/organizationUserFeedback.spec.jsx.snap
@@ -1421,9 +1421,9 @@ exports[`OrganizationUserFeedback renders 1`] = `
className="css-1lz3nth-TimeRangeRoot e1u8612l0"
>
<StyledHeaderItem
- allowClear={false}
+ allowClear={true}
hasChanges={false}
- hasSelected={true}
+ hasSelected={false}
icon={
<StyledInlineSvg
src="icon-calendar"
@@ -1431,6 +1431,7 @@ exports[`OrganizationUserFeedback renders 1`] = `
}
innerRef={[Function]}
isOpen={false}
+ onClear={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
onMouseEnter={[Function]}
@@ -1444,16 +1445,17 @@ exports[`OrganizationUserFeedback renders 1`] = `
tabIndex={-1}
>
<ForwardRef
- allowClear={false}
+ allowClear={true}
className="css-22y332-StyledHeaderItem e1u8612l1"
hasChanges={false}
- hasSelected={true}
+ hasSelected={false}
icon={
<StyledInlineSvg
src="icon-calendar"
/>
}
isOpen={false}
+ onClear={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
onMouseEnter={[Function]}
@@ -1467,10 +1469,10 @@ exports[`OrganizationUserFeedback renders 1`] = `
tabIndex={-1}
>
<HeaderItem
- allowClear={false}
+ allowClear={true}
className="css-22y332-StyledHeaderItem e1u8612l1"
hasChanges={false}
- hasSelected={true}
+ hasSelected={false}
icon={
<StyledInlineSvg
src="icon-calendar"
@@ -1478,6 +1480,7 @@ exports[`OrganizationUserFeedback renders 1`] = `
}
innerRef={[Function]}
isOpen={false}
+ onClear={[Function]}
onClick={[Function]}
onKeyDown={[Function]}
onMouseEnter={[Function]}
@@ -1492,7 +1495,7 @@ exports[`OrganizationUserFeedback renders 1`] = `
>
<StyledHeaderItem
className="css-22y332-StyledHeaderItem e1u8612l1"
- hasSelected={true}
+ hasSelected={false}
innerRef={[Function]}
isOpen={false}
onClick={[Function]}
@@ -1507,7 +1510,7 @@ exports[`OrganizationUserFeedback renders 1`] = `
tabIndex={-1}
>
<div
- className="e1u8612l1 css-xvcre7-StyledHeaderItem-StyledHeaderItem enk2k7v0"
+ className="e1u8612l1 css-1v6igws-StyledHeaderItem-StyledHeaderItem enk2k7v0"
onClick={[Function]}
onKeyDown={[Function]}
onMouseEnter={[Function]}
@@ -1520,10 +1523,10 @@ exports[`OrganizationUserFeedback renders 1`] = `
tabIndex={-1}
>
<IconContainer
- hasSelected={true}
+ hasSelected={false}
>
<span
- className="css-mzutvw-IconContainer enk2k7v2"
+ className="css-1af7peg-IconContainer enk2k7v2"
>
<StyledInlineSvg
src="icon-calendar"
|
e6f52f2fcdacda84594031b78725ab50c3785092
|
2024-09-17 00:21:48
|
anthony sottile
|
ref: optimize DelegatedBySiloMode by avoiding locking in the normal case (#77573)
| false
|
optimize DelegatedBySiloMode by avoiding locking in the normal case (#77573)
|
ref
|
diff --git a/src/sentry/hybridcloud/rpc/__init__.py b/src/sentry/hybridcloud/rpc/__init__.py
index 330ef4087a3937..926558f7b44ce6 100644
--- a/src/sentry/hybridcloud/rpc/__init__.py
+++ b/src/sentry/hybridcloud/rpc/__init__.py
@@ -1,10 +1,9 @@
from __future__ import annotations
-import contextlib
import datetime
import logging
import threading
-from collections.abc import Callable, Generator, Iterable, Mapping
+from collections.abc import Callable, Iterable, Mapping
from enum import Enum
from typing import Any, Generic, Protocol, Self, TypeVar, cast
@@ -118,39 +117,27 @@ class DelegatedBySiloMode(Generic[ServiceInterface]):
service is closed, or when the backing service implementation changes.
"""
- _constructors: Mapping[SiloMode, Callable[[], ServiceInterface]]
- _singleton: dict[SiloMode, ServiceInterface | None]
- _lock: threading.RLock
-
def __init__(self, mapping: Mapping[SiloMode, Callable[[], ServiceInterface]]):
self._constructors = mapping
- self._singleton = {}
+ self._singleton: dict[SiloMode, ServiceInterface] = {}
self._lock = threading.RLock()
- @contextlib.contextmanager
- def with_replacement(
- self, service: ServiceInterface | None, silo_mode: SiloMode
- ) -> Generator[None]:
- with self._lock:
- prev = self._singleton.get(silo_mode, None)
- self._singleton[silo_mode] = service
- try:
- yield
- finally:
- with self._lock:
- self._singleton[silo_mode] = prev
-
def __getattr__(self, item: str) -> Any:
cur_mode = SiloMode.get_current_mode()
- with self._lock:
- if impl := self._singleton.get(cur_mode, None):
- return getattr(impl, item)
- if con := self._constructors.get(cur_mode, None):
- self._singleton[cur_mode] = inst = con()
- return getattr(inst, item)
+ try:
+ # fast path: object already built
+ impl = self._singleton[cur_mode]
+ except KeyError:
+ # slow path: only lock when building the object
+ with self._lock:
+ # another thread may have won the race to build the object
+ try:
+ impl = self._singleton[cur_mode]
+ except KeyError:
+ impl = self._singleton[cur_mode] = self._constructors[cur_mode]()
- raise KeyError(f"No implementation found for {cur_mode}.")
+ return getattr(impl, item)
class DelegatedByOpenTransaction(Generic[ServiceInterface]):
|
c0993d7f3a2e3c2670a73f22145d6a7cf49b86be
|
2024-01-10 00:46:28
|
David Wang
|
feat(crons): Trigger callback hook on monitor creation (#62850)
| false
|
Trigger callback hook on monitor creation (#62850)
|
feat
|
diff --git a/static/app/types/hooks.tsx b/static/app/types/hooks.tsx
index 4fd1e1310c8143..5e61b6844b2f64 100644
--- a/static/app/types/hooks.tsx
+++ b/static/app/types/hooks.tsx
@@ -147,6 +147,8 @@ type QualitativeIssueFeedbackProps = {
type GuideUpdateCallback = (nextGuide: Guide | null, opts: {dismissed?: boolean}) => void;
+type MonitorCreatedCallback = (organization: Organization) => void;
+
type SentryLogoProps = SVGIconProps & {
pride?: boolean;
};
@@ -317,6 +319,7 @@ export type ReactHooks = {
*/
type CallbackHooks = {
'callback:on-guide-update': GuideUpdateCallback;
+ 'callback:on-monitor-created': MonitorCreatedCallback;
};
/**
diff --git a/static/app/views/monitors/components/monitorCreateForm.tsx b/static/app/views/monitors/components/monitorCreateForm.tsx
index 80dfbbe42b6ca1..85c485dc0d2fd2 100644
--- a/static/app/views/monitors/components/monitorCreateForm.tsx
+++ b/static/app/views/monitors/components/monitorCreateForm.tsx
@@ -14,6 +14,7 @@ import Panel from 'sentry/components/panels/panel';
import PanelBody from 'sentry/components/panels/panelBody';
import {timezoneOptions} from 'sentry/data/timezones';
import {t} from 'sentry/locale';
+import HookStore from 'sentry/stores/hookStore';
import {space} from 'sentry/styles/space';
import {isActiveSuperuser} from 'sentry/utils/isActiveSuperuser';
import commonTheme from 'sentry/utils/theme';
@@ -42,6 +43,7 @@ export default function MonitorCreateForm() {
const organization = useOrganization();
const {projects} = useProjects();
const {selection} = usePageFilters();
+ const monitorCreationCallbacks = HookStore.get('callback:on-monitor-created');
const form = useRef(
new FormModel({
@@ -71,6 +73,7 @@ export default function MonitorCreateForm() {
query: endpointOptions.query,
})
);
+ monitorCreationCallbacks.map(cb => cb(organization));
}
function changeScheduleType(type: ScheduleType) {
diff --git a/static/app/views/monitors/create.tsx b/static/app/views/monitors/create.tsx
index 4a4b0ec0fcd41d..79df65d87160a1 100644
--- a/static/app/views/monitors/create.tsx
+++ b/static/app/views/monitors/create.tsx
@@ -5,6 +5,7 @@ import {Breadcrumbs} from 'sentry/components/breadcrumbs';
import FeedbackWidgetButton from 'sentry/components/feedback/widget/feedbackWidgetButton';
import * as Layout from 'sentry/components/layouts/thirds';
import {t} from 'sentry/locale';
+import HookStore from 'sentry/stores/hookStore';
import useOrganization from 'sentry/utils/useOrganization';
import usePageFilters from 'sentry/utils/usePageFilters';
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
@@ -13,9 +14,12 @@ import MonitorForm from './components/monitorForm';
import {Monitor} from './types';
function CreateMonitor() {
- const {slug: orgSlug} = useOrganization();
+ const organization = useOrganization();
+ const orgSlug = organization.slug;
const {selection} = usePageFilters();
+ const monitorCreationCallbacks = HookStore.get('callback:on-monitor-created');
+
function onSubmitSuccess(data: Monitor) {
const endpointOptions = {
query: {
@@ -29,6 +33,7 @@ function CreateMonitor() {
query: endpointOptions.query,
})
);
+ monitorCreationCallbacks.map(cb => cb(organization));
}
return (
|
43b187701ea8cd80bd162b1e64ee6bc0d999b87d
|
2020-11-06 15:15:50
|
Markus Unterwaditzer
|
fix(native): Do not crash when arch is missing for applecrashreport (#21783)
| false
|
Do not crash when arch is missing for applecrashreport (#21783)
|
fix
|
diff --git a/src/sentry/lang/native/applecrashreport.py b/src/sentry/lang/native/applecrashreport.py
index fd7fbe278fe8d9..ac40b76165cda4 100644
--- a/src/sentry/lang/native/applecrashreport.py
+++ b/src/sentry/lang/native/applecrashreport.py
@@ -175,7 +175,7 @@ def _convert_debug_meta_to_binary_image_row(self, debug_image):
hex(image_addr),
hex(image_addr + debug_image["image_size"] - 1),
image_name(debug_image.get("code_file") or NATIVE_UNKNOWN_STRING),
- self.context["device"]["arch"],
+ get_path(self.context, "device", "arch") or NATIVE_UNKNOWN_STRING,
debug_image.get("debug_id").replace("-", "").lower(),
debug_image.get("code_file") or NATIVE_UNKNOWN_STRING,
)
|
fe53e4680df3f8f6e69fb2a0b50ece2a08a34b14
|
2022-09-28 01:35:37
|
UTKARSH ANAND
|
fix(avatarChooser): Handle submit without selecting file #38190 (#38191)
| false
|
Handle submit without selecting file #38190 (#38191)
|
fix
|
diff --git a/static/app/components/avatarChooser.tsx b/static/app/components/avatarChooser.tsx
index b86441833523f8..4ac1bcac100c82 100644
--- a/static/app/components/avatarChooser.tsx
+++ b/static/app/components/avatarChooser.tsx
@@ -169,7 +169,7 @@ class AvatarChooser extends Component<Props, State> {
help,
defaultChoice,
} = this.props;
- const {hasError, model} = this.state;
+ const {hasError, model, dataUrl} = this.state;
if (hasError) {
return <LoadingError />;
@@ -249,7 +249,7 @@ class AvatarChooser extends Component<Props, State> {
type="button"
priority="primary"
onClick={this.handleSaveSettings}
- disabled={disabled}
+ disabled={disabled || (avatarType === 'upload' && !dataUrl)}
>
{t('Save Avatar')}
</Button>
|
0e61c3ce0e5e681bbe4ca3b34402d3ba8c10481f
|
2019-05-28 23:27:10
|
Billy Vong
|
feat(ui): Add component to render Incident status changes (#13375)
| false
|
Add component to render Incident status changes (#13375)
|
feat
|
diff --git a/src/sentry/static/sentry/app/actionCreators/incident.jsx b/src/sentry/static/sentry/app/actionCreators/incident.jsx
index 3d2ebf116b96d8..e2f84495b88067 100644
--- a/src/sentry/static/sentry/app/actionCreators/incident.jsx
+++ b/src/sentry/static/sentry/app/actionCreators/incident.jsx
@@ -54,8 +54,6 @@ export async function fetchIncidentActivities(api, orgId, incidentId) {
* Creates a note for an incident
*/
export async function createIncidentNote(api, orgId, incidentId, note) {
- addLoadingMessage(t('Posting comment...'));
-
try {
const result = await api.requestPromise(
`/organizations/${orgId}/incidents/${incidentId}/comments/`,
@@ -67,8 +65,6 @@ export async function createIncidentNote(api, orgId, incidentId, note) {
}
);
- clearIndicators();
-
return result;
} catch (err) {
addErrorMessage(t('Unable to post comment'));
@@ -80,8 +76,6 @@ export async function createIncidentNote(api, orgId, incidentId, note) {
* Deletes a note for an incident
*/
export async function deleteIncidentNote(api, orgId, incidentId, noteId) {
- addLoadingMessage(t('Removing comment...'));
-
try {
const result = await api.requestPromise(
`/organizations/${orgId}/incidents/${incidentId}/comments/${noteId}/`,
@@ -90,7 +84,6 @@ export async function deleteIncidentNote(api, orgId, incidentId, noteId) {
}
);
- clearIndicators();
return result;
} catch (err) {
addErrorMessage(t('Failed to delete comment'));
@@ -102,8 +95,6 @@ export async function deleteIncidentNote(api, orgId, incidentId, noteId) {
* Updates a note for an incident
*/
export async function updateIncidentNote(api, orgId, incidentId, noteId, note) {
- addLoadingMessage(t('Updating comment...'));
-
try {
const result = await api.requestPromise(
`/organizations/${orgId}/incidents/${incidentId}/comments/${noteId}/`,
diff --git a/src/sentry/static/sentry/app/views/organizationIncidents/details/activity.jsx b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/activity.jsx
similarity index 51%
rename from src/sentry/static/sentry/app/views/organizationIncidents/details/activity.jsx
rename to src/sentry/static/sentry/app/views/organizationIncidents/details/activity/activity.jsx
index 5aa24865ade096..bbb96fc5a624eb 100644
--- a/src/sentry/static/sentry/app/views/organizationIncidents/details/activity.jsx
+++ b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/activity.jsx
@@ -5,16 +5,8 @@ import moment from 'moment';
import styled from 'react-emotion';
import {INCIDENT_ACTIVITY_TYPE} from 'app/views/organizationIncidents/utils';
-import {
- createIncidentNote,
- deleteIncidentNote,
- fetchIncidentActivities,
- updateIncidentNote,
-} from 'app/actionCreators/incident';
import {t} from 'app/locale';
-import {uniqueId} from 'app/utils/guid';
import ActivityItem from 'app/components/activity/item';
-import ConfigStore from 'app/stores/configStore';
import ErrorBoundary from 'app/components/errorBoundary';
import LoadingError from 'app/components/loadingError';
import Note from 'app/components/activity/note';
@@ -22,14 +14,10 @@ import NoteInputWithStorage from 'app/components/activity/note/inputWithStorage'
import SentryTypes from 'app/sentryTypes';
import TimeSince from 'app/components/timeSince';
import space from 'app/styles/space';
-import withApi from 'app/utils/withApi';
import ActivityPlaceholder from './activityPlaceholder';
import DateDivider from './dateDivider';
-
-function makeDefaultErrorJson() {
- return {detail: t('Unknown error. Please try again.')};
-}
+import StatusItem from './statusItem';
/**
* Activity component on Incident Details view
@@ -44,6 +32,8 @@ class Activity extends React.Component {
error: PropTypes.bool,
me: SentryTypes.User,
activities: PropTypes.arrayOf(SentryTypes.IncidentActivity),
+ noteInputId: PropTypes.string,
+ noteInputProps: PropTypes.object,
createError: PropTypes.bool,
createBusy: PropTypes.bool,
@@ -70,6 +60,7 @@ class Activity extends React.Component {
me,
incidentId,
activities,
+ noteInputId,
createBusy,
createError,
createErrorJSON,
@@ -80,6 +71,7 @@ class Activity extends React.Component {
memberList: [],
teams: [],
minHeight: 80,
+ ...this.props.noteInputProps,
};
const activitiesByDate = groupBy(activities, ({dateCreated}) =>
moment(dateCreated).format('ll')
@@ -91,6 +83,7 @@ class Activity extends React.Component {
<ActivityItem author={{type: 'user', user: me}}>
{() => (
<NoteInputWithStorage
+ key={noteInputId}
storageKey="incidentIdinput"
itemKey={incidentId}
onCreate={onCreateNote}
@@ -151,18 +144,12 @@ class Activity extends React.Component {
</ErrorBoundary>
);
} else {
- // TODO(billy): This will change depending on the different
- // activity types we will have to support
return (
<ErrorBoundary mini key={`note-${activity.id}`}>
- <ActivityItem
+ <StatusItem
showTime
- item={activity}
- author={{
- type: activity.user ? 'user' : 'system',
- user: activity.user,
- }}
- date={activity.dateCreated}
+ authorName={authorName}
+ activity={activity}
/>
</ErrorBoundary>
);
@@ -176,167 +163,7 @@ class Activity extends React.Component {
}
}
-class ActivityContainer extends React.Component {
- static propTypes = {
- api: PropTypes.object.isRequired,
- };
-
- state = {
- loading: true,
- error: false,
- createBusy: false,
- createError: false,
- activities: null,
- };
-
- componentDidMount() {
- this.fetchData();
- }
-
- async fetchData() {
- const {api, params} = this.props;
- const {incidentId, orgId} = params;
-
- try {
- const activities = await fetchIncidentActivities(api, orgId, incidentId);
- this.setState({activities, loading: false});
- } catch (err) {
- this.setState({loading: false, error: !!err});
- }
- }
-
- handleCreateNote = async note => {
- const {api, params} = this.props;
- const {incidentId, orgId} = params;
-
- this.setState({
- createBusy: true,
- });
-
- const newActivity = {
- comment: note.text,
- type: INCIDENT_ACTIVITY_TYPE.COMMENT,
- dateCreated: new Date(),
- user: ConfigStore.get('user'),
- id: uniqueId(),
- incidentIdentifier: incidentId,
- };
-
- this.setState(state => ({
- createBusy: false,
-
- activities: [newActivity, ...(state.activities || [])],
- }));
-
- try {
- const newNote = await createIncidentNote(api, orgId, incidentId, note);
-
- this.setState(state => {
- const activities = [
- newNote,
- ...state.activities.filter(activity => activity !== newActivity),
- ];
-
- return {
- createBusy: false,
- activities,
- };
- });
- } catch (error) {
- this.setState(state => {
- const activities = state.activities.filter(activity => activity !== newActivity);
-
- return {
- activities,
- createBusy: false,
- createError: true,
- createErrorJSON: error.responseJSON || makeDefaultErrorJson(),
- };
- });
- }
- };
-
- getIndexAndActivityFromState = activity => {
- // `index` should probably be found, if not let error hit Sentry
- const index = this.state.activities.findIndex(({id}) => id === activity.id);
- return [index, this.state.activities[index]];
- };
-
- handleDeleteNote = async activity => {
- const {api, params} = this.props;
- const {incidentId, orgId} = params;
-
- const [index, oldActivity] = this.getIndexAndActivityFromState(activity);
-
- this.setState(state => ({
- activities: removeFromArrayIndex(state.activities, index),
- }));
-
- try {
- await deleteIncidentNote(api, orgId, incidentId, activity.id);
- } catch (error) {
- this.setState(state => ({
- activities: replaceAtArrayIndex(state.activities, index, oldActivity),
- }));
- }
- };
-
- handleUpdateNote = async (note, activity) => {
- const {api, params} = this.props;
- const {incidentId, orgId} = params;
-
- const [index, oldActivity] = this.getIndexAndActivityFromState(activity);
-
- this.setState(state => ({
- activities: replaceAtArrayIndex(state.activities, index, {
- ...oldActivity,
- comment: note.text,
- }),
- }));
-
- try {
- await updateIncidentNote(api, orgId, incidentId, activity.id, note);
- } catch (error) {
- this.setState(state => ({
- activities: replaceAtArrayIndex(state.activities, index, oldActivity),
- }));
- }
- };
-
- render() {
- const {api, params, ...props} = this.props;
- const {incidentId, orgId} = params;
- const me = ConfigStore.get('user');
-
- return (
- <Activity
- incidentId={incidentId}
- orgId={orgId}
- me={me}
- api={api}
- {...this.state}
- onCreateNote={this.handleCreateNote}
- onUpdateNote={this.handleUpdateNote}
- onDeleteNote={this.handleDeleteNote}
- {...props}
- />
- );
- }
-}
-
-export default withApi(ActivityContainer);
-
-function removeFromArrayIndex(array, index) {
- const newArray = [...array];
- newArray.splice(index, 1);
- return newArray;
-}
-
-function replaceAtArrayIndex(array, index, obj) {
- const newArray = [...array];
- newArray.splice(index, 1, obj);
- return newArray;
-}
+export default Activity;
const StyledTimeSince = styled(TimeSince)`
color: ${p => p.theme.gray2};
diff --git a/src/sentry/static/sentry/app/views/organizationIncidents/details/activityPlaceholder.jsx b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/activityPlaceholder.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/organizationIncidents/details/activityPlaceholder.jsx
rename to src/sentry/static/sentry/app/views/organizationIncidents/details/activity/activityPlaceholder.jsx
diff --git a/src/sentry/static/sentry/app/views/organizationIncidents/details/dateDivider.jsx b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/dateDivider.jsx
similarity index 100%
rename from src/sentry/static/sentry/app/views/organizationIncidents/details/dateDivider.jsx
rename to src/sentry/static/sentry/app/views/organizationIncidents/details/activity/dateDivider.jsx
diff --git a/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/index.jsx b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/index.jsx
new file mode 100644
index 00000000000000..a05bc783bcf2d8
--- /dev/null
+++ b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/index.jsx
@@ -0,0 +1,195 @@
+import PropTypes from 'prop-types';
+import React from 'react';
+
+import {INCIDENT_ACTIVITY_TYPE} from 'app/views/organizationIncidents/utils';
+import {
+ createIncidentNote,
+ deleteIncidentNote,
+ fetchIncidentActivities,
+ updateIncidentNote,
+} from 'app/actionCreators/incident';
+import {t} from 'app/locale';
+import {uniqueId} from 'app/utils/guid';
+import ConfigStore from 'app/stores/configStore';
+import withApi from 'app/utils/withApi';
+
+import Activity from './activity';
+
+function makeDefaultErrorJson() {
+ return {detail: t('Unknown error. Please try again.')};
+}
+
+/**
+ * Activity component on Incident Details view
+ * Allows user to leave a comment on an incidentId as well as
+ * fetch and render existing activity items.
+ */
+class ActivityContainer extends React.Component {
+ static propTypes = {
+ api: PropTypes.object.isRequired,
+ };
+
+ state = {
+ loading: true,
+ error: false,
+ noteInputId: uniqueId(),
+ noteInputText: '',
+ createBusy: false,
+ createError: false,
+ activities: null,
+ };
+
+ componentDidMount() {
+ this.fetchData();
+ }
+
+ async fetchData() {
+ const {api, params} = this.props;
+ const {incidentId, orgId} = params;
+
+ try {
+ const activities = await fetchIncidentActivities(api, orgId, incidentId);
+ this.setState({activities, loading: false});
+ } catch (err) {
+ this.setState({loading: false, error: !!err});
+ }
+ }
+
+ handleCreateNote = async note => {
+ const {api, params} = this.props;
+ const {incidentId, orgId} = params;
+
+ const newActivity = {
+ comment: note.text,
+ type: INCIDENT_ACTIVITY_TYPE.COMMENT,
+ dateCreated: new Date(),
+ user: ConfigStore.get('user'),
+ id: uniqueId(),
+ incidentIdentifier: incidentId,
+ };
+
+ this.setState(state => ({
+ createBusy: true,
+ // This is passed as a key to NoteInput that re-mounts
+ // (basically so we can reset text input to empty string)
+ noteInputId: uniqueId(),
+ activities: [newActivity, ...(state.activities || [])],
+ noteInputText: '',
+ }));
+
+ try {
+ const newNote = await createIncidentNote(api, orgId, incidentId, note);
+
+ this.setState(state => {
+ // Update activities to replace our fake new activity with activity object from server
+ const activities = [
+ newNote,
+ ...state.activities.filter(activity => activity !== newActivity),
+ ];
+
+ return {
+ createBusy: false,
+ activities,
+ };
+ });
+ } catch (error) {
+ this.setState(state => {
+ const activities = state.activities.filter(activity => activity !== newActivity);
+
+ return {
+ // We clear the textarea immediately when submitting, restore
+ // value when there has been an error
+ noteInputText: note.text,
+ activities,
+ createBusy: false,
+ createError: true,
+ createErrorJSON: error.responseJSON || makeDefaultErrorJson(),
+ };
+ });
+ }
+ };
+
+ getIndexAndActivityFromState = activity => {
+ // `index` should probably be found, if not let error hit Sentry
+ const index = this.state.activities.findIndex(({id}) => id === activity.id);
+ return [index, this.state.activities[index]];
+ };
+
+ handleDeleteNote = async activity => {
+ const {api, params} = this.props;
+ const {incidentId, orgId} = params;
+
+ const [index, oldActivity] = this.getIndexAndActivityFromState(activity);
+
+ this.setState(state => ({
+ activities: removeFromArrayIndex(state.activities, index),
+ }));
+
+ try {
+ await deleteIncidentNote(api, orgId, incidentId, activity.id);
+ } catch (error) {
+ this.setState(state => ({
+ activities: replaceAtArrayIndex(state.activities, index, oldActivity),
+ }));
+ }
+ };
+
+ handleUpdateNote = async (note, activity) => {
+ const {api, params} = this.props;
+ const {incidentId, orgId} = params;
+
+ const [index, oldActivity] = this.getIndexAndActivityFromState(activity);
+
+ this.setState(state => ({
+ activities: replaceAtArrayIndex(state.activities, index, {
+ ...oldActivity,
+ comment: note.text,
+ }),
+ }));
+
+ try {
+ await updateIncidentNote(api, orgId, incidentId, activity.id, note);
+ } catch (error) {
+ this.setState(state => ({
+ activities: replaceAtArrayIndex(state.activities, index, oldActivity),
+ }));
+ }
+ };
+
+ render() {
+ const {api, params, ...props} = this.props;
+ const {incidentId, orgId} = params;
+ const me = ConfigStore.get('user');
+
+ return (
+ <Activity
+ noteInputId={this.state.noteInputId}
+ incidentId={incidentId}
+ orgId={orgId}
+ me={me}
+ api={api}
+ noteProps={{
+ text: this.state.noteInputText,
+ }}
+ {...this.state}
+ onCreateNote={this.handleCreateNote}
+ onUpdateNote={this.handleUpdateNote}
+ onDeleteNote={this.handleDeleteNote}
+ {...props}
+ />
+ );
+ }
+}
+export default withApi(ActivityContainer);
+
+function removeFromArrayIndex(array, index) {
+ const newArray = [...array];
+ newArray.splice(index, 1);
+ return newArray;
+}
+
+function replaceAtArrayIndex(array, index, obj) {
+ const newArray = [...array];
+ newArray.splice(index, 1, obj);
+ return newArray;
+}
diff --git a/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/statusItem.jsx b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/statusItem.jsx
new file mode 100644
index 00000000000000..f7011e1ab3d354
--- /dev/null
+++ b/src/sentry/static/sentry/app/views/organizationIncidents/details/activity/statusItem.jsx
@@ -0,0 +1,75 @@
+import PropTypes from 'prop-types';
+import React from 'react';
+import styled from 'react-emotion';
+
+import {
+ INCIDENT_ACTIVITY_TYPE,
+ INCIDENT_STATUS,
+} from 'app/views/organizationIncidents/utils';
+import {t} from 'app/locale';
+import ActivityItem from 'app/components/activity/item';
+import Chart from 'app/views/organizationIncidents/details/chart';
+import SentryTypes from 'app/sentryTypes';
+
+/**
+ * StatusItem renders status changes for Incidents
+ *
+ * For example, incident created, detected, or closed
+ */
+class StatusItem extends React.Component {
+ static propTypes = {
+ activity: SentryTypes.IncidentActivity.isRequired,
+ authorName: PropTypes.string,
+ };
+
+ render() {
+ const {activity, authorName} = this.props;
+
+ const isCreated = activity.type === INCIDENT_ACTIVITY_TYPE.CREATED;
+ const isDetected = activity.type === INCIDENT_ACTIVITY_TYPE.DETECTED;
+ const isClosed =
+ activity.type === INCIDENT_ACTIVITY_TYPE.STATUS_CHANGE &&
+ activity.value == INCIDENT_STATUS.CLOSED;
+ const isReopened =
+ activity.type === INCIDENT_ACTIVITY_TYPE.STATUS_CHANGE &&
+ activity.value == INCIDENT_STATUS.CREATED &&
+ activity.previousValue == INCIDENT_STATUS.CLOSED;
+
+ // Unknown activity, don't render anything
+ if (!isCreated && !isDetected && !isClosed && !isReopened) {
+ return null;
+ }
+
+ return (
+ <ActivityItem
+ showTime
+ author={{
+ type: activity.user ? 'user' : 'system',
+ user: activity.user,
+ }}
+ header={
+ <div>
+ <AuthorName>{authorName}</AuthorName> {isCreated && t('created')}
+ {isDetected && t('detected')}
+ {isClosed && t('closed')}
+ {isReopened && t('re-opened')} {t('an Incident')}
+ </div>
+ }
+ date={activity.dateCreated}
+ >
+ {activity.eventStats && (
+ <Chart
+ data={activity.eventStats.data}
+ detected={(isCreated || isDetected) && activity.dateCreated}
+ />
+ )}
+ </ActivityItem>
+ );
+ }
+}
+
+export default StatusItem;
+
+const AuthorName = styled('span')`
+ font-weight: bold;
+`;
diff --git a/src/sentry/static/sentry/app/views/organizationIncidents/details/body.jsx b/src/sentry/static/sentry/app/views/organizationIncidents/details/body.jsx
index 35213e5ea7116f..a1860a7b51316d 100644
--- a/src/sentry/static/sentry/app/views/organizationIncidents/details/body.jsx
+++ b/src/sentry/static/sentry/app/views/organizationIncidents/details/body.jsx
@@ -1,12 +1,10 @@
import React from 'react';
-import moment from 'moment';
import styled from 'react-emotion';
import {PageContent} from 'app/styles/organization';
import {t} from 'app/locale';
-import LineChart from 'app/components/charts/lineChart';
+import Chart from 'app/views/organizationIncidents/details/chart';
import Link from 'app/components/links/link';
-import MarkPoint from 'app/components/charts/components/markPoint';
import NavTabs from 'app/components/navTabs';
import SeenByList from 'app/components/seenByList';
import SentryTypes from 'app/sentryTypes';
@@ -15,35 +13,11 @@ import theme from 'app/utils/theme';
import Activity from './activity';
import IncidentsSuspects from './suspects';
-import detectedSymbol from './detectedSymbol';
-import closedSymbol from './closedSymbol';
const TABS = {
activity: {name: t('Activity'), component: Activity},
};
-/**
- * So we'll have to see how this looks with real data, but echarts requires
- * an explicit (x,y) value to draw a symbol (incident detected/closed bubble).
- *
- * This uses the closest date *without* going over.
- *
- * AFAICT we can't give it an x-axis value and have it draw on the line,
- * so we probably need to calculate the y-axis value ourselves if we want it placed
- * at the exact time.
- */
-function getNearbyIndex(data, needle) {
- // `data` is sorted, return the first index whose value (timestamp) is > `needle`
- const index = data.findIndex(([ts]) => ts > needle);
-
- // this shouldn't happen, as we try to buffer dates before start/end dates
- if (index === 0) {
- return 0;
- }
-
- return index !== -1 ? index - 1 : data.length - 1;
-}
-
export default class DetailsBody extends React.Component {
static propTypes = {
incident: SentryTypes.Incident,
@@ -63,28 +37,6 @@ export default class DetailsBody extends React.Component {
const {activeTab} = this.state;
const ActiveComponent = TABS[activeTab].component;
- const chartData =
- incident &&
- incident.eventStats.data.map(([ts, val], i) => {
- return [
- ts * 1000,
- val.length ? val.reduce((acc, {count} = {count: 0}) => acc + count, 0) : 0,
- ];
- });
-
- const detectedTs = incident && moment.utc(incident.dateDetected).unix();
- const closedTs =
- incident && incident.dateClosed && moment.utc(incident.dateClosed).unix();
-
- const nearbyDetectedTimestampIndex =
- detectedTs && getNearbyIndex(incident.eventStats.data, detectedTs);
- const nearbyClosedTimestampIndex =
- closedTs && getNearbyIndex(incident.eventStats.data, closedTs);
-
- const detectedCoordinate = chartData && chartData[nearbyDetectedTimestampIndex];
- const closedCoordinate =
- chartData && closedTs && chartData[nearbyClosedTimestampIndex];
-
return (
<StyledPageContent>
<Main>
@@ -112,33 +64,10 @@ export default class DetailsBody extends React.Component {
<Sidebar>
<PageContent>
{incident && (
- <LineChart
- isGroupedByDate
- series={[
- {
- seriesName: t('Events'),
- dataArray: chartData,
- markPoint: MarkPoint({
- data: [
- {
- symbol: `image://${detectedSymbol}`,
- name: t('Incident Detected'),
- coord: detectedCoordinate,
- },
- ...(closedTs
- ? [
- {
- symbol: `image://${closedSymbol}`,
- symbolSize: 24,
- name: t('Incident Closed'),
- coord: closedCoordinate,
- },
- ]
- : []),
- ],
- }),
- },
- ]}
+ <Chart
+ data={incident.eventStats.data}
+ detected={incident.dateDetected}
+ closed={incident.dateClosed}
/>
)}
<IncidentsSuspects suspects={[]} />
diff --git a/src/sentry/static/sentry/app/views/organizationIncidents/details/chart.jsx b/src/sentry/static/sentry/app/views/organizationIncidents/details/chart.jsx
new file mode 100644
index 00000000000000..ff5fada2be62f7
--- /dev/null
+++ b/src/sentry/static/sentry/app/views/organizationIncidents/details/chart.jsx
@@ -0,0 +1,91 @@
+import PropTypes from 'prop-types';
+import React from 'react';
+import moment from 'moment';
+
+import {t} from 'app/locale';
+import LineChart from 'app/components/charts/lineChart';
+import MarkPoint from 'app/components/charts/components/markPoint';
+
+import closedSymbol from './closedSymbol';
+import detectedSymbol from './detectedSymbol';
+
+/**
+ * So we'll have to see how this looks with real data, but echarts requires
+ * an explicit (x,y) value to draw a symbol (incident detected/closed bubble).
+ *
+ * This uses the closest date *without* going over.
+ *
+ * AFAICT we can't give it an x-axis value and have it draw on the line,
+ * so we probably need to calculate the y-axis value ourselves if we want it placed
+ * at the exact time.
+ */
+function getNearbyIndex(data, needle) {
+ // `data` is sorted, return the first index whose value (timestamp) is > `needle`
+ const index = data.findIndex(([ts]) => ts > needle);
+
+ // this shouldn't happen, as we try to buffer dates before start/end dates
+ if (index === 0) {
+ return 0;
+ }
+
+ return index !== -1 ? index - 1 : data.length - 1;
+}
+
+export default class Chart extends React.Component {
+ static propTypes = {
+ data: PropTypes.arrayOf(PropTypes.number),
+ detected: PropTypes.string,
+ closed: PropTypes.string,
+ };
+ render() {
+ const {data, detected, closed} = this.props;
+
+ const chartData = data.map(([ts, val], i) => {
+ return [
+ ts * 1000,
+ val.length ? val.reduce((acc, {count} = {count: 0}) => acc + count, 0) : 0,
+ ];
+ });
+
+ const detectedTs = detected && moment.utc(detected).unix();
+ const closedTs = closed && moment.utc(closed).unix();
+
+ const nearbyDetectedTimestampIndex = detectedTs && getNearbyIndex(data, detectedTs);
+ const nearbyClosedTimestampIndex = closedTs && getNearbyIndex(data, closedTs);
+
+ const detectedCoordinate = chartData && chartData[nearbyDetectedTimestampIndex];
+ const closedCoordinate =
+ chartData && closedTs && chartData[nearbyClosedTimestampIndex];
+
+ return (
+ <LineChart
+ isGroupedByDate
+ series={[
+ {
+ seriesName: t('Events'),
+ dataArray: chartData,
+ markPoint: MarkPoint({
+ data: [
+ {
+ symbol: `image://${detectedSymbol}`,
+ name: t('Incident Started'),
+ coord: detectedCoordinate,
+ },
+ ...(closedTs
+ ? [
+ {
+ symbol: `image://${closedSymbol}`,
+ symbolSize: 24,
+ name: t('Incident Closed'),
+ coord: closedCoordinate,
+ },
+ ]
+ : []),
+ ],
+ }),
+ },
+ ]}
+ />
+ );
+ }
+}
|
5ce04306e594961747fe7de46d13c223576e0d51
|
2024-09-18 22:39:10
|
Armen Zambrano G.
|
tests(issue_platform): Test that we can delete Issue Platform issues (#77653)
| false
|
Test that we can delete Issue Platform issues (#77653)
|
tests
|
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index e1d4b936d41402..4683234338a78f 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -512,6 +512,8 @@ tests/sentry/api/endpoints/test_organization_dashboard_widget_details.py @ge
/src/sentry/api/helpers/group_index/ @getsentry/issues
/src/sentry/api/helpers/source_map_helper.py @getsentry/issues
/src/sentry/api/issue_search.py @getsentry/issues
+/src/sentry/deletions/defaults/group.py @getsentry/issues
+/src/sentry/deletions/tasks/groups.py @getsentry/issues
/src/sentry/event_manager.py @getsentry/issues
/src/sentry/eventstore/models.py @getsentry/issues
/src/sentry/grouping/ @getsentry/issues
@@ -550,6 +552,7 @@ tests/sentry/api/endpoints/test_organization_dashboard_widget_details.py @ge
/static/app/utils/analytics.tsx @getsentry/issues
/static/app/utils/routeAnalytics/ @getsentry/issues
/tests/sentry/api/test_issue_search.py @getsentry/issues
+/tests/sentry/deletions/test_group.py @getsentry/issues
/tests/sentry/event_manager/ @getsentry/issues
/tests/sentry/grouping/ @getsentry/issues
/tests/sentry/search/ @getsentry/issues
diff --git a/tests/sentry/deletions/test_group.py b/tests/sentry/deletions/test_group.py
index 400565673fc4eb..76ded3ec42ca75 100644
--- a/tests/sentry/deletions/test_group.py
+++ b/tests/sentry/deletions/test_group.py
@@ -17,14 +17,15 @@
from sentry.models.userreport import UserReport
from sentry.testutils.cases import SnubaTestCase, TestCase
from sentry.testutils.helpers.datetime import before_now, iso_format
+from tests.sentry.issues.test_utils import OccurrenceTestMixin
class DeleteGroupTest(TestCase, SnubaTestCase):
def setUp(self):
super().setUp()
- group1_data = {"timestamp": iso_format(before_now(minutes=1)), "fingerprint": ["group1"]}
- group2_data = {"timestamp": iso_format(before_now(minutes=1)), "fingerprint": ["group2"]}
- self.project = self.create_project()
+ one_minute = iso_format(before_now(minutes=1))
+ group1_data = {"timestamp": one_minute, "fingerprint": ["group1"]}
+ group2_data = {"timestamp": one_minute, "fingerprint": ["group2"]}
# Group 1 events
self.event = self.store_event(
@@ -189,3 +190,16 @@ def test_delete_groups_delete_grouping_records_by_hash(
assert mock_delete_seer_grouping_records_by_hash_apply_async.call_args[1] == {
"args": [group.project.id, hashes, 0]
}
+
+
+class DeleteIssuePlatformTest(TestCase, SnubaTestCase, OccurrenceTestMixin):
+ def test_issue_platform(self):
+ event = self.store_event(data={}, project_id=self.project.id)
+ node_id = Event.generate_node_id(event.project_id, event.event_id)
+ self.build_occurrence(event_id=event.event_id)
+
+ with self.tasks():
+ delete_groups(object_ids=[event.group_id])
+
+ assert not nodestore.backend.get(node_id)
+ assert not Group.objects.filter(id=event.group_id).exists()
|
118e0a50611bff4e77de15c5a978606fb799aa9b
|
2020-05-06 02:39:30
|
Billy Vong
|
ref(ui): Remove legacy `<ProjectSelector>` (#18613)
| false
|
Remove legacy `<ProjectSelector>` (#18613)
|
ref
|
diff --git a/src/sentry/static/sentry/app/components/organizations/multipleProjectSelector.jsx b/src/sentry/static/sentry/app/components/organizations/multipleProjectSelector.jsx
index 7da02a5cb4eba1..575e7d5826ef6b 100644
--- a/src/sentry/static/sentry/app/components/organizations/multipleProjectSelector.jsx
+++ b/src/sentry/static/sentry/app/components/organizations/multipleProjectSelector.jsx
@@ -10,13 +10,14 @@ import {ALL_ACCESS_PROJECTS} from 'app/constants/globalSelectionHeader';
import getRouteStringFromRoutes from 'app/utils/getRouteStringFromRoutes';
import {t, tct} from 'app/locale';
import Button from 'app/components/button';
-import ProjectSelector from 'app/components/projectSelector';
import InlineSvg from 'app/components/inlineSvg';
import Tooltip from 'app/components/tooltip';
import HeaderItem from 'app/components/organizations/headerItem';
import {growIn} from 'app/styles/animations';
import space from 'app/styles/space';
+import ProjectSelector from './projectSelector';
+
export default class MultipleProjectSelector extends React.PureComponent {
static propTypes = {
organization: SentryTypes.Organization.isRequired,
diff --git a/src/sentry/static/sentry/app/components/projectSelector.jsx b/src/sentry/static/sentry/app/components/organizations/projectSelector.jsx
similarity index 78%
rename from src/sentry/static/sentry/app/components/projectSelector.jsx
rename to src/sentry/static/sentry/app/components/organizations/projectSelector.jsx
index 55b1b28f098bb2..122055184f1b73 100644
--- a/src/sentry/static/sentry/app/components/projectSelector.jsx
+++ b/src/sentry/static/sentry/app/components/organizations/projectSelector.jsx
@@ -2,14 +2,12 @@ import PropTypes from 'prop-types';
import React from 'react';
import styled from '@emotion/styled';
import {Link} from 'react-router';
-import flatten from 'lodash/flatten';
import {analytics} from 'app/utils/analytics';
import {sortArray} from 'app/utils';
import {t} from 'app/locale';
import {alertHighlight, pulse} from 'app/styles/animations';
import Button from 'app/components/button';
-import ConfigStore from 'app/stores/configStore';
import BookmarkStar from 'app/components/projects/bookmarkStar';
import DropdownAutoComplete from 'app/components/dropdownAutoComplete';
import Feature from 'app/components/acl/feature';
@@ -21,7 +19,6 @@ import IdBadge from 'app/components/idBadge';
import SentryTypes from 'app/sentryTypes';
import space from 'app/styles/space';
import theme from 'app/utils/theme';
-import withProjects from 'app/utils/withProjects';
import {IconAdd, IconSettings} from 'app/icons';
const renderDisabledCheckbox = p => (
@@ -41,13 +38,7 @@ const renderDisabledCheckbox = p => (
class ProjectSelector extends React.Component {
static propTypes = {
- // Accepts a project id (slug) and not a project *object* because ProjectSelector
- // is created from Django templates, and only organization is serialized
- projectId: PropTypes.string,
- organization: PropTypes.object.isRequired,
- projects: PropTypes.arrayOf(
- PropTypes.oneOfType([PropTypes.string, SentryTypes.Project])
- ),
+ organization: SentryTypes.Organization,
// used by multiProjectSelector
multiProjects: PropTypes.arrayOf(
@@ -99,114 +90,51 @@ class ProjectSelector extends React.Component {
onSelect: () => {},
};
- constructor(props) {
- super(props);
-
- this.state = {
- activeProject: this.getActiveProject(),
- selectedProjects: new Map(),
- };
- }
+ state = {
+ selectedProjects: new Map(),
+ };
urlPrefix() {
return `/organizations/${this.props.organization.slug}`;
}
- getActiveProject() {
- const {projectId} = this.props;
- const projects = flatten(this.getProjects());
-
- return projects.find(({slug}) => slug === projectId);
- }
-
getProjects() {
- const {organization, projects, multiProjects, nonMemberProjects} = this.props;
-
- if (multiProjects) {
- return [
- sortArray(multiProjects, project => [!project.isBookmarked, project.name]),
- nonMemberProjects || [],
- ];
- }
-
- // Legacy
- const {isSuperuser} = ConfigStore.get('user');
- const unfilteredProjects = projects || organization.projects;
-
- const filteredProjects = isSuperuser
- ? unfilteredProjects
- : unfilteredProjects.filter(project => project.isMember);
+ const {multiProjects, nonMemberProjects} = this.props;
return [
- sortArray(filteredProjects, project => [!project.isBookmarked, project.name]),
- [],
+ sortArray(multiProjects, project => [!project.isBookmarked, project.name]),
+ nonMemberProjects || [],
];
}
- isControlled = () => typeof this.props.selectedProjects !== 'undefined';
-
- toggleProject(project, e) {
- const {onMultiSelect} = this.props;
- const {slug} = project;
- // Don't update state if this is a controlled component
- if (this.isControlled()) {
- return;
- }
-
- this.setState(state => {
- const selectedProjects = new Map(state.selectedProjects.entries());
-
- if (selectedProjects.has(slug)) {
- selectedProjects.delete(slug);
- } else {
- selectedProjects.set(slug, project);
- }
-
- if (typeof onMultiSelect === 'function') {
- onMultiSelect(Array.from(selectedProjects.values()), e);
- }
-
- return {
- selectedProjects,
- };
- });
- }
-
handleSelect = ({value: project}) => {
const {onSelect} = this.props;
- this.setState({activeProject: project});
onSelect(project);
};
handleMultiSelect = (project, e) => {
const {onMultiSelect, selectedProjects} = this.props;
- const isControlled = this.isControlled();
const hasCallback = typeof onMultiSelect === 'function';
- if (isControlled && !hasCallback) {
+ if (!hasCallback) {
// eslint-disable-next-line no-console
console.error(
'ProjectSelector is a controlled component but `onMultiSelect` callback is not defined'
);
+ return;
}
- if (hasCallback) {
- if (isControlled) {
- const selectedProjectsMap = new Map(selectedProjects.map(p => [p.slug, p]));
- if (selectedProjectsMap.has(project.slug)) {
- // unselected a project
-
- selectedProjectsMap.delete(project.slug);
- } else {
- selectedProjectsMap.set(project.slug, project);
- }
+ const selectedProjectsMap = new Map(selectedProjects.map(p => [p.slug, p]));
+ if (selectedProjectsMap.has(project.slug)) {
+ // unselected a project
- onMultiSelect(Array.from(selectedProjectsMap.values()), e);
- }
+ selectedProjectsMap.delete(project.slug);
+ } else {
+ selectedProjectsMap.set(project.slug, project);
}
- this.toggleProject(project, e);
+ onMultiSelect(Array.from(selectedProjectsMap.values()), e);
};
render() {
@@ -223,7 +151,6 @@ class ProjectSelector extends React.Component {
searching,
paginated,
} = this.props;
- const {activeProject} = this.state;
const access = new Set(org.access);
const [projects, nonMemberProjects] = this.getProjects();
@@ -243,9 +170,7 @@ class ProjectSelector extends React.Component {
multi={multi}
inputValue={inputValue}
isChecked={
- this.isControlled()
- ? !!this.props.selectedProjects.find(({slug}) => slug === project.slug)
- : this.state.selectedProjects.has(project.slug)
+ !!this.props.selectedProjects.find(({slug}) => slug === project.slug)
}
style={{padding: 0}}
onMultiSelect={this.handleMultiSelect}
@@ -333,10 +258,7 @@ class ProjectSelector extends React.Component {
{renderProps =>
children({
...renderProps,
- activeProject,
- selectedProjects: this.isControlled()
- ? this.props.selectedProjects
- : Array.from(this.state.selectedProjects.values()),
+ selectedProjects: this.props.selectedProjects,
})
}
</DropdownAutoComplete>
@@ -513,4 +435,4 @@ const BadgeAndActionsWrapper = styled('div')`
}
`;
-export default withProjects(ProjectSelector);
+export default ProjectSelector;
diff --git a/src/sentry/static/sentry/app/components/projectHeader/projectSelector.jsx b/src/sentry/static/sentry/app/components/projectHeader/projectSelector.jsx
deleted file mode 100644
index d49f14eb6ba800..00000000000000
--- a/src/sentry/static/sentry/app/components/projectHeader/projectSelector.jsx
+++ /dev/null
@@ -1,127 +0,0 @@
-import {withRouter} from 'react-router';
-import PropTypes from 'prop-types';
-import React from 'react';
-import styled from '@emotion/styled';
-
-import {t} from 'app/locale';
-import IdBadge from 'app/components/idBadge';
-import InlineSvg from 'app/components/inlineSvg';
-import Link from 'app/components/links/link';
-import ProjectSelector from 'app/components/projectSelector';
-import space from 'app/styles/space';
-
-const ProjectHeaderProjectSelector = withRouter(
- class ProjectHeaderProjectSelector extends React.Component {
- static propTypes = {
- organization: PropTypes.object.isRequired,
- router: PropTypes.object,
- };
-
- static contextTypes = {
- location: PropTypes.object,
- };
-
- /**
- * Returns an object with the target project url. If
- * the router is present, passed as the 'to' property.
- * If not, passed as an absolute URL via the 'href' property.
- */
- getProjectUrlProps(project) {
- const org = this.props.organization;
- const path = `/${org.slug}/${project.slug}/`;
-
- if (this.context.location) {
- return {to: path};
- } else {
- return {href: path};
- }
- }
-
- getProjectLabel(project) {
- return project.slug;
- }
-
- handleSelect = project => {
- const {router} = this.props;
- const {to, href} = this.getProjectUrlProps(project);
- if (to) {
- router.push(to);
- } else {
- window.location.assign(href);
- }
- };
-
- renderDropDownLabelContent = (getActorProps, activeProject) => {
- if (activeProject) {
- const {to, href} = this.getProjectUrlProps(activeProject);
- return (
- <IdBadge
- project={activeProject}
- avatarSize={20}
- displayName={
- <ProjectNameLink to={to || href}>
- {this.getProjectLabel(activeProject)}
- </ProjectNameLink>
- }
- />
- );
- }
-
- return (
- <SelectProject
- {...getActorProps({
- role: 'button',
- })}
- >
- {t('Select a project')}
- </SelectProject>
- );
- };
-
- render() {
- return (
- <ProjectSelector {...this.props} onSelect={this.handleSelect}>
- {({getActorProps, activeProject}) => (
- <DropdownLabel>
- {this.renderDropDownLabelContent(getActorProps, activeProject)}
- <DropdownIcon />
- </DropdownLabel>
- )}
- </ProjectSelector>
- );
- }
- }
-);
-
-export default ProjectHeaderProjectSelector;
-
-const FlexY = styled('div')`
- display: flex;
- align-items: center;
- justify-content: space-between;
-`;
-
-const DropdownLabel = styled(FlexY)`
- margin-right: ${space(1)};
-`;
-
-const DropdownIcon = styled(props => <InlineSvg {...props} src="icon-chevron-down" />)`
- margin-left: ${space(0.5)};
- font-size: 10px;
-`;
-
-const SelectProject = styled('span')`
- color: ${p => p.theme.gray4};
- cursor: pointer;
- font-size: 20px;
- font-weight: 600;
- padding-right: ${space(0.5)};
-`;
-
-const ProjectNameLink = styled(Link)`
- color: ${p => p.theme.textColor};
- font-size: 20px;
- line-height: 1.2;
- font-weight: 600;
- margin-left: ${space(0.25)};
-`;
diff --git a/tests/js/spec/components/projectSelector.spec.jsx b/tests/js/spec/components/organizations/projectSelector.spec.jsx
similarity index 66%
rename from tests/js/spec/components/projectSelector.spec.jsx
rename to tests/js/spec/components/organizations/projectSelector.spec.jsx
index c58dd42119c85e..47e16ff77d22a2 100644
--- a/tests/js/spec/components/projectSelector.spec.jsx
+++ b/tests/js/spec/components/organizations/projectSelector.spec.jsx
@@ -1,8 +1,7 @@
import React from 'react';
import {mountWithTheme} from 'sentry-test/enzyme';
-import ProjectSelector from 'app/components/projectSelector';
-import ProjectsStore from 'app/stores/projectsStore';
+import ProjectSelector from 'app/components/organizations/projectSelector';
describe('ProjectSelector', function() {
const testTeam = TestStubs.Team({
@@ -45,16 +44,15 @@ describe('ProjectSelector', function() {
organization: mockOrg,
projectId: '',
children: actorRenderer,
+ multiProjects: mockOrg.projects,
+ selectedProjects: [],
};
- beforeEach(function() {
- ProjectsStore.loadInitialData(mockOrg.projects);
- });
-
it('should show empty message with no projects button, when no projects, and has no "project:write" access', function() {
const wrapper = mountWithTheme(
<ProjectSelector
{...props}
+ multiProjects={[]}
organization={{
id: 'org',
slug: 'org-slug',
@@ -66,8 +64,6 @@ describe('ProjectSelector', function() {
routerContext
);
- ProjectsStore.loadInitialData([]);
-
openMenu(wrapper);
expect(wrapper.find('EmptyMessage').prop('children')).toBe('You have no projects');
// Should not have "Create Project" button
@@ -78,6 +74,7 @@ describe('ProjectSelector', function() {
const wrapper = mountWithTheme(
<ProjectSelector
{...props}
+ multiProjects={[]}
organization={{
id: 'org',
slug: 'org-slug',
@@ -89,8 +86,6 @@ describe('ProjectSelector', function() {
routerContext
);
- ProjectsStore.loadInitialData([]);
-
openMenu(wrapper);
expect(wrapper.find('EmptyMessage').prop('children')).toBe('You have no projects');
// Should not have "Create Project" button
@@ -100,6 +95,7 @@ describe('ProjectSelector', function() {
it('lists projects and has filter', function() {
const wrapper = mountWithTheme(<ProjectSelector {...props} />, routerContext);
openMenu(wrapper);
+
expect(wrapper.find('AutoCompleteItem')).toHaveLength(2);
});
@@ -167,8 +163,14 @@ describe('ProjectSelector', function() {
it('does not call `onSelect` when using multi select', function() {
const mock = jest.fn();
+ const onMultiSelectMock = jest.fn();
const wrapper = mountWithTheme(
- <ProjectSelector {...props} multi onSelect={mock} />,
+ <ProjectSelector
+ {...props}
+ multi
+ onSelect={mock}
+ onMultiSelect={onMultiSelectMock}
+ />,
routerContext
);
openMenu(wrapper);
@@ -181,107 +183,7 @@ describe('ProjectSelector', function() {
// onSelect callback should NOT be called
expect(mock).not.toHaveBeenCalled();
- });
-
- it('calls `onMultiSelect` and render prop when using multi select as an uncontrolled component', async function() {
- const mock = jest.fn();
- const wrapper = mountWithTheme(
- <ProjectSelector {...props} multi onMultiSelect={mock} />,
- routerContext
- );
- openMenu(wrapper);
-
- // Select first project
- wrapper
- .find('CheckboxHitbox')
- .at(0)
- .simulate('click', {target: {checked: true}});
-
- expect(mock).toHaveBeenLastCalledWith(
- [
- expect.objectContaining({
- slug: 'test-project',
- }),
- ],
- expect.anything()
- );
-
- expect(actorRenderer).toHaveBeenLastCalledWith(
- expect.objectContaining({
- selectedProjects: [expect.objectContaining({slug: 'test-project'})],
- })
- );
-
- expect(
- Array.from(
- wrapper
- .find('ProjectSelectorItem')
- .filterWhere(p => p.prop('isChecked'))
- .map(p => p.prop('project').slug)
- )
- ).toEqual(['test-project']);
-
- // second project
- wrapper
- .find('CheckboxHitbox')
- .at(1)
- .simulate('click', {target: {checked: true}});
-
- expect(mock).toHaveBeenLastCalledWith(
- [
- expect.objectContaining({
- slug: 'test-project',
- }),
- expect.objectContaining({
- slug: 'another-project',
- }),
- ],
- expect.anything()
- );
- expect(actorRenderer).toHaveBeenLastCalledWith(
- expect.objectContaining({
- selectedProjects: [
- expect.objectContaining({slug: 'test-project'}),
- expect.objectContaining({slug: 'another-project'}),
- ],
- })
- );
- expect(
- Array.from(
- wrapper
- .find('ProjectSelectorItem')
- .filterWhere(p => p.prop('isChecked'))
- .map(p => p.prop('project').slug)
- )
- ).toEqual(['test-project', 'another-project']);
-
- // Can unselect item
- wrapper
- .find('CheckboxHitbox')
- .at(1)
- .simulate('click', {target: {checked: false}});
-
- expect(mock).toHaveBeenLastCalledWith(
- [
- expect.objectContaining({
- slug: 'test-project',
- }),
- ],
- expect.anything()
- );
- expect(actorRenderer).toHaveBeenLastCalledWith(
- expect.objectContaining({
- selectedProjects: [expect.objectContaining({slug: 'test-project'})],
- })
- );
- expect(
- Array.from(
- wrapper
- .find('ProjectSelectorItem')
- .filterWhere(p => p.prop('isChecked'))
- .map(p => p.prop('project').slug)
- )
- ).toEqual(['test-project']);
+ expect(onMultiSelectMock).toHaveBeenCalled();
});
it('displays multi projects', function() {
diff --git a/tests/js/spec/components/projectHeader/projectSelector.spec.jsx b/tests/js/spec/components/projectHeader/projectSelector.spec.jsx
deleted file mode 100644
index 8ab509af6fdb07..00000000000000
--- a/tests/js/spec/components/projectHeader/projectSelector.spec.jsx
+++ /dev/null
@@ -1,94 +0,0 @@
-import React from 'react';
-
-import {mountWithTheme} from 'sentry-test/enzyme';
-import ProjectHeaderProjectSelector from 'app/components/projectHeader/projectSelector';
-import ProjectsStore from 'app/stores/projectsStore';
-
-describe('ProjectHeaderProjectSelector', function() {
- const testTeam = TestStubs.Team({
- id: 'test-team',
- slug: 'test-team',
- isMember: true,
- });
-
- const testProject = TestStubs.Project({
- id: 'test-project',
- slug: 'test-project',
- isBookmarked: true,
- isMember: true,
- teams: [testTeam],
- });
- const anotherProject = TestStubs.Project({
- id: 'another-project',
- slug: 'another-project',
- isMember: true,
- teams: [testTeam],
- });
-
- const mockOrg = TestStubs.Organization({
- id: 'org',
- slug: 'org',
- teams: [testTeam],
- projects: [testProject, anotherProject],
- features: ['new-teams'],
- access: [],
- });
-
- const routerContext = TestStubs.routerContext([{organization: mockOrg}]);
-
- const openMenu = wrapper => wrapper.find('DropdownLabel').simulate('click');
-
- beforeEach(function() {
- ProjectsStore.loadInitialData(mockOrg.projects);
- });
-
- it('renders with "Select a project" when no project is selected', function() {
- const wrapper = mountWithTheme(
- <ProjectHeaderProjectSelector organization={mockOrg} projectId="" />,
- routerContext
- );
-
- expect(wrapper.find('SelectProject')).toHaveLength(1);
- });
-
- it('has project label when project is selected', function() {
- const wrapper = mountWithTheme(
- <ProjectHeaderProjectSelector organization={mockOrg} projectId="" />,
- routerContext
- );
- openMenu(wrapper);
-
- // Select first project
- wrapper
- .find('AutoCompleteItem')
- .first()
- .simulate('click');
-
- expect(wrapper.find('IdBadge').prop('project')).toEqual(
- expect.objectContaining({
- slug: 'test-project',
- })
- );
- });
-
- it('calls `router.push` when a project is selected', function() {
- const routerMock = TestStubs.router();
- const wrapper = mountWithTheme(
- <ProjectHeaderProjectSelector
- organization={mockOrg}
- projectId=""
- router={routerMock}
- />,
- routerContext
- );
- openMenu(wrapper);
-
- // Select first project
- wrapper
- .find('AutoCompleteItem')
- .first()
- .simulate('click');
-
- expect(routerMock.push).toHaveBeenCalledWith('/org/test-project/');
- });
-});
|
bc8c5d4741da6eed82f824c24eaa534b1f5cd7b6
|
2024-09-30 22:26:53
|
Colton Allen
|
feat(flags): Add initial flags blueprint (#77190)
| false
|
Add initial flags blueprint (#77190)
|
feat
|
diff --git a/src/sentry/flags/README.md b/src/sentry/flags/README.md
new file mode 100644
index 00000000000000..6a4cab09d9f614
--- /dev/null
+++ b/src/sentry/flags/README.md
@@ -0,0 +1 @@
+flag log
diff --git a/src/sentry/flags/__init__.py b/src/sentry/flags/__init__.py
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/src/sentry/flags/docs/api.md b/src/sentry/flags/docs/api.md
new file mode 100644
index 00000000000000..ba4f8b48a7cb8b
--- /dev/null
+++ b/src/sentry/flags/docs/api.md
@@ -0,0 +1,111 @@
+# Flags API
+
+Host: https://sentry.io/api/0
+
+**Authors.**
+
+@cmanallen
+
+**How to read this document.**
+
+This document is structured by resource with each resource having actions that can be performed against it. Every action that either accepts a request or returns a response WILL document the full interchange format. Clients may opt to restrict response data or provide a subset of the request data.
+
+## Flag Logs [/organizations/<organization_id_or_slug>/flag-log/]
+
+- Parameters
+ - query (optional, string) - Search query with space-separated field/value pairs. ie: `?query=environment:prod AND project:3`.
+ - start (optional, string) - ISO 8601 format (`YYYY-MM-DDTHH:mm:ss.sssZ`)
+ - end (optional, string) - ISO 8601 format. Required if `start` is set.
+ - statsPeriod (optional, string) - A positive integer suffixed with a unit type.
+ - cursor (optional, string)
+ - per_page (optional, number)
+ Default: 10
+ - offset (optional, number)
+ Default: 0
+
+### Browse Flag Logs [GET]
+
+Retrieve a collection of flag logs.
+
+**Attributes**
+
+| Column | Type | Description |
+| ---------------- | ------ | ---------------------------------------------------- |
+| action | string | Enum of `created` or `modified`. |
+| flag | string | The name of the flag changed. |
+| modified_at | string | ISO-8601 timestamp of when the flag was changed. |
+| modified_by | string | The user responsible for the change. |
+| modified_by_type | string | Enum of `email`, `id`, or `name`. |
+| tags | object | A collection of provider-specified scoping metadata. |
+
+- Response 200
+
+ ```json
+ {
+ "data": [
+ {
+ "action": "created",
+ "flag": "my-flag-name",
+ "modified_at": "2024-01-01T05:12:33",
+ "modified_by": "2552",
+ "modified_by_type": "id",
+ "tags": {
+ "environment": "production"
+ }
+ }
+ ]
+ }
+ ```
+
+## Flag Log [/organizations/<organization_id_or_slug>/flag-log/<flag>/]
+
+### Fetch Flag Log [GET]
+
+Retrieve a single flag log instance.
+
+- Response 200
+
+ ```json
+ {
+ "data": {
+ "action": "modified",
+ "flag": "new-flag-name",
+ "modified_at": "2024-11-19T19:12:55",
+ "modified_by": "[email protected]",
+ "modified_by_type": "email",
+ "tags": {
+ "environment": "development"
+ }
+ }
+ }
+ ```
+
+## Webhooks [/webhooks/flags/organization/<organization_id_or_slug>/provider/<provider>/]
+
+### Create Flag Log [POST]
+
+The shape of the request object varies by provider. The `<provider>` URI parameter informs the server of the shape of the request and it is on the server to handle the provider. The following providers are supported: Unleash, Split, and LaunchDarkly.
+
+**Flag Pole Example:**
+
+Flag pole is Sentry owned. It matches our audit-log resource because it is designed for that purpose.
+
+- Request (application/json)
+
+ ```json
+ {
+ "data": [
+ {
+ "action": "modified",
+ "flag": "flag-name",
+ "modified_at": "2024-11-19T19:12:55",
+ "modified_by": "[email protected]",
+ "tags": {
+ "commit_sha": "1f33a107d7cd060ab9c98e11c9e5a62dc1347861"
+ }
+ }
+ ]
+ }
+ ```
+
+- Response 201
|
987941b902a6afa4d3ff8af34b1519def0edf17a
|
2024-08-15 22:08:10
|
Cathy Teng
|
nit(scm): group functions by class they come from in main integration class (#76240)
| false
|
group functions by class they come from in main integration class (#76240)
|
nit
|
diff --git a/src/sentry/integrations/bitbucket/integration.py b/src/sentry/integrations/bitbucket/integration.py
index be5b4efd9357c1..a1a884e18958b8 100644
--- a/src/sentry/integrations/bitbucket/integration.py
+++ b/src/sentry/integrations/bitbucket/integration.py
@@ -90,13 +90,13 @@ def integration_name(self) -> str:
def get_client(self):
return BitbucketApiClient(integration=self.model)
- @property
- def username(self):
- return self.model.name
+ # IntegrationInstallation methods
def error_message_from_json(self, data):
return data.get("error", {}).get("message", "unknown error")
+ # RepositoryIntegration methods
+
def get_repositories(self, query=None):
username = self.model.metadata.get("uuid", self.username)
if not query:
@@ -156,6 +156,12 @@ def extract_source_path_from_source_url(self, repo: Repository, url: str) -> str
_, _, source_path = url.partition("/")
return source_path
+ # Bitbucket only methods
+
+ @property
+ def username(self):
+ return self.model.name
+
class BitbucketIntegrationProvider(IntegrationProvider):
key = "bitbucket"
diff --git a/src/sentry/integrations/bitbucket_server/integration.py b/src/sentry/integrations/bitbucket_server/integration.py
index 691815f9aefad0..3fadf550245c59 100644
--- a/src/sentry/integrations/bitbucket_server/integration.py
+++ b/src/sentry/integrations/bitbucket_server/integration.py
@@ -249,13 +249,13 @@ def get_client(self):
identity=self.default_identity,
)
- @property
- def username(self):
- return self.model.name
+ # IntegrationInstallation methods
def error_message_from_json(self, data):
return data.get("error", {}).get("message", "unknown error")
+ # RepositoryIntegration methods
+
def get_repositories(self, query=None):
if not query:
resp = self.get_client().get_repos()
@@ -310,6 +310,12 @@ def extract_branch_from_source_url(self, repo: Repository, url: str) -> str:
def extract_source_path_from_source_url(self, repo: Repository, url: str) -> str:
raise IntegrationFeatureNotImplementedError
+ # Bitbucket Server only methods
+
+ @property
+ def username(self):
+ return self.model.name
+
class BitbucketServerIntegrationProvider(IntegrationProvider):
key = "bitbucket_server"
diff --git a/src/sentry/integrations/github/integration.py b/src/sentry/integrations/github/integration.py
index 5cb32312adf3f0..51acb4da00e320 100644
--- a/src/sentry/integrations/github/integration.py
+++ b/src/sentry/integrations/github/integration.py
@@ -268,7 +268,7 @@ def has_repo_access(self, repo: RpcRepository) -> bool:
return False
return True
- # for derive code mappings (TODO: define in an ABC)
+ # for derive code mappings - TODO(cathy): define in an ABC
def get_trees_for_org(self, cache_seconds: int = 3600 * 24) -> dict[str, RepoTree]:
trees: dict[str, RepoTree] = {}
domain_name = self.model.metadata["domain_name"]
@@ -291,7 +291,7 @@ def get_trees_for_org(self, cache_seconds: int = 3600 * 24) -> dict[str, RepoTre
return trees
- # TODO: define in issue ABC
+ # TODO(cathy): define in issue ABC
def search_issues(self, query: str) -> Mapping[str, Sequence[Mapping[str, Any]]]:
return self.get_client().search_issues(query)
diff --git a/src/sentry/integrations/github_enterprise/integration.py b/src/sentry/integrations/github_enterprise/integration.py
index ad1e86d9056aa6..123a7f1c950122 100644
--- a/src/sentry/integrations/github_enterprise/integration.py
+++ b/src/sentry/integrations/github_enterprise/integration.py
@@ -154,6 +154,19 @@ def get_client(self):
org_integration_id=self.org_integration.id,
)
+ # IntegrationInstallation methods
+
+ def message_from_error(self, exc):
+ if isinstance(exc, ApiError):
+ message = API_ERRORS.get(exc.code)
+ if message is None:
+ message = exc.json.get("message", "unknown error") if exc.json else "unknown error"
+ return f"Error Communicating with GitHub Enterprise (HTTP {exc.code}): {message}"
+ else:
+ return ERR_INTERNAL
+
+ # RepositoryIntegration methods
+
def get_repositories(self, query=None):
if not query:
return [
@@ -197,15 +210,6 @@ def has_repo_access(self, repo: RpcRepository) -> bool:
# TODO: define this, used to migrate repositories
return False
- def message_from_error(self, exc):
- if isinstance(exc, ApiError):
- message = API_ERRORS.get(exc.code)
- if message is None:
- message = exc.json.get("message", "unknown error") if exc.json else "unknown error"
- return f"Error Communicating with GitHub Enterprise (HTTP {exc.code}): {message}"
- else:
- return ERR_INTERNAL
-
class InstallationForm(forms.Form):
url = forms.CharField(
diff --git a/src/sentry/integrations/gitlab/integration.py b/src/sentry/integrations/gitlab/integration.py
index 27627fafa077b8..210bfdcab5fcb7 100644
--- a/src/sentry/integrations/gitlab/integration.py
+++ b/src/sentry/integrations/gitlab/integration.py
@@ -103,9 +103,6 @@ def __init__(self, *args, **kwargs):
def integration_name(self) -> str:
return "gitlab"
- def get_group_id(self):
- return self.model.metadata["group_id"]
-
def get_client(self):
if self.default_identity is None:
try:
@@ -115,6 +112,22 @@ def get_client(self):
return GitLabApiClient(self)
+ # IntegrationInstallation methods
+ def error_message_from_json(self, data):
+ """
+ Extract error messages from gitlab API errors.
+ Generic errors come in the `error` key while validation errors
+ are generally in `message`.
+
+ See https://docs.gitlab.com/ee/api/#data-validation-and-error-reporting
+ """
+ if "message" in data:
+ return data["message"]
+ if "error" in data:
+ return data["error"]
+
+ # RepositoryIntegration methods
+
def has_repo_access(self, repo: RpcRepository) -> bool:
# TODO: define this, used to migrate repositories
return False
@@ -148,28 +161,21 @@ def extract_source_path_from_source_url(self, repo: Repository, url: str) -> str
_, _, source_path = url.partition("/")
return source_path
+ # Gitlab only functions
+
+ def get_group_id(self):
+ return self.model.metadata["group_id"]
+
def search_projects(self, query):
client = self.get_client()
group_id = self.get_group_id()
return client.search_projects(group_id, query)
+ # TODO(cathy): define in issue ABC
def search_issues(self, project_id, query, iids):
client = self.get_client()
return client.search_project_issues(project_id, query, iids)
- def error_message_from_json(self, data):
- """
- Extract error messages from gitlab API errors.
- Generic errors come in the `error` key while validation errors
- are generally in `message`.
-
- See https://docs.gitlab.com/ee/api/#data-validation-and-error-reporting
- """
- if "message" in data:
- return data["message"]
- if "error" in data:
- return data["error"]
-
class InstallationForm(forms.Form):
url = forms.CharField(
diff --git a/src/sentry/integrations/vsts/integration.py b/src/sentry/integrations/vsts/integration.py
index f240608cec9c48..61ac90d9e9f65f 100644
--- a/src/sentry/integrations/vsts/integration.py
+++ b/src/sentry/integrations/vsts/integration.py
@@ -131,47 +131,12 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
def integration_name(self) -> str:
return "vsts"
- def all_repos_migrated(self) -> bool:
- return not self.get_unmigratable_repositories()
-
- def get_repositories(self, query: str | None = None) -> Sequence[Mapping[str, str]]:
- try:
- repos = self.get_client().get_repos()
- except (ApiError, IdentityNotValid) as e:
- raise IntegrationError(self.message_from_error(e))
- data = []
- for repo in repos["value"]:
- data.append(
- {
- "name": "{}/{}".format(repo["project"]["name"], repo["name"]),
- "identifier": repo["id"],
- }
- )
- return data
-
- def get_unmigratable_repositories(self) -> list[RpcRepository]:
- repos = repository_service.get_repositories(
- organization_id=self.organization_id, providers=["visualstudio"]
- )
- identifiers_to_exclude = {r["identifier"] for r in self.get_repositories()}
- return [repo for repo in repos if repo.external_id not in identifiers_to_exclude]
-
- def has_repo_access(self, repo: RpcRepository) -> bool:
- client = self.get_client()
- try:
- # since we don't actually use webhooks for vsts commits,
- # just verify repo access
- client.get_repo(repo.config["name"], project=repo.config["project"])
- except (ApiError, IdentityNotValid):
- return False
- return True
-
def get_client(self) -> VstsApiClient:
base_url = self.instance
if SiloMode.get_current_mode() != SiloMode.REGION:
if self.default_identity is None:
self.default_identity = self.get_default_identity()
- self.check_domain_name(self.default_identity)
+ self._check_domain_name(self.default_identity)
if self.org_integration is None:
raise Exception("self.org_integration is not defined")
@@ -184,15 +149,7 @@ def get_client(self) -> VstsApiClient:
identity_id=self.org_integration.default_auth_id,
)
- def check_domain_name(self, default_identity: RpcIdentity) -> None:
- if re.match("^https://.+/$", self.model.metadata["domain_name"]):
- return
-
- base_url = VstsIntegrationProvider.get_base_url(
- default_identity.data["access_token"], self.model.external_id
- )
- self.model.metadata["domain_name"] = base_url
- self.model.save()
+ # IntegrationInstallation methods
def get_organization_config(self) -> Sequence[Mapping[str, Any]]:
client = self.get_client()
@@ -333,6 +290,40 @@ def get_config_data(self) -> Mapping[str, Any]:
config["sync_status_forward"] = sync_status_forward
return config
+ # RepositoryIntegration methods
+
+ def get_repositories(self, query: str | None = None) -> Sequence[Mapping[str, str]]:
+ try:
+ repos = self.get_client().get_repos()
+ except (ApiError, IdentityNotValid) as e:
+ raise IntegrationError(self.message_from_error(e))
+ data = []
+ for repo in repos["value"]:
+ data.append(
+ {
+ "name": "{}/{}".format(repo["project"]["name"], repo["name"]),
+ "identifier": repo["id"],
+ }
+ )
+ return data
+
+ def get_unmigratable_repositories(self) -> list[RpcRepository]:
+ repos = repository_service.get_repositories(
+ organization_id=self.organization_id, providers=["visualstudio"]
+ )
+ identifiers_to_exclude = {r["identifier"] for r in self.get_repositories()}
+ return [repo for repo in repos if repo.external_id not in identifiers_to_exclude]
+
+ def has_repo_access(self, repo: RpcRepository) -> bool:
+ client = self.get_client()
+ try:
+ # since we don't actually use webhooks for vsts commits,
+ # just verify repo access
+ client.get_repo(repo.config["name"], project=repo.config["project"])
+ except (ApiError, IdentityNotValid):
+ return False
+ return True
+
def source_url_matches(self, url: str) -> bool:
return url.startswith(self.model.metadata["domain_name"])
@@ -362,6 +353,18 @@ def extract_source_path_from_source_url(self, repo: Repository, url: str) -> str
return qs["path"][0].lstrip("/")
return ""
+ # Azure DevOps only methods
+
+ def _check_domain_name(self, default_identity: RpcIdentity) -> None:
+ if re.match("^https://.+/$", self.model.metadata["domain_name"]):
+ return
+
+ base_url = VstsIntegrationProvider.get_base_url(
+ default_identity.data["access_token"], self.model.external_id
+ )
+ self.model.metadata["domain_name"] = base_url
+ self.model.save()
+
@property
def instance(self) -> str:
return self.model.metadata["domain_name"]
|
c9eb08cae1f5d56a5faa7ac20486fddfb2982ffa
|
2018-01-12 07:35:13
|
David Cramer
|
fix(api): Correct servicehook docs
| false
|
Correct servicehook docs
|
fix
|
diff --git a/src/sentry/api/endpoints/project_servicehooks.py b/src/sentry/api/endpoints/project_servicehooks.py
index adf747d0e99108..e2d3808a531e99 100644
--- a/src/sentry/api/endpoints/project_servicehooks.py
+++ b/src/sentry/api/endpoints/project_servicehooks.py
@@ -24,7 +24,7 @@ def create_hook_scenario(runner):
runner.request(
method='POST',
path='/projects/%s/%s/hooks/' % (runner.org.slug, runner.default_project.slug),
- data={'name': 'Fabulous Key'}
+ data={'url': 'https://example.com/sentry-hook', 'events': ['event.alert', 'event.created']}
)
@@ -82,6 +82,11 @@ def post(self, request, project):
Create a new client key bound to a project. The key's secret and
public key are generated by the server.
+ Events include:
+
+ - event.alert: An alert is generated for an event (via rules).
+ - event.created: A new event has been processed.
+
:pparam string organization_slug: the slug of the organization the
client keys belong to.
:pparam string project_slug: the slug of the project the client keys
|
37b4e4019cd13a0063227c3a8c3554220b6024a1
|
2023-12-16 02:13:12
|
Armen Zambrano G
|
fix(metrics_extraction): user_misery (#61299)
| false
|
user_misery (#61299)
|
fix
|
diff --git a/src/sentry/search/events/builder/metrics.py b/src/sentry/search/events/builder/metrics.py
index 7bda899d53f3cc..a617510774dfb0 100644
--- a/src/sentry/search/events/builder/metrics.py
+++ b/src/sentry/search/events/builder/metrics.py
@@ -352,6 +352,16 @@ def resolve_query(
self.orderby = self.resolve_orderby(orderby)
with sentry_sdk.start_span(op="QueryBuilder", description="resolve_groupby"):
self.groupby = self.resolve_groupby(groupby_columns)
+ else:
+ # On demand still needs to call resolve since resolving columns has a side_effect
+ # of adding their alias to the function_alias_map, which is required to convert snuba
+ # aliases back to their original functions.
+ for column in selected_columns:
+ try:
+ self.resolve_select([column], [])
+ except (IncompatibleMetricsQuery, InvalidSearchQuery):
+ # This may fail for some columns like apdex but it will still enter into the field_alias_map
+ pass
if len(self.metric_ids) > 0 and not self.use_metrics_layer:
self.where.append(
diff --git a/tests/snuba/api/endpoints/test_organization_events_mep.py b/tests/snuba/api/endpoints/test_organization_events_mep.py
index cd1d12c0f95ba2..103a1442306a71 100644
--- a/tests/snuba/api/endpoints/test_organization_events_mep.py
+++ b/tests/snuba/api/endpoints/test_organization_events_mep.py
@@ -1,10 +1,11 @@
from __future__ import annotations
-from typing import Any
+from typing import Any, Optional
from unittest import mock
import pytest
from django.urls import reverse
+from rest_framework.response import Response
from sentry.api.bases.organization_events import DATASET_OPTIONS
from sentry.discover.models import TeamKeyTransaction
@@ -3066,10 +3067,10 @@ class OrganizationEventsMetricsEnhancedPerformanceEndpointTestWithOnDemandMetric
):
viewname = "sentry-api-0-organization-events"
- def setUp(self):
+ def setUp(self) -> None:
super().setUp()
- def do_request(self, query):
+ def do_request(self, query: Any) -> Any:
self.login_as(user=self.user)
url = reverse(
self.viewname,
@@ -3078,14 +3079,26 @@ def do_request(self, query):
with self.feature({"organizations:on-demand-metrics-extraction-widgets": True}):
return self.client.get(url, query, format="json")
- def _test_is_metrics_extracted_data(
- self, params: dict[str, Any], expected_on_demand_query: bool, dataset: str
- ) -> None:
- spec = OnDemandMetricSpec(
- field="count()",
- query="transaction.duration:>1s",
- spec_type=MetricSpecType.DYNAMIC_QUERY,
- )
+ def _on_demand_query_check(
+ self,
+ params: dict[str, Any],
+ groupbys: Optional[list[str]] = None,
+ expected_on_demand_query: Optional[bool] = True,
+ expected_dataset: Optional[str] = "metricsEnhanced",
+ ) -> Response:
+ """Do a request to the events endpoint with metrics enhanced and on-demand enabled."""
+ for field in params["field"]:
+ spec = OnDemandMetricSpec(
+ field=field,
+ query=params["query"],
+ environment=params.get("environment"),
+ groupbys=groupbys,
+ spec_type=MetricSpecType.DYNAMIC_QUERY,
+ )
+ # Expected parameters for this helper function
+ params["dataset"] = "metricsEnhanced"
+ params["useOnDemandMetrics"] = "true"
+ params["onDemandType"] = "dynamic_query"
self.store_on_demand_metric(1, spec=spec)
response = self.do_request(params)
@@ -3093,22 +3106,39 @@ def _test_is_metrics_extracted_data(
assert response.status_code == 200, response.content
meta = response.data["meta"]
assert meta.get("isMetricsExtractedData", False) is expected_on_demand_query
- assert meta["dataset"] == dataset
+ assert meta["dataset"] == expected_dataset
- return meta
+ return response
+
+ def test_is_metrics_extracted_data_is_included(self) -> None:
+ self._on_demand_query_check(
+ {"field": ["count()"], "query": "transaction.duration:>=91", "yAxis": "count()"}
+ )
- def test_is_metrics_extracted_data_is_included(self):
- self._test_is_metrics_extracted_data(
+ def test_transaction_user_misery(self) -> None:
+ resp = self._on_demand_query_check(
{
- "field": ["count()"],
+ "field": ["user_misery(300)", "apdex(300)"],
+ "project": self.project.id,
+ "query": "",
+ "sort": "-user_misery(300)",
+ "per_page": "20",
+ "referrer": "api.dashboards.tablewidget",
+ },
+ groupbys=["transaction"],
+ )
+ assert resp.data == {
+ "data": [{"user_misery(300)": 0.0, "apdex(300)": 0.0}],
+ "meta": {
+ "fields": {"user_misery(300)": "number", "apdex(300)": "number"},
+ "units": {"user_misery(300)": None, "apdex(300)": None},
+ "isMetricsData": True,
+ "isMetricsExtractedData": True,
+ "tips": {},
+ "datasetReason": "unchanged",
"dataset": "metricsEnhanced",
- "query": "transaction.duration:>=91",
- "useOnDemandMetrics": "true",
- "yAxis": "count()",
},
- expected_on_demand_query=True,
- dataset="metricsEnhanced",
- )
+ }
class OrganizationEventsMetricsEnhancedPerformanceEndpointTestWithMetricLayer(
|
ea4b4ca0f74a9e101b9d9fa9c766dd7911a78e7b
|
2025-03-13 20:09:55
|
George Gritsouk
|
ref(dashboards): Simplify `TimeSeries` field meta (#86834)
| false
|
Simplify `TimeSeries` field meta (#86834)
|
ref
|
diff --git a/static/app/utils/discover/fields.tsx b/static/app/utils/discover/fields.tsx
index 5599779b8ce7d2..2e17ddd87d05a5 100644
--- a/static/app/utils/discover/fields.tsx
+++ b/static/app/utils/discover/fields.tsx
@@ -248,6 +248,8 @@ export const RATE_UNIT_TITLE: Record<RateUnit, string> = {
[RateUnit.PER_HOUR]: 'Per Hour',
};
+export type DataUnit = DurationUnit | SizeUnit | RateUnit | null;
+
const getDocsAndOutputType = (key: AggregationKey) => {
return {
documentation: AGGREGATION_FIELDS[key].desc,
diff --git a/static/app/utils/timeSeries/scaleTimeSeriesData.spec.tsx b/static/app/utils/timeSeries/scaleTimeSeriesData.spec.tsx
index 76e6c2d6ea9b52..42f66070a074b5 100644
--- a/static/app/utils/timeSeries/scaleTimeSeriesData.spec.tsx
+++ b/static/app/utils/timeSeries/scaleTimeSeriesData.spec.tsx
@@ -13,12 +13,8 @@ describe('scaleTimeSeriesData', () => {
},
],
meta: {
- fields: {
- user: 'string',
- },
- units: {
- user: null,
- },
+ type: 'string',
+ unit: null,
},
};
@@ -40,12 +36,8 @@ describe('scaleTimeSeriesData', () => {
},
],
meta: {
- fields: {
- 'transaction.duration': 'duration',
- },
- units: {
- 'transaction.duration': 'second',
- },
+ type: 'duration',
+ unit: DurationUnit.SECOND,
},
};
@@ -62,12 +54,8 @@ describe('scaleTimeSeriesData', () => {
},
],
meta: {
- fields: {
- 'transaction.duration': 'duration',
- },
- units: {
- 'transaction.duration': 'second',
- },
+ type: 'duration',
+ unit: DurationUnit.SECOND,
},
};
@@ -80,12 +68,8 @@ describe('scaleTimeSeriesData', () => {
},
],
meta: {
- fields: {
- 'transaction.duration': 'duration',
- },
- units: {
- 'transaction.duration': 'millisecond',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
},
});
});
@@ -100,12 +84,8 @@ describe('scaleTimeSeriesData', () => {
},
],
meta: {
- fields: {
- 'file.size': 'size',
- },
- units: {
- 'file.size': 'mebibyte',
- },
+ type: 'size',
+ unit: SizeUnit.MEBIBYTE,
},
};
@@ -118,12 +98,8 @@ describe('scaleTimeSeriesData', () => {
},
],
meta: {
- fields: {
- 'file.size': 'size',
- },
- units: {
- 'file.size': 'byte',
- },
+ type: 'size',
+ unit: SizeUnit.BYTE,
},
});
});
diff --git a/static/app/utils/timeSeries/scaleTimeSeriesData.tsx b/static/app/utils/timeSeries/scaleTimeSeriesData.tsx
index 6ce7937758b629..4b2ae0349307df 100644
--- a/static/app/utils/timeSeries/scaleTimeSeriesData.tsx
+++ b/static/app/utils/timeSeries/scaleTimeSeriesData.tsx
@@ -1,12 +1,7 @@
import * as Sentry from '@sentry/react';
import partialRight from 'lodash/partialRight';
-import type {
- AggregationOutputType,
- DurationUnit,
- RateUnit,
- SizeUnit,
-} from 'sentry/utils/discover/fields';
+import type {AggregationOutputType, DataUnit} from 'sentry/utils/discover/fields';
import {convertDuration} from 'sentry/utils/unitConversion/convertDuration';
import {convertRate} from 'sentry/utils/unitConversion/convertRate';
import {convertSize} from 'sentry/utils/unitConversion/convertSize';
@@ -24,11 +19,11 @@ import {
export function scaleTimeSeriesData(
timeSeries: Readonly<TimeSeries>,
- destinationUnit: DurationUnit | SizeUnit | RateUnit | null
+ destinationUnit: DataUnit
): TimeSeries {
// TODO: Instead of a fallback, allow this to be `null`, which might happen
const sourceType =
- (timeSeries.meta?.fields[timeSeries.field] as AggregationOutputType) ??
+ (timeSeries.meta?.type as AggregationOutputType) ??
(FALLBACK_TYPE as AggregationOutputType);
// Don't bother trying to convert numbers, dates, etc.
@@ -36,7 +31,7 @@ export function scaleTimeSeriesData(
return timeSeries;
}
- const sourceUnit = timeSeries.meta?.units?.[timeSeries.field] ?? null;
+ const sourceUnit = timeSeries.meta?.unit;
if (!destinationUnit || sourceUnit === destinationUnit) {
return timeSeries;
@@ -87,12 +82,8 @@ export function scaleTimeSeriesData(
}),
meta: {
...timeSeries.meta,
- fields: {
- [timeSeries.field]: sourceType,
- },
- units: {
- [timeSeries.field]: destinationUnit,
- },
+ type: sourceType,
+ unit: destinationUnit,
},
};
}
diff --git a/static/app/utils/timeSeries/splitSeriesIntoCompleteAndIncomplete.spec.tsx b/static/app/utils/timeSeries/splitSeriesIntoCompleteAndIncomplete.spec.tsx
index ad26839c65f6fa..350e8885852db0 100644
--- a/static/app/utils/timeSeries/splitSeriesIntoCompleteAndIncomplete.spec.tsx
+++ b/static/app/utils/timeSeries/splitSeriesIntoCompleteAndIncomplete.spec.tsx
@@ -1,5 +1,7 @@
import {resetMockDate, setMockDate} from 'sentry-test/utils';
+import {DurationUnit} from '../discover/fields';
+
import {splitSeriesIntoCompleteAndIncomplete} from './splitSeriesIntoCompleteAndIncomplete';
describe('splitSeriesIntoCompleteAndIncomplete', () => {
@@ -29,12 +31,8 @@ describe('splitSeriesIntoCompleteAndIncomplete', () => {
},
],
meta: {
- fields: {
- 'p99(span.duration)': 'duration',
- },
- units: {
- 'p99(span.duration)': 'millisecond',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
},
};
@@ -83,12 +81,8 @@ describe('splitSeriesIntoCompleteAndIncomplete', () => {
},
],
meta: {
- fields: {
- 'p99(span.duration)': 'duration',
- },
- units: {
- 'p99(span.duration)': 'millisecond',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
},
};
@@ -145,12 +139,8 @@ describe('splitSeriesIntoCompleteAndIncomplete', () => {
},
],
meta: {
- fields: {
- 'p99(span.duration)': 'duration',
- },
- units: {
- 'p99(span.duration)': 'millisecond',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
},
};
@@ -214,12 +204,8 @@ describe('splitSeriesIntoCompleteAndIncomplete', () => {
},
],
meta: {
- fields: {
- 'p99(span.duration)': 'duration',
- },
- units: {
- 'p99(span.duration)': 'millisecond',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
},
};
diff --git a/static/app/views/dashboards/widgetCard/chart.tsx b/static/app/views/dashboards/widgetCard/chart.tsx
index 44df2273ed9067..88330d82a40e56 100644
--- a/static/app/views/dashboards/widgetCard/chart.tsx
+++ b/static/app/views/dashboards/widgetCard/chart.tsx
@@ -39,7 +39,7 @@ import {
tooltipFormatter,
} from 'sentry/utils/discover/charts';
import type {EventsMetaType, MetaType} from 'sentry/utils/discover/eventView';
-import type {AggregationOutputType} from 'sentry/utils/discover/fields';
+import type {AggregationOutputType, DataUnit} from 'sentry/utils/discover/fields';
import {
aggregateOutputType,
getAggregateArg,
@@ -225,7 +225,10 @@ class WidgetCardChart extends Component<WidgetCardChartProps> {
key={i}
field={field}
value={value}
- meta={meta}
+ meta={{
+ type: meta.fields?.[field] ?? null,
+ unit: (meta.units?.[field] as DataUnit) ?? null,
+ }}
thresholds={widget.thresholds ?? undefined}
preferredPolarity="-"
/>
diff --git a/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.spec.tsx b/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.spec.tsx
index 799e9af9abaf2e..83240cb81dd910 100644
--- a/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.spec.tsx
+++ b/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.spec.tsx
@@ -1,6 +1,7 @@
import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
import {textWithMarkupMatcher} from 'sentry-test/utils';
+import {DurationUnit, RateUnit} from 'sentry/utils/discover/fields';
import {BigNumberWidgetVisualization} from 'sentry/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization';
import {Widget} from '../widget/widget';
@@ -23,10 +24,8 @@ describe('BigNumberWidgetVisualization', () => {
value={Infinity}
field="count()"
meta={{
- fields: {
- 'count()': 'number',
- },
- units: {},
+ type: 'number',
+ unit: null,
}}
/>
}
@@ -42,12 +41,8 @@ describe('BigNumberWidgetVisualization', () => {
value={'2024-10-17T16:08:07+00:00'}
field="max(timestamp)"
meta={{
- fields: {
- 'max(timestamp)': 'date',
- },
- units: {
- 'max(timestamp)': null,
- },
+ type: 'date',
+ unit: null,
}}
/>
);
@@ -61,10 +56,8 @@ describe('BigNumberWidgetVisualization', () => {
value={'/api/0/fetch'}
field="any(transaction)"
meta={{
- fields: {
- 'max(timestamp)': 'string',
- },
- units: {},
+ type: 'string',
+ unit: null,
}}
/>
);
@@ -78,12 +71,8 @@ describe('BigNumberWidgetVisualization', () => {
value={17.28}
field="p95(span.duration)"
meta={{
- fields: {
- 'p95(span.duration)': 'duration',
- },
- units: {
- 'p95(span.duration)': 'milliseconds',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
}}
/>
);
@@ -97,12 +86,8 @@ describe('BigNumberWidgetVisualization', () => {
value={178451214}
field="count()"
meta={{
- fields: {
- 'count()': 'integer',
- },
- units: {
- 'count()': null,
- },
+ type: 'integer',
+ unit: null,
}}
/>
);
@@ -119,10 +104,8 @@ describe('BigNumberWidgetVisualization', () => {
field="count()"
maximumValue={100000000}
meta={{
- fields: {
- 'count()': 'integer',
- },
- units: {},
+ type: 'integer',
+ unit: null,
}}
/>
);
@@ -139,12 +122,8 @@ describe('BigNumberWidgetVisualization', () => {
previousPeriodValue={0.1728139}
field="http_response_code_rate(500)"
meta={{
- fields: {
- 'http_response_code_rate(500)': 'percentage',
- },
- units: {
- 'http_response_code_rate(500)': null,
- },
+ type: 'percentage',
+ unit: null,
}}
/>
);
@@ -161,12 +140,8 @@ describe('BigNumberWidgetVisualization', () => {
value={14.227123}
field="eps()"
meta={{
- fields: {
- 'eps()': 'rate',
- },
- units: {
- 'eps()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND,
}}
thresholds={{
max_values: {
@@ -190,12 +165,8 @@ describe('BigNumberWidgetVisualization', () => {
value={135} // 2.25/s
field="mystery_error_rate()"
meta={{
- fields: {
- 'mystery_error_rate()': 'rate',
- },
- units: {
- 'mystery_error_rate()': '1/minute',
- },
+ type: 'rate',
+ unit: RateUnit.PER_MINUTE,
}}
thresholds={{
max_values: {
@@ -216,12 +187,8 @@ describe('BigNumberWidgetVisualization', () => {
value={135}
field="mystery_error_rate()"
meta={{
- fields: {
- 'mystery_error_rate()': 'rate',
- },
- units: {
- 'mystery_error_rate()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND,
}}
thresholds={{
max_values: {
diff --git a/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.stories.tsx b/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.stories.tsx
index ef4ce0ff0aecf0..728cce283ae830 100644
--- a/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.stories.tsx
+++ b/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.stories.tsx
@@ -7,6 +7,7 @@ import SideBySide from 'sentry/components/stories/sideBySide';
import SizingWindow from 'sentry/components/stories/sizingWindow';
import storyBook from 'sentry/stories/storyBook';
import {space} from 'sentry/styles/space';
+import {DurationUnit, RateUnit} from 'sentry/utils/discover/fields';
import {BigNumberWidgetVisualization} from './bigNumberWidgetVisualization';
@@ -60,12 +61,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
value={0.01087819860850493}
field="eps()"
meta={{
- fields: {
- 'eps()': 'rate',
- },
- units: {
- 'eps()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND,
}}
thresholds={{
max_values: {
@@ -83,12 +80,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
value={178451214}
field="count()"
meta={{
- fields: {
- 'count()': 'integer',
- },
- units: {
- 'count()': null,
- },
+ type: 'integer',
+ unit: null,
}}
/>
</Container>
@@ -99,12 +92,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
value={17.28}
field="p95(span.duration)"
meta={{
- fields: {
- 'p95(span.duration)': 'duration',
- },
- units: {
- 'p95(spa.duration)': 'milliseconds',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
}}
/>
</Container>
@@ -115,12 +104,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
value={'2024-10-17T16:08:07+00:00'}
field="max(timestamp)"
meta={{
- fields: {
- 'max(timestamp)': 'date',
- },
- units: {
- 'max(timestamp)': null,
- },
+ type: 'date',
+ unit: null,
}}
/>
</Container>
@@ -164,10 +149,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
field="count()"
maximumValue={1000000}
meta={{
- fields: {
- 'count()': 'integer',
- },
- units: {},
+ type: 'integer',
+ unit: null,
}}
/>
</SmallWidget>
@@ -200,12 +183,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
field="eps()"
previousPeriodValue={15.0088607819850493}
meta={{
- fields: {
- 'eps()': 'rate',
- },
- units: {
- 'eps()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND,
}}
/>
</SmallWidget>
@@ -217,10 +196,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
field="http_rate(500)"
preferredPolarity="-"
meta={{
- fields: {
- 'http_rate(500)': 'percentage',
- },
- units: {},
+ type: 'percentage',
+ unit: null,
}}
/>
</SmallWidget>
@@ -231,10 +208,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
previousPeriodValue={0.1728139}
preferredPolarity="+"
meta={{
- fields: {
- 'http_rate(200)': 'percentage',
- },
- units: {},
+ type: 'percentage',
+ unit: null,
}}
/>
</SmallWidget>
@@ -245,12 +220,8 @@ export default storyBook('BigNumberWidgetVisualization', story => {
story('Thresholds', () => {
const meta = {
- fields: {
- 'eps()': 'rate',
- },
- units: {
- 'eps()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND,
};
const thresholds = {
diff --git a/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.tsx b/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.tsx
index 71b365f86f47c8..0ca499ce3495b5 100644
--- a/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.tsx
+++ b/static/app/views/dashboards/widgets/bigNumberWidget/bigNumberWidgetVisualization.tsx
@@ -47,14 +47,26 @@ export function BigNumberWidgetVisualization(props: BigNumberWidgetVisualization
const location = useLocation();
const organization = useOrganization();
- // TODO: meta as MetaType is a white lie. `MetaType` doesn't know that types can be null, but they can!
+ const unit = meta?.unit;
+ const type = meta?.type;
+
+ // Create old-school renderer meta, so we can pass it to field renderers
+ const rendererMeta: MetaType = {
+ fields: {
+ [field]: type ?? undefined,
+ },
+ };
+
+ if (unit) {
+ rendererMeta.units = {
+ [field]: unit,
+ };
+ }
+
const fieldRenderer = meta
- ? getFieldRenderer(field, meta as MetaType, false)
+ ? getFieldRenderer(field, rendererMeta, false)
: (renderableValue: any) => renderableValue.toString();
- const unit = meta?.units?.[field];
- const type = meta?.fields?.[field];
-
const baggage = {
location,
organization,
diff --git a/static/app/views/dashboards/widgets/common/types.tsx b/static/app/views/dashboards/widgets/common/types.tsx
index 2a84ef423ae05f..4a1b0247d2d0ef 100644
--- a/static/app/views/dashboards/widgets/common/types.tsx
+++ b/static/app/views/dashboards/widgets/common/types.tsx
@@ -1,10 +1,11 @@
import type {AccuracyStats, Confidence} from 'sentry/types/organization';
+import type {DataUnit} from 'sentry/utils/discover/fields';
import type {ThresholdsConfig} from '../../widgetBuilder/buildSteps/thresholdsStep/thresholdsStep';
export type Meta = {
- fields: Record<string, string | null>;
- units: Record<string, string | null>;
+ type: string | null; // TODO: This can probably be `AggregationOutputType`
+ unit: DataUnit | null;
isOther?: boolean;
};
diff --git a/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleDurationTimeSeries.ts b/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleDurationTimeSeries.ts
index 1643235353c29d..9704cfcd03f54f 100644
--- a/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleDurationTimeSeries.ts
+++ b/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleDurationTimeSeries.ts
@@ -1,12 +1,10 @@
+import {DurationUnit} from 'sentry/utils/discover/fields';
+
export const sampleDurationTimeSeries = {
field: 'p99(span.duration)',
meta: {
- fields: {
- 'p99(span.duration)': 'duration',
- },
- units: {
- 'p99(span.duration)': 'millisecond',
- },
+ type: 'duration',
+ unit: DurationUnit.MILLISECOND,
},
data: [
{
diff --git a/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleThroughputTimeSeries.ts b/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleThroughputTimeSeries.ts
index e4e740f9813597..e9fad3f98b9d6b 100644
--- a/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleThroughputTimeSeries.ts
+++ b/static/app/views/dashboards/widgets/timeSeriesWidget/fixtures/sampleThroughputTimeSeries.ts
@@ -1,12 +1,10 @@
+import {RateUnit} from 'sentry/utils/discover/fields';
+
export const sampleThroughputTimeSeries = {
field: 'eps()',
meta: {
- fields: {
- 'eps()': 'rate',
- },
- units: {
- 'eps()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND,
},
data: [
{
diff --git a/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/continuousTimeSeries.tsx b/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/continuousTimeSeries.tsx
index 02fee846ff1379..3ea28443dc3bd8 100644
--- a/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/continuousTimeSeries.tsx
+++ b/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/continuousTimeSeries.tsx
@@ -1,11 +1,6 @@
import type {SeriesOption} from 'echarts';
-import type {
- AggregationOutputType,
- DurationUnit,
- RateUnit,
- SizeUnit,
-} from 'sentry/utils/discover/fields';
+import type {AggregationOutputType, DataUnit} from 'sentry/utils/discover/fields';
import {scaleTimeSeriesData} from 'sentry/utils/timeSeries/scaleTimeSeriesData';
import type {TimeSeries} from '../../common/types';
@@ -29,7 +24,7 @@ export type ContinuousTimeSeriesPlottingOptions = {
/**
* Final plottable unit. This might be different from the original unit of the data, because we scale all time series to a single common unit.
*/
- unit: DurationUnit | SizeUnit | RateUnit | null;
+ unit: DataUnit;
/**
* If the chart has multiple Y axes (e.g., plotting durations and rates on the same chart), whether this value should be plotted on the left or right axis.
*/
@@ -62,17 +57,12 @@ export abstract class ContinuousTimeSeries<
}
get dataType(): AggregationOutputType {
- // TODO: Simplify this. `TimeSeries` types should already have this type
- return this.timeSeries.meta.fields[this.timeSeries.field]! as AggregationOutputType;
+ // TODO: Remove the `as` cast. `TimeSeries` meta should use `AggregationOutputType` instead of `string`
+ return this.timeSeries.meta.type as AggregationOutputType;
}
- get dataUnit(): DurationUnit | SizeUnit | RateUnit | null {
- // TODO: Simplify this. `TimeSeries` units should already have this type
- return this.timeSeries.meta.units[this.timeSeries.field] as
- | DurationUnit
- | SizeUnit
- | RateUnit
- | null;
+ get dataUnit(): DataUnit {
+ return this.timeSeries.meta.unit;
}
get start(): string | null {
@@ -99,7 +89,7 @@ export abstract class ContinuousTimeSeries<
};
}
- scaleToUnit(destinationUnit: DurationUnit | SizeUnit | RateUnit | null): TimeSeries {
+ scaleToUnit(destinationUnit: DataUnit): TimeSeries {
return scaleTimeSeriesData(this.timeSeries, destinationUnit);
}
diff --git a/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/plottable.tsx b/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/plottable.tsx
index 54ca1d5bb2b394..37692a64266e09 100644
--- a/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/plottable.tsx
+++ b/static/app/views/dashboards/widgets/timeSeriesWidget/plottables/plottable.tsx
@@ -1,11 +1,6 @@
import type {SeriesOption} from 'echarts';
-import type {
- AggregationOutputType,
- DurationUnit,
- RateUnit,
- SizeUnit,
-} from 'sentry/utils/discover/fields';
+import type {AggregationOutputType, DataUnit} from 'sentry/utils/discover/fields';
/**
* A `Plottable` is any object that can be converted to an ECharts `Series` and therefore plotted on an ECharts chart. This could be a data series, releases, samples, and other kinds of markers. `TimeSeriesWidgetVisualization` uses `Plottable` objects under the hood, to convert data coming into the component via props into ECharts series.
@@ -23,7 +18,7 @@ export interface Plottable {
/**
* If the plottable is based on data, the unit. Otherwise, null
*/
- dataUnit: DurationUnit | SizeUnit | RateUnit | null;
+ dataUnit: DataUnit;
/**
* Start timestamp of the plottable, if applicable
*/
diff --git a/static/app/views/dashboards/widgets/timeSeriesWidget/settings.tsx b/static/app/views/dashboards/widgets/timeSeriesWidget/settings.tsx
index 7b1e90c43d4ef5..461fb7c1c69bc3 100644
--- a/static/app/views/dashboards/widgets/timeSeriesWidget/settings.tsx
+++ b/static/app/views/dashboards/widgets/timeSeriesWidget/settings.tsx
@@ -1,5 +1,6 @@
import {
type AggregationOutputType,
+ type DataUnit,
DurationUnit,
RateUnit,
SizeUnit,
@@ -16,4 +17,4 @@ export const FALLBACK_UNIT_FOR_FIELD_TYPE = {
string: null,
size: SizeUnit.BYTE,
rate: RateUnit.PER_SECOND,
-} satisfies Record<AggregationOutputType, DurationUnit | SizeUnit | RateUnit | null>;
+} satisfies Record<AggregationOutputType, DataUnit>;
diff --git a/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.stories.tsx b/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.stories.tsx
index e717ba86716dbd..325f6d09011dba 100644
--- a/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.stories.tsx
+++ b/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.stories.tsx
@@ -9,6 +9,7 @@ import SideBySide from 'sentry/components/stories/sideBySide';
import SizingWindow from 'sentry/components/stories/sizingWindow';
import storyBook from 'sentry/stories/storyBook';
import type {DateString} from 'sentry/types/core';
+import {DurationUnit, RateUnit} from 'sentry/utils/discover/fields';
import {decodeScalar} from 'sentry/utils/queryString';
import {shiftTimeSeriesToNow} from 'sentry/utils/timeSeries/shiftTimeSeriesToNow';
import useLocationQuery from 'sentry/utils/url/useLocationQuery';
@@ -34,14 +35,6 @@ const sampleDurationTimeSeries2 = {
value: datum.value * 0.3 + 30 * Math.random(),
};
}),
- meta: {
- fields: {
- 'p50(span.duration)': 'duration',
- },
- units: {
- 'p50(span.duration)': 'millisecond',
- },
- },
};
export default storyBook('TimeSeriesWidgetVisualization', (story, APIReference) => {
@@ -273,12 +266,8 @@ export default storyBook('TimeSeriesWidgetVisualization', (story, APIReference)
};
}),
meta: {
- fields: {
- 'p99(span.self_time)': 'duration',
- },
- units: {
- 'p99(span.self_time)': 'second',
- },
+ type: 'duration',
+ unit: DurationUnit.SECOND,
},
};
@@ -390,12 +379,8 @@ export default storyBook('TimeSeriesWidgetVisualization', (story, APIReference)
...sampleThroughputTimeSeries,
field: 'error_rate()',
meta: {
- fields: {
- 'error_rate()': 'rate',
- },
- units: {
- 'error_rate()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND,
},
};
@@ -554,14 +539,6 @@ export default storyBook('TimeSeriesWidgetVisualization', (story, APIReference)
new Line({
...sampleThroughputTimeSeries,
field: 'error_rate()',
- meta: {
- fields: {
- 'error_rate()': 'rate',
- },
- units: {
- 'error_rate()': '1/second',
- },
- },
}),
]}
releases={releases}
diff --git a/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.tsx b/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.tsx
index 9599573a6033fb..4031cdc64ee51e 100644
--- a/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.tsx
+++ b/static/app/views/dashboards/widgets/timeSeriesWidget/timeSeriesWidgetVisualization.tsx
@@ -11,7 +11,6 @@ import type {
import type EChartsReactCore from 'echarts-for-react/lib/core';
import groupBy from 'lodash/groupBy';
import mapValues from 'lodash/mapValues';
-import uniq from 'lodash/uniq';
import BaseChart from 'sentry/components/charts/baseChart';
import {getFormatter} from 'sentry/components/charts/components/tooltip';
@@ -22,6 +21,7 @@ import LoadingIndicator from 'sentry/components/loadingIndicator';
import {getChartColorPalette} from 'sentry/constants/chartPalette';
import type {EChartDataZoomHandler, ReactEchartsRef} from 'sentry/types/echarts';
import {defined} from 'sentry/utils';
+import {uniq} from 'sentry/utils/array/uniq';
import type {AggregationOutputType} from 'sentry/utils/discover/fields';
import {type Range, RangeMap} from 'sentry/utils/number/rangeMap';
import useOrganization from 'sentry/utils/useOrganization';
diff --git a/static/app/views/insights/common/queries/useSortedTimeSeries.tsx b/static/app/views/insights/common/queries/useSortedTimeSeries.tsx
index f0207785b6793e..341f5ad098e650 100644
--- a/static/app/views/insights/common/queries/useSortedTimeSeries.tsx
+++ b/static/app/views/insights/common/queries/useSortedTimeSeries.tsx
@@ -6,6 +6,7 @@ import type {
MultiSeriesEventsStats,
} from 'sentry/types/organization';
import {encodeSort} from 'sentry/utils/discover/eventView';
+import type {DataUnit} from 'sentry/utils/discover/fields';
import {
type DiscoverQueryProps,
useGenericDiscoverQuery,
@@ -219,12 +220,8 @@ export function convertEventsStatsToTimeSeriesData(
value: countsForTimestamp.reduce((acc, {count}) => acc + count, 0),
})),
meta: {
- fields: {
- [label]: seriesData.meta?.fields?.[seriesName]!,
- },
- units: {
- [label]: seriesData.meta?.units?.[seriesName]!,
- },
+ type: seriesData.meta?.fields?.[seriesName]!,
+ unit: seriesData.meta?.units?.[seriesName] as DataUnit,
},
confidence: determineSeriesConfidence(seriesData),
sampleCount: seriesData.meta?.accuracy?.sampleCount,
diff --git a/static/app/views/insights/common/utils/convertSeriesToTimeseries.tsx b/static/app/views/insights/common/utils/convertSeriesToTimeseries.tsx
index a0c1069398ddf3..c3e2737afab38f 100644
--- a/static/app/views/insights/common/utils/convertSeriesToTimeseries.tsx
+++ b/static/app/views/insights/common/utils/convertSeriesToTimeseries.tsx
@@ -1,3 +1,4 @@
+import type {DataUnit} from 'sentry/utils/discover/fields';
import type {TimeSeries} from 'sentry/views/dashboards/widgets/common/types';
import type {DiscoverSeries} from '../queries/useDiscoverSeries';
@@ -5,7 +6,11 @@ import type {DiscoverSeries} from '../queries/useDiscoverSeries';
export function convertSeriesToTimeseries(series: DiscoverSeries): TimeSeries {
return {
field: series.seriesName,
- meta: series.meta,
+ meta: {
+ // This behavior is a little awkward. Normally `meta` shouldn't be missing, but we sometime return blank meta from helper hooks
+ type: series.meta?.fields?.[series.seriesName] ?? null,
+ unit: (series.meta?.units?.[series.seriesName] ?? null) as DataUnit,
+ },
data: (series?.data ?? []).map(datum => ({
timestamp: datum.name.toString(),
value: datum.value,
diff --git a/static/app/views/projectDetail/projectScoreCards/projectAnrScoreCard.tsx b/static/app/views/projectDetail/projectScoreCards/projectAnrScoreCard.tsx
index 79ef2d7766f2f3..f2db7fe392b466 100644
--- a/static/app/views/projectDetail/projectScoreCards/projectAnrScoreCard.tsx
+++ b/static/app/views/projectDetail/projectScoreCards/projectAnrScoreCard.tsx
@@ -182,10 +182,8 @@ export function ProjectAnrScoreCard({
field="anr_rate()"
preferredPolarity="-"
meta={{
- fields: {
- 'anr_rate()': 'percentage',
- },
- units: {},
+ type: 'percentage',
+ unit: null,
}}
/>
}
diff --git a/static/app/views/projectDetail/projectScoreCards/projectApdexScoreCard.tsx b/static/app/views/projectDetail/projectScoreCards/projectApdexScoreCard.tsx
index 27fcb9e5d04682..a493df06a81bcb 100644
--- a/static/app/views/projectDetail/projectScoreCards/projectApdexScoreCard.tsx
+++ b/static/app/views/projectDetail/projectScoreCards/projectApdexScoreCard.tsx
@@ -169,10 +169,8 @@ function ProjectApdexScoreCard(props: Props) {
previousPeriodValue={previousApdex}
field="apdex()"
meta={{
- fields: {
- 'apdex()': 'number',
- },
- units: {},
+ type: 'number',
+ unit: null,
}}
preferredPolarity="+"
/>
diff --git a/static/app/views/projectDetail/projectScoreCards/projectStabilityScoreCard.tsx b/static/app/views/projectDetail/projectScoreCards/projectStabilityScoreCard.tsx
index 6c2bbaba1437c3..e01647070433e6 100644
--- a/static/app/views/projectDetail/projectScoreCards/projectStabilityScoreCard.tsx
+++ b/static/app/views/projectDetail/projectScoreCards/projectStabilityScoreCard.tsx
@@ -196,10 +196,8 @@ function ProjectStabilityScoreCard(props: Props) {
previousPeriodValue={previousScore ? previousScore / 100 : undefined}
field={`${props.field}()`}
meta={{
- fields: {
- [`${props.field}()`]: 'percentage',
- },
- units: {},
+ type: 'percentage',
+ unit: null,
}}
preferredPolarity="+"
/>
diff --git a/static/app/views/projectDetail/projectScoreCards/projectVelocityScoreCard.tsx b/static/app/views/projectDetail/projectScoreCards/projectVelocityScoreCard.tsx
index 2d21fe45b393b7..394aabfa81d531 100644
--- a/static/app/views/projectDetail/projectScoreCards/projectVelocityScoreCard.tsx
+++ b/static/app/views/projectDetail/projectScoreCards/projectVelocityScoreCard.tsx
@@ -208,10 +208,8 @@ function ProjectVelocityScoreCard(props: Props) {
field="count()"
maximumValue={API_LIMIT}
meta={{
- fields: {
- 'count()': 'number',
- },
- units: {},
+ type: 'number',
+ unit: null,
}}
preferredPolarity="+"
/>
diff --git a/tests/js/fixtures/timeSeries.ts b/tests/js/fixtures/timeSeries.ts
index d55e4322576e8a..9837180898f738 100644
--- a/tests/js/fixtures/timeSeries.ts
+++ b/tests/js/fixtures/timeSeries.ts
@@ -1,15 +1,12 @@
+import { RateUnit } from "sentry/utils/discover/fields";
import { TimeSeries } from "sentry/views/dashboards/widgets/common/types";
export function TimeSeriesFixture(params: Partial<TimeSeries> = {}): TimeSeries {
return {
field: 'eps()',
meta: {
- fields: {
- 'eps()': 'rate',
- },
- units: {
- 'eps()': '1/second',
- },
+ type: 'rate',
+ unit: RateUnit.PER_SECOND
},
data: [
{
|
fe7fa9c66fd47be1c31f9634a7eac906ac8404f9
|
2024-03-04 14:12:24
|
Ogi
|
feat(dashboards): metric big number widget (#65882)
| false
|
metric big number widget (#65882)
|
feat
|
diff --git a/static/app/components/modals/metricWidgetViewerModal/visualization.tsx b/static/app/components/modals/metricWidgetViewerModal/visualization.tsx
index 78f2a5b96c1dfe..d5afe91eba7ebe 100644
--- a/static/app/components/modals/metricWidgetViewerModal/visualization.tsx
+++ b/static/app/components/modals/metricWidgetViewerModal/visualization.tsx
@@ -18,10 +18,12 @@ import {
} from 'sentry/utils/metrics/useMetricsQuery';
import usePageFilters from 'sentry/utils/usePageFilters';
import {DASHBOARD_CHART_GROUP} from 'sentry/views/dashboards/dashboard';
+import {BigNumber, getBigNumberData} from 'sentry/views/dashboards/metrics/bigNumber';
import {getTableData, MetricTable} from 'sentry/views/dashboards/metrics/table';
import {toMetricDisplayType} from 'sentry/views/dashboards/metrics/utils';
import {DisplayType} from 'sentry/views/dashboards/types';
import {displayTypes} from 'sentry/views/dashboards/widgetBuilder/utils';
+import {LoadingScreen} from 'sentry/views/dashboards/widgetCard/widgetCardChartContainer';
import {getIngestionSeriesId, MetricChart} from 'sentry/views/ddm/chart/chart';
import {SummaryTable} from 'sentry/views/ddm/summaryTable';
import {useSeriesHover} from 'sentry/views/ddm/useSeriesHover';
@@ -100,12 +102,10 @@ function useFocusedSeries({
};
}
-const supportedDisplayTypes = Object.keys(displayTypes)
- .filter(d => d !== DisplayType.BIG_NUMBER)
- .map(value => ({
- label: displayTypes[value],
- value,
- }));
+const supportedDisplayTypes = Object.keys(displayTypes).map(value => ({
+ label: displayTypes[value],
+ value,
+}));
interface MetricVisualizationProps {
displayType: DisplayType;
@@ -120,8 +120,6 @@ export function MetricVisualization({
}: MetricVisualizationProps) {
const {selection} = usePageFilters();
- const isTable = displayType === DisplayType.TABLE;
-
const {
data: timeseriesData,
isLoading,
@@ -133,6 +131,39 @@ export function MetricVisualization({
const widgetMQL = useMemo(() => getWidgetTitle(queries), [queries]);
+ const visualizationComponent = useMemo(() => {
+ if (!timeseriesData) {
+ return null;
+ }
+ if (displayType === DisplayType.TABLE) {
+ return (
+ <MetricTableVisualization
+ isLoading={isLoading}
+ timeseriesData={timeseriesData}
+ queries={queries}
+ />
+ );
+ }
+ if (displayType === DisplayType.BIG_NUMBER) {
+ return (
+ <MetricBigNumberVisualization
+ timeseriesData={timeseriesData}
+ isLoading={isLoading}
+ queries={queries}
+ />
+ );
+ }
+
+ return (
+ <MetricChartVisualization
+ isLoading={isLoading}
+ timeseriesData={timeseriesData}
+ queries={queries}
+ displayType={displayType}
+ />
+ );
+ }, [displayType, isLoading, queries, timeseriesData]);
+
if (!timeseriesData || isError) {
return (
<StyledMetricChartContainer>
@@ -168,20 +199,7 @@ export function MetricVisualization({
onChange={({value}) => onDisplayTypeChange(value as DisplayType)}
/>
</ViualizationHeader>
- {!isTable ? (
- <MetricChartVisualization
- isLoading={isLoading}
- timeseriesData={timeseriesData}
- queries={queries}
- displayType={displayType}
- />
- ) : (
- <MetricTableVisualization
- isLoading={isLoading}
- timeseriesData={timeseriesData}
- queries={queries}
- />
- )}
+ {visualizationComponent}
</StyledOuterContainer>
);
}
@@ -209,6 +227,27 @@ function MetricTableVisualization({
);
}
+function MetricBigNumberVisualization({
+ timeseriesData,
+ queries,
+ isLoading,
+}: MetricTableVisualizationProps) {
+ const bigNumberData = useMemo(() => {
+ return timeseriesData ? getBigNumberData(timeseriesData, queries) : undefined;
+ }, [timeseriesData, queries]);
+
+ if (!bigNumberData) {
+ return null;
+ }
+
+ return (
+ <Fragment>
+ <LoadingScreen loading={isLoading} />
+ <BigNumber>{bigNumberData}</BigNumber>
+ </Fragment>
+ );
+}
+
interface MetricChartVisualizationProps extends MetricTableVisualizationProps {
displayType: DisplayType;
}
diff --git a/static/app/views/dashboards/metrics/bigNumber.tsx b/static/app/views/dashboards/metrics/bigNumber.tsx
new file mode 100644
index 00000000000000..452fa36c9084d3
--- /dev/null
+++ b/static/app/views/dashboards/metrics/bigNumber.tsx
@@ -0,0 +1,80 @@
+import {useMemo} from 'react';
+import styled from '@emotion/styled';
+
+import {space} from 'sentry/styles/space';
+import type {MetricsQueryApiResponse} from 'sentry/types';
+import {formatMetricsUsingUnitAndOp} from 'sentry/utils/metrics/formatters';
+import {parseMRI} from 'sentry/utils/metrics/mri';
+import {
+ isMetricFormula,
+ type MetricsQueryApiQueryParams,
+ type MetricsQueryApiRequestQuery,
+} from 'sentry/utils/metrics/useMetricsQuery';
+import {LoadingScreen} from 'sentry/views/dashboards/widgetCard/widgetCardChartContainer';
+
+interface MetricBigNumberContainerProps {
+ isLoading: boolean;
+ metricQueries: MetricsQueryApiRequestQuery[];
+ timeseriesData?: MetricsQueryApiResponse;
+}
+
+export function MetricBigNumberContainer({
+ timeseriesData,
+ metricQueries,
+ isLoading,
+}: MetricBigNumberContainerProps) {
+ const bigNumberData = useMemo(() => {
+ return timeseriesData ? getBigNumberData(timeseriesData, metricQueries) : undefined;
+ }, [timeseriesData, metricQueries]);
+
+ if (!bigNumberData) {
+ return null;
+ }
+
+ return (
+ <BigNumberWrapper>
+ <LoadingScreen loading={isLoading} />
+ <BigNumber>{bigNumberData}</BigNumber>
+ </BigNumberWrapper>
+ );
+}
+
+export function getBigNumberData(
+ data: MetricsQueryApiResponse,
+ queries: MetricsQueryApiQueryParams[]
+): string {
+ const filteredQueries = queries.filter(
+ query => !isMetricFormula(query)
+ ) as MetricsQueryApiRequestQuery[];
+
+ const firstQuery = filteredQueries[0];
+
+ const value = data.data[0][0].totals;
+
+ return formatMetricsUsingUnitAndOp(
+ value,
+ parseMRI(firstQuery.mri)?.unit!,
+ firstQuery.op
+ );
+}
+
+const BigNumberWrapper = styled('div')`
+ height: 100%;
+ width: 100%;
+ overflow: hidden;
+`;
+
+export const BigNumber = styled('div')`
+ line-height: 1;
+ display: inline-flex;
+ flex: 1;
+ width: 100%;
+ min-height: 0;
+ font-size: 32px;
+ color: ${p => p.theme.headingColor};
+ padding: ${space(1)} ${space(3)} ${space(3)} ${space(3)};
+
+ * {
+ text-align: left !important;
+ }
+`;
diff --git a/static/app/views/dashboards/metrics/widgetCard.tsx b/static/app/views/dashboards/metrics/widgetCard.tsx
index fd7fd32027fe34..03f23bd86934d2 100644
--- a/static/app/views/dashboards/metrics/widgetCard.tsx
+++ b/static/app/views/dashboards/metrics/widgetCard.tsx
@@ -13,6 +13,7 @@ import {space} from 'sentry/styles/space';
import type {Organization, PageFilters} from 'sentry/types';
import {getWidgetTitle} from 'sentry/utils/metrics';
import {useMetricsQuery} from 'sentry/utils/metrics/useMetricsQuery';
+import {MetricBigNumberContainer} from 'sentry/views/dashboards/metrics/bigNumber';
import {MetricChartContainer} from 'sentry/views/dashboards/metrics/chart';
import {MetricTableContainer} from 'sentry/views/dashboards/metrics/table';
import {
@@ -63,8 +64,6 @@ export function MetricWidgetCard({
const widgetMQL = useMemo(() => getWidgetTitle(metricQueries), [metricQueries]);
- const isTable = widget.displayType === DisplayType.TABLE;
-
const {
data: timeseriesData,
isLoading,
@@ -74,6 +73,37 @@ export function MetricWidgetCard({
intervalLadder: widget.displayType === DisplayType.BAR ? 'bar' : 'dashboard',
});
+ const vizualizationComponent = useMemo(() => {
+ if (widget.displayType === DisplayType.TABLE) {
+ return (
+ <MetricTableContainer
+ metricQueries={metricQueries}
+ timeseriesData={timeseriesData}
+ isLoading={isLoading}
+ />
+ );
+ }
+ if (widget.displayType === DisplayType.BIG_NUMBER) {
+ return (
+ <MetricBigNumberContainer
+ timeseriesData={timeseriesData}
+ isLoading={isLoading}
+ metricQueries={metricQueries}
+ />
+ );
+ }
+
+ return (
+ <MetricChartContainer
+ timeseriesData={timeseriesData}
+ isLoading={isLoading}
+ metricQueries={metricQueries}
+ displayType={toMetricDisplayType(widget.displayType)}
+ chartHeight={!showContextMenu ? 200 : undefined}
+ />
+ );
+ }, [widget.displayType, metricQueries, timeseriesData, isLoading, showContextMenu]);
+
if (isError) {
const errorMessage =
error?.responseJSON?.detail?.toString() || t('Error while fetching metrics data');
@@ -135,23 +165,8 @@ export function MetricWidgetCard({
renderErrorMessage={renderErrorMessage}
error={error}
>
- {!isTable ? (
- <MetricChartContainer
- timeseriesData={timeseriesData}
- isLoading={isLoading}
- metricQueries={metricQueries}
- displayType={toMetricDisplayType(widget.displayType)}
- chartHeight={!showContextMenu ? 200 : undefined}
- />
- ) : (
- <MetricTableContainer
- metricQueries={metricQueries}
- timeseriesData={timeseriesData}
- isLoading={isLoading}
- />
- )}
+ {vizualizationComponent}
</WidgetCardBody>
-
{isEditingDashboard && <Toolbar onDelete={onDelete} onDuplicate={onDuplicate} />}
</WidgetCardPanel>
</DashboardsMEPContext.Provider>
|
da71322981b922958802507aa0ea11789a0b76ad
|
2023-04-21 01:18:56
|
John
|
feat(generic metrics): Implement use case logic in IndexerBatch (#47113)
| false
|
Implement use case logic in IndexerBatch (#47113)
|
feat
|
diff --git a/src/sentry/sentry_metrics/consumers/indexer/batch.py b/src/sentry/sentry_metrics/consumers/indexer/batch.py
index 02ccfe95c2a9e4..66cc78a659b772 100644
--- a/src/sentry/sentry_metrics/consumers/indexer/batch.py
+++ b/src/sentry/sentry_metrics/consumers/indexer/batch.py
@@ -1,5 +1,6 @@
import logging
import random
+import re
from collections import defaultdict
from typing import (
Any,
@@ -22,14 +23,14 @@
from arroyo.codecs.json import JsonCodec
from arroyo.types import BrokerValue, Message
from django.conf import settings
-from sentry_kafka_schemas.schema_types.ingest_metrics_v1 import IngestMetric
from sentry_kafka_schemas.schema_types.snuba_generic_metrics_v1 import GenericMetric
from sentry_kafka_schemas.schema_types.snuba_metrics_v1 import Metric
-from sentry.sentry_metrics.configuration import UseCaseKey
from sentry.sentry_metrics.consumers.indexer.common import IndexerOutputMessageBatch, MessageBatch
+from sentry.sentry_metrics.consumers.indexer.parsed_message import ParsedMessage
from sentry.sentry_metrics.consumers.indexer.routing_producer import RoutingPayload
from sentry.sentry_metrics.indexer.base import Metadata
+from sentry.sentry_metrics.use_case_id_registry import UseCaseID
from sentry.utils import json, metrics
logger = logging.getLogger(__name__)
@@ -39,6 +40,9 @@
MAX_TAG_VALUE_LENGTH = 200
ACCEPTED_METRIC_TYPES = {"s", "c", "d"} # set, counter, distribution
+MRI_RE_PATTERN = re.compile("^([c|s|d|g|e]):([a-zA-Z0-9_]+)/.*$")
+
+OrgId = int
class PartitionIdxOffset(NamedTuple):
@@ -71,16 +75,26 @@ def invalid_metric_tags(tags: Mapping[str, str]) -> Sequence[str]:
return invalid_strs
+# TODO: Move this to where we do use case registration
+def extract_use_case_id(mri: str) -> Optional[UseCaseID]:
+ """
+ Returns the use case ID given the MRI, returns None if MRI is invalid.
+ """
+ if matched := MRI_RE_PATTERN.match(mri):
+ use_case_str = matched.group(2)
+ if use_case_str in {id.value for id in UseCaseID}:
+ return UseCaseID(use_case_str)
+ raise ValidationError(f"Invalid mri: {mri}")
+
+
class IndexerBatch:
def __init__(
self,
- use_case_id: UseCaseKey,
outer_message: Message[MessageBatch],
should_index_tag_values: bool,
is_output_sliced: bool,
arroyo_input_codec: Optional[JsonCodec[Any]],
) -> None:
- self.use_case_id = use_case_id
self.outer_message = outer_message
self.__should_index_tag_values = should_index_tag_values
self.is_output_sliced = is_output_sliced
@@ -91,14 +105,13 @@ def __init__(
@metrics.wraps("process_messages.extract_messages")
def _extract_messages(self) -> None:
self.skipped_offsets: Set[PartitionIdxOffset] = set()
- self.parsed_payloads_by_offset: MutableMapping[PartitionIdxOffset, IngestMetric] = {}
+ self.parsed_payloads_by_offset: MutableMapping[PartitionIdxOffset, ParsedMessage] = {}
for msg in self.outer_message.payload:
assert isinstance(msg.value, BrokerValue)
partition_offset = PartitionIdxOffset(msg.value.partition.index, msg.value.offset)
try:
parsed_payload = json.loads(msg.payload.value.decode("utf-8"), use_rapid_json=True)
- self.parsed_payloads_by_offset[partition_offset] = parsed_payload
except rapidjson.JSONDecodeError:
self.skipped_offsets.add(partition_offset)
logger.error(
@@ -107,7 +120,16 @@ def _extract_messages(self) -> None:
exc_info=True,
)
continue
-
+ try:
+ parsed_payload["use_case_id"] = extract_use_case_id(parsed_payload["name"])
+ except ValidationError:
+ self.skipped_offsets.add(partition_offset)
+ logger.error(
+ "process_messages.invalid_metric_resource_identifier",
+ extra={"payload_value": str(msg.payload.value)},
+ exc_info=True,
+ )
+ continue
try:
if self.__input_codec:
self.__input_codec.validate(parsed_payload)
@@ -122,6 +144,7 @@ def _extract_messages(self) -> None:
extra={"payload_value": str(msg.payload.value)},
exc_info=True,
)
+ self.parsed_payloads_by_offset[partition_offset] = parsed_payload
@metrics.wraps("process_messages.filter_messages")
def filter_messages(self, keys_to_remove: Sequence[PartitionIdxOffset]) -> None:
@@ -149,8 +172,10 @@ def filter_messages(self, keys_to_remove: Sequence[PartitionIdxOffset]) -> None:
self.skipped_offsets.update(keys_to_remove)
@metrics.wraps("process_messages.extract_strings")
- def extract_strings(self) -> Mapping[int, Set[str]]:
- org_strings = defaultdict(set)
+ def extract_strings(self) -> Mapping[UseCaseID, Mapping[OrgId, Set[str]]]:
+ strings: Mapping[UseCaseID, Mapping[OrgId, Set[str]]] = defaultdict(
+ lambda: defaultdict(set)
+ )
for partition_offset, message in self.parsed_payloads_by_offset.items():
if partition_offset in self.skipped_offsets:
@@ -160,6 +185,7 @@ def extract_strings(self) -> Mapping[int, Set[str]]:
metric_name = message["name"]
metric_type = message["type"]
+ use_case_id = message["use_case_id"]
org_id = message["org_id"]
tags = message.get("tags", {})
@@ -167,6 +193,7 @@ def extract_strings(self) -> Mapping[int, Set[str]]:
logger.error(
"process_messages.invalid_metric_name",
extra={
+ "use_case_id": use_case_id,
"org_id": org_id,
"metric_name": metric_name,
"partition": partition_idx,
@@ -179,19 +206,23 @@ def extract_strings(self) -> Mapping[int, Set[str]]:
if metric_type not in ACCEPTED_METRIC_TYPES:
logger.error(
"process_messages.invalid_metric_type",
- extra={"org_id": org_id, "metric_type": metric_type, "offset": offset},
+ extra={
+ "use_case_id": use_case_id,
+ "org_id": org_id,
+ "metric_type": metric_type,
+ "offset": offset,
+ },
)
self.skipped_offsets.add(partition_offset)
continue
- invalid_strs = invalid_metric_tags(tags)
-
- if invalid_strs:
+ if invalid_strs := invalid_metric_tags(tags):
# sentry doesn't seem to actually capture nested logger.error extra args
sentry_sdk.set_extra("all_metric_tags", tags)
logger.error(
"process_messages.invalid_tags",
extra={
+ "use_case_id": use_case_id,
"org_id": org_id,
"metric_name": metric_name,
"invalid_tags": invalid_strs,
@@ -202,28 +233,30 @@ def extract_strings(self) -> Mapping[int, Set[str]]:
self.skipped_offsets.add(partition_offset)
continue
- parsed_strings = {
+ strings_in_message = {
metric_name,
*tags.keys(),
}
if self.__should_index_tag_values:
- parsed_strings.update(tags.values())
+ strings_in_message.update(tags.values())
- org_strings[org_id].update(parsed_strings)
+ strings[use_case_id][org_id].update(strings_in_message)
- string_count = 0
- for org_set in org_strings:
- string_count += len(org_strings[org_set])
- metrics.gauge("process_messages.lookups_per_batch", value=string_count)
+ for use_case_id, org_mapping in strings.items():
+ metrics.gauge(
+ "process_messages.lookups_per_batch",
+ value=sum(len(parsed_strings) for parsed_strings in org_mapping.values()),
+ tags={"use_case": use_case_id.value},
+ )
- return org_strings
+ return strings
@metrics.wraps("process_messages.reconstruct_messages")
def reconstruct_messages(
self,
- mapping: Mapping[int, Mapping[str, Optional[int]]],
- bulk_record_meta: Mapping[int, Mapping[str, Metadata]],
+ mapping: Mapping[OrgId, Mapping[str, Optional[int]]],
+ bulk_record_meta: Mapping[OrgId, Mapping[str, Metadata]],
) -> IndexerOutputMessageBatch:
new_messages: IndexerOutputMessageBatch = []
@@ -358,7 +391,7 @@ def reconstruct_messages(
# XXX: relay actually sends this value unconditionally
"retention_days": old_payload_value.get("retention_days", 90),
"mapping_meta": output_message_meta,
- "use_case_id": self.use_case_id.value,
+ "use_case_id": old_payload_value["use_case_id"].value,
"metric_id": numeric_metric_id,
"org_id": old_payload_value["org_id"],
"timestamp": old_payload_value["timestamp"],
@@ -377,7 +410,7 @@ def reconstruct_messages(
"version": 2,
"retention_days": old_payload_value.get("retention_days", 90),
"mapping_meta": output_message_meta,
- "use_case_id": self.use_case_id.value,
+ "use_case_id": old_payload_value["use_case_id"].value,
"metric_id": numeric_metric_id,
"org_id": old_payload_value["org_id"],
"timestamp": old_payload_value["timestamp"],
diff --git a/src/sentry/sentry_metrics/consumers/indexer/parsed_message.py b/src/sentry/sentry_metrics/consumers/indexer/parsed_message.py
new file mode 100644
index 00000000000000..afb8520310d079
--- /dev/null
+++ b/src/sentry/sentry_metrics/consumers/indexer/parsed_message.py
@@ -0,0 +1,26 @@
+from typing import Dict, List, Literal, TypedDict, Union
+
+from typing_extensions import Required
+
+from sentry.sentry_metrics.use_case_id_registry import UseCaseID
+
+
+class ParsedMessage(TypedDict, total=False):
+ """Internal representation of a parsed ingest metric message for indexer to support generic metrics"""
+
+ use_case_id: Required[UseCaseID]
+ org_id: Required[int]
+ project_id: Required[int]
+ name: Required[str]
+ type: Required["_IngestMetricType"]
+ timestamp: Required[int]
+ tags: Required[Dict[str, str]]
+ value: Required[Union["CounterMetricValue", "SetMetricValue", "DistributionMetricValue"]]
+ retention_days: Required[int]
+
+
+_IngestMetricType = Union[Literal["c"], Literal["d"], Literal["s"]]
+CounterMetricValue = Union[int, float]
+DistributionMetricValue = List[Union[int, float]]
+SetMetricValue = List["_SetMetricValueItem"]
+_SetMetricValueItem = int
diff --git a/src/sentry/sentry_metrics/consumers/indexer/processing.py b/src/sentry/sentry_metrics/consumers/indexer/processing.py
index 2e3c5ccaf8a389..fcc3c9fef02ce6 100644
--- a/src/sentry/sentry_metrics/consumers/indexer/processing.py
+++ b/src/sentry/sentry_metrics/consumers/indexer/processing.py
@@ -86,7 +86,6 @@ def _process_messages_impl(
is_output_sliced = self._config.is_output_sliced or False
batch = IndexerBatch(
- self._config.use_case_id,
outer_message,
should_index_tag_values=should_index_tag_values,
is_output_sliced=is_output_sliced,
@@ -100,7 +99,7 @@ def _process_messages_impl(
):
cardinality_limiter = cardinality_limiter_factory.get_ratelimiter(self._config)
cardinality_limiter_state = cardinality_limiter.check_cardinality_limits(
- batch.use_case_id, batch.parsed_payloads_by_offset
+ self._config.use_case_id, batch.parsed_payloads_by_offset
)
sdk.set_measurement(
@@ -108,7 +107,8 @@ def _process_messages_impl(
)
batch.filter_messages(cardinality_limiter_state.keys_to_remove)
- org_strings = batch.extract_strings()
+ extracted_strings = batch.extract_strings()
+ org_strings = next(iter(extracted_strings.values())) if extracted_strings else {}
sdk.set_measurement("org_strings.len", len(org_strings))
diff --git a/tests/sentry/sentry_metrics/test_batch.py b/tests/sentry/sentry_metrics/test_batch.py
index 0ceee46c5d16f8..a98d1270f44f75 100644
--- a/tests/sentry/sentry_metrics/test_batch.py
+++ b/tests/sentry/sentry_metrics/test_batch.py
@@ -1,6 +1,8 @@
import logging
from collections.abc import MutableMapping
from datetime import datetime, timezone
+from enum import Enum
+from unittest.mock import patch
import pytest
import sentry_kafka_schemas
@@ -8,12 +10,19 @@
from arroyo.codecs.json import JsonCodec
from arroyo.types import BrokerValue, Message, Partition, Topic, Value
-from sentry.sentry_metrics.configuration import UseCaseKey
from sentry.sentry_metrics.consumers.indexer.batch import IndexerBatch, PartitionIdxOffset
from sentry.sentry_metrics.indexer.base import FetchType, FetchTypeExt, Metadata
-from sentry.snuba.metrics.naming_layer.mri import SessionMRI
+from sentry.snuba.metrics.naming_layer.mri import SessionMRI, TransactionMRI
from sentry.utils import json
+
+class MockUseCaseID(Enum):
+ TRANSACTIONS = "transactions"
+ SESSIONS = "sessions"
+ USE_CASE_1 = "use_case_1"
+ USE_CASE_2 = "use_case_2"
+
+
pytestmark = pytest.mark.sentry_metrics
ts = int(datetime.now(tz=timezone.utc).timestamp())
@@ -60,16 +69,18 @@
}
extracted_string_output = {
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "errored",
- "healthy",
- "init",
- "production",
- "s:sessions/error@none",
- "session.status",
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
@@ -169,36 +180,41 @@ def _get_string_indexer_log_records(caplog):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
@pytest.mark.parametrize(
"should_index_tag_values, expected",
[
pytest.param(
True,
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "errored",
- "healthy",
- "init",
- "production",
- "s:sessions/error@none",
- "session.status",
- },
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ },
+ }
},
id="index tag values true",
),
pytest.param(
False,
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "s:sessions/error@none",
- "session.status",
- },
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "s:sessions/error@none",
+ "session.status",
+ },
+ }
},
id="index tag values false",
),
@@ -217,7 +233,6 @@ def test_extract_strings_with_rollout(should_index_tag_values, expected):
]
)
batch = IndexerBatch(
- UseCaseKey.PERFORMANCE,
outer_message,
should_index_tag_values,
False,
@@ -227,8 +242,54 @@ def test_extract_strings_with_rollout(should_index_tag_values, expected):
assert batch.extract_strings() == expected
-def test_all_resolved(caplog, settings):
- settings.SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 1.0
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
+def test_extract_strings_with_multiple_use_case_ids():
+ """
+ Verify that the extract string method can handle payloads that has multiple
+ (generic) uses cases
+ """
+ counter_payload = {
+ "name": "c:use_case_1/session@none",
+ "tags": {
+ "environment": "production",
+ "session.status": "init",
+ },
+ "timestamp": ts,
+ "type": "c",
+ "value": 1,
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+
+ distribution_payload = {
+ "name": "d:use_case_2/duration@second",
+ "tags": {
+ "environment": "production",
+ "session.status": "healthy",
+ },
+ "timestamp": ts,
+ "type": "d",
+ "value": [4, 5, 6],
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+
+ set_payload = {
+ "name": "s:use_case_2/error@none",
+ "tags": {
+ "environment": "production",
+ "session.status": "errored",
+ },
+ "timestamp": ts,
+ "type": "s",
+ "value": [3],
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+
outer_message = _construct_outer_message(
[
(counter_payload, []),
@@ -236,26 +297,259 @@ def test_all_resolved(caplog, settings):
(set_payload, []),
]
)
-
batch = IndexerBatch(
- UseCaseKey.PERFORMANCE,
outer_message,
True,
False,
arroyo_input_codec=_INGEST_SCHEMA,
)
- assert batch.extract_strings() == (
- {
+ assert batch.extract_strings() == {
+ MockUseCaseID.USE_CASE_1: {
1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
+ "c:use_case_1/session@none",
"environment",
+ "production",
+ "session.status",
+ "init",
+ }
+ },
+ MockUseCaseID.USE_CASE_2: {
+ 1: {
+ "d:use_case_2/duration@second",
+ "environment",
+ "production",
+ "session.status",
+ "healthy",
+ "s:use_case_2/error@none",
+ "environment",
+ "production",
+ "session.status",
"errored",
+ }
+ },
+ }
+
+
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
+def test_extract_strings_with_invalid_mri():
+ """
+ Verify that extract strings will drop payload that has invalid MRI in name field but continue processing the rest
+ """
+ bad_counter_payload = {
+ "name": "invalid_MRI",
+ "tags": {
+ "environment": "production",
+ "session.status": "init",
+ },
+ "timestamp": ts,
+ "type": "c",
+ "value": 1,
+ "org_id": 100,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+ counter_payload = {
+ "name": "c:use_case_1/session@none",
+ "tags": {
+ "environment": "production",
+ "session.status": "init",
+ },
+ "timestamp": ts,
+ "type": "c",
+ "value": 1,
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+
+ distribution_payload = {
+ "name": "d:use_case_2/duration@second",
+ "tags": {
+ "environment": "production",
+ "session.status": "healthy",
+ },
+ "timestamp": ts,
+ "type": "d",
+ "value": [4, 5, 6],
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+
+ set_payload = {
+ "name": "s:use_case_2/error@none",
+ "tags": {
+ "environment": "production",
+ "session.status": "errored",
+ },
+ "timestamp": ts,
+ "type": "s",
+ "value": [3],
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+
+ outer_message = _construct_outer_message(
+ [
+ (bad_counter_payload, []),
+ (counter_payload, []),
+ (distribution_payload, []),
+ (set_payload, []),
+ ]
+ )
+ batch = IndexerBatch(
+ outer_message,
+ True,
+ False,
+ arroyo_input_codec=_INGEST_SCHEMA,
+ )
+ assert batch.extract_strings() == {
+ MockUseCaseID.USE_CASE_1: {
+ 1: {
+ "c:use_case_1/session@none",
+ "environment",
+ "production",
+ "session.status",
+ "init",
+ }
+ },
+ MockUseCaseID.USE_CASE_2: {
+ 1: {
+ "d:use_case_2/duration@second",
+ "environment",
+ "production",
+ "session.status",
"healthy",
+ "s:use_case_2/error@none",
+ "environment",
+ "production",
+ "session.status",
+ "errored",
+ }
+ },
+ }
+
+
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
+def test_extract_strings_with_multiple_use_case_ids_and_org_ids():
+ """
+ Verify that the extract string method can handle payloads that has multiple
+ (generic) uses cases and from different orgs
+ """
+ custom_uc_counter_payload = {
+ "name": "c:use_case_1/session@none",
+ "tags": {
+ "environment": "production",
+ "session.status": "init",
+ },
+ "timestamp": ts,
+ "type": "c",
+ "value": 1,
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+ perf_distribution_payload = {
+ "name": TransactionMRI.MEASUREMENTS_FCP.value,
+ "tags": {
+ "environment": "production",
+ "session.status": "healthy",
+ },
+ "timestamp": ts,
+ "type": "d",
+ "value": [4, 5, 6],
+ "org_id": 1,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+ custom_uc_set_payload = {
+ "name": "s:use_case_1/error@none",
+ "tags": {
+ "environment": "production",
+ "session.status": "errored",
+ },
+ "timestamp": ts,
+ "type": "s",
+ "value": [3],
+ "org_id": 2,
+ "retention_days": 90,
+ "project_id": 3,
+ }
+
+ outer_message = _construct_outer_message(
+ [
+ (custom_uc_counter_payload, []),
+ (perf_distribution_payload, []),
+ (custom_uc_set_payload, []),
+ ]
+ )
+ batch = IndexerBatch(
+ outer_message,
+ True,
+ False,
+ arroyo_input_codec=_INGEST_SCHEMA,
+ )
+ assert batch.extract_strings() == {
+ MockUseCaseID.USE_CASE_1: {
+ 1: {
+ "c:use_case_1/session@none",
+ "environment",
+ "production",
+ "session.status",
"init",
+ },
+ 2: {
+ "s:use_case_1/error@none",
+ "environment",
"production",
- "s:sessions/error@none",
"session.status",
+ "errored",
+ },
+ },
+ MockUseCaseID.TRANSACTIONS: {
+ 1: {
+ TransactionMRI.MEASUREMENTS_FCP.value,
+ "environment",
+ "production",
+ "session.status",
+ "healthy",
+ }
+ },
+ }
+
+
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
+def test_all_resolved(caplog, settings):
+ settings.SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 1.0
+ outer_message = _construct_outer_message(
+ [
+ (counter_payload, []),
+ (distribution_payload, []),
+ (set_payload, []),
+ ]
+ )
+
+ batch = IndexerBatch(
+ outer_message,
+ True,
+ False,
+ arroyo_input_codec=_INGEST_SCHEMA,
+ )
+ assert batch.extract_strings() == (
+ {
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
)
@@ -310,7 +604,7 @@ def test_all_resolved(caplog, settings):
"tags": {"3": 7, "9": 6},
"timestamp": ts,
"type": "c",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": 1.0,
},
[("mapping_sources", b"ch"), ("metric_type", "c")],
@@ -333,7 +627,7 @@ def test_all_resolved(caplog, settings):
"tags": {"3": 7, "9": 5},
"timestamp": ts,
"type": "d",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [4, 5, 6],
},
[("mapping_sources", b"ch"), ("metric_type", "d")],
@@ -356,7 +650,7 @@ def test_all_resolved(caplog, settings):
"tags": {"3": 7, "9": 4},
"timestamp": ts,
"type": "s",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [3],
},
[("mapping_sources", b"cd"), ("metric_type", "s")],
@@ -364,6 +658,7 @@ def test_all_resolved(caplog, settings):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_all_resolved_with_routing_information(caplog, settings):
settings.SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 1.0
outer_message = _construct_outer_message(
@@ -375,7 +670,6 @@ def test_all_resolved_with_routing_information(caplog, settings):
)
batch = IndexerBatch(
- UseCaseKey.PERFORMANCE,
outer_message,
True,
True,
@@ -383,16 +677,18 @@ def test_all_resolved_with_routing_information(caplog, settings):
)
assert batch.extract_strings() == (
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "errored",
- "healthy",
- "init",
- "production",
- "s:sessions/error@none",
- "session.status",
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
)
@@ -448,7 +744,7 @@ def test_all_resolved_with_routing_information(caplog, settings):
"tags": {"3": 7, "9": 6},
"timestamp": ts,
"type": "c",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": 1.0,
},
[("mapping_sources", b"ch"), ("metric_type", "c")],
@@ -472,7 +768,7 @@ def test_all_resolved_with_routing_information(caplog, settings):
"tags": {"3": 7, "9": 5},
"timestamp": ts,
"type": "d",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [4, 5, 6],
},
[("mapping_sources", b"ch"), ("metric_type", "d")],
@@ -496,7 +792,7 @@ def test_all_resolved_with_routing_information(caplog, settings):
"tags": {"3": 7, "9": 4},
"timestamp": ts,
"type": "s",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [3],
},
[("mapping_sources", b"cd"), ("metric_type", "s")],
@@ -504,6 +800,7 @@ def test_all_resolved_with_routing_information(caplog, settings):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_all_resolved_retention_days_honored(caplog, settings):
"""
Tests that the indexer batch honors the incoming retention_days values
@@ -523,7 +820,6 @@ def test_all_resolved_retention_days_honored(caplog, settings):
)
batch = IndexerBatch(
- UseCaseKey.PERFORMANCE,
outer_message,
True,
False,
@@ -531,16 +827,18 @@ def test_all_resolved_retention_days_honored(caplog, settings):
)
assert batch.extract_strings() == (
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "errored",
- "healthy",
- "init",
- "production",
- "s:sessions/error@none",
- "session.status",
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
)
@@ -595,7 +893,7 @@ def test_all_resolved_retention_days_honored(caplog, settings):
"tags": {"3": 7, "9": 6},
"timestamp": ts,
"type": "c",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": 1.0,
},
[("mapping_sources", b"ch"), ("metric_type", "c")],
@@ -618,7 +916,7 @@ def test_all_resolved_retention_days_honored(caplog, settings):
"tags": {"3": 7, "9": 5},
"timestamp": ts,
"type": "d",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [4, 5, 6],
},
[("mapping_sources", b"ch"), ("metric_type", "d")],
@@ -641,7 +939,7 @@ def test_all_resolved_retention_days_honored(caplog, settings):
"tags": {"3": 7, "9": 4},
"timestamp": ts,
"type": "s",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [3],
},
[("mapping_sources", b"cd"), ("metric_type", "s")],
@@ -649,6 +947,7 @@ def test_all_resolved_retention_days_honored(caplog, settings):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_batch_resolve_with_values_not_indexed(caplog, settings):
"""
Tests that the indexer batch skips resolving tag values for indexing and
@@ -669,7 +968,6 @@ def test_batch_resolve_with_values_not_indexed(caplog, settings):
)
batch = IndexerBatch(
- UseCaseKey.PERFORMANCE,
outer_message,
False,
False,
@@ -677,12 +975,14 @@ def test_batch_resolve_with_values_not_indexed(caplog, settings):
)
assert batch.extract_strings() == (
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "s:sessions/error@none",
- "session.status",
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
)
@@ -728,7 +1028,7 @@ def test_batch_resolve_with_values_not_indexed(caplog, settings):
"tags": {"3": "production", "5": "init"},
"timestamp": ts,
"type": "c",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": 1.0,
},
[("mapping_sources", b"c"), ("metric_type", "c")],
@@ -750,7 +1050,7 @@ def test_batch_resolve_with_values_not_indexed(caplog, settings):
"tags": {"3": "production", "5": "healthy"},
"timestamp": ts,
"type": "d",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [4, 5, 6],
},
[("mapping_sources", b"c"), ("metric_type", "d")],
@@ -772,7 +1072,7 @@ def test_batch_resolve_with_values_not_indexed(caplog, settings):
"tags": {"3": "production", "5": "errored"},
"timestamp": ts,
"type": "s",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [3],
},
[("mapping_sources", b"c"), ("metric_type", "s")],
@@ -780,6 +1080,7 @@ def test_batch_resolve_with_values_not_indexed(caplog, settings):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_metric_id_rate_limited(caplog, settings):
settings.SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 1.0
outer_message = _construct_outer_message(
@@ -790,21 +1091,21 @@ def test_metric_id_rate_limited(caplog, settings):
]
)
- batch = IndexerBatch(
- UseCaseKey.PERFORMANCE, outer_message, True, False, arroyo_input_codec=_INGEST_SCHEMA
- )
+ batch = IndexerBatch(outer_message, True, False, arroyo_input_codec=_INGEST_SCHEMA)
assert batch.extract_strings() == (
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "errored",
- "healthy",
- "init",
- "production",
- "s:sessions/error@none",
- "session.status",
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
)
@@ -859,7 +1160,7 @@ def test_metric_id_rate_limited(caplog, settings):
"tags": {"3": 7, "9": 4},
"timestamp": ts,
"type": "s",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [3],
},
[("mapping_sources", b"cd"), ("metric_type", "s")],
@@ -878,6 +1179,7 @@ def test_metric_id_rate_limited(caplog, settings):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_tag_key_rate_limited(caplog, settings):
settings.SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 1.0
outer_message = _construct_outer_message(
@@ -888,21 +1190,21 @@ def test_tag_key_rate_limited(caplog, settings):
]
)
- batch = IndexerBatch(
- UseCaseKey.PERFORMANCE, outer_message, True, False, arroyo_input_codec=_INGEST_SCHEMA
- )
+ batch = IndexerBatch(outer_message, True, False, arroyo_input_codec=_INGEST_SCHEMA)
assert batch.extract_strings() == (
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "errored",
- "healthy",
- "init",
- "production",
- "s:sessions/error@none",
- "session.status",
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
)
@@ -958,6 +1260,7 @@ def test_tag_key_rate_limited(caplog, settings):
assert _deconstruct_messages(snuba_payloads) == []
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_tag_value_rate_limited(caplog, settings):
settings.SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 1.0
outer_message = _construct_outer_message(
@@ -968,21 +1271,21 @@ def test_tag_value_rate_limited(caplog, settings):
]
)
- batch = IndexerBatch(
- UseCaseKey.PERFORMANCE, outer_message, True, False, arroyo_input_codec=_INGEST_SCHEMA
- )
+ batch = IndexerBatch(outer_message, True, False, arroyo_input_codec=_INGEST_SCHEMA)
assert batch.extract_strings() == (
{
- 1: {
- "c:sessions/session@none",
- "d:sessions/duration@second",
- "environment",
- "errored",
- "healthy",
- "init",
- "production",
- "s:sessions/error@none",
- "session.status",
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "d:sessions/duration@second",
+ "environment",
+ "errored",
+ "healthy",
+ "init",
+ "production",
+ "s:sessions/error@none",
+ "session.status",
+ }
}
}
)
@@ -1046,7 +1349,7 @@ def test_tag_value_rate_limited(caplog, settings):
"tags": {"3": 7, "9": 6},
"timestamp": ts,
"type": "c",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": 1.0,
},
[("mapping_sources", b"ch"), ("metric_type", "c")],
@@ -1069,7 +1372,7 @@ def test_tag_value_rate_limited(caplog, settings):
"tags": {"3": 7, "9": 5},
"timestamp": ts,
"type": "d",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [4, 5, 6],
},
[("mapping_sources", b"ch"), ("metric_type", "d")],
@@ -1077,6 +1380,7 @@ def test_tag_value_rate_limited(caplog, settings):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_one_org_limited(caplog, settings):
settings.SENTRY_METRICS_INDEXER_DEBUG_LOG_SAMPLE_RATE = 1.0
outer_message = _construct_outer_message(
@@ -1087,7 +1391,6 @@ def test_one_org_limited(caplog, settings):
)
batch = IndexerBatch(
- UseCaseKey.PERFORMANCE,
outer_message,
True,
False,
@@ -1095,20 +1398,22 @@ def test_one_org_limited(caplog, settings):
)
assert batch.extract_strings() == (
{
- 1: {
- "c:sessions/session@none",
- "environment",
- "init",
- "production",
- "session.status",
- },
- 2: {
- "d:sessions/duration@second",
- "environment",
- "healthy",
- "production",
- "session.status",
- },
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "c:sessions/session@none",
+ "environment",
+ "init",
+ "production",
+ "session.status",
+ },
+ 2: {
+ "d:sessions/duration@second",
+ "environment",
+ "healthy",
+ "production",
+ "session.status",
+ },
+ }
}
)
@@ -1178,7 +1483,7 @@ def test_one_org_limited(caplog, settings):
"tags": {"2": 4, "5": 3},
"timestamp": ts,
"type": "d",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [4, 5, 6],
},
[("mapping_sources", b"ch"), ("metric_type", "d")],
@@ -1186,6 +1491,7 @@ def test_one_org_limited(caplog, settings):
]
+@patch("sentry.sentry_metrics.consumers.indexer.batch.UseCaseID", MockUseCaseID)
def test_cardinality_limiter(caplog, settings):
"""
Test functionality of the indexer batch related to cardinality-limiting. More concretely, assert that `IndexerBatch.filter_messages`:
@@ -1206,7 +1512,6 @@ def test_cardinality_limiter(caplog, settings):
)
batch = IndexerBatch(
- UseCaseKey.PERFORMANCE,
outer_message,
True,
False,
@@ -1221,15 +1526,17 @@ def test_cardinality_limiter(caplog, settings):
]
batch.filter_messages(keys_to_remove)
assert batch.extract_strings() == {
- 1: {
- "environment",
- "errored",
- "production",
- # Note, we only extracted one MRI, of the one metric that we didn't
- # drop
- "s:sessions/error@none",
- "session.status",
- },
+ MockUseCaseID.SESSIONS: {
+ 1: {
+ "environment",
+ "errored",
+ "production",
+ # Note, we only extracted one MRI, of the one metric that we didn't
+ # drop
+ "s:sessions/error@none",
+ "session.status",
+ },
+ }
}
snuba_payloads = batch.reconstruct_messages(
@@ -1272,7 +1579,7 @@ def test_cardinality_limiter(caplog, settings):
"tags": {"1": 3, "5": 2},
"timestamp": ts,
"type": "s",
- "use_case_id": "performance",
+ "use_case_id": "sessions",
"value": [3],
},
[
diff --git a/tests/sentry/sentry_metrics/test_multiprocess_steps.py b/tests/sentry/sentry_metrics/test_multiprocess_steps.py
index d1a679b2ef2eef..03d13562a3983e 100644
--- a/tests/sentry/sentry_metrics/test_multiprocess_steps.py
+++ b/tests/sentry/sentry_metrics/test_multiprocess_steps.py
@@ -282,7 +282,7 @@ def __translated_payload(
)
payload["retention_days"] = 90
payload["tags"] = new_tags
- payload["use_case_id"] = "release-health"
+ payload["use_case_id"] = "sessions"
payload.pop("unit", None)
del payload["name"]
@@ -443,9 +443,6 @@ def test_process_messages_rate_limited(caplog, settings) -> None:
rate_limited_payload = deepcopy(distribution_payload)
rate_limited_payload["tags"]["custom_tag"] = "rate_limited_test"
- rate_limited_payload2 = deepcopy(distribution_payload)
- rate_limited_payload2["name"] = "rate_limited_test"
-
message_batch = [
Message(
BrokerValue(
@@ -463,14 +460,6 @@ def test_process_messages_rate_limited(caplog, settings) -> None:
datetime.now(),
)
),
- Message(
- BrokerValue(
- KafkaPayload(None, json.dumps(rate_limited_payload2).encode("utf-8"), []),
- Partition(Topic("topic"), 0),
- 2,
- datetime.now(),
- )
- ),
]
# the outer message uses the last message's partition, offset, and timestamp
last = message_batch[-1]
|
6c062c1a1f53ab1ea103a21f1db26db5a0d52319
|
2022-10-12 00:58:15
|
Nar Saynorath
|
fix(discover-homepage): Remove feature flag check on homepage endpoint (#39882)
| false
|
Remove feature flag check on homepage endpoint (#39882)
|
fix
|
diff --git a/src/sentry/discover/endpoints/discover_homepage_query.py b/src/sentry/discover/endpoints/discover_homepage_query.py
index 9dd51d90067357..c43d903c6996f9 100644
--- a/src/sentry/discover/endpoints/discover_homepage_query.py
+++ b/src/sentry/discover/endpoints/discover_homepage_query.py
@@ -30,12 +30,9 @@ class DiscoverHomepageQueryEndpoint(OrganizationEndpoint):
)
def has_feature(self, organization, request):
- return (
- features.has("organizations:discover", organization, actor=request.user)
- or features.has("organizations:discover-query", organization, actor=request.user)
- ) and features.has(
- "organizations:discover-query-builder-as-landing-page", organization, actor=request.user
- )
+ return features.has(
+ "organizations:discover", organization, actor=request.user
+ ) or features.has("organizations:discover-query", organization, actor=request.user)
def get(self, request: Request, organization) -> Response:
if not self.has_feature(organization, request):
|
01bbc1bdb9090b464d9de217413753dd543efbca
|
2021-10-20 18:52:33
|
Matej Minar
|
feat(ui): Add absolute numbers to release adoption charts (#29436)
| false
|
Add absolute numbers to release adoption charts (#29436)
|
feat
|
diff --git a/static/app/components/charts/baseChart.tsx b/static/app/components/charts/baseChart.tsx
index b43d0265f697fc..fded6fa42bacd0 100644
--- a/static/app/components/charts/baseChart.tsx
+++ b/static/app/components/charts/baseChart.tsx
@@ -105,7 +105,11 @@ type Props = {
utc: boolean,
showTimeInTooltip: boolean
) => string;
- valueFormatter?: (value: number, label?: string) => string | number;
+ valueFormatter?: (
+ value: number,
+ label?: string,
+ seriesParams?: EChartOption.Tooltip.Format
+ ) => string | number;
nameFormatter?: (name: string) => string;
/**
* Array containing seriesNames that need to be indented
diff --git a/static/app/components/charts/components/tooltip.tsx b/static/app/components/charts/components/tooltip.tsx
index 8949576e923648..abac340d221a55 100644
--- a/static/app/components/charts/components/tooltip.tsx
+++ b/static/app/components/charts/components/tooltip.tsx
@@ -191,7 +191,7 @@ function getFormatter({
const formattedLabel = nameFormatter(
truncationFormatter(s.seriesName ?? '', truncate)
);
- const value = valueFormatter(getSeriesValue(s, 1), s.seriesName);
+ const value = valueFormatter(getSeriesValue(s, 1), s.seriesName, s);
const className = indentLabels.includes(formattedLabel)
? 'tooltip-label tooltip-label-indent'
diff --git a/static/app/utils/sessions.tsx b/static/app/utils/sessions.tsx
index c6f2ba5cf1437f..28159e40c737b5 100644
--- a/static/app/utils/sessions.tsx
+++ b/static/app/utils/sessions.tsx
@@ -24,6 +24,14 @@ export function getCount(groups: SessionApiResponse['groups'] = [], field: Sessi
return groups.reduce((acc, group) => acc + group.totals[field], 0);
}
+export function getCountAtIndex(
+ groups: SessionApiResponse['groups'] = [],
+ field: SessionField,
+ index: number
+) {
+ return groups.reduce((acc, group) => acc + group.series[field][index], 0);
+}
+
export function getCrashFreeRate(
groups: SessionApiResponse['groups'] = [],
field: SessionField
diff --git a/static/app/views/releases/detail/overview/sidebar/releaseAdoption.tsx b/static/app/views/releases/detail/overview/sidebar/releaseAdoption.tsx
index 5833cf9671126d..f67cf7887c2ea3 100644
--- a/static/app/views/releases/detail/overview/sidebar/releaseAdoption.tsx
+++ b/static/app/views/releases/detail/overview/sidebar/releaseAdoption.tsx
@@ -1,6 +1,7 @@
import {withRouter, WithRouterProps} from 'react-router';
import {useTheme} from '@emotion/react';
import styled from '@emotion/styled';
+import {EChartOption} from 'echarts/lib/echarts';
import Feature from 'app/components/acl/feature';
import ChartZoom from 'app/components/charts/chartZoom';
@@ -22,7 +23,8 @@ import {
SessionApiResponse,
SessionField,
} from 'app/types';
-import {getAdoptionSeries, getCount} from 'app/utils/sessions';
+import {formatAbbreviatedNumber} from 'app/utils/formatters';
+import {getAdoptionSeries, getCount, getCountAtIndex} from 'app/utils/sessions';
import {
ADOPTION_STAGE_LABELS,
@@ -33,6 +35,13 @@ import {
import {generateReleaseMarkLines, releaseMarkLinesLabels} from '../../utils';
import {Wrapper} from '../styles';
+const sessionsAxisIndex = 0;
+const usersAxisIndex = 1;
+const axisIndexToSessionsField = {
+ [sessionsAxisIndex]: SessionField.SESSIONS,
+ [usersAxisIndex]: SessionField.USERS,
+};
+
type Props = {
release: ReleaseWithHealth;
project: ReleaseProject;
@@ -44,7 +53,7 @@ type Props = {
errored: boolean;
} & WithRouterProps;
-function ReleaseComparisonChart({
+function ReleaseAdoption({
release,
project,
environment,
@@ -72,17 +81,17 @@ function ReleaseComparisonChart({
location,
{
hideLabel: true,
- axisIndex: 0,
+ axisIndex: sessionsAxisIndex,
}
);
const series = [
...sessionsMarkLines,
{
- seriesName: t('Sessions Adopted'),
+ seriesName: t('Sessions'),
connectNulls: true,
- yAxisIndex: 0,
- xAxisIndex: 0,
+ yAxisIndex: sessionsAxisIndex,
+ xAxisIndex: sessionsAxisIndex,
data: getAdoptionSeries(
releaseSessions.groups,
allSessions?.groups,
@@ -95,15 +104,15 @@ function ReleaseComparisonChart({
if (hasUsers) {
const usersMarkLines = generateReleaseMarkLines(release, project, theme, location, {
hideLabel: true,
- axisIndex: 1,
+ axisIndex: usersAxisIndex,
});
series.push(...usersMarkLines);
series.push({
- seriesName: t('Users Adopted'),
+ seriesName: t('Users'),
connectNulls: true,
- yAxisIndex: 1,
- xAxisIndex: 1,
+ yAxisIndex: usersAxisIndex,
+ xAxisIndex: usersAxisIndex,
data: getAdoptionSeries(
releaseSessions.groups,
allSessions?.groups,
@@ -154,7 +163,7 @@ function ReleaseComparisonChart({
],
axisPointer: {
// Link each x-axis together.
- link: [{xAxisIndex: [0, 1]}],
+ link: [{xAxisIndex: [sessionsAxisIndex, usersAxisIndex]}],
},
xAxes: Array.from(new Array(2)).map((_i, index) => ({
gridIndex: index,
@@ -163,13 +172,11 @@ function ReleaseComparisonChart({
})),
yAxes: [
{
- // sessions adopted
- gridIndex: 0,
+ gridIndex: sessionsAxisIndex,
...axisLineConfig,
},
{
- // users adopted
- gridIndex: 1,
+ gridIndex: usersAxisIndex,
...axisLineConfig,
},
],
@@ -180,13 +187,30 @@ function ReleaseComparisonChart({
tooltip: {
trigger: 'axis' as const,
truncate: 80,
- valueFormatter: (value: number, label?: string) =>
- label && Object.values(releaseMarkLinesLabels).includes(label) ? '' : `${value}%`,
+ valueFormatter: (
+ value: number,
+ label?: string,
+ seriesParams?: EChartOption.Tooltip.Format
+ ) => {
+ const {axisIndex, dataIndex} =
+ (seriesParams as EChartOption.Tooltip.Format & {axisIndex: number}) || {};
+ const absoluteCount = getCountAtIndex(
+ releaseSessions?.groups,
+ axisIndexToSessionsField[axisIndex ?? 0],
+ dataIndex ?? 0
+ );
+
+ return label && Object.values(releaseMarkLinesLabels).includes(label)
+ ? ''
+ : `<span>${formatAbbreviatedNumber(absoluteCount)} <span style="color: ${
+ theme.white
+ };margin-left: ${space(0.5)}">${value}%</span></span>`;
+ },
filter: (_, seriesParam) => {
const {seriesName, axisIndex} = seriesParam;
// do not display tooltips for "Users Adopted" marklines
if (
- axisIndex === 1 &&
+ axisIndex === usersAxisIndex &&
Object.values(releaseMarkLinesLabels).includes(seriesName)
) {
return false;
@@ -291,7 +315,7 @@ function ReleaseComparisonChart({
start={start}
end={end}
usePageDate
- xAxisIndex={[0, 1]}
+ xAxisIndex={[sessionsAxisIndex, usersAxisIndex]}
>
{zoomRenderProps => (
<LineChart {...chartOptions} {...zoomRenderProps} series={getSeries()} />
@@ -335,4 +359,4 @@ const ChartLabel = styled('div')<{top: string}>`
right: 0;
`;
-export default withRouter(ReleaseComparisonChart);
+export default withRouter(ReleaseAdoption);
diff --git a/tests/js/spec/utils/sessions.spec.tsx b/tests/js/spec/utils/sessions.spec.tsx
index 70c9c2b918c2f0..e4f5bc646c05ce 100644
--- a/tests/js/spec/utils/sessions.spec.tsx
+++ b/tests/js/spec/utils/sessions.spec.tsx
@@ -2,6 +2,7 @@ import {SessionField, SessionStatus} from 'app/types';
import {
filterSessionsInTimeWindow,
getCount,
+ getCountAtIndex,
getCrashFreeRate,
getSessionsInterval,
getSessionStatusRate,
@@ -148,6 +149,16 @@ describe('utils/sessions', () => {
});
});
+ describe('getCountAtIndex', () => {
+ const groups = [sessionsApiResponse.groups[1], sessionsApiResponse.groups[2]];
+ it('returns sessions count', () => {
+ expect(getCountAtIndex(groups, SessionField.SESSIONS, 1)).toBe(35);
+ });
+ it('returns users count', () => {
+ expect(getCountAtIndex(groups, SessionField.USERS, 1)).toBe(16);
+ });
+ });
+
describe('getCrashFreeRate', () => {
const {groups} = sessionsApiResponse;
it('returns crash free sessions', () => {
|
22f6893dd58f16757985b21f014764991632a957
|
2023-03-14 04:20:57
|
Ryan Albrecht
|
test(replay): Cleanup TestStubs.ReplayReaderParams (#45548)
| false
|
Cleanup TestStubs.ReplayReaderParams (#45548)
|
test
|
diff --git a/fixtures/js-stubs/replayReaderParams.js b/fixtures/js-stubs/replayReaderParams.js
deleted file mode 100644
index 459d4201249868..00000000000000
--- a/fixtures/js-stubs/replayReaderParams.js
+++ /dev/null
@@ -1,124 +0,0 @@
-import {duration} from 'moment';
-
-const defaultRRWebEvents = [
- {
- type: 0,
- data: {},
- timestamp: 1663865919000,
- delay: -198487,
- },
- {
- type: 1,
- data: {},
- timestamp: 1663865920587,
- delay: -135199,
- },
- {
- type: 4,
- data: {
- href: 'http://localhost:3000/',
- width: 1536,
- height: 722,
- },
- timestamp: 1663865920587,
- delay: -135199,
- },
-];
-
-const defaultBreadcrumbs = [
- {
- timestamp: 1663865920851,
- type: 5,
- data: {
- payload: {
- timestamp: 1663865920.851,
- type: 'default',
- level: 'info',
- category: 'ui.focus',
- },
- },
- },
- {
- timestamp: 1663865922024,
- type: 5,
- data: {
- payload: {
- timestamp: 1663865922.024,
- type: 'default',
- level: 'info',
- category: 'ui.click',
- message:
- 'input.form-control[type="text"][name="url"][title="Fully qualified URL prefixed with http or https"]',
- data: {
- nodeId: 37,
- },
- },
- },
- },
-];
-
-export function ReplayReaderParams({
- attachments = [...defaultRRWebEvents, ...defaultBreadcrumbs],
- replayRecord = {},
- errors = [],
-} = {}) {
- return {
- replayRecord: {
- activity: 0,
- browser: {
- name: 'Other',
- version: '',
- },
- count_errors: 1,
- count_segments: 14,
- count_urls: 1,
- device: {
- name: '',
- brand: '',
- model_id: '',
- family: 'Other',
- },
- dist: '',
- duration: duration(84000),
- environment: 'demo',
- error_ids: ['5c83aaccfffb4a708ae893bad9be3a1c'],
- finished_at: new Date('Sep 22, 2022 5:00:03 PM UTC'),
- id: '761104e184c64d439ee1014b72b4d83b',
- longest_transaction: 0,
- os: {
- name: 'Other',
- version: '',
- },
- platform: 'javascript',
- project_id: '6273278',
- releases: ['1.0.0', '2.0.0'],
- sdk: {
- name: 'sentry.javascript.browser',
- version: '7.1.1',
- },
- started_at: new Date('Sep 22, 2022 4:58:39 PM UTC'),
- tags: {
- 'browser.name': ['Other'],
- 'device.family': ['Other'],
- 'os.name': ['Other'],
- platform: ['javascript'],
- releases: ['1.0.0', '2.0.0'],
- 'sdk.name': ['sentry.javascript.browser'],
- 'sdk.version': ['7.1.1'],
- 'user.ip': ['127.0.0.1'],
- },
- trace_ids: [],
- urls: ['http://localhost:3000/'],
- user: {
- id: '',
- name: '',
- email: '',
- ip: '127.0.0.1',
- display_name: '127.0.0.1',
- },
- ...replayRecord,
- },
- attachments,
- errors,
- };
-}
diff --git a/fixtures/js-stubs/replayRecord.ts b/fixtures/js-stubs/replayRecord.ts
index 477694df67efd2..a15ff218ab0b2a 100644
--- a/fixtures/js-stubs/replayRecord.ts
+++ b/fixtures/js-stubs/replayRecord.ts
@@ -37,16 +37,7 @@ export function ReplayRecord(replayRecord: Partial<TReplayRecord> = {}): TReplay
version: '7.1.1',
},
started_at: new Date('Sep 22, 2022 4:58:39 PM UTC'),
- tags: {
- 'browser.name': ['Other'],
- 'device.family': ['Other'],
- 'os.name': ['Other'],
- platform: ['javascript'],
- releases: ['1.0.0', '2.0.0'],
- 'sdk.name': ['sentry.javascript.browser'],
- 'sdk.version': ['7.1.1'],
- 'user.ip': ['127.0.0.1'],
- },
+
trace_ids: [],
urls: ['http://localhost:3000/'],
user: {
@@ -57,5 +48,16 @@ export function ReplayRecord(replayRecord: Partial<TReplayRecord> = {}): TReplay
display_name: '127.0.0.1',
},
...replayRecord,
+ tags: {
+ ...replayRecord.tags,
+ 'browser.name': [replayRecord.browser?.name ?? 'Other'],
+ 'device.family': [replayRecord.device?.family ?? 'Other'],
+ 'os.name': [replayRecord.os?.name ?? 'Other'],
+ platform: [replayRecord.platform ?? 'javascript'],
+ releases: replayRecord.releases ?? ['1.0.0', '2.0.0'],
+ 'sdk.name': [replayRecord.sdk?.name ?? 'sentry.javascript.browser'],
+ 'sdk.version': [replayRecord.sdk?.version ?? '7.1.1'],
+ 'user.ip': [replayRecord.user?.ip ?? '127.0.0.1'],
+ },
};
}
diff --git a/fixtures/js-stubs/types.tsx b/fixtures/js-stubs/types.tsx
index 5b8d9e8f5682ac..779f178f8b80c5 100644
--- a/fixtures/js-stubs/types.tsx
+++ b/fixtures/js-stubs/types.tsx
@@ -102,7 +102,6 @@ type TestStubFixtures = {
ReplayError: OverridableStub;
ReplayRRWebDivHelloWorld: OverridableStub;
ReplayRRWebNode: OverridableStub;
- ReplayReaderParams: OverridableStub;
ReplayRecord: OverridableStub<ReplayRecord>;
ReplaySegmentBreadcrumb: OverridableStub;
ReplaySegmentConsole: OverridableStub;
diff --git a/static/app/components/events/eventReplay/replayPreview.spec.tsx b/static/app/components/events/eventReplay/replayPreview.spec.tsx
index 9773c91ce445e4..502b499cb2ca12 100644
--- a/static/app/components/events/eventReplay/replayPreview.spec.tsx
+++ b/static/app/components/events/eventReplay/replayPreview.spec.tsx
@@ -30,8 +30,18 @@ jest.mock('screenfull', () => ({
}));
// Get replay data with the mocked replay reader params
-const replayReaderParams = TestStubs.ReplayReaderParams({});
-const mockReplay = ReplayReader.factory(replayReaderParams);
+const mockReplay = ReplayReader.factory({
+ replayRecord: TestStubs.ReplayRecord({
+ browser: {
+ name: 'Chrome',
+ version: '110.0.0',
+ },
+ }),
+ errors: [],
+ attachments: TestStubs.ReplaySegmentInit({
+ timestamp: new Date('Sep 22, 2022 4:58:39 PM UTC'),
+ }),
+});
// Mock useReplayData hook to return the mocked replay data
jest.mock('sentry/utils/replays/hooks/useReplayData', () => {
diff --git a/static/app/components/events/interfaces/breadcrumbs/breadcrumbs.spec.tsx b/static/app/components/events/interfaces/breadcrumbs/breadcrumbs.spec.tsx
index 53b0a461bcf1df..2bdaecfe5177d6 100644
--- a/static/app/components/events/interfaces/breadcrumbs/breadcrumbs.spec.tsx
+++ b/static/app/components/events/interfaces/breadcrumbs/breadcrumbs.spec.tsx
@@ -11,7 +11,11 @@ import {
} from 'sentry/utils/replays/hooks/useReplayOnboarding';
import ReplayReader from 'sentry/utils/replays/replayReader';
-const mockReplay = ReplayReader.factory(TestStubs.ReplayReaderParams());
+const mockReplay = ReplayReader.factory({
+ replayRecord: TestStubs.ReplayRecord({}),
+ errors: [],
+ attachments: TestStubs.ReplaySegmentInit({}),
+});
jest.mock('sentry/utils/replays/hooks/useReplayOnboarding');
diff --git a/static/app/components/replays/walker/urlWalker.spec.tsx b/static/app/components/replays/walker/urlWalker.spec.tsx
index 8de8789d6d0651..f1817251491376 100644
--- a/static/app/components/replays/walker/urlWalker.spec.tsx
+++ b/static/app/components/replays/walker/urlWalker.spec.tsx
@@ -28,7 +28,7 @@ describe('UrlWalker', () => {
});
describe('CrumbWalker', () => {
- const {replayRecord} = TestStubs.ReplayReaderParams();
+ const replayRecord = TestStubs.ReplayRecord({});
const PAGELOAD_CRUMB = TestStubs.Breadcrumb({
id: 4,
diff --git a/static/app/views/replays/detail/tagPanel/index.spec.tsx b/static/app/views/replays/detail/tagPanel/index.spec.tsx
index 39e23073ca4140..f1b015181169d4 100644
--- a/static/app/views/replays/detail/tagPanel/index.spec.tsx
+++ b/static/app/views/replays/detail/tagPanel/index.spec.tsx
@@ -4,20 +4,21 @@ import {Provider as ReplayContextProvider} from 'sentry/components/replays/repla
import ReplayReader from 'sentry/utils/replays/replayReader';
import TagPanel from 'sentry/views/replays/detail/tagPanel';
-// Get replay data with the mocked replay reader params
-const replayReaderParams = TestStubs.ReplayReaderParams({
- replayRecord: {
+const mockReplay = ReplayReader.factory({
+ replayRecord: TestStubs.ReplayRecord({
+ browser: {
+ name: 'Chrome',
+ version: '110.0.0',
+ },
tags: {
- 'browser.name': ['Chrome'],
- 'sdk.version': ['7.13.0', '7.13.2'],
- foo: ['bar'],
+ foo: ['bar', 'baz'],
'my custom tag': ['a wordy value'],
},
- },
+ }),
+ errors: [],
+ attachments: [],
});
-const mockReplay = ReplayReader.factory(replayReaderParams);
-
const renderComponent = (replay: ReplayReader | null) => {
return render(
<ReplayContextProvider isFetching={false} replay={replay}>
@@ -51,9 +52,9 @@ describe('TagPanel', () => {
it('should show the tags correctly inside ReplayTagsTableRow component with multiple items array', () => {
renderComponent(mockReplay);
- expect(screen.getByText('sdk.version')).toBeInTheDocument();
- expect(screen.getByText('7.13.0')).toBeInTheDocument();
- expect(screen.getByText('7.13.2')).toBeInTheDocument();
+ expect(screen.getByText('foo')).toBeInTheDocument();
+ expect(screen.getByText('bar')).toBeInTheDocument();
+ expect(screen.getByText('baz')).toBeInTheDocument();
});
it('should link known tags to their proper field names', () => {
@@ -63,6 +64,10 @@ describe('TagPanel', () => {
'href',
'/organizations/org-slug/replays/?query=tags%5B%22foo%22%5D%3A%22bar%22'
);
+ expect(screen.getByText('baz').closest('a')).toHaveAttribute(
+ 'href',
+ '/organizations/org-slug/replays/?query=tags%5B%22foo%22%5D%3A%22baz%22'
+ );
});
it('should link user-submitted tags with the tags[] syntax', () => {
|
9f7c3ef54a215210ca6532d5b29e9f1f6c64a12f
|
2019-10-30 02:24:24
|
Jan Michael Auer
|
fix(store): Consider functions without filename for event title (#15320)
| false
|
Consider functions without filename for event title (#15320)
|
fix
|
diff --git a/src/sentry/eventtypes/error.py b/src/sentry/eventtypes/error.py
index 6e54112dd44e75..daaa1c4ffcaeef 100644
--- a/src/sentry/eventtypes/error.py
+++ b/src/sentry/eventtypes/error.py
@@ -11,7 +11,7 @@ def get_crash_location(data):
from sentry.stacktraces.processing import get_crash_frame_from_event_data
frame = get_crash_frame_from_event_data(
- data, frame_filter=lambda x: x.get("filename") or x.get("abs_path")
+ data, frame_filter=lambda x: x.get("function") not in (None, "<redacted>", "<unknown>")
)
if frame is not None:
from sentry.stacktraces.functions import get_function_name_for_frame
diff --git a/tests/sentry/eventtypes/test_error.py b/tests/sentry/eventtypes/test_error.py
index e15124ae3a4e74..d299341e8c60d8 100644
--- a/tests/sentry/eventtypes/test_error.py
+++ b/tests/sentry/eventtypes/test_error.py
@@ -15,6 +15,31 @@ def test_get_metadata_none(self):
data = {"exception": {"values": [{"type": None, "value": None, "stacktrace": {}}]}}
assert inst.get_metadata(data) == {"type": "Error", "value": ""}
+ def test_get_metadata_function(self):
+ inst = ErrorEvent()
+ data = {
+ "platform": "native",
+ "exception": {
+ "values": [
+ {
+ "stacktrace": {
+ "frames": [
+ {"in_app": True, "function": "void top_func(int)"},
+ {"in_app": False, "function": "void invalid_func(int)"},
+ {"in_app": True, "function": "<unknown>"},
+ ]
+ }
+ }
+ ]
+ },
+ }
+ assert inst.get_metadata(data) == {"type": "Error", "value": "", "function": "top_func"}
+
+ def test_get_metadata_function_none_frame(self):
+ inst = ErrorEvent()
+ data = {"exception": {"values": [{"stacktrace": {"frames": [None]}}]}}
+ assert inst.get_metadata(data) == {"type": "Error", "value": ""}
+
def test_get_title_none_value(self):
inst = ErrorEvent()
result = inst.get_title({"type": "Error", "value": None})
|
47943eebbebe7f330a468c397854e87c0545eb80
|
2022-09-22 14:32:01
|
Priscila Oliveira
|
ref(test): Convert user misery to rtl + ts (#38941)
| false
|
Convert user misery to rtl + ts (#38941)
|
ref
|
diff --git a/static/app/components/scoreBar.tsx b/static/app/components/scoreBar.tsx
index 58524b7ce373e9..8be44a89908ff1 100644
--- a/static/app/components/scoreBar.tsx
+++ b/static/app/components/scoreBar.tsx
@@ -21,6 +21,7 @@ const BaseScoreBar = ({
thickness = 4,
radius = 3,
palette = theme.similarity.colors,
+ ...props
}: Props) => {
const maxScore = palette.length;
@@ -38,7 +39,7 @@ const BaseScoreBar = ({
};
return (
- <div className={className}>
+ <div className={className} {...props}>
{[...Array(scoreInBounds)].map((_j, i) => (
<Bar {...barProps} key={i} color={palette[paletteIndex]} />
))}
diff --git a/static/app/components/userMisery.spec.jsx b/static/app/components/userMisery.spec.tsx
similarity index 66%
rename from static/app/components/userMisery.spec.jsx
rename to static/app/components/userMisery.spec.tsx
index 01df1dd0107d36..4c56702ef1282b 100644
--- a/static/app/components/userMisery.spec.jsx
+++ b/static/app/components/userMisery.spec.tsx
@@ -1,15 +1,10 @@
-import {mountWithTheme} from 'sentry-test/enzyme';
+import {render, screen} from 'sentry-test/reactTestingLibrary';
-import ScoreBar from 'sentry/components/scoreBar';
import UserMisery from 'sentry/components/userMisery';
describe('UserMisery', function () {
- beforeEach(function () {});
-
- afterEach(function () {});
-
it('renders no bars when user misery is less than 0.05', function () {
- const wrapper = mountWithTheme(
+ render(
<UserMisery
bars={10}
barHeight={20}
@@ -19,11 +14,12 @@ describe('UserMisery', function () {
totalUsers={100}
/>
);
- expect(wrapper.find(ScoreBar).props().score).toEqual(0);
+
+ expect(screen.getByTestId('score-bar-0')).toBeInTheDocument();
});
it('renders no bars when user misery is equal to 0.05', function () {
- const wrapper = mountWithTheme(
+ render(
<UserMisery
bars={10}
barHeight={20}
@@ -33,11 +29,12 @@ describe('UserMisery', function () {
totalUsers={100}
/>
);
- expect(wrapper.find(ScoreBar).props().score).toEqual(0);
+
+ expect(screen.getByTestId('score-bar-0')).toBeInTheDocument();
});
it('renders one bar when user misery is greater than 0.05', function () {
- const wrapper = mountWithTheme(
+ render(
<UserMisery
bars={10}
barHeight={20}
@@ -47,6 +44,7 @@ describe('UserMisery', function () {
totalUsers={100}
/>
);
- expect(wrapper.find(ScoreBar).props().score).toEqual(1);
+
+ expect(screen.getByTestId('score-bar-1')).toBeInTheDocument();
});
});
diff --git a/static/app/components/userMisery.tsx b/static/app/components/userMisery.tsx
index a90418187bc515..eb01a9f060e0e8 100644
--- a/static/app/components/userMisery.tsx
+++ b/static/app/components/userMisery.tsx
@@ -56,9 +56,16 @@ function UserMisery(props: Props) {
userMisery: userMisery.toFixed(3),
});
}
+
return (
<Tooltip title={title} containerDisplayMode="block">
- <ScoreBar size={barHeight} score={score} palette={palette} radius={0} />
+ <ScoreBar
+ size={barHeight}
+ score={score}
+ palette={palette}
+ radius={0}
+ data-test-id={`score-bar-${score}`}
+ />
</Tooltip>
);
}
|
ed7d223bcabaa7a82462ee67d3b8dfc31991b039
|
2024-06-05 15:39:02
|
elramen
|
ref(metrics): Add metrics for dev script execution times (#71822)
| false
|
Add metrics for dev script execution times (#71822)
|
ref
|
diff --git a/requirements-dev-frozen.txt b/requirements-dev-frozen.txt
index d52f04fe48881d..ac7ffef046105f 100644
--- a/requirements-dev-frozen.txt
+++ b/requirements-dev-frozen.txt
@@ -177,7 +177,7 @@ rsa==4.8
s3transfer==0.10.0
selenium==4.16.0
sentry-arroyo==2.16.5
-sentry-cli==2.16.0
+sentry-cli==2.32.0
sentry-devenv==1.6.2
sentry-forked-django-stubs==5.0.2.post2
sentry-forked-djangorestframework-stubs==3.15.0.post1
diff --git a/requirements-dev.txt b/requirements-dev.txt
index 37825274e4c199..7232dfffadb725 100644
--- a/requirements-dev.txt
+++ b/requirements-dev.txt
@@ -18,7 +18,7 @@ pytest-sentry>=0.3.0
pytest-xdist>=3
responses>=0.23.1
selenium>=4.16.0
-sentry-cli>=2.16.0
+sentry-cli>=2.32.0
# pre-commit dependencies
pre-commit>=3.3
diff --git a/scripts/do.sh b/scripts/do.sh
index 693f87e2d2579e..b6a7155b2a1686 100755
--- a/scripts/do.sh
+++ b/scripts/do.sh
@@ -13,4 +13,12 @@ source "${HERE}/lib.sh"
# a venv can avoid enabling this by setting SENTRY_NO_VENV_CHECK
[ -z "${SENTRY_NO_VENV_CHECK+x}" ] && eval "${HERE}/ensure-venv.sh"
# If you call this script
+start=`date +%s`
"$@"
+end=`date +%s`
+duration=$(($end-$start))
+
+configure-sentry-cli
+# DSN for `sentry-devservices` project in the Sentry SDKs org. Used as authentication for sentry-cli.
+export SENTRY_DSN=https://[email protected]/4507346183716864
+"${venv_name}"/bin/sentry-cli send-metric distribution -n script_execution_time -v $duration -u second -t script:$1
diff --git a/scripts/lib.sh b/scripts/lib.sh
index 84642c743b00ec..662ae4a7ab26e4 100755
--- a/scripts/lib.sh
+++ b/scripts/lib.sh
@@ -34,6 +34,22 @@ require() {
command -v "$1" >/dev/null 2>&1
}
+configure-sentry-cli() {
+ if [ -f "${venv_name}/bin/sentry-cli" ]; then
+ return 0
+ elif [ -f "${venv_name}/bin/pip" ]; then
+ echo 'installing sentry-cli'
+ pip-install sentry-cli
+ else
+ cat <<EOF
+${red}${bold}
+ERROR: sentry-cli could not be installed, please run "devenv sync".
+${reset}
+EOF
+ return 1
+ fi
+}
+
query-valid-python-version() {
python_version=$(python3 -V 2>&1 | awk '{print $2}')
if [[ -n "${SENTRY_PYTHON_VERSION:-}" ]]; then
@@ -79,7 +95,7 @@ sudo-askpass() {
}
pip-install() {
- pip install --constraint "${HERE}/../requirements-dev-frozen.txt" "$@"
+ "${venv_name}/bin/pip" install --constraint "${HERE}/../requirements-dev-frozen.txt" "$@"
}
upgrade-pip() {
|
e9707f5fd4f836831ca10bb331e7c9a42cf1443b
|
2022-09-14 04:03:15
|
Evan Purkhiser
|
ref(js): Remove duplicate typing in organizationsStore (#38776)
| false
|
Remove duplicate typing in organizationsStore (#38776)
|
ref
|
diff --git a/static/app/stores/organizationsStore.tsx b/static/app/stores/organizationsStore.tsx
index eda2d6028c856d..7dd99c98d6beed 100644
--- a/static/app/stores/organizationsStore.tsx
+++ b/static/app/stores/organizationsStore.tsx
@@ -35,11 +35,11 @@ const storeConfig: OrganizationsStoreDefinition = {
this.loaded = false;
},
- onUpdate(org: Organization) {
+ onUpdate(org) {
this.add(org);
},
- onChangeSlug(prev: Organization, next: Organization) {
+ onChangeSlug(prev, next) {
if (prev.slug === next.slug) {
return;
}
@@ -48,11 +48,11 @@ const storeConfig: OrganizationsStoreDefinition = {
this.add(next);
},
- onRemoveSuccess(slug: string) {
+ onRemoveSuccess(slug) {
this.remove(slug);
},
- get(slug: Organization['slug']) {
+ get(slug) {
return this.state.find((item: Organization) => item.slug === slug);
},
@@ -64,12 +64,12 @@ const storeConfig: OrganizationsStoreDefinition = {
return this.state;
},
- remove(slug: Organization['slug']) {
+ remove(slug) {
this.state = this.state.filter(item => slug !== item.slug);
this.trigger(this.state);
},
- add(item: Organization) {
+ add(item) {
let match = false;
this.state.forEach((existing, idx) => {
if (existing.id === item.id) {
|
a21b422b1c3de67119fab3715f0076366055820e
|
2024-03-14 00:42:58
|
Malachi Willey
|
feat(issue-priority): Remove issues from stream when reprioritizing with priority dropdown (#66846)
| false
|
Remove issues from stream when reprioritizing with priority dropdown (#66846)
|
feat
|
diff --git a/static/app/components/stream/group.spec.tsx b/static/app/components/stream/group.spec.tsx
index 97e53995ac5c91..2a3927d1ae9e82 100644
--- a/static/app/components/stream/group.spec.tsx
+++ b/static/app/components/stream/group.spec.tsx
@@ -92,7 +92,7 @@ describe('StreamGroup', function () {
it('can change priority', async function () {
const mockModifyGroup = MockApiClient.addMockResponse({
- url: '/projects/org-slug/foo-project/issues/',
+ url: '/organizations/org-slug/issues/',
method: 'PUT',
body: {priority: PriorityLevel.HIGH},
});
@@ -107,7 +107,7 @@ describe('StreamGroup', function () {
await userEvent.click(screen.getByRole('menuitemradio', {name: 'High'}));
expect(within(priorityDropdown).getByText('High')).toBeInTheDocument();
expect(mockModifyGroup).toHaveBeenCalledWith(
- '/projects/org-slug/foo-project/issues/',
+ '/organizations/org-slug/issues/',
expect.objectContaining({
data: expect.objectContaining({
priority: 'high',
diff --git a/static/app/components/stream/group.tsx b/static/app/components/stream/group.tsx
index 3e8401f28d3cd0..4f230554607a1b 100644
--- a/static/app/components/stream/group.tsx
+++ b/static/app/components/stream/group.tsx
@@ -33,6 +33,7 @@ import type {
InboxDetails,
NewQuery,
Organization,
+ PriorityLevel,
User,
} from 'sentry/types';
import {IssueCategory} from 'sentry/types';
@@ -63,6 +64,7 @@ type Props = {
index?: number;
memberList?: User[];
narrowGroups?: boolean;
+ onPriorityChange?: (newPriority: PriorityLevel) => void;
query?: string;
queryFilterDescription?: string;
showLastTriggered?: boolean;
@@ -93,6 +95,7 @@ function BaseGroupRow({
useTintRow = true,
narrowGroups = false,
showLastTriggered = false,
+ onPriorityChange,
}: Props) {
const groups = useLegacyStore(GroupStore);
const group = groups.find(item => item.id === id) as Group;
@@ -457,7 +460,9 @@ function BaseGroupRow({
{organization.features.includes('issue-priority-ui') &&
withColumns.includes('priority') ? (
<PriorityWrapper narrowGroups={narrowGroups}>
- {group.priority ? <GroupPriority group={group} /> : null}
+ {group.priority ? (
+ <GroupPriority group={group} onChange={onPriorityChange} />
+ ) : null}
</PriorityWrapper>
) : null}
{withColumns.includes('assignee') && (
diff --git a/static/app/views/issueDetails/groupPriority.tsx b/static/app/views/issueDetails/groupPriority.tsx
index 18c5af1ec7756c..f96dfd525d3db3 100644
--- a/static/app/views/issueDetails/groupPriority.tsx
+++ b/static/app/views/issueDetails/groupPriority.tsx
@@ -1,5 +1,9 @@
import {bulkUpdate} from 'sentry/actionCreators/group';
-import {addLoadingMessage, clearIndicators} from 'sentry/actionCreators/indicator';
+import {
+ addErrorMessage,
+ addLoadingMessage,
+ clearIndicators,
+} from 'sentry/actionCreators/indicator';
import {GroupPriorityDropdown} from 'sentry/components/group/groupPriority';
import {t} from 'sentry/locale';
import IssueListCacheStore from 'sentry/stores/IssueListCacheStore';
@@ -11,13 +15,14 @@ import useOrganization from 'sentry/utils/useOrganization';
type GroupDetailsPriorityProps = {
group: Group;
+ onChange?: (priority: PriorityLevel) => void;
};
-function GroupPriority({group}: GroupDetailsPriorityProps) {
+function GroupPriority({group, onChange}: GroupDetailsPriorityProps) {
const api = useApi({persistInFlight: true});
const organization = useOrganization();
- const onChange = (priority: PriorityLevel) => {
+ const onChangePriority = (priority: PriorityLevel) => {
if (priority === group.priority) {
return;
}
@@ -36,11 +41,20 @@ function GroupPriority({group}: GroupDetailsPriorityProps) {
api,
{
orgId: organization.slug,
- projectId: group.project.slug,
itemIds: [group.id],
data: {priority},
+ failSilently: true,
},
- {complete: clearIndicators}
+ {
+ success: () => {
+ clearIndicators();
+ onChange?.(priority);
+ },
+ error: () => {
+ clearIndicators();
+ addErrorMessage(t('Unable to update issue priority'));
+ },
+ }
);
};
@@ -51,7 +65,7 @@ function GroupPriority({group}: GroupDetailsPriorityProps) {
return (
<GroupPriorityDropdown
groupId={group.id}
- onChange={onChange}
+ onChange={onChangePriority}
value={group.priority ?? PriorityLevel.MEDIUM}
lastEditedBy={lastEditedBy}
/>
diff --git a/static/app/views/issueDetails/header.spec.tsx b/static/app/views/issueDetails/header.spec.tsx
index 945fa9cdd5aea2..cc95ea65086959 100644
--- a/static/app/views/issueDetails/header.spec.tsx
+++ b/static/app/views/issueDetails/header.spec.tsx
@@ -191,7 +191,7 @@ describe('GroupHeader', () => {
describe('priority', () => {
it('can change priority', async function () {
const mockModifyIssue = MockApiClient.addMockResponse({
- url: `/projects/org-slug/project-slug/issues/`,
+ url: `/organizations/org-slug/issues/`,
method: 'PUT',
body: {},
});
diff --git a/static/app/views/issueList/actions/index.tsx b/static/app/views/issueList/actions/index.tsx
index e7ea51bb2bca3a..ac0c6fc34785d2 100644
--- a/static/app/views/issueList/actions/index.tsx
+++ b/static/app/views/issueList/actions/index.tsx
@@ -2,10 +2,15 @@ import {Fragment, useEffect, useState} from 'react';
import styled from '@emotion/styled';
import {bulkDelete, bulkUpdate, mergeGroups} from 'sentry/actionCreators/group';
+import {
+ addErrorMessage,
+ addLoadingMessage,
+ clearIndicators,
+} from 'sentry/actionCreators/indicator';
import {Alert} from 'sentry/components/alert';
import Checkbox from 'sentry/components/checkbox';
import {Sticky} from 'sentry/components/sticky';
-import {tct, tn} from 'sentry/locale';
+import {t, tct, tn} from 'sentry/locale';
import GroupStore from 'sentry/stores/groupStore';
import ProjectsStore from 'sentry/stores/projectsStore';
import SelectedGroupStore from 'sentry/stores/selectedGroupStore';
@@ -167,6 +172,10 @@ function IssueListActions({
// * users with global views need to be explicit about what projects the query will run against
const projectConstraints = {project: selection.projects};
+ if (itemIds?.length) {
+ addLoadingMessage(t('Saving changes\u2026'));
+ }
+
bulkUpdate(
api,
{
@@ -175,13 +184,19 @@ function IssueListActions({
data,
query,
environment: selection.environments,
+ failSilently: true,
...projectConstraints,
...selection.datetime,
},
{
- complete: () => {
+ success: () => {
+ clearIndicators();
onActionTaken?.(itemIds ?? [], data);
},
+ error: () => {
+ clearIndicators();
+ addErrorMessage(t('Unable to update issues'));
+ },
}
);
});
diff --git a/static/app/views/issueList/groupListBody.tsx b/static/app/views/issueList/groupListBody.tsx
index d8611cbbc307c4..155aac95d076bd 100644
--- a/static/app/views/issueList/groupListBody.tsx
+++ b/static/app/views/issueList/groupListBody.tsx
@@ -10,6 +10,7 @@ import useApi from 'sentry/utils/useApi';
import useMedia from 'sentry/utils/useMedia';
import useOrganization from 'sentry/utils/useOrganization';
import {useSyncedLocalStorageState} from 'sentry/utils/useSyncedLocalStorageState';
+import type {IssueUpdateData} from 'sentry/views/issueList/types';
import NoGroupsHandler from './noGroupsHandler';
import {SAVED_SEARCHES_SIDEBAR_OPEN_LOCALSTORAGE_KEY} from './utils';
@@ -21,6 +22,7 @@ type GroupListBodyProps = {
groupStatsPeriod: string;
loading: boolean;
memberList: IndexedMembersByProject;
+ onActionTaken: (itemIds: string[], data: IssueUpdateData) => void;
query: string;
refetchGroups: () => void;
selectedProjectIds: number[];
@@ -31,6 +33,7 @@ type GroupListProps = {
groupIds: string[];
groupStatsPeriod: string;
memberList: IndexedMembersByProject;
+ onActionTaken: (itemIds: string[], data: IssueUpdateData) => void;
query: string;
};
@@ -44,6 +47,7 @@ function GroupListBody({
error,
refetchGroups,
selectedProjectIds,
+ onActionTaken,
}: GroupListBodyProps) {
const api = useApi();
const organization = useOrganization();
@@ -75,6 +79,7 @@ function GroupListBody({
query={query}
displayReprocessingLayout={displayReprocessingLayout}
groupStatsPeriod={groupStatsPeriod}
+ onActionTaken={onActionTaken}
/>
);
}
@@ -85,6 +90,7 @@ function GroupList({
query,
displayReprocessingLayout,
groupStatsPeriod,
+ onActionTaken,
}: GroupListProps) {
const [isSavedSearchesOpen] = useSyncedLocalStorageState(
SAVED_SEARCHES_SIDEBAR_OPEN_LOCALSTORAGE_KEY,
@@ -116,6 +122,7 @@ function GroupList({
useFilteredStats
canSelect={canSelect}
narrowGroups={isSavedSearchesOpen}
+ onPriorityChange={priority => onActionTaken([id], {priority})}
/>
);
})}
diff --git a/static/app/views/issueList/overview.actions.spec.tsx b/static/app/views/issueList/overview.actions.spec.tsx
index 3249ef42e89fba..804e8354fa638a 100644
--- a/static/app/views/issueList/overview.actions.spec.tsx
+++ b/static/app/views/issueList/overview.actions.spec.tsx
@@ -8,7 +8,13 @@ import {ProjectFixture} from 'sentry-fixture/project';
import {RouteComponentPropsFixture} from 'sentry-fixture/routeComponentPropsFixture';
import {TagsFixture} from 'sentry-fixture/tags';
-import {render, screen, userEvent, within} from 'sentry-test/reactTestingLibrary';
+import {
+ render,
+ screen,
+ userEvent,
+ waitFor,
+ within,
+} from 'sentry-test/reactTestingLibrary';
import Indicators from 'sentry/components/indicators';
import GroupStore from 'sentry/stores/groupStore';
@@ -331,7 +337,7 @@ describe('IssueListOverview (actions)', function () {
});
});
- it('removes issues after reprioritizing (when excluding priorities)', async function () {
+ it('removes issues after bulk reprioritizing (when excluding priorities)', async function () {
const updateIssueMock = MockApiClient.addMockResponse({
url: '/organizations/org-slug/issues/',
method: 'PUT',
@@ -369,7 +375,40 @@ describe('IssueListOverview (actions)', function () {
expect(screen.queryByText('Medium priority issue')).not.toBeInTheDocument();
});
- it('does not remove issues after reprioritizing (when query includes all priorities)', async function () {
+ it('removes issues after reprioritizing single issue (when excluding priorities)', async function () {
+ const updateIssueMock = MockApiClient.addMockResponse({
+ url: '/organizations/org-slug/issues/',
+ method: 'PUT',
+ });
+
+ render(<IssueListOverview {...defaultProps} />, {organization});
+
+ expect(screen.getByText('Medium priority issue')).toBeInTheDocument();
+
+ // After action, will refetch so need to mock that response
+ MockApiClient.addMockResponse({
+ url: '/organizations/org-slug/issues/',
+ body: [highPriorityGroup],
+ headers: {Link: DEFAULT_LINKS_HEADER},
+ });
+
+ await userEvent.click(screen.getByText('Med'));
+ await userEvent.click(screen.getByRole('menuitemradio', {name: 'Low'}));
+
+ await waitFor(() => {
+ expect(updateIssueMock).toHaveBeenCalledWith(
+ '/organizations/org-slug/issues/',
+ expect.objectContaining({
+ query: expect.objectContaining({id: ['1']}),
+ data: {priority: PriorityLevel.LOW},
+ })
+ );
+ });
+
+ expect(screen.queryByText('Medium priority issue')).not.toBeInTheDocument();
+ });
+
+ it('does not remove issues after bulk reprioritizing (when query includes all priorities)', async function () {
const updateIssueMock = MockApiClient.addMockResponse({
url: '/organizations/org-slug/issues/',
method: 'PUT',
diff --git a/static/app/views/issueList/overview.tsx b/static/app/views/issueList/overview.tsx
index fb7f627bb65633..9cf8e393e13726 100644
--- a/static/app/views/issueList/overview.tsx
+++ b/static/app/views/issueList/overview.tsx
@@ -1283,6 +1283,7 @@ class IssueListOverview extends Component<Props, State> {
loading={issuesLoading}
error={error}
refetchGroups={this.fetchData}
+ onActionTaken={this.onActionTaken}
/>
</VisuallyCompleteWithData>
</PanelBody>
|
edee378f64c28d380c73da11fdf4d73bf238b8c6
|
2024-05-24 12:45:59
|
anthony sottile
|
ref: stop using CanonicalKeyDict in detect_performance_issues (#71444)
| false
|
stop using CanonicalKeyDict in detect_performance_issues (#71444)
|
ref
|
diff --git a/src/sentry/spans/consumers/detect_performance_issues/message.py b/src/sentry/spans/consumers/detect_performance_issues/message.py
index 68c67b0215f541..034c0a08b8f067 100644
--- a/src/sentry/spans/consumers/detect_performance_issues/message.py
+++ b/src/sentry/spans/consumers/detect_performance_issues/message.py
@@ -19,7 +19,6 @@
from sentry.issues.producer import PayloadType, produce_occurrence_to_kafka
from sentry.models.project import Project
from sentry.utils import metrics
-from sentry.utils.canonical import CanonicalKeyDict
from sentry.utils.dates import to_datetime
logger = logging.getLogger(__name__)
@@ -200,10 +199,9 @@ def process_segment(spans: list[dict[str, Any]]):
projects = {project.id: project}
- data = CanonicalKeyDict(event)
jobs: Sequence[Job] = [
{
- "data": data,
+ "data": event,
"project_id": project.id,
"raw": False,
"start_time": None,
|
a89f96f1e234274c63aeefca556d2137dcb3d48c
|
2023-06-01 23:58:14
|
Snigdha Sharma
|
fix(migration): Update migration to use RangeQuerySetWrapper (#50179)
| false
|
Update migration to use RangeQuerySetWrapper (#50179)
|
fix
|
diff --git a/src/sentry/migrations/0476_convert_unresolved_to_set_escalating_activitytype.py b/src/sentry/migrations/0476_convert_unresolved_to_set_escalating_activitytype.py
index 9386f6f176b188..75b4178b8d00d3 100644
--- a/src/sentry/migrations/0476_convert_unresolved_to_set_escalating_activitytype.py
+++ b/src/sentry/migrations/0476_convert_unresolved_to_set_escalating_activitytype.py
@@ -4,13 +4,13 @@
from sentry.new_migrations.migrations import CheckedMigration
from sentry.types.activity import ActivityType
-from sentry.utils.query import RangeQuerySetWrapperWithProgressBar
+from sentry.utils.query import RangeQuerySetWrapper
def convert_to_set_escalating(apps, schema_editor):
Activity = apps.get_model("sentry", "Activity")
- for activity in RangeQuerySetWrapperWithProgressBar(
+ for activity in RangeQuerySetWrapper(
Activity.objects.filter(type=ActivityType.SET_UNRESOLVED.value)
):
|
5f430bf76c6a65882c2820bc72e5e207bdb5a92a
|
2018-11-30 05:46:29
|
Dan Fuller
|
ref: Convert ProjectBookmark.project_id to a FlexibleForeignKey
| false
|
Convert ProjectBookmark.project_id to a FlexibleForeignKey
|
ref
|
diff --git a/src/sentry/models/projectbookmark.py b/src/sentry/models/projectbookmark.py
index e753bc3232ecee..1477fbe5607b83 100644
--- a/src/sentry/models/projectbookmark.py
+++ b/src/sentry/models/projectbookmark.py
@@ -12,8 +12,9 @@
from django.utils import timezone
from sentry.db.models import (
- BoundedBigIntegerField, FlexibleForeignKey, Model, BaseManager, sane_repr
+ FlexibleForeignKey, Model, BaseManager, sane_repr
)
+from sentry.models import Project
class ProjectBookmark(Model):
@@ -23,7 +24,7 @@ class ProjectBookmark(Model):
"""
__core__ = True
- project_id = BoundedBigIntegerField(blank=True, null=True)
+ project = FlexibleForeignKey(Project, blank=True, null=True, db_constraint=False)
user = FlexibleForeignKey(settings.AUTH_USER_MODEL)
date_added = models.DateTimeField(default=timezone.now, null=True)
@@ -32,6 +33,6 @@ class ProjectBookmark(Model):
class Meta:
app_label = 'sentry'
db_table = 'sentry_projectbookmark'
- unique_together = (('project_id', 'user', ))
+ unique_together = (('project', 'user', ))
__repr__ = sane_repr('project_id', 'user_id')
diff --git a/src/sentry/south_migrations/0451_auto__del_field_projectbookmark_project_id__add_field_projectbookmark_.py b/src/sentry/south_migrations/0451_auto__del_field_projectbookmark_project_id__add_field_projectbookmark_.py
new file mode 100644
index 00000000000000..eed9ce8e4af0f4
--- /dev/null
+++ b/src/sentry/south_migrations/0451_auto__del_field_projectbookmark_project_id__add_field_projectbookmark_.py
@@ -0,0 +1,1239 @@
+# -*- coding: utf-8 -*-
+from south.utils import datetime_utils as datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ # Flag to indicate if this migration is too risky
+ # to run online and needs to be coordinated for offline
+ is_dangerous = False
+
+ def forwards(self, orm):
+ pass
+
+ def backwards(self, orm):
+ pass
+
+ models = {
+ 'sentry.activity': {
+ 'Meta': {'object_name': 'Activity'},
+ 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True'}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'type': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True'})
+ },
+ 'sentry.apiapplication': {
+ 'Meta': {'object_name': 'ApiApplication'},
+ 'allowed_origins': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'client_id': ('django.db.models.fields.CharField', [], {'default': "'741bc335115a49e8aeee6638082cecc0b25c318626534be8bd0268093e8438e1'", 'unique': 'True', 'max_length': '64'}),
+ 'client_secret': ('sentry.db.models.fields.encrypted.EncryptedTextField', [], {'default': "'1a53c776eda44f379bd538768c9e4a5565d03eacfbe04eafb80090d61ae3c964'"}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'homepage_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'default': "'Touching Troll'", 'max_length': '64', 'blank': 'True'}),
+ 'owner': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}),
+ 'privacy_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'}),
+ 'redirect_uris': ('django.db.models.fields.TextField', [], {}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'terms_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'})
+ },
+ 'sentry.apiauthorization': {
+ 'Meta': {'unique_together': "(('user', 'application'),)", 'object_name': 'ApiAuthorization'},
+ 'application': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ApiApplication']", 'null': 'True'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'scope_list': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'scopes': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.apigrant': {
+ 'Meta': {'object_name': 'ApiGrant'},
+ 'application': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ApiApplication']"}),
+ 'code': ('django.db.models.fields.CharField', [], {'default': "'7d0d16cf515e490cb0c814586823ac67'", 'max_length': '64', 'db_index': 'True'}),
+ 'expires_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2018, 11, 29, 0, 0)', 'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'redirect_uri': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'scope_list': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'scopes': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.apikey': {
+ 'Meta': {'object_name': 'ApiKey'},
+ 'allowed_origins': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32'}),
+ 'label': ('django.db.models.fields.CharField', [], {'default': "'Default'", 'max_length': '64', 'blank': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'key_set'", 'to': "orm['sentry.Organization']"}),
+ 'scope_list': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'scopes': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'})
+ },
+ 'sentry.apitoken': {
+ 'Meta': {'object_name': 'ApiToken'},
+ 'application': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ApiApplication']", 'null': 'True'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'expires_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2018, 12, 29, 0, 0)', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'refresh_token': ('django.db.models.fields.CharField', [], {'default': "'a4a7976a2898468098b787881a643f156b6d0f0dffa447debffd63efd107ee11'", 'max_length': '64', 'unique': 'True', 'null': 'True'}),
+ 'scope_list': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'scopes': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
+ 'token': ('django.db.models.fields.CharField', [], {'default': "'74cc249804bb4227869ca3c8d3d94621f7ef3023d5d34004ad872801911aa6db'", 'unique': 'True', 'max_length': '64'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.assistantactivity': {
+ 'Meta': {'unique_together': "(('user', 'guide_id'),)", 'object_name': 'AssistantActivity', 'db_table': "'sentry_assistant_activity'"},
+ 'dismissed_ts': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'guide_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'useful': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}),
+ 'viewed_ts': ('django.db.models.fields.DateTimeField', [], {'null': 'True'})
+ },
+ 'sentry.auditlogentry': {
+ 'Meta': {'object_name': 'AuditLogEntry'},
+ 'actor': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'blank': 'True', 'related_name': "'audit_actors'", 'null': 'True', 'to': "orm['sentry.User']"}),
+ 'actor_key': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ApiKey']", 'null': 'True', 'blank': 'True'}),
+ 'actor_label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),
+ 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'event': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'target_object': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'target_user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'blank': 'True', 'related_name': "'audit_targets'", 'null': 'True', 'to': "orm['sentry.User']"})
+ },
+ 'sentry.authenticator': {
+ 'Meta': {'unique_together': "(('user', 'type'),)", 'object_name': 'Authenticator', 'db_table': "'auth_authenticator'"},
+ 'config': ('sentry.db.models.fields.encrypted.EncryptedPickledObjectField', [], {}),
+ 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedAutoField', [], {'primary_key': 'True'}),
+ 'last_used_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'type': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.authidentity': {
+ 'Meta': {'unique_together': "(('auth_provider', 'ident'), ('auth_provider', 'user'))", 'object_name': 'AuthIdentity'},
+ 'auth_provider': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.AuthProvider']"}),
+ 'data': ('sentry.db.models.fields.encrypted.EncryptedJsonField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'last_synced': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'last_verified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.authprovider': {
+ 'Meta': {'object_name': 'AuthProvider'},
+ 'config': ('sentry.db.models.fields.encrypted.EncryptedJsonField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'default_global_access': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'default_role': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '50'}),
+ 'default_teams': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.Team']", 'symmetrical': 'False', 'blank': 'True'}),
+ 'flags': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_sync': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']", 'unique': 'True'}),
+ 'provider': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'sync_time': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'})
+ },
+ 'sentry.broadcast': {
+ 'Meta': {'object_name': 'Broadcast'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_expires': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2018, 12, 6, 0, 0)', 'null': 'True', 'blank': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
+ 'link': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'message': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'upstream_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'blank': 'True'})
+ },
+ 'sentry.broadcastseen': {
+ 'Meta': {'unique_together': "(('broadcast', 'user'),)", 'object_name': 'BroadcastSeen'},
+ 'broadcast': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Broadcast']"}),
+ 'date_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.commit': {
+ 'Meta': {'unique_together': "(('repository_id', 'key'),)", 'object_name': 'Commit', 'index_together': "(('repository_id', 'date_added'),)"},
+ 'author': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.CommitAuthor']", 'null': 'True'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'message': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'repository_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {})
+ },
+ 'sentry.commitauthor': {
+ 'Meta': {'unique_together': "(('organization_id', 'email'), ('organization_id', 'external_id'))", 'object_name': 'CommitAuthor'},
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+ 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '164', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'sentry.commitfilechange': {
+ 'Meta': {'unique_together': "(('commit', 'filename'),)", 'object_name': 'CommitFileChange'},
+ 'commit': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Commit']"}),
+ 'filename': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '1'})
+ },
+ 'sentry.counter': {
+ 'Meta': {'object_name': 'Counter', 'db_table': "'sentry_projectcounter'"},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'unique': 'True'}),
+ 'value': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {})
+ },
+ 'sentry.deletedorganization': {
+ 'Meta': {'object_name': 'DeletedOrganization'},
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'actor_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
+ 'actor_label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'date_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'reason': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'slug': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'})
+ },
+ 'sentry.deletedproject': {
+ 'Meta': {'object_name': 'DeletedProject'},
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'actor_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
+ 'actor_label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'date_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'organization_name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'organization_slug': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
+ 'platform': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'reason': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'slug': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'})
+ },
+ 'sentry.deletedteam': {
+ 'Meta': {'object_name': 'DeletedTeam'},
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'actor_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
+ 'actor_label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'date_created': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'organization_name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'organization_slug': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
+ 'reason': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
+ 'slug': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'})
+ },
+ 'sentry.deploy': {
+ 'Meta': {'object_name': 'Deploy'},
+ 'date_finished': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_started': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'environment_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),
+ 'notified': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'})
+ },
+ 'sentry.discoversavedquery': {
+ 'Meta': {'object_name': 'DiscoverSavedQuery'},
+ 'created_by': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'date_created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
+ 'date_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.Project']", 'through': "orm['sentry.DiscoverSavedQueryProject']", 'symmetrical': 'False'}),
+ 'query': ('jsonfield.fields.JSONField', [], {'default': '{}'})
+ },
+ 'sentry.discoversavedqueryproject': {
+ 'Meta': {'unique_together': "(('project', 'discover_saved_query'),)", 'object_name': 'DiscoverSavedQueryProject'},
+ 'discover_saved_query': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.DiscoverSavedQuery']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"})
+ },
+ 'sentry.distribution': {
+ 'Meta': {'unique_together': "(('release', 'name'),)", 'object_name': 'Distribution'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"})
+ },
+ 'sentry.email': {
+ 'Meta': {'object_name': 'Email'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('sentry.db.models.fields.citext.CIEmailField', [], {'unique': 'True', 'max_length': '75'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'})
+ },
+ 'sentry.environment': {
+ 'Meta': {'unique_together': "(('organization_id', 'name'),)", 'object_name': 'Environment'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.Project']", 'through': "orm['sentry.EnvironmentProject']", 'symmetrical': 'False'})
+ },
+ 'sentry.environmentproject': {
+ 'Meta': {'unique_together': "(('project', 'environment'),)", 'object_name': 'EnvironmentProject'},
+ 'environment': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Environment']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"})
+ },
+ 'sentry.event': {
+ 'Meta': {'unique_together': "(('project_id', 'event_id'),)", 'object_name': 'Event', 'db_table': "'sentry_message'", 'index_together': "(('group_id', 'datetime'),)"},
+ 'data': ('sentry.db.models.fields.node.NodeField', [], {'null': 'True', 'blank': 'True'}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True', 'db_column': "'message_id'"}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'message': ('django.db.models.fields.TextField', [], {}),
+ 'platform': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'time_spent': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'null': 'True'})
+ },
+ 'sentry.eventattachment': {
+ 'Meta': {'unique_together': "(('project_id', 'event_id', 'file'),)", 'object_name': 'EventAttachment', 'index_together': "(('project_id', 'date_added'),)"},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']"}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.TextField', [], {}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {})
+ },
+ 'sentry.eventmapping': {
+ 'Meta': {'unique_together': "(('project_id', 'event_id'),)", 'object_name': 'EventMapping'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {})
+ },
+ 'sentry.eventprocessingissue': {
+ 'Meta': {'unique_together': "(('raw_event', 'processing_issue'),)", 'object_name': 'EventProcessingIssue'},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'processing_issue': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ProcessingIssue']"}),
+ 'raw_event': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.RawEvent']"})
+ },
+ 'sentry.eventtag': {
+ 'Meta': {'unique_together': "(('event_id', 'key_id', 'value_id'),)", 'object_name': 'EventTag', 'index_together': "(('group_id', 'key_id', 'value_id'),)"},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'event_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'value_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {})
+ },
+ 'sentry.eventuser': {
+ 'Meta': {'unique_together': "(('project_id', 'ident'), ('project_id', 'hash'))", 'object_name': 'EventUser', 'index_together': "(('project_id', 'email'), ('project_id', 'username'), ('project_id', 'ip_address'))"},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True'}),
+ 'hash': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
+ 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39', 'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True'})
+ },
+ 'sentry.externalissue': {
+ 'Meta': {'unique_together': "(('organization_id', 'integration_id', 'key'),)", 'object_name': 'ExternalIssue'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'description': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'integration_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'metadata': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'title': ('django.db.models.fields.TextField', [], {'null': 'True'})
+ },
+ 'sentry.featureadoption': {
+ 'Meta': {'unique_together': "(('organization', 'feature_id'),)", 'object_name': 'FeatureAdoption'},
+ 'applicable': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'date_completed': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'feature_id': ('django.db.models.fields.PositiveIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"})
+ },
+ 'sentry.file': {
+ 'Meta': {'object_name': 'File'},
+ 'blob': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'legacy_blob'", 'null': 'True', 'to': "orm['sentry.FileBlob']"}),
+ 'blobs': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.FileBlob']", 'through': "orm['sentry.FileBlobIndex']", 'symmetrical': 'False'}),
+ 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'db_index': 'True'}),
+ 'headers': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.TextField', [], {}),
+ 'path': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'size': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '64'})
+ },
+ 'sentry.fileblob': {
+ 'Meta': {'object_name': 'FileBlob'},
+ 'checksum': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '40'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'path': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'size': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'})
+ },
+ 'sentry.fileblobindex': {
+ 'Meta': {'unique_together': "(('file', 'blob', 'offset'),)", 'object_name': 'FileBlobIndex'},
+ 'blob': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.FileBlob']"}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'offset': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {})
+ },
+ 'sentry.fileblobowner': {
+ 'Meta': {'unique_together': "(('blob', 'organization'),)", 'object_name': 'FileBlobOwner'},
+ 'blob': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.FileBlob']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"})
+ },
+ 'sentry.group': {
+ 'Meta': {'unique_together': "(('project', 'short_id'),)", 'object_name': 'Group', 'db_table': "'sentry_groupedmessage'", 'index_together': "(('project', 'first_release'),)"},
+ 'active_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}),
+ 'culprit': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'db_column': "'view'", 'blank': 'True'}),
+ 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True', 'blank': 'True'}),
+ 'first_release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']", 'null': 'True', 'on_delete': 'models.PROTECT'}),
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_public': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'level': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '40', 'db_index': 'True', 'blank': 'True'}),
+ 'logger': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64', 'db_index': 'True', 'blank': 'True'}),
+ 'message': ('django.db.models.fields.TextField', [], {}),
+ 'num_comments': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'null': 'True'}),
+ 'platform': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}),
+ 'resolved_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'}),
+ 'score': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '0'}),
+ 'short_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'time_spent_count': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '0'}),
+ 'time_spent_total': ('sentry.db.models.fields.bounded.BoundedIntegerField', [], {'default': '0'}),
+ 'times_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '1', 'db_index': 'True'})
+ },
+ 'sentry.groupassignee': {
+ 'Meta': {'object_name': 'GroupAssignee', 'db_table': "'sentry_groupasignee'"},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'assignee_set'", 'unique': 'True', 'to': "orm['sentry.Group']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'assignee_set'", 'to': "orm['sentry.Project']"}),
+ 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'sentry_assignee_set'", 'null': 'True', 'to': "orm['sentry.Team']"}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'sentry_assignee_set'", 'null': 'True', 'to': "orm['sentry.User']"})
+ },
+ 'sentry.groupbookmark': {
+ 'Meta': {'unique_together': "(('project', 'user', 'group'),)", 'object_name': 'GroupBookmark'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'bookmark_set'", 'to': "orm['sentry.Group']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'bookmark_set'", 'to': "orm['sentry.Project']"}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'sentry_bookmark_set'", 'to': "orm['sentry.User']"})
+ },
+ 'sentry.groupcommitresolution': {
+ 'Meta': {'unique_together': "(('group_id', 'commit_id'),)", 'object_name': 'GroupCommitResolution'},
+ 'commit_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'})
+ },
+ 'sentry.groupemailthread': {
+ 'Meta': {'unique_together': "(('email', 'group'), ('email', 'msgid'))", 'object_name': 'GroupEmailThread'},
+ 'date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'groupemail_set'", 'to': "orm['sentry.Group']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'msgid': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'groupemail_set'", 'to': "orm['sentry.Project']"})
+ },
+ 'sentry.groupenvironment': {
+ 'Meta': {'unique_together': "[('group_id', 'environment_id')]", 'object_name': 'GroupEnvironment', 'index_together': "[('environment_id', 'first_release_id')]"},
+ 'environment_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'first_release_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'})
+ },
+ 'sentry.grouphash': {
+ 'Meta': {'unique_together': "(('project', 'hash'),)", 'object_name': 'GroupHash'},
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'null': 'True'}),
+ 'group_tombstone_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True', 'db_index': 'True'}),
+ 'hash': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}),
+ 'state': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'})
+ },
+ 'sentry.grouplink': {
+ 'Meta': {'unique_together': "(('group_id', 'linked_type', 'linked_id'),)", 'object_name': 'GroupLink'},
+ 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'linked_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'linked_type': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '1'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'db_index': 'True'}),
+ 'relationship': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '2'})
+ },
+ 'sentry.groupmeta': {
+ 'Meta': {'unique_together': "(('group', 'key'),)", 'object_name': 'GroupMeta'},
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'value': ('django.db.models.fields.TextField', [], {})
+ },
+ 'sentry.groupredirect': {
+ 'Meta': {'object_name': 'GroupRedirect'},
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'previous_group_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'unique': 'True'})
+ },
+ 'sentry.grouprelease': {
+ 'Meta': {'unique_together': "(('group_id', 'release_id', 'environment'),)", 'object_name': 'GroupRelease'},
+ 'environment': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '64'}),
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'release_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'sentry.groupresolution': {
+ 'Meta': {'object_name': 'GroupResolution'},
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'unique': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'type': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'})
+ },
+ 'sentry.grouprulestatus': {
+ 'Meta': {'unique_together': "(('rule', 'group'),)", 'object_name': 'GroupRuleStatus'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_active': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'rule': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Rule']"}),
+ 'status': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'})
+ },
+ 'sentry.groupseen': {
+ 'Meta': {'unique_together': "(('user', 'group'),)", 'object_name': 'GroupSeen'},
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'db_index': 'False'})
+ },
+ 'sentry.groupshare': {
+ 'Meta': {'object_name': 'GroupShare'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'unique': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True'}),
+ 'uuid': ('django.db.models.fields.CharField', [], {'default': "'14315ce24e6b4bb59f28dec8e0a50795'", 'unique': 'True', 'max_length': '32'})
+ },
+ 'sentry.groupsnooze': {
+ 'Meta': {'object_name': 'GroupSnooze'},
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'count': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'unique': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'state': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
+ 'until': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'user_count': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'user_window': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'window': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'})
+ },
+ 'sentry.groupsubscription': {
+ 'Meta': {'unique_together': "(('group', 'user'),)", 'object_name': 'GroupSubscription'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'subscription_set'", 'to': "orm['sentry.Group']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'subscription_set'", 'to': "orm['sentry.Project']"}),
+ 'reason': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.grouptagkey': {
+ 'Meta': {'unique_together': "(('project_id', 'group_id', 'key'),)", 'object_name': 'GroupTagKey'},
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True', 'db_index': 'True'}),
+ 'values_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'})
+ },
+ 'sentry.grouptagvalue': {
+ 'Meta': {'unique_together': "(('group_id', 'key', 'value'),)", 'object_name': 'GroupTagValue', 'db_table': "'sentry_messagefiltervalue'", 'index_together': "(('project_id', 'key', 'value', 'last_seen'),)"},
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}),
+ 'group_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True', 'db_index': 'True'}),
+ 'times_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+ },
+ 'sentry.grouptombstone': {
+ 'Meta': {'object_name': 'GroupTombstone'},
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'culprit': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'level': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '40', 'blank': 'True'}),
+ 'message': ('django.db.models.fields.TextField', [], {}),
+ 'previous_group_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'unique': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"})
+ },
+ 'sentry.identity': {
+ 'Meta': {'unique_together': "(('idp', 'external_id'), ('idp', 'user'))", 'object_name': 'Identity'},
+ 'data': ('sentry.db.models.fields.encrypted.EncryptedJsonField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_verified': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'idp': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.IdentityProvider']"}),
+ 'scopes': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.identityprovider': {
+ 'Meta': {'unique_together': "(('type', 'external_id'),)", 'object_name': 'IdentityProvider'},
+ 'config': ('sentry.db.models.fields.encrypted.EncryptedJsonField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '64'})
+ },
+ 'sentry.integration': {
+ 'Meta': {'unique_together': "(('provider', 'external_id'),)", 'object_name': 'Integration'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'metadata': ('sentry.db.models.fields.encrypted.EncryptedJsonField', [], {'default': '{}'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'organizations': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'integrations'", 'symmetrical': 'False', 'through': "orm['sentry.OrganizationIntegration']", 'to': "orm['sentry.Organization']"}),
+ 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'integrations'", 'symmetrical': 'False', 'through': "orm['sentry.ProjectIntegration']", 'to': "orm['sentry.Project']"}),
+ 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'null': 'True'})
+ },
+ 'sentry.integrationexternalproject': {
+ 'Meta': {'unique_together': "(('organization_integration_id', 'external_id'),)", 'object_name': 'IntegrationExternalProject'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'organization_integration_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'resolved_status': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'unresolved_status': ('django.db.models.fields.CharField', [], {'max_length': '64'})
+ },
+ 'sentry.latestrelease': {
+ 'Meta': {'unique_together': "(('repository_id', 'environment_id'),)", 'object_name': 'LatestRelease'},
+ 'commit_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'deploy_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'environment_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'release_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {}),
+ 'repository_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {})
+ },
+ 'sentry.lostpasswordhash': {
+ 'Meta': {'object_name': 'LostPasswordHash'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'hash': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'unique': 'True'})
+ },
+ 'sentry.option': {
+ 'Meta': {'object_name': 'Option'},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
+ 'last_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'value': ('sentry.db.models.fields.encrypted.EncryptedPickledObjectField', [], {})
+ },
+ 'sentry.organization': {
+ 'Meta': {'object_name': 'Organization'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'default_role': ('django.db.models.fields.CharField', [], {'default': "'member'", 'max_length': '32'}),
+ 'flags': ('django.db.models.fields.BigIntegerField', [], {'default': '1'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'members': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'org_memberships'", 'symmetrical': 'False', 'through': "orm['sentry.OrganizationMember']", 'to': "orm['sentry.User']"}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'})
+ },
+ 'sentry.organizationaccessrequest': {
+ 'Meta': {'unique_together': "(('team', 'member'),)", 'object_name': 'OrganizationAccessRequest'},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'member': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.OrganizationMember']"}),
+ 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Team']"})
+ },
+ 'sentry.organizationavatar': {
+ 'Meta': {'object_name': 'OrganizationAvatar'},
+ 'avatar_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'avatar'", 'unique': 'True', 'to': "orm['sentry.Organization']"})
+ },
+ 'sentry.organizationintegration': {
+ 'Meta': {'unique_together': "(('organization', 'integration'),)", 'object_name': 'OrganizationIntegration'},
+ 'config': ('sentry.db.models.fields.encrypted.EncryptedJsonField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'default_auth_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True', 'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'integration': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Integration']"}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'})
+ },
+ 'sentry.organizationmember': {
+ 'Meta': {'unique_together': "(('organization', 'user'), ('organization', 'email'))", 'object_name': 'OrganizationMember'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}),
+ 'flags': ('django.db.models.fields.BigIntegerField', [], {'default': '0'}),
+ 'has_global_access': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'member_set'", 'to': "orm['sentry.Organization']"}),
+ 'role': ('django.db.models.fields.CharField', [], {'default': "'member'", 'max_length': '32'}),
+ 'teams': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sentry.Team']", 'symmetrical': 'False', 'through': "orm['sentry.OrganizationMemberTeam']", 'blank': 'True'}),
+ 'token': ('django.db.models.fields.CharField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
+ 'token_expires_at': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True'}),
+ 'type': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '50', 'blank': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'blank': 'True', 'related_name': "'sentry_orgmember_set'", 'null': 'True', 'to': "orm['sentry.User']"})
+ },
+ 'sentry.organizationmemberteam': {
+ 'Meta': {'unique_together': "(('team', 'organizationmember'),)", 'object_name': 'OrganizationMemberTeam', 'db_table': "'sentry_organizationmember_teams'"},
+ 'id': ('sentry.db.models.fields.bounded.BoundedAutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'organizationmember': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.OrganizationMember']"}),
+ 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Team']"})
+ },
+ 'sentry.organizationonboardingtask': {
+ 'Meta': {'unique_together': "(('organization', 'task'),)", 'object_name': 'OrganizationOnboardingTask'},
+ 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'date_completed': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'task': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True'})
+ },
+ 'sentry.organizationoption': {
+ 'Meta': {'unique_together': "(('organization', 'key'),)", 'object_name': 'OrganizationOption', 'db_table': "'sentry_organizationoptions'"},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'value': ('sentry.db.models.fields.encrypted.EncryptedPickledObjectField', [], {})
+ },
+ 'sentry.processingissue': {
+ 'Meta': {'unique_together': "(('project', 'checksum', 'type'),)", 'object_name': 'ProcessingIssue'},
+ 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '40', 'db_index': 'True'}),
+ 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '30'})
+ },
+ 'sentry.project': {
+ 'Meta': {'unique_together': "(('organization', 'slug'),)", 'object_name': 'Project'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'first_event': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'flags': ('django.db.models.fields.BigIntegerField', [], {'default': '0', 'null': 'True'}),
+ 'forced_color': ('django.db.models.fields.CharField', [], {'max_length': '6', 'null': 'True', 'blank': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'platform': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'public': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'null': 'True'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'teams': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'teams'", 'symmetrical': 'False', 'through': "orm['sentry.ProjectTeam']", 'to': "orm['sentry.Team']"})
+ },
+ 'sentry.projectavatar': {
+ 'Meta': {'object_name': 'ProjectAvatar'},
+ 'avatar_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'avatar'", 'unique': 'True', 'to': "orm['sentry.Project']"})
+ },
+ 'sentry.projectbookmark': {
+ 'Meta': {'unique_together': "(('project', 'user'),)", 'object_name': 'ProjectBookmark'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True', 'blank': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.projectcficachefile': {
+ 'Meta': {'unique_together': "(('project', 'debug_file'),)", 'object_name': 'ProjectCfiCacheFile'},
+ 'cache_file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']"}),
+ 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+ 'debug_file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ProjectDebugFile']", 'on_delete': 'models.DO_NOTHING', 'db_column': "'dsym_file_id'"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}),
+ 'version': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {})
+ },
+ 'sentry.projectdebugfile': {
+ 'Meta': {'object_name': 'ProjectDebugFile', 'db_table': "'sentry_projectdsymfile'", 'index_together': "(('project', 'debug_id'),)"},
+ 'cpu_name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+ 'data': ('jsonfield.fields.JSONField', [], {'null': 'True'}),
+ 'debug_id': ('django.db.models.fields.CharField', [], {'max_length': '64', 'db_column': "'uuid'"}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'object_name': ('django.db.models.fields.TextField', [], {}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'})
+ },
+ 'sentry.projectintegration': {
+ 'Meta': {'unique_together': "(('project', 'integration'),)", 'object_name': 'ProjectIntegration'},
+ 'config': ('sentry.db.models.fields.encrypted.EncryptedJsonField', [], {'default': '{}'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'integration': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Integration']"}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"})
+ },
+ 'sentry.projectkey': {
+ 'Meta': {'object_name': 'ProjectKey'},
+ 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'key_set'", 'to': "orm['sentry.Project']"}),
+ 'public_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}),
+ 'rate_limit_count': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'rate_limit_window': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'roles': ('django.db.models.fields.BigIntegerField', [], {'default': '1'}),
+ 'secret_key': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'})
+ },
+ 'sentry.projectoption': {
+ 'Meta': {'unique_together': "(('project', 'key'),)", 'object_name': 'ProjectOption', 'db_table': "'sentry_projectoptions'"},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'value': ('sentry.db.models.fields.encrypted.EncryptedPickledObjectField', [], {})
+ },
+ 'sentry.projectownership': {
+ 'Meta': {'object_name': 'ProjectOwnership'},
+ 'date_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'fallthrough': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'last_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'unique': 'True'}),
+ 'raw': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'schema': ('jsonfield.fields.JSONField', [], {'null': 'True'})
+ },
+ 'sentry.projectplatform': {
+ 'Meta': {'unique_together': "(('project_id', 'platform'),)", 'object_name': 'ProjectPlatform'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'platform': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {})
+ },
+ 'sentry.projectredirect': {
+ 'Meta': {'unique_together': "(('organization', 'redirect_slug'),)", 'object_name': 'ProjectRedirect'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'redirect_slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
+ },
+ 'sentry.projectsymcachefile': {
+ 'Meta': {'unique_together': "(('project', 'debug_file'),)", 'object_name': 'ProjectSymCacheFile'},
+ 'cache_file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']"}),
+ 'checksum': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+ 'debug_file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ProjectDebugFile']", 'on_delete': 'models.DO_NOTHING', 'db_column': "'dsym_file_id'"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}),
+ 'version': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {})
+ },
+ 'sentry.projectteam': {
+ 'Meta': {'unique_together': "(('project', 'team'),)", 'object_name': 'ProjectTeam'},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Team']"})
+ },
+ 'sentry.promptsactivity': {
+ 'Meta': {'unique_together': "(('user', 'feature', 'organization_id', 'project_id'),)", 'object_name': 'PromptsActivity'},
+ 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'feature': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.pullrequest': {
+ 'Meta': {'unique_together': "(('repository_id', 'key'),)", 'object_name': 'PullRequest', 'db_table': "'sentry_pull_request'", 'index_together': "(('repository_id', 'date_added'), ('organization_id', 'merge_commit_sha'))"},
+ 'author': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.CommitAuthor']", 'null': 'True'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'merge_commit_sha': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'message': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'repository_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'title': ('django.db.models.fields.TextField', [], {'null': 'True'})
+ },
+ 'sentry.pullrequestcommit': {
+ 'Meta': {'unique_together': "(('pull_request', 'commit'),)", 'object_name': 'PullRequestCommit', 'db_table': "'sentry_pullrequest_commit'"},
+ 'commit': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Commit']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'pull_request': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.PullRequest']"})
+ },
+ 'sentry.rawevent': {
+ 'Meta': {'unique_together': "(('project', 'event_id'),)", 'object_name': 'RawEvent'},
+ 'data': ('sentry.db.models.fields.node.NodeField', [], {'null': 'True', 'blank': 'True'}),
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"})
+ },
+ 'sentry.relay': {
+ 'Meta': {'object_name': 'Relay'},
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_internal': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'public_key': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'relay_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'})
+ },
+ 'sentry.release': {
+ 'Meta': {'unique_together': "(('organization', 'version'),)", 'object_name': 'Release'},
+ 'authors': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'commit_count': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'null': 'True'}),
+ 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_released': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'date_started': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_commit_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'last_deploy_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'new_groups': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'owner': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'projects': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'releases'", 'symmetrical': 'False', 'through': "orm['sentry.ReleaseProject']", 'to': "orm['sentry.Project']"}),
+ 'ref': ('django.db.models.fields.CharField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}),
+ 'total_deploys': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'null': 'True'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+ 'version': ('django.db.models.fields.CharField', [], {'max_length': '250'})
+ },
+ 'sentry.releasecommit': {
+ 'Meta': {'unique_together': "(('release', 'commit'), ('release', 'order'))", 'object_name': 'ReleaseCommit'},
+ 'commit': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Commit']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'order': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"})
+ },
+ 'sentry.releaseenvironment': {
+ 'Meta': {'unique_together': "(('organization_id', 'release_id', 'environment_id'),)", 'object_name': 'ReleaseEnvironment', 'db_table': "'sentry_environmentrelease'"},
+ 'environment_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'release_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'})
+ },
+ 'sentry.releasefile': {
+ 'Meta': {'unique_together': "(('release', 'ident'),)", 'object_name': 'ReleaseFile'},
+ 'dist': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Distribution']", 'null': 'True'}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+ 'name': ('django.db.models.fields.TextField', [], {}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"})
+ },
+ 'sentry.releaseheadcommit': {
+ 'Meta': {'unique_together': "(('repository_id', 'release'),)", 'object_name': 'ReleaseHeadCommit'},
+ 'commit': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Commit']"}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"}),
+ 'repository_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {})
+ },
+ 'sentry.releaseproject': {
+ 'Meta': {'unique_together': "(('project', 'release'),)", 'object_name': 'ReleaseProject', 'db_table': "'sentry_release_project'"},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'new_groups': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'null': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"})
+ },
+ 'sentry.releaseprojectenvironment': {
+ 'Meta': {'unique_together': "(('project', 'release', 'environment'),)", 'object_name': 'ReleaseProjectEnvironment'},
+ 'environment': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Environment']"}),
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'last_deploy_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True', 'db_index': 'True'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'new_issues_count': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'release': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Release']"})
+ },
+ 'sentry.repository': {
+ 'Meta': {'unique_together': "(('organization_id', 'name'), ('organization_id', 'provider', 'external_id'))", 'object_name': 'Repository'},
+ 'config': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'integration_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True', 'db_index': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+ 'organization_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'provider': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'})
+ },
+ 'sentry.reprocessingreport': {
+ 'Meta': {'unique_together': "(('project', 'event_id'),)", 'object_name': 'ReprocessingReport'},
+ 'datetime': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"})
+ },
+ 'sentry.rule': {
+ 'Meta': {'object_name': 'Rule'},
+ 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'environment_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'})
+ },
+ 'sentry.savedsearch': {
+ 'Meta': {'unique_together': "(('project', 'name'),)", 'object_name': 'SavedSearch'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'owner': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']", 'null': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'query': ('django.db.models.fields.TextField', [], {})
+ },
+ 'sentry.savedsearchuserdefault': {
+ 'Meta': {'unique_together': "(('project', 'user'),)", 'object_name': 'SavedSearchUserDefault', 'db_table': "'sentry_savedsearch_userdefault'"},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"}),
+ 'savedsearch': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.SavedSearch']"}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.scheduleddeletion': {
+ 'Meta': {'unique_together': "(('app_label', 'model_name', 'object_id'),)", 'object_name': 'ScheduledDeletion'},
+ 'aborted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'data': ('jsonfield.fields.JSONField', [], {'default': '{}'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_scheduled': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2018, 12, 29, 0, 0)'}),
+ 'guid': ('django.db.models.fields.CharField', [], {'default': "'83101f62d5e442b9988ef62f7ab9a8c5'", 'unique': 'True', 'max_length': '32'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'in_progress': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'model_name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'object_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {})
+ },
+ 'sentry.scheduledjob': {
+ 'Meta': {'object_name': 'ScheduledJob'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_scheduled': ('django.db.models.fields.DateTimeField', [], {}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'payload': ('jsonfield.fields.JSONField', [], {'default': '{}'})
+ },
+ 'sentry.sentryapp': {
+ 'Meta': {'object_name': 'SentryApp'},
+ 'application': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'sentry_app'", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['sentry.ApiApplication']"}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'date_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_alertable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'name': ('django.db.models.fields.TextField', [], {}),
+ 'overview': ('django.db.models.fields.TextField', [], {'null': 'True'}),
+ 'owner': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'owned_sentry_apps'", 'to': "orm['sentry.Organization']"}),
+ 'proxy_user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'sentry_app'", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['sentry.User']"}),
+ 'redirect_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'}),
+ 'scope_list': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'scopes': ('django.db.models.fields.BigIntegerField', [], {'default': 'None'}),
+ 'slug': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'uuid': ('django.db.models.fields.CharField', [], {'default': "'fa516b79-73a5-4b36-9918-7bedf6a91cb6'", 'max_length': '64'}),
+ 'webhook_url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+ },
+ 'sentry.sentryappavatar': {
+ 'Meta': {'object_name': 'SentryAppAvatar'},
+ 'avatar_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}),
+ 'sentry_app': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'avatar'", 'unique': 'True', 'to': "orm['sentry.SentryApp']"})
+ },
+ 'sentry.sentryappinstallation': {
+ 'Meta': {'object_name': 'SentryAppInstallation'},
+ 'api_grant': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'sentry_app_installation'", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['sentry.ApiGrant']"}),
+ 'authorization': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'sentry_app_installation'", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['sentry.ApiAuthorization']"}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'date_deleted': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'date_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'sentry_app_installations'", 'to': "orm['sentry.Organization']"}),
+ 'sentry_app': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'installations'", 'to': "orm['sentry.SentryApp']"}),
+ 'uuid': ('django.db.models.fields.CharField', [], {'default': "'9e363335-882a-42cd-bd4c-5107a34b5ae5'", 'max_length': '64'})
+ },
+ 'sentry.servicehook': {
+ 'Meta': {'object_name': 'ServiceHook'},
+ 'actor_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'application': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.ApiApplication']", 'null': 'True'}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'events': ('sentry.db.models.fields.array.ArrayField', [], {'of': (u'django.db.models.fields.TextField', [], {})}),
+ 'guid': ('django.db.models.fields.CharField', [], {'max_length': '32', 'unique': 'True', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'secret': ('sentry.db.models.fields.encrypted.EncryptedTextField', [], {'default': "'9d78780c8cd04167bf5db0cbb728380d8ff14efe64494080999955262a82d0d4'"}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0', 'db_index': 'True'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '512'}),
+ 'version': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'})
+ },
+ 'sentry.tagkey': {
+ 'Meta': {'unique_together': "(('project_id', 'key'),)", 'object_name': 'TagKey', 'db_table': "'sentry_filterkey'"},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'label': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'db_index': 'True'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'values_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'})
+ },
+ 'sentry.tagvalue': {
+ 'Meta': {'unique_together': "(('project_id', 'key', 'value'),)", 'object_name': 'TagValue', 'db_table': "'sentry_filtervalue'", 'index_together': "(('project_id', 'key', 'last_seen'),)"},
+ 'data': ('sentry.db.models.fields.gzippeddict.GzippedDictField', [], {'null': 'True', 'blank': 'True'}),
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True', 'db_index': 'True'}),
+ 'project_id': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'null': 'True', 'db_index': 'True'}),
+ 'times_seen': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'}),
+ 'value': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+ },
+ 'sentry.team': {
+ 'Meta': {'unique_together': "(('organization', 'slug'),)", 'object_name': 'Team'},
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']"}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+ 'status': ('sentry.db.models.fields.bounded.BoundedPositiveIntegerField', [], {'default': '0'})
+ },
+ 'sentry.teamavatar': {
+ 'Meta': {'object_name': 'TeamAvatar'},
+ 'avatar_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}),
+ 'team': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'avatar'", 'unique': 'True', 'to': "orm['sentry.Team']"})
+ },
+ 'sentry.user': {
+ 'Meta': {'object_name': 'User', 'db_table': "'auth_user'"},
+ 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+ 'flags': ('django.db.models.fields.BigIntegerField', [], {'default': '0', 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedAutoField', [], {'primary_key': 'True'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'is_managed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_password_expired': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_sentry_app': ('django.db.models.fields.NullBooleanField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
+ 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'last_active': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'null': 'True'}),
+ 'last_password_change': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '200', 'db_column': "'first_name'", 'blank': 'True'}),
+ 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'session_nonce': ('django.db.models.fields.CharField', [], {'max_length': '12', 'null': 'True'}),
+ 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
+ },
+ 'sentry.useravatar': {
+ 'Meta': {'object_name': 'UserAvatar'},
+ 'avatar_type': ('django.db.models.fields.PositiveSmallIntegerField', [], {'default': '0'}),
+ 'file': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.File']", 'unique': 'True', 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ident': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '32', 'db_index': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'avatar'", 'unique': 'True', 'to': "orm['sentry.User']"})
+ },
+ 'sentry.useremail': {
+ 'Meta': {'unique_together': "(('user', 'email'),)", 'object_name': 'UserEmail'},
+ 'date_hash_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'is_verified': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'related_name': "'emails'", 'to': "orm['sentry.User']"}),
+ 'validation_hash': ('django.db.models.fields.CharField', [], {'default': "u'UYIMzBc8dKhIIIImByyNoS4jz3sFSsv7'", 'max_length': '32'})
+ },
+ 'sentry.userip': {
+ 'Meta': {'unique_together': "(('user', 'ip_address'),)", 'object_name': 'UserIP'},
+ 'country_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True'}),
+ 'first_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'ip_address': ('django.db.models.fields.GenericIPAddressField', [], {'max_length': '39'}),
+ 'last_seen': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'region_code': ('django.db.models.fields.CharField', [], {'max_length': '16', 'null': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.useroption': {
+ 'Meta': {'unique_together': "(('user', 'project', 'key'), ('user', 'organization', 'key'))", 'object_name': 'UserOption'},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'key': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
+ 'organization': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Organization']", 'null': 'True'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']", 'null': 'True'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"}),
+ 'value': ('sentry.db.models.fields.encrypted.EncryptedPickledObjectField', [], {})
+ },
+ 'sentry.userpermission': {
+ 'Meta': {'unique_together': "(('user', 'permission'),)", 'object_name': 'UserPermission'},
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'permission': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'user': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.User']"})
+ },
+ 'sentry.userreport': {
+ 'Meta': {'unique_together': "(('project', 'event_id'),)", 'object_name': 'UserReport', 'index_together': "(('project', 'event_id'), ('project', 'date_added'))"},
+ 'comments': ('django.db.models.fields.TextField', [], {}),
+ 'date_added': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
+ 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+ 'environment': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Environment']", 'null': 'True'}),
+ 'event_id': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
+ 'event_user_id': ('sentry.db.models.fields.bounded.BoundedBigIntegerField', [], {'null': 'True'}),
+ 'group': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Group']", 'null': 'True'}),
+ 'id': ('sentry.db.models.fields.bounded.BoundedBigAutoField', [], {'primary_key': 'True'}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
+ 'project': ('sentry.db.models.fields.foreignkey.FlexibleForeignKey', [], {'to': "orm['sentry.Project']"})
+ }
+ }
+
+ complete_apps = ['sentry']
|
3e307ca0d38a686598182556aa1136ebd8eeee17
|
2020-04-27 14:28:57
|
Markus Unterwaditzer
|
ref: Remove outcomes consumer (#18440)
| false
|
Remove outcomes consumer (#18440)
|
ref
|
diff --git a/src/sentry/ingest/outcomes_consumer.py b/src/sentry/ingest/outcomes_consumer.py
deleted file mode 100644
index f7168a1e66eec4..00000000000000
--- a/src/sentry/ingest/outcomes_consumer.py
+++ /dev/null
@@ -1,150 +0,0 @@
-"""
-The OutcomeConsumer is a task that runs a loop in which it reads outcome messages coming on a kafka queue and
-processes them.
-
-Long Story: Event outcomes are placed on the same Kafka event queue by both Sentry and Relay.
-When Sentry generates an outcome for a message it also sends a signal ( a Django signal) that
-is used by getSentry for internal accounting.
-
-Relay (running as a Rust process) cannot send django signals so in order to get outcome signals sent from
-Relay into getSentry we have this outcome consumers which listens to all outcomes in the kafka queue and
-for outcomes that were sent from Relay sends the signals to getSentry.
-
-In conclusion the OutcomeConsumer listens on the the outcomes kafka topic, filters the outcomes by dropping
-the outcomes that originate from sentry and keeping the outcomes originating in relay and sends
-signals to getSentry for these outcomes.
-
-"""
-from __future__ import absolute_import
-
-import time
-import atexit
-import logging
-import multiprocessing.dummy
-import multiprocessing as _multiprocessing
-
-from sentry.utils.batching_kafka_consumer import AbstractBatchWorker
-
-from django.conf import settings
-
-from sentry.constants import DataCategory
-from sentry.models.project import Project
-from sentry.db.models.manager import BaseManager
-from sentry.signals import event_filtered, event_discarded, event_dropped, event_saved
-from sentry.utils.kafka import create_batching_kafka_consumer
-from sentry.utils import json, metrics
-from sentry.utils.data_filters import FilterStatKeys
-from sentry.utils.dates import to_datetime, parse_timestamp
-from sentry.utils.outcomes import Outcome
-from sentry.buffer.redis import batch_buffers_incr
-
-logger = logging.getLogger(__name__)
-
-
-def _get_signal_cache_key(project_id, event_id):
- return "signal:{}:{}".format(project_id, event_id)
-
-
-def _process_signal(msg):
- project_id = int(msg.get("project_id") or 0)
- if project_id == 0:
- metrics.incr("outcomes_consumer.skip_outcome", tags={"reason": "project_zero"})
- return # no project. this is valid, so ignore silently.
-
- outcome = int(msg.get("outcome", -1))
- if outcome not in (Outcome.ACCEPTED, Outcome.FILTERED, Outcome.RATE_LIMITED):
- metrics.incr("outcomes_consumer.skip_outcome", tags={"reason": "wrong_outcome_type"})
- return # nothing to do here
-
- event_id = msg.get("event_id")
- if not event_id:
- metrics.incr("outcomes_consumer.skip_outcome", tags={"reason": "missing_event_id"})
- return
-
- try:
- project = Project.objects.get_from_cache(id=project_id)
- except Project.DoesNotExist:
- metrics.incr("outcomes_consumer.skip_outcome", tags={"reason": "unknown_project"})
- logger.error("OutcomesConsumer could not find project with id: %s", project_id)
- return
-
- reason = msg.get("reason")
- remote_addr = msg.get("remote_addr")
- quantity = msg.get("quantity")
-
- category = msg.get("category")
- if category is not None:
- category = DataCategory(category)
-
- if outcome == Outcome.ACCEPTED:
- event_saved.send_robust(
- project=project, category=category, quantity=quantity, sender=OutcomesConsumerWorker
- )
- elif outcome == Outcome.FILTERED and reason == FilterStatKeys.DISCARDED_HASH:
- event_discarded.send_robust(
- project=project, category=category, quantity=quantity, sender=OutcomesConsumerWorker
- )
- elif outcome == Outcome.FILTERED:
- event_filtered.send_robust(
- ip=remote_addr,
- project=project,
- category=category,
- quantity=quantity,
- sender=OutcomesConsumerWorker,
- )
- elif outcome == Outcome.RATE_LIMITED:
- event_dropped.send_robust(
- ip=remote_addr,
- project=project,
- reason_code=reason,
- category=category,
- quantity=quantity,
- sender=OutcomesConsumerWorker,
- )
-
- timestamp = msg.get("timestamp")
- if timestamp is not None:
- delta = to_datetime(time.time()) - parse_timestamp(timestamp)
- metrics.timing("outcomes_consumer.timestamp_lag", delta.total_seconds())
-
- metrics.incr("outcomes_consumer.signal_sent", tags={"reason": reason, "outcome": outcome})
-
-
-def _process_signal_with_timer(message):
- with metrics.timer("outcomes_consumer.process_signal"):
- return _process_signal(message)
-
-
-class OutcomesConsumerWorker(AbstractBatchWorker):
- def __init__(self, concurrency):
- self.pool = _multiprocessing.dummy.Pool(concurrency)
- atexit.register(self.pool.close)
-
- def process_message(self, message):
- return json.loads(message.value())
-
- def flush_batch(self, batch):
- batch.sort(key=lambda msg: msg.get("project_id", 0) or 0)
-
- with metrics.timer("outcomes_consumer.process_signal_batch"):
- with batch_buffers_incr():
- with BaseManager.local_cache():
- for _ in self.pool.imap_unordered(
- _process_signal_with_timer, batch, chunksize=100
- ):
- pass
-
- def shutdown(self):
- pass
-
-
-def get_outcomes_consumer(concurrency=None, **options):
- """
- Handles outcome requests coming via a kafka queue from Relay.
- """
-
- return create_batching_kafka_consumer(
- topic_names=[settings.KAFKA_OUTCOMES],
- worker=OutcomesConsumerWorker(concurrency=concurrency),
- **options
- )
diff --git a/src/sentry/runner/commands/run.py b/src/sentry/runner/commands/run.py
index 339a2a3d356aac..32a5cc968ab6e3 100644
--- a/src/sentry/runner/commands/run.py
+++ b/src/sentry/runner/commands/run.py
@@ -459,25 +459,3 @@ def ingest_consumer(consumer_types, all_consumer_types, **options):
ingest_consumer_types=",".join(sorted(consumer_types)), _all_threads=True
):
get_ingest_consumer(consumer_types=consumer_types, **options).run()
-
-
[email protected]("outcomes-consumer")
-@log_options()
-@batching_kafka_options("outcomes-consumer")
[email protected](
- "--concurrency",
- type=int,
- default=1,
- help="Spawn this many threads to process outcomes. Defaults to 1.",
-)
-@configuration
-def outcome_consumer(**options):
- """
- Runs an "outcomes consumer" task.
-
- The "outcomes consumer" tasks read outcomes from a kafka topic and sends
- signals for some of them.
- """
- from sentry.ingest.outcomes_consumer import get_outcomes_consumer
-
- get_outcomes_consumer(**options).run()
diff --git a/src/sentry/signals.py b/src/sentry/signals.py
index f55494c353185a..41e899c994a8e0 100644
--- a/src/sentry/signals.py
+++ b/src/sentry/signals.py
@@ -52,14 +52,8 @@ def send_robust(self, sender, **named):
buffer_incr_complete = BetterSignal(providing_args=["model", "columns", "extra", "result"])
-event_discarded = BetterSignal(providing_args=["project", "category", "quantity"])
-event_dropped = BetterSignal(
- providing_args=["ip", "data", "project", "reason_code", "category", "quantity"]
-)
-event_filtered = BetterSignal(providing_args=["ip", "project", "category", "quantity"])
pending_delete = BetterSignal(providing_args=["instance", "actor"])
event_processed = BetterSignal(providing_args=["project", "event"])
-event_saved = BetterSignal(providing_args=["project", "category", "quantity"])
# DEPRECATED
event_received = BetterSignal(providing_args=["ip", "project"])
diff --git a/src/sentry/utils/sdk.py b/src/sentry/utils/sdk.py
index e062ef291e684e..4e3d1e5fd0fe2c 100644
--- a/src/sentry/utils/sdk.py
+++ b/src/sentry/utils/sdk.py
@@ -20,7 +20,8 @@
"sentry/event_manager.py",
"sentry/tasks/process_buffer.py",
"sentry/ingest/ingest_consumer.py",
- "sentry/ingest/outcomes_consumer.py",
+ # This consumer lives outside of sentry but is just as unsafe.
+ "outcomes_consumer.py",
)
# Reexport sentry_sdk just in case we ever have to write another shim like we
diff --git a/tests/sentry/ingest/test_outcomes_consumer.py b/tests/sentry/ingest/test_outcomes_consumer.py
deleted file mode 100644
index cc90bd1435f17a..00000000000000
--- a/tests/sentry/ingest/test_outcomes_consumer.py
+++ /dev/null
@@ -1,238 +0,0 @@
-from __future__ import absolute_import
-
-import logging
-import pytest
-import six
-
-from sentry.ingest.outcomes_consumer import get_outcomes_consumer
-from sentry.signals import event_filtered, event_discarded, event_dropped, event_saved
-from sentry.testutils.factories import Factories
-from sentry.utils.outcomes import Outcome
-from django.conf import settings
-from sentry.utils import json
-from sentry.utils.json import prune_empty_keys
-from sentry.utils.data_filters import FilterStatKeys
-
-
-logger = logging.getLogger(__name__)
-
-# Poll this amount of times (for 0.1 sec each) at most to wait for messages
-MAX_POLL_ITERATIONS = 50
-
-group_counter = 0
-
-
-def _get_next_group_id():
- """
- Returns a unique kafka consumer group identifier, which is required to get
- tests passing.
- """
- global group_counter
- group_counter += 1
- return "test-outcome-consumer-%s" % group_counter
-
-
-def _get_event_id(base_event_id):
- return "{:032}".format(int(base_event_id))
-
-
-class OutcomeTester(object):
- def __init__(self, kafka_producer, kafka_admin, task_runner):
- self.events_filtered = []
- self.events_discarded = []
- self.events_dropped = []
- self.events_saved = []
-
- event_filtered.connect(self._event_filtered_receiver)
- event_discarded.connect(self._event_discarded_receiver)
- event_dropped.connect(self._event_dropped_receiver)
- event_saved.connect(self._event_saved_receiver)
-
- self.task_runner = task_runner
- self.topic_name = settings.KAFKA_OUTCOMES
- self.organization = Factories.create_organization()
- self.project = Factories.create_project(organization=self.organization)
-
- self.producer = self._create_producer(kafka_producer, kafka_admin)
-
- def track_outcome(
- self,
- event_id=None,
- key_id=None,
- outcome=None,
- reason=None,
- remote_addr=None,
- timestamp=None,
- ):
- message = {
- "project_id": self.project.id,
- "org_id": self.organization.id,
- "event_id": event_id,
- "key_id": key_id,
- "outcome": outcome,
- "reason": reason,
- "remote_addr": remote_addr,
- "timestamp": timestamp,
- }
-
- message = json.dumps(prune_empty_keys(message))
- self.producer.produce(self.topic_name, message)
-
- def run(self, predicate=None):
- if predicate is None:
- predicate = lambda: True
-
- consumer = get_outcomes_consumer(
- max_batch_size=1,
- max_batch_time=100,
- group_id=_get_next_group_id(),
- auto_offset_reset="earliest",
- )
-
- with self.task_runner():
- i = 0
- while predicate() and i < MAX_POLL_ITERATIONS:
- consumer._run_once()
- i += 1
-
- # Verify that we consumed everything and didn't time out
- # assert not predicate()
- assert i < MAX_POLL_ITERATIONS
-
- def _event_filtered_receiver(self, **kwargs):
- self.events_filtered.append(kwargs)
-
- def _event_discarded_receiver(self, **kwargs):
- self.events_discarded.append(kwargs)
-
- def _event_dropped_receiver(self, **kwargs):
- self.events_dropped.append(kwargs)
-
- def _event_saved_receiver(self, **kwargs):
- self.events_saved.append(kwargs)
-
- def _create_producer(self, kafka_producer, kafka_admin):
- # Clear the topic to ensure we run in a pristine environment
- admin = kafka_admin(settings)
- admin.delete_topic(self.topic_name)
-
- producer = kafka_producer(settings)
- return producer
-
-
[email protected]
-def outcome_tester(requires_kafka, kafka_producer, kafka_admin, task_runner):
- return OutcomeTester(kafka_producer, kafka_admin, task_runner)
-
-
[email protected]_db
-def test_outcome_consumer_ignores_invalid_outcomes(outcome_tester):
- # Add two FILTERED items so we know when the producer has reached the end
- for i in range(4):
- outcome_tester.track_outcome(
- event_id=_get_event_id(i),
- outcome=Outcome.INVALID if i < 2 else Outcome.FILTERED,
- reason="some_reason",
- remote_addr="127.33.44.{}".format(i),
- )
-
- outcome_tester.run(lambda: len(outcome_tester.events_filtered) < 2)
-
- # verify that the appropriate filters were called
- ips = [outcome["ip"] for outcome in outcome_tester.events_filtered]
- assert ips == ["127.33.44.2", "127.33.44.3"]
- assert not outcome_tester.events_dropped
- assert not outcome_tester.events_saved
-
-
[email protected]_db
-def test_outcome_consumer_remembers_handled_outcomes(outcome_tester):
- for i in six.moves.range(1, 3):
- # emit the same outcome twice (simulate the case when the producer goes
- # down without committing the kafka offsets and is restarted)
- outcome_tester.track_outcome(
- event_id=_get_event_id(i),
- outcome=Outcome.FILTERED,
- reason="some_reason",
- remote_addr="127.33.44.{}".format(1),
- )
-
- outcome_tester.run(lambda: len(outcome_tester.events_filtered) < 1)
-
- ips = [outcome["ip"] for outcome in outcome_tester.events_filtered]
- assert ips == ["127.33.44.1"] # only once!
- assert not outcome_tester.events_dropped
- assert not outcome_tester.events_saved
-
-
[email protected]_db
-def test_outcome_consumer_handles_filtered_outcomes(outcome_tester):
- for i in six.moves.range(1, 3):
- outcome_tester.track_outcome(
- event_id=_get_event_id(i),
- outcome=Outcome.FILTERED,
- reason="some_reason",
- remote_addr="127.33.44.{}".format(i),
- )
-
- outcome_tester.run(lambda: len(outcome_tester.events_filtered) < 2)
-
- # verify that the appropriate filters were called
- ips = [outcome["ip"] for outcome in outcome_tester.events_filtered]
- assert len(ips) == 2
- assert set(ips) == set(["127.33.44.1", "127.33.44.2"])
- assert not outcome_tester.events_dropped
- assert not outcome_tester.events_saved
-
-
[email protected]_db
-def test_outcome_consumer_handles_rate_limited_outcomes(outcome_tester):
- for i in six.moves.range(1, 3):
- outcome_tester.track_outcome(
- event_id=_get_event_id(i),
- outcome=Outcome.RATE_LIMITED,
- reason="reason_{}".format(i),
- remote_addr="127.33.44.{}".format(i),
- )
-
- outcome_tester.run(lambda: len(outcome_tester.events_dropped) < 2)
-
- assert not outcome_tester.events_filtered
- tuples = [(o["ip"], o["reason_code"]) for o in outcome_tester.events_dropped]
- assert set(tuples) == set([("127.33.44.1", "reason_1"), ("127.33.44.2", "reason_2")])
-
-
[email protected]_db
-def test_outcome_consumer_handles_accepted_outcomes(outcome_tester):
- for i in six.moves.range(1, 3):
- outcome_tester.track_outcome(
- event_id=_get_event_id(i),
- outcome=Outcome.ACCEPTED,
- remote_addr="127.33.44.{}".format(i),
- )
-
- outcome_tester.run(lambda: len(outcome_tester.events_saved) < 2)
-
- assert not outcome_tester.events_filtered
- assert len(outcome_tester.events_saved) == 2
-
-
[email protected]_db
-def test_outcome_consumer_handles_discarded_outcomes(outcome_tester):
- for i in six.moves.range(4):
- if i < 2:
- reason = "something_else"
- else:
- reason = FilterStatKeys.DISCARDED_HASH
-
- outcome_tester.track_outcome(
- event_id=_get_event_id(i),
- outcome=Outcome.FILTERED,
- reason=reason,
- remote_addr="127.33.44.{}".format(i),
- )
-
- outcome_tester.run(lambda: len(outcome_tester.events_discarded) < 2)
-
- assert len(outcome_tester.events_filtered) == 2
- assert len(outcome_tester.events_discarded) == 2
|
90aae1c6e2b3b9ef7a5f6efe2757ab8498fa78f5
|
2018-04-17 04:09:30
|
David Cramer
|
fix(api): Up broadcast message length to 256
| false
|
Up broadcast message length to 256
|
fix
|
diff --git a/src/sentry/api/validators/broadcast.py b/src/sentry/api/validators/broadcast.py
index 6a10596e7d3798..3de35e277eec87 100644
--- a/src/sentry/api/validators/broadcast.py
+++ b/src/sentry/api/validators/broadcast.py
@@ -9,7 +9,7 @@ class BroadcastValidator(serializers.Serializer):
class AdminBroadcastValidator(BroadcastValidator):
title = serializers.CharField(max_length=32, required=True)
- message = serializers.CharField(max_length=32, required=True)
+ message = serializers.CharField(max_length=256, required=True)
link = serializers.URLField(required=True)
isActive = serializers.BooleanField(required=False)
dateExpires = serializers.DateTimeField(required=False)
|
162b88d0a3d2f616cb2adace9d730ea895365d4f
|
2019-06-06 22:28:59
|
Lyn Nagara
|
feat(events-v2): Respect project and environment filter on events page (#13562)
| false
|
Respect project and environment filter on events page (#13562)
|
feat
|
diff --git a/src/sentry/static/sentry/app/views/organizationEventsV2/utils.jsx b/src/sentry/static/sentry/app/views/organizationEventsV2/utils.jsx
index ae6c3710252232..ead6c4f1aee9fa 100644
--- a/src/sentry/static/sentry/app/views/organizationEventsV2/utils.jsx
+++ b/src/sentry/static/sentry/app/views/organizationEventsV2/utils.jsx
@@ -40,6 +40,8 @@ export function getQuery(view, location) {
});
const data = pick(location.query, [
+ 'project',
+ 'environment',
'start',
'end',
'utc',
|
c4f2a000e06fd5b8ab7376c5966c938a7e6c877b
|
2024-04-16 01:32:34
|
George Gritsouk
|
fix(perf): Link Response module domains to a specific project (#68905)
| false
|
Link Response module domains to a specific project (#68905)
|
fix
|
diff --git a/static/app/views/performance/http/domainCell.tsx b/static/app/views/performance/http/domainCell.tsx
index 2ab730759dfcf1..af31ca3fd1db1a 100644
--- a/static/app/views/performance/http/domainCell.tsx
+++ b/static/app/views/performance/http/domainCell.tsx
@@ -25,6 +25,7 @@ export function DomainCell({projectId, domain}: Props) {
const queryString = {
...location.query,
+ project: projectId,
'span.domain': undefined,
domain,
};
|
7e37686fd6742ec9008c576c89e0635fe84484c5
|
2022-09-28 20:44:05
|
William Mak
|
chore(discover): Update the interval badge to new (#39406)
| false
|
Update the interval badge to new (#39406)
|
chore
|
diff --git a/static/app/views/eventsV2/chartFooter.tsx b/static/app/views/eventsV2/chartFooter.tsx
index b927634f969100..778bc37f0ac2ad 100644
--- a/static/app/views/eventsV2/chartFooter.tsx
+++ b/static/app/views/eventsV2/chartFooter.tsx
@@ -138,7 +138,7 @@ export default function ChartFooter({
eventView={eventView}
onIntervalChange={onIntervalChange}
/>
- <IntervalBadge type="beta" />
+ <FeatureBadge type="new" space={0} />
</Feature>
<OptionSelector
title={t('Display')}
@@ -183,7 +183,3 @@ const SwitchLabel = styled('div')`
padding-right: 4px;
font-weight: bold;
`;
-
-const IntervalBadge = styled(FeatureBadge)`
- margin-left: 0px;
-`;
|
016775591af11435210d7a778c222b33ad8b8604
|
2022-02-02 21:07:50
|
Priscila Oliveira
|
ref(native-stack-trace-v2): Add native stack trace new content design (#31320)
| false
|
Add native stack trace new content design (#31320)
|
ref
|
diff --git a/static/app/components/events/interfaces/crashContent/exception/stackTrace.tsx b/static/app/components/events/interfaces/crashContent/exception/stackTrace.tsx
index ab9ea2290d9a58..a325551113a66a 100644
--- a/static/app/components/events/interfaces/crashContent/exception/stackTrace.tsx
+++ b/static/app/components/events/interfaces/crashContent/exception/stackTrace.tsx
@@ -5,6 +5,7 @@ import {ExceptionValue, Group, Organization, PlatformType} from 'sentry/types';
import {Event} from 'sentry/types/event';
import {STACK_VIEW} from 'sentry/types/stacktrace';
import {defined} from 'sentry/utils';
+import {isNativePlatform} from 'sentry/utils/platform';
import useOrganization from 'sentry/utils/useOrganization';
import EmptyMessage from 'sentry/views/settings/components/emptyMessage';
@@ -58,7 +59,7 @@ function StackTrace({
return (
<Panel dashedBorder>
<EmptyMessage
- icon={<IconWarning size="xs" />}
+ icon={<IconWarning size="xl" />}
title={
hasHierarchicalGrouping
? t('No relevant stack trace has been found!')
@@ -86,7 +87,10 @@ function StackTrace({
* It is easier to fix the UI logic to show a non-empty stack trace for chained exceptions
*/
- if (!!organization?.features?.includes('native-stack-trace-v2')) {
+ if (
+ !!organization?.features?.includes('native-stack-trace-v2') &&
+ isNativePlatform(platform)
+ ) {
return (
<StacktraceContentV3
data={data}
diff --git a/static/app/components/events/interfaces/crashContent/stackTrace/contentV3.tsx b/static/app/components/events/interfaces/crashContent/stackTrace/contentV3.tsx
index 89411d390c87ac..315205af1f05c4 100644
--- a/static/app/components/events/interfaces/crashContent/stackTrace/contentV3.tsx
+++ b/static/app/components/events/interfaces/crashContent/stackTrace/contentV3.tsx
@@ -1,15 +1,13 @@
import {cloneElement, Fragment, useState} from 'react';
import styled from '@emotion/styled';
-import List from 'sentry/components/list';
-import ListItem from 'sentry/components/list/listItem';
+import {Panel} from 'sentry/components/panels';
import {t} from 'sentry/locale';
-import space from 'sentry/styles/space';
import {Frame, Group, PlatformType} from 'sentry/types';
import {Event} from 'sentry/types/event';
import {StacktraceType} from 'sentry/types/stacktrace';
-import Line from '../../frame/lineV2';
+import NativeFrame from '../../nativeFrame';
import {getImageRange, parseAddress} from '../../utils';
type Props = {
@@ -18,18 +16,16 @@ type Props = {
event: Event;
groupingCurrentLevel?: Group['metadata']['current_level'];
newestFirst?: boolean;
- className?: string;
isHoverPreviewed?: boolean;
includeSystemFrames?: boolean;
expandFirstFrame?: boolean;
};
-function StackTraceContent({
+function Content({
data,
platform,
event,
newestFirst,
- className,
isHoverPreviewed,
groupingCurrentLevel,
includeSystemFrames = true,
@@ -62,20 +58,6 @@ function StackTraceContent({
return image;
}
- function getClassName() {
- const classes = ['traceback'];
-
- if (className) {
- classes.push(className);
- }
-
- if (includeSystemFrames) {
- return [...classes, 'full-traceback'].join(' ');
- }
-
- return [...classes, 'in-app-traceback'].join(' ');
- }
-
function isFrameUsedForGrouping(frame: Frame) {
const {minGroupingLevel} = frame;
@@ -112,161 +94,151 @@ function StackTraceContent({
}
function renderOmittedFrames(firstFrameOmitted: any, lastFrameOmitted: any) {
- return (
- <ListItem className="frame frames-omitted">
- {t(
- 'Frames %d until %d were omitted and not available.',
- firstFrameOmitted,
- lastFrameOmitted
- )}
- </ListItem>
+ return t(
+ 'Frames %d until %d were omitted and not available.',
+ firstFrameOmitted,
+ lastFrameOmitted
);
}
- function renderConvertedFrames() {
- const firstFrameOmitted = framesOmitted?.[0] ?? null;
- const lastFrameOmitted = framesOmitted?.[1] ?? null;
- const lastFrameIndex = getLastFrameIndex();
-
- let nRepeats = 0;
-
- const maxLengthOfAllRelativeAddresses = frames.reduce(
- (maxLengthUntilThisPoint, frame) => {
- const correspondingImage = findImageForAddress(
- frame.instructionAddr,
- frame.addrMode
- );
-
- try {
- const relativeAddress = (
- parseAddress(frame.instructionAddr) -
- parseAddress(correspondingImage.image_addr)
- ).toString(16);
-
- return maxLengthUntilThisPoint > relativeAddress.length
- ? maxLengthUntilThisPoint
- : relativeAddress.length;
- } catch {
- return maxLengthUntilThisPoint;
- }
- },
- 0
- );
-
- const convertedFrames = frames
- .map((frame, frameIndex) => {
- const prevFrame = frames[frameIndex - 1];
- const nextFrame = frames[frameIndex + 1];
-
- const repeatedFrame =
- nextFrame &&
- frame.lineNo === nextFrame.lineNo &&
- frame.instructionAddr === nextFrame.instructionAddr &&
- frame.package === nextFrame.package &&
- frame.module === nextFrame.module &&
- frame.function === nextFrame.function;
-
- if (repeatedFrame) {
- nRepeats++;
- }
-
- const isUsedForGrouping = isFrameUsedForGrouping(frame);
-
- const isVisible =
- includeSystemFrames ||
- frame.inApp ||
- (nextFrame && nextFrame.inApp) ||
- // the last non-app frame
- (!frame.inApp && !nextFrame) ||
- isUsedForGrouping;
-
- if (isVisible && !repeatedFrame) {
- const lineProps = {
- event,
- frame,
- prevFrame,
- nextFrame,
- isExpanded: expandFirstFrame && lastFrameIndex === frameIndex,
- emptySourceNotation: lastFrameIndex === frameIndex && frameIndex === 0,
- platform,
- timesRepeated: nRepeats,
- showingAbsoluteAddress: showingAbsoluteAddresses,
- onAddressToggle: handleToggleAddresses,
- image: findImageForAddress(frame.instructionAddr, frame.addrMode),
- maxLengthOfRelativeAddress: maxLengthOfAllRelativeAddresses,
- registers: {},
- includeSystemFrames,
- onFunctionNameToggle: handleToggleFunctionName,
- showCompleteFunctionName,
- isHoverPreviewed,
- isUsedForGrouping,
- };
-
- nRepeats = 0;
-
- if (frameIndex === firstFrameOmitted) {
- return (
- <Fragment key={frameIndex}>
- <Line {...lineProps} nativeV2 />
- {renderOmittedFrames(firstFrameOmitted, lastFrameOmitted)}
- </Fragment>
- );
- }
-
- return <Line key={frameIndex} nativeV2 {...lineProps} />;
- }
+ const firstFrameOmitted = framesOmitted?.[0] ?? null;
+ const lastFrameOmitted = framesOmitted?.[1] ?? null;
+ const lastFrameIndex = getLastFrameIndex();
+
+ let nRepeats = 0;
+
+ const maxLengthOfAllRelativeAddresses = frames.reduce(
+ (maxLengthUntilThisPoint, frame) => {
+ const correspondingImage = findImageForAddress(
+ frame.instructionAddr,
+ frame.addrMode
+ );
+
+ try {
+ const relativeAddress = (
+ parseAddress(frame.instructionAddr) -
+ parseAddress(correspondingImage.image_addr)
+ ).toString(16);
+
+ return maxLengthUntilThisPoint > relativeAddress.length
+ ? maxLengthUntilThisPoint
+ : relativeAddress.length;
+ } catch {
+ return maxLengthUntilThisPoint;
+ }
+ },
+ 0
+ );
- if (!repeatedFrame) {
- nRepeats = 0;
- }
+ const convertedFrames = frames
+ .map((frame, frameIndex) => {
+ const prevFrame = frames[frameIndex - 1];
+ const nextFrame = frames[frameIndex + 1];
+
+ const repeatedFrame =
+ nextFrame &&
+ frame.lineNo === nextFrame.lineNo &&
+ frame.instructionAddr === nextFrame.instructionAddr &&
+ frame.package === nextFrame.package &&
+ frame.module === nextFrame.module &&
+ frame.function === nextFrame.function;
+
+ if (repeatedFrame) {
+ nRepeats++;
+ }
- if (frameIndex !== firstFrameOmitted) {
- return null;
+ const isUsedForGrouping = isFrameUsedForGrouping(frame);
+
+ const isVisible =
+ includeSystemFrames ||
+ frame.inApp ||
+ (nextFrame && nextFrame.inApp) ||
+ // the last non-app frame
+ (!frame.inApp && !nextFrame) ||
+ isUsedForGrouping;
+
+ if (isVisible && !repeatedFrame) {
+ const frameProps = {
+ event,
+ frame,
+ prevFrame,
+ nextFrame,
+ isExpanded: expandFirstFrame && lastFrameIndex === frameIndex,
+ emptySourceNotation: lastFrameIndex === frameIndex && frameIndex === 0,
+ platform,
+ timesRepeated: nRepeats,
+ showingAbsoluteAddress: showingAbsoluteAddresses,
+ onAddressToggle: handleToggleAddresses,
+ image: findImageForAddress(frame.instructionAddr, frame.addrMode),
+ maxLengthOfRelativeAddress: maxLengthOfAllRelativeAddresses,
+ registers: {},
+ includeSystemFrames,
+ onFunctionNameToggle: handleToggleFunctionName,
+ showCompleteFunctionName,
+ isHoverPreviewed,
+ isUsedForGrouping,
+ };
+
+ nRepeats = 0;
+
+ if (frameIndex === firstFrameOmitted) {
+ return (
+ <Fragment key={frameIndex}>
+ <NativeFrame {...frameProps} />
+ {renderOmittedFrames(firstFrameOmitted, lastFrameOmitted)}
+ </Fragment>
+ );
}
- return renderOmittedFrames(firstFrameOmitted, lastFrameOmitted);
- })
- .filter(frame => !!frame) as React.ReactElement[];
+ return <NativeFrame key={frameIndex} {...frameProps} />;
+ }
- if (convertedFrames.length > 0 && registers) {
- const lastFrame = convertedFrames.length - 1;
- convertedFrames[lastFrame] = cloneElement(convertedFrames[lastFrame], {
- registers,
- });
+ if (!repeatedFrame) {
+ nRepeats = 0;
+ }
- if (!newestFirst) {
- return convertedFrames;
+ if (frameIndex !== firstFrameOmitted) {
+ return null;
}
- return [...convertedFrames].reverse();
- }
+ return renderOmittedFrames(firstFrameOmitted, lastFrameOmitted);
+ })
+ .filter(frame => !!frame) as React.ReactElement[];
- if (!newestFirst) {
- return convertedFrames;
- }
+ if (convertedFrames.length > 0 && registers) {
+ const lastFrame = convertedFrames.length - 1;
+ convertedFrames[lastFrame] = cloneElement(convertedFrames[lastFrame], {
+ registers,
+ });
- return [...convertedFrames].reverse();
+ return (
+ <Wrapper isHoverPreviewed={isHoverPreviewed} data-test-id="stack-trace">
+ {!newestFirst ? convertedFrames : [...convertedFrames].reverse()}
+ </Wrapper>
+ );
}
return (
- <StyledList className={getClassName()} data-test-id="stack-trace">
- {renderConvertedFrames()}
- </StyledList>
+ <Wrapper isHoverPreviewed={isHoverPreviewed} data-test-id="stack-trace">
+ {!newestFirst ? convertedFrames : [...convertedFrames].reverse()}
+ </Wrapper>
);
}
-export default StackTraceContent;
+export default Content;
-const StyledList = styled(List)`
- gap: 0;
- position: relative;
+const Wrapper = styled(Panel)<{isHoverPreviewed?: boolean}>`
+ display: grid;
overflow: hidden;
- z-index: 1;
- box-shadow: ${p => p.theme.dropShadowLight};
-
- && {
- border-radius: ${p => p.theme.borderRadius};
- border: 1px solid ${p => p.theme.gray200};
- margin-bottom: ${space(3)};
- }
+ font-size: ${p => p.theme.fontSizeSmall};
+ line-height: 16px;
+ color: ${p => p.theme.gray500};
+ ${p =>
+ p.isHoverPreviewed &&
+ `
+ border: 0;
+ border-radius: 0;
+ box-shadow: none;
+ margin-bottom: 0;
+ `}
`;
diff --git a/static/app/components/events/interfaces/crashContent/stackTrace/index.tsx b/static/app/components/events/interfaces/crashContent/stackTrace/index.tsx
index 41890ec915ffb6..ca869609ad6bbd 100644
--- a/static/app/components/events/interfaces/crashContent/stackTrace/index.tsx
+++ b/static/app/components/events/interfaces/crashContent/stackTrace/index.tsx
@@ -2,6 +2,7 @@ import ErrorBoundary from 'sentry/components/errorBoundary';
import {PlatformType} from 'sentry/types';
import {Event} from 'sentry/types/event';
import {STACK_VIEW, StacktraceType} from 'sentry/types/stacktrace';
+import {isNativePlatform} from 'sentry/utils/platform';
import Content from './content';
import ContentV2 from './contentV2';
@@ -28,23 +29,34 @@ function StackTrace({
groupingCurrentLevel,
nativeV2,
}: Props) {
- return (
- <ErrorBoundary mini>
- {stackView === STACK_VIEW.RAW ? (
+ if (stackView === STACK_VIEW.RAW) {
+ return (
+ <ErrorBoundary mini>
<pre className="traceback plain">
{rawStacktraceContent(stacktrace, event.platform)}
</pre>
- ) : nativeV2 ? (
+ </ErrorBoundary>
+ );
+ }
+
+ if (nativeV2 && isNativePlatform(platform)) {
+ return (
+ <ErrorBoundary mini>
<ContentV3
data={stacktrace}
- className="no-exception"
includeSystemFrames={stackView === STACK_VIEW.FULL}
platform={platform}
event={event}
newestFirst={newestFirst}
groupingCurrentLevel={groupingCurrentLevel}
/>
- ) : hasHierarchicalGrouping ? (
+ </ErrorBoundary>
+ );
+ }
+
+ if (hasHierarchicalGrouping) {
+ return (
+ <ErrorBoundary mini>
<ContentV2
data={stacktrace}
className="no-exception"
@@ -54,16 +66,20 @@ function StackTrace({
newestFirst={newestFirst}
groupingCurrentLevel={groupingCurrentLevel}
/>
- ) : (
- <Content
- data={stacktrace}
- className="no-exception"
- includeSystemFrames={stackView === STACK_VIEW.FULL}
- platform={platform}
- event={event}
- newestFirst={newestFirst}
- />
- )}
+ </ErrorBoundary>
+ );
+ }
+
+ return (
+ <ErrorBoundary mini>
+ <Content
+ data={stacktrace}
+ className="no-exception"
+ includeSystemFrames={stackView === STACK_VIEW.FULL}
+ platform={platform}
+ event={event}
+ newestFirst={newestFirst}
+ />
</ErrorBoundary>
);
}
diff --git a/static/app/components/events/interfaces/defaultFrame.tsx b/static/app/components/events/interfaces/defaultFrame.tsx
new file mode 100644
index 00000000000000..e69de29bb2d1d6
diff --git a/static/app/components/events/interfaces/frame/context.tsx b/static/app/components/events/interfaces/frame/context.tsx
index 445f1ee9306090..58932527233f02 100644
--- a/static/app/components/events/interfaces/frame/context.tsx
+++ b/static/app/components/events/interfaces/frame/context.tsx
@@ -32,6 +32,7 @@ type Props = {
emptySourceNotation?: boolean;
hasAssembly?: boolean;
expandable?: boolean;
+ className?: string;
};
const Context = ({
@@ -47,6 +48,7 @@ const Context = ({
frame,
event,
organization,
+ className,
}: Props) => {
if (!hasContextSource && !hasContextVars && !hasContextRegisters && !hasAssembly) {
return emptySourceNotation ? (
@@ -69,7 +71,10 @@ const Context = ({
const startLineNo = hasContextSource ? frame.context[0][0] : undefined;
return (
- <ol start={startLineNo} className={`context ${isExpanded ? 'expanded' : ''}`}>
+ <ol
+ start={startLineNo}
+ className={`${className} context ${isExpanded ? 'expanded' : ''}`}
+ >
{defined(frame.errors) && (
<li className={expandable ? 'expandable error' : 'error'} key="errors">
{frame.errors.join(', ')}
diff --git a/static/app/components/events/interfaces/nativeFrame.tsx b/static/app/components/events/interfaces/nativeFrame.tsx
new file mode 100644
index 00000000000000..2e02575115f30a
--- /dev/null
+++ b/static/app/components/events/interfaces/nativeFrame.tsx
@@ -0,0 +1,482 @@
+import {Fragment, MouseEvent, useContext, useState} from 'react';
+import {css} from '@emotion/react';
+import styled from '@emotion/styled';
+import scrollToElement from 'scroll-to-element';
+
+import Button from 'sentry/components/button';
+import {
+ hasAssembly,
+ hasContextRegisters,
+ hasContextSource,
+ hasContextVars,
+ isDotnet,
+ isExpandable,
+ trimPackage,
+} from 'sentry/components/events/interfaces/frame/utils';
+import {formatAddress, parseAddress} from 'sentry/components/events/interfaces/utils';
+import AnnotatedText from 'sentry/components/events/meta/annotatedText';
+import {getMeta} from 'sentry/components/events/meta/metaProxy';
+import {TraceEventDataSectionContext} from 'sentry/components/events/traceEventDataSection';
+import {DisplayOption} from 'sentry/components/events/traceEventDataSection/displayOptions';
+import {STACKTRACE_PREVIEW_TOOLTIP_DELAY} from 'sentry/components/stacktracePreview';
+import StrictClick from 'sentry/components/strictClick';
+import Tooltip from 'sentry/components/tooltip';
+import {IconChevron} from 'sentry/icons/iconChevron';
+import {IconInfo} from 'sentry/icons/iconInfo';
+import {IconQuestion} from 'sentry/icons/iconQuestion';
+import {IconWarning} from 'sentry/icons/iconWarning';
+import {t} from 'sentry/locale';
+import {DebugMetaActions} from 'sentry/stores/debugMetaStore';
+import space from 'sentry/styles/space';
+import {Frame, PlatformType, SentryAppComponent} from 'sentry/types';
+import {Event} from 'sentry/types/event';
+import {defined} from 'sentry/utils';
+import {Color} from 'sentry/utils/theme';
+import withSentryAppComponents from 'sentry/utils/withSentryAppComponents';
+
+import DebugImage from './debugMeta/debugImage';
+import {combineStatus} from './debugMeta/utils';
+import Context from './frame/context';
+import {SymbolicatorStatus} from './types';
+
+type Props = {
+ frame: Frame;
+ event: Event;
+ registers: Record<string, string>;
+ components: Array<SentryAppComponent>;
+ isUsedForGrouping: boolean;
+ platform: PlatformType;
+ isHoverPreviewed?: boolean;
+ isExpanded?: boolean;
+ nextFrame?: Frame;
+ includeSystemFrames?: boolean;
+ prevFrame?: Frame;
+ image?: React.ComponentProps<typeof DebugImage>['image'];
+ maxLengthOfRelativeAddress?: number;
+ emptySourceNotation?: boolean;
+ isOnlyFrame?: boolean;
+};
+
+function NativeFrame({
+ frame,
+ nextFrame,
+ prevFrame,
+ includeSystemFrames,
+ isUsedForGrouping,
+ maxLengthOfRelativeAddress,
+ image,
+ registers,
+ isOnlyFrame,
+ event,
+ components,
+ isExpanded,
+ platform,
+ emptySourceNotation = false,
+ /**
+ * Is the stack trace being previewed in a hovercard?
+ */
+ isHoverPreviewed = false,
+}: Props) {
+ const traceEventDataSectionContext = useContext(TraceEventDataSectionContext);
+
+ const absolute = traceEventDataSectionContext?.activeDisplayOptions.includes(
+ DisplayOption.ABSOLUTE_ADDRESSES
+ );
+
+ const fullStackTrace = traceEventDataSectionContext?.activeDisplayOptions.includes(
+ DisplayOption.FULL_STACK_TRACE
+ );
+
+ const fullFunctionName = traceEventDataSectionContext?.activeDisplayOptions.includes(
+ DisplayOption.VERBOSE_FUNCTION_NAMES
+ );
+
+ const absoluteFilePaths = traceEventDataSectionContext?.activeDisplayOptions.includes(
+ DisplayOption.ABSOLUTE_FILE_PATHS
+ );
+
+ const tooltipDelay = isHoverPreviewed ? STACKTRACE_PREVIEW_TOOLTIP_DELAY : undefined;
+ const foundByStackScanning = frame.trust === 'scan' || frame.trust === 'cfi-scan';
+ const startingAddress = image ? image.image_addr : null;
+ const packageClickable =
+ !!frame.symbolicatorStatus &&
+ frame.symbolicatorStatus !== SymbolicatorStatus.UNKNOWN_IMAGE &&
+ !isHoverPreviewed;
+
+ const leadsToApp = !frame.inApp && ((nextFrame && nextFrame.inApp) || !nextFrame);
+ const expandable =
+ !leadsToApp || includeSystemFrames
+ ? isExpandable({
+ frame,
+ registers,
+ platform,
+ emptySourceNotation,
+ isOnlyFrame,
+ })
+ : false;
+
+ const inlineFrame =
+ prevFrame &&
+ platform === (prevFrame.platform || platform) &&
+ frame.instructionAddr === prevFrame.instructionAddr;
+
+ const functionNameHiddenDetails =
+ defined(frame.rawFunction) &&
+ defined(frame.function) &&
+ frame.function !== frame.rawFunction;
+
+ const [expanded, setExpanded] = useState(expandable ? isExpanded ?? false : false);
+
+ function getRelativeAddress() {
+ if (!startingAddress) {
+ return '';
+ }
+
+ const relativeAddress = formatAddress(
+ parseAddress(frame.instructionAddr) - parseAddress(startingAddress),
+ maxLengthOfRelativeAddress
+ );
+
+ return `+${relativeAddress}`;
+ }
+
+ function getAddressTooltip() {
+ if (inlineFrame && foundByStackScanning) {
+ return t('Inline frame, found by stack scanning');
+ }
+
+ if (inlineFrame) {
+ return t('Inline frame');
+ }
+
+ if (foundByStackScanning) {
+ return t('Found by stack scanning');
+ }
+
+ return undefined;
+ }
+
+ function getFunctionName() {
+ if (functionNameHiddenDetails && fullFunctionName && frame.rawFunction) {
+ return {
+ value: frame.rawFunction,
+ meta: getMeta(frame, 'rawFunction'),
+ };
+ }
+
+ if (frame.function) {
+ return {
+ value: frame.function,
+ meta: getMeta(frame, 'function'),
+ };
+ }
+
+ return undefined;
+ }
+
+ function getStatus() {
+ // this is the status of image that belongs to this frame
+ if (!image) {
+ return undefined;
+ }
+
+ const combinedStatus = combineStatus(image.debug_status, image.unwind_status);
+
+ switch (combinedStatus) {
+ case 'unused':
+ return undefined;
+ case 'found':
+ return 'success';
+ default:
+ return 'error';
+ }
+ }
+
+ function handleGoToImagesLoaded(e: MouseEvent) {
+ e.stopPropagation(); // to prevent collapsing if collapsible
+
+ if (frame.instructionAddr) {
+ const searchTerm =
+ !(!frame.addrMode || frame.addrMode === 'abs') && image
+ ? `${image.debug_id}!${frame.instructionAddr}`
+ : frame.instructionAddr;
+
+ DebugMetaActions.updateFilter(searchTerm);
+ }
+
+ scrollToElement('#images-loaded');
+ }
+
+ function handleToggleContext(e: MouseEvent) {
+ if (!expandable) {
+ return;
+ }
+ e.preventDefault();
+ setExpanded(!expanded);
+ }
+
+ const relativeAddress = getRelativeAddress();
+ const addressTooltip = getAddressTooltip();
+ const functionName = getFunctionName();
+ const status = getStatus();
+
+ return (
+ <GridRow
+ inApp={frame.inApp}
+ expandable={expandable}
+ expanded={expanded}
+ data-test-id="stack-trace-frame"
+ >
+ <StrictClick onClick={handleToggleContext}>
+ <Fragment>
+ <StatusCell>
+ {(status === 'error' || status === undefined) &&
+ (packageClickable ? (
+ <PackageStatusButton
+ onClick={handleGoToImagesLoaded}
+ title={t('Go to images loaded')}
+ aria-label={t('Go to images loaded')}
+ icon={
+ status === 'error' ? (
+ <IconQuestion size="sm" color="red300" />
+ ) : (
+ <IconWarning size="sm" color="red300" />
+ )
+ }
+ size="zero"
+ borderless
+ />
+ ) : status === 'error' ? (
+ <IconQuestion size="sm" color="red300" />
+ ) : (
+ <IconWarning size="sm" color="red300" />
+ ))}
+ </StatusCell>
+ <PackageCell>
+ {!fullStackTrace && !expanded && leadsToApp && (
+ <Fragment>
+ {!nextFrame ? t('Crashed in non-app') : t('Called from')}
+ {':'}
+ </Fragment>
+ )}
+ <span>
+ <Tooltip
+ title={frame.package ?? t('Go to images loaded')}
+ delay={tooltipDelay}
+ disabled={frame.package ? false : !packageClickable}
+ containerDisplayMode="inline-flex"
+ >
+ <Package
+ color={
+ status === undefined || status === 'error'
+ ? 'red300'
+ : packageClickable
+ ? 'blue300'
+ : undefined
+ }
+ onClick={packageClickable ? handleGoToImagesLoaded : undefined}
+ >
+ {frame.package ? trimPackage(frame.package) : `<${t('unknown')}>`}
+ </Package>
+ </Tooltip>
+ </span>
+ </PackageCell>
+ <AddressCell>
+ <Tooltip
+ title={addressTooltip}
+ disabled={!(foundByStackScanning || inlineFrame)}
+ delay={tooltipDelay}
+ >
+ {!relativeAddress || absolute ? frame.instructionAddr : relativeAddress}
+ </Tooltip>
+ </AddressCell>
+ <GroupingCell>
+ {isUsedForGrouping && (
+ <Tooltip
+ title={t('This frame appears in all other events related to this issue')}
+ containerDisplayMode="inline-flex"
+ >
+ <IconInfo size="sm" color="gray300" />
+ </Tooltip>
+ )}
+ </GroupingCell>
+ <FunctionNameCell>
+ <FunctionName>
+ {functionName ? (
+ <AnnotatedText value={functionName.value} meta={functionName.meta} />
+ ) : (
+ `<${t('unknown')}>`
+ )}
+ </FunctionName>
+ {frame.filename && (
+ <Tooltip
+ title={frame.absPath}
+ disabled={!(defined(frame.absPath) && frame.absPath !== frame.filename)}
+ delay={tooltipDelay}
+ containerDisplayMode="inline-flex"
+ >
+ <FileName>
+ {'('}
+ {absoluteFilePaths ? frame.absPath : frame.filename}
+ {frame.lineNo && `:${frame.lineNo}`}
+ {')'}
+ </FileName>
+ </Tooltip>
+ )}
+ </FunctionNameCell>
+ <ExpandCell>
+ {expandable && (
+ <ToggleButton
+ size="zero"
+ css={isDotnet(platform) && {display: 'block !important'}} // remove important once we get rid of css files
+ title={t('Toggle Context')}
+ aria-label={t('Toggle Context')}
+ tooltipProps={
+ isHoverPreviewed ? {delay: STACKTRACE_PREVIEW_TOOLTIP_DELAY} : undefined
+ }
+ onClick={handleToggleContext}
+ icon={<IconChevron size="8px" direction={expanded ? 'up' : 'down'} />}
+ />
+ )}
+ </ExpandCell>
+ </Fragment>
+ </StrictClick>
+ <RegistersCell>
+ {expanded && (
+ <Registers
+ frame={frame}
+ event={event}
+ registers={registers}
+ components={components}
+ hasContextSource={hasContextSource(frame)}
+ hasContextVars={hasContextVars(frame)}
+ hasContextRegisters={hasContextRegisters(registers)}
+ emptySourceNotation={emptySourceNotation}
+ hasAssembly={hasAssembly(frame, platform)}
+ expandable={expandable}
+ isExpanded={expanded}
+ />
+ )}
+ </RegistersCell>
+ </GridRow>
+ );
+}
+
+export default withSentryAppComponents(NativeFrame, {componentType: 'stacktrace-link'});
+
+const Cell = styled('div')`
+ padding: ${space(0.5)};
+ display: flex;
+ flex-wrap: wrap;
+ word-break: break-all;
+ align-items: flex-start;
+`;
+
+const StatusCell = styled(Cell)`
+ @media (max-width: ${p => p.theme.breakpoints[0]}) {
+ grid-column: 1/1;
+ grid-row: 1/1;
+ }
+`;
+
+const PackageCell = styled(Cell)`
+ color: ${p => p.theme.subText};
+ @media (max-width: ${p => p.theme.breakpoints[0]}) {
+ grid-column: 2/2;
+ grid-row: 1/1;
+ display: grid;
+ grid-template-columns: 1fr;
+ grid-template-rows: repeat(2, auto);
+ }
+`;
+
+const AddressCell = styled(Cell)`
+ font-family: ${p => p.theme.text.familyMono};
+ @media (max-width: ${p => p.theme.breakpoints[0]}) {
+ grid-column: 3/3;
+ grid-row: 1/1;
+ }
+`;
+
+const GroupingCell = styled(Cell)`
+ @media (max-width: ${p => p.theme.breakpoints[0]}) {
+ grid-column: 1/1;
+ grid-row: 2/2;
+ }
+`;
+
+const FunctionNameCell = styled(Cell)`
+ color: ${p => p.theme.textColor};
+ @media (max-width: ${p => p.theme.breakpoints[0]}) {
+ grid-column: 2/-1;
+ grid-row: 2/2;
+ }
+`;
+
+const ExpandCell = styled(Cell)``;
+
+const RegistersCell = styled('div')`
+ grid-column: 1/-1;
+`;
+
+const Registers = styled(Context)`
+ margin: ${space(1)} 0 ${space(1)} ${space(0.5)};
+ padding: ${space(1)};
+`;
+
+const ToggleButton = styled(Button)`
+ width: 16px;
+ height: 16px;
+`;
+
+const Package = styled('span')<{color?: Color}>`
+ border-bottom: 1px dashed ${p => p.theme.border};
+ ${p => p.color && `color: ${p.theme[p.color]}`};
+ ${p => p.onClick && `cursor: pointer;`}
+`;
+
+const FunctionName = styled('div')`
+ color: ${p => p.theme.headingColor};
+ margin-right: ${space(1)};
+`;
+
+const FileName = styled('span')`
+ color: ${p => p.theme.subText};
+ border-bottom: 1px dashed ${p => p.theme.border};
+`;
+
+const PackageStatusButton = styled(Button)`
+ padding: 0;
+ border: none;
+`;
+
+const GridRow = styled('div')<{inApp: boolean; expandable: boolean; expanded: boolean}>`
+ ${p => p.expandable && `cursor: pointer;`};
+ ${p => p.inApp && `background: ${p.theme.bodyBackground};`};
+ ${p =>
+ !p.inApp &&
+ css`
+ color: ${p.theme.subText};
+ ${FunctionName} {
+ color: ${p.theme.subText};
+ }
+ ${FunctionNameCell} {
+ color: ${p.theme.subText};
+ }
+ `};
+
+ display: grid;
+ align-items: flex-start;
+ padding: ${space(0.5)};
+ :not(:last-child) {
+ border-bottom: 1px solid ${p => p.theme.border};
+ }
+
+ grid-template-columns: 24px 132px 138px 24px 1fr 24px;
+ grid-template-rows: 1fr;
+
+ @media (max-width: ${p => p.theme.breakpoints[0]}) {
+ grid-template-columns: 24px auto minmax(138px, 1fr) 24px;
+ grid-template-rows: repeat(2, auto);
+ }
+`;
diff --git a/static/app/components/panels/panel.tsx b/static/app/components/panels/panel.tsx
index cd41e82cc87084..abdb9b9f27e979 100644
--- a/static/app/components/panels/panel.tsx
+++ b/static/app/components/panels/panel.tsx
@@ -3,6 +3,7 @@ import styled from '@emotion/styled';
import space from 'sentry/styles/space';
type Props = {
+ 'data-test-id'?: string;
dashedBorder?: boolean;
};
diff --git a/static/app/components/stacktracePreview.tsx b/static/app/components/stacktracePreview.tsx
index 11aa7158ec8c32..e4d0f3645b4fb3 100644
--- a/static/app/components/stacktracePreview.tsx
+++ b/static/app/components/stacktracePreview.tsx
@@ -4,15 +4,17 @@ import styled from '@emotion/styled';
import StackTraceContent from 'sentry/components/events/interfaces/crashContent/stackTrace/content';
import StackTraceContentV2 from 'sentry/components/events/interfaces/crashContent/stackTrace/contentV2';
+import StackTraceContentV3 from 'sentry/components/events/interfaces/crashContent/stackTrace/contentV3';
import {isStacktraceNewestFirst} from 'sentry/components/events/interfaces/utils';
import Hovercard, {Body} from 'sentry/components/hovercard';
import LoadingIndicator from 'sentry/components/loadingIndicator';
import {t} from 'sentry/locale';
import space from 'sentry/styles/space';
-import {Organization} from 'sentry/types';
+import {Organization, PlatformType} from 'sentry/types';
import {EntryType, Event} from 'sentry/types/event';
import {StacktraceType} from 'sentry/types/stacktrace';
import {defined} from 'sentry/utils';
+import {isNativePlatform} from 'sentry/utils/platform';
import useApi from 'sentry/utils/useApi';
import findBestThread from './events/interfaces/threads/threadSelector/findBestThread';
@@ -54,14 +56,76 @@ function getStacktrace(event: Event): StacktraceType | null {
return null;
}
+function StackTracePreviewContent({
+ event,
+ stacktrace,
+ orgFeatures = [],
+ groupingCurrentLevel,
+}: {
+ event: Event;
+ stacktrace: StacktraceType;
+ orgFeatures?: string[];
+ groupingCurrentLevel?: number;
+}) {
+ const includeSystemFrames = React.useMemo(() => {
+ return stacktrace?.frames?.every(frame => !frame.inApp) ?? false;
+ }, [stacktrace]);
+
+ const framePlatform = stacktrace?.frames?.find(frame => !!frame.platform)?.platform;
+ const platform = (framePlatform ?? event.platform ?? 'other') as PlatformType;
+ const newestFirst = isStacktraceNewestFirst();
+
+ if (orgFeatures.includes('native-stack-trace-v2') && isNativePlatform(platform)) {
+ return (
+ <StackTraceContentV3
+ data={stacktrace}
+ expandFirstFrame={false}
+ includeSystemFrames={includeSystemFrames}
+ platform={platform}
+ newestFirst={newestFirst}
+ event={event}
+ groupingCurrentLevel={groupingCurrentLevel}
+ isHoverPreviewed
+ />
+ );
+ }
+
+ if (orgFeatures.includes('grouping-stacktrace-ui')) {
+ return (
+ <StackTraceContentV2
+ data={stacktrace}
+ expandFirstFrame={false}
+ includeSystemFrames={includeSystemFrames}
+ platform={platform}
+ newestFirst={newestFirst}
+ event={event}
+ groupingCurrentLevel={groupingCurrentLevel}
+ isHoverPreviewed
+ />
+ );
+ }
+
+ return (
+ <StackTraceContent
+ data={stacktrace}
+ expandFirstFrame={false}
+ includeSystemFrames={includeSystemFrames}
+ platform={platform}
+ newestFirst={newestFirst}
+ event={event}
+ isHoverPreviewed
+ />
+ );
+}
+
type StackTracePreviewProps = {
issueId: string;
organization: Organization;
+ children: React.ReactNode;
groupingCurrentLevel?: number;
eventId?: string;
projectSlug?: string;
className?: string;
- children: React.ReactNode;
};
function StackTracePreview(props: StackTracePreviewProps): React.ReactElement {
@@ -139,7 +203,7 @@ function StackTracePreview(props: StackTracePreviewProps): React.ReactElement {
// Not sure why we need to stop propagation, maybe to to prevent the hovercard from closing?
// If we are doing this often, maybe it should be part of the hovercard component.
- const handleStacktracePreviewClick = React.useCallback((e: React.MouseEvent) => {
+ const handleStackTracePreviewClick = React.useCallback((e: React.MouseEvent) => {
e.stopPropagation();
}, []);
@@ -150,10 +214,6 @@ function StackTracePreview(props: StackTracePreviewProps): React.ReactElement {
return null;
}, [event]);
- const includeSystemFrames = React.useMemo(() => {
- return stacktrace?.frames?.every(frame => !frame.inApp) ?? false;
- }, [stacktrace]);
-
return (
<span
className={props.className}
@@ -163,41 +223,25 @@ function StackTracePreview(props: StackTracePreviewProps): React.ReactElement {
<StyledHovercard
body={
status === 'loading' && !loadingVisible ? null : status === 'loading' ? (
- <NoStackTraceWrapper onClick={handleStacktracePreviewClick}>
+ <NoStackTraceWrapper onClick={handleStackTracePreviewClick}>
<LoadingIndicator hideMessage size={32} />
</NoStackTraceWrapper>
) : status === 'error' ? (
- <NoStackTraceWrapper onClick={handleStacktracePreviewClick}>
+ <NoStackTraceWrapper onClick={handleStackTracePreviewClick}>
{t('Failed to load stack trace.')}
</NoStackTraceWrapper>
) : !stacktrace ? (
- <NoStackTraceWrapper onClick={handleStacktracePreviewClick}>
+ <NoStackTraceWrapper onClick={handleStackTracePreviewClick}>
{t('There is no stack trace available for this issue.')}
</NoStackTraceWrapper>
) : !event ? null : (
- <div onClick={handleStacktracePreviewClick}>
- {!!props.organization.features?.includes('grouping-stacktrace-ui') ? (
- <StackTraceContentV2
- data={stacktrace}
- expandFirstFrame={false}
- includeSystemFrames={includeSystemFrames}
- platform={event.platform ?? 'other'}
- newestFirst={isStacktraceNewestFirst()}
- event={event}
- groupingCurrentLevel={props.groupingCurrentLevel}
- isHoverPreviewed
- />
- ) : (
- <StackTraceContent
- data={stacktrace}
- expandFirstFrame={false}
- includeSystemFrames={includeSystemFrames}
- platform={event.platform ?? 'other'}
- newestFirst={isStacktraceNewestFirst()}
- event={event}
- isHoverPreviewed
- />
- )}
+ <div onClick={handleStackTracePreviewClick}>
+ <StackTracePreviewContent
+ event={event}
+ stacktrace={stacktrace}
+ groupingCurrentLevel={props.groupingCurrentLevel}
+ orgFeatures={props.organization.features}
+ />
</div>
)
}
diff --git a/static/app/views/performance/utils.tsx b/static/app/views/performance/utils.tsx
index 5ab4267e44817b..58b9c3b95a381a 100644
--- a/static/app/views/performance/utils.tsx
+++ b/static/app/views/performance/utils.tsx
@@ -57,9 +57,11 @@ export function platformToPerformanceType(
if (projectIds.length === 0 || projectIds[0] === ALL_ACCESS_PROJECTS) {
return PROJECT_PERFORMANCE_TYPE.ANY;
}
+
const selectedProjects = projects.filter(p =>
projectIds.includes(parseInt(`${p.id}`, 10))
);
+
if (selectedProjects.length === 0 || selectedProjects.some(p => !p.platform)) {
return PROJECT_PERFORMANCE_TYPE.ANY;
}
diff --git a/tests/js/spec/components/events/interfaces/threadsV2.spec.tsx b/tests/js/spec/components/events/interfaces/threadsV2.spec.tsx
index 8ebf86ba61a378..680eee48615850 100644
--- a/tests/js/spec/components/events/interfaces/threadsV2.spec.tsx
+++ b/tests/js/spec/components/events/interfaces/threadsV2.spec.tsx
@@ -227,7 +227,7 @@ describe('ThreadsV2', function () {
).toBeInTheDocument();
expect(screen.getByText('divided by 0')).toBeInTheDocument();
- expect(screen.getByTestId('stack-trace')).toBeInTheDocument();
+ expect(screen.getByTestId('stack-trace-content-v2')).toBeInTheDocument();
expect(screen.queryAllByTestId('stack-trace-frame')).toHaveLength(3);
expect(container).toSnapshot();
@@ -326,7 +326,7 @@ describe('ThreadsV2', function () {
'false'
);
- expect(screen.getByTestId('stack-trace')).toBeInTheDocument();
+ expect(screen.getByTestId('stack-trace-content-v2')).toBeInTheDocument();
expect(screen.queryAllByTestId('stack-trace-frame')).toHaveLength(3);
// Check Full Stack Trace
|
c0415f84a89f62d5a50141199aef4a455a8cedb0
|
2021-05-11 18:08:27
|
Joris Bayer
|
fix: Load secondary grouping enhancements (#25990)
| false
|
Load secondary grouping enhancements (#25990)
|
fix
|
diff --git a/src/sentry/grouping/api.py b/src/sentry/grouping/api.py
index e33f9ec8e1e6f9..2a7c201d1dcdff 100644
--- a/src/sentry/grouping/api.py
+++ b/src/sentry/grouping/api.py
@@ -41,7 +41,7 @@ def get_grouping_config_dict_for_project(project, silent=True, secondary=False):
# At a later point we might want to store additional information here
# such as frames that mark the end of a stacktrace and more.
- return {"id": config_id, "enhancements": _get_project_enhancements_config(project)}
+ return {"id": config_id, "enhancements": _get_project_enhancements_config(project, secondary)}
def get_grouping_config_dict_for_event_data(data, project):
|
874c9cd8fc0fa4ff5c99c1fdb9d69f4d3b32e320
|
2023-07-13 22:25:55
|
Spencer Murray
|
ref(stats): Convert teamReleases to functional (#52413)
| false
|
Convert teamReleases to functional (#52413)
|
ref
|
diff --git a/fixtures/js-stubs/teamReleaseCounts.js b/fixtures/js-stubs/teamReleaseCounts.js
new file mode 100644
index 00000000000000..54d5f08b87d9a7
--- /dev/null
+++ b/fixtures/js-stubs/teamReleaseCounts.js
@@ -0,0 +1,28 @@
+export function TeamReleaseCounts() {
+ return {
+ release_counts: {
+ '2021-03-11': 1,
+ '2021-03-12': 2,
+ '2021-03-13': 1,
+ '2021-03-14': 0,
+ '2021-03-15': 0,
+ '2021-03-16': 0,
+ '2021-03-17': 0,
+ '2021-03-18': 0,
+ '2021-03-19': 0,
+ '2021-03-20': 1,
+ '2021-03-21': 0,
+ '2021-03-22': 1,
+ '2021-03-23': 0,
+ '2021-03-24': 0,
+ },
+ project_avgs: {
+ 123: 3,
+ 234: 4,
+ },
+ last_week_totals: {
+ 123: 2,
+ 234: 4,
+ },
+ };
+}
diff --git a/fixtures/js-stubs/types.tsx b/fixtures/js-stubs/types.tsx
index 2826dcbe86e2ac..c535c785ccb336 100644
--- a/fixtures/js-stubs/types.tsx
+++ b/fixtures/js-stubs/types.tsx
@@ -177,6 +177,7 @@ type TestStubFixtures = {
TeamAlertsTriggered: SimpleStub;
TeamIssuesBreakdown: SimpleStub;
TeamIssuesReviewed: SimpleStub;
+ TeamReleaseCounts: SimpleStub;
TeamResolutionTime: SimpleStub;
TeamRoleList: OverridableStub;
Tombstones: OverridableStubList;
diff --git a/static/app/views/organizationStats/teamInsights/teamReleases.spec.tsx b/static/app/views/organizationStats/teamInsights/teamReleases.spec.tsx
new file mode 100644
index 00000000000000..376062ee05ade6
--- /dev/null
+++ b/static/app/views/organizationStats/teamInsights/teamReleases.spec.tsx
@@ -0,0 +1,78 @@
+import {render, screen} from 'sentry-test/reactTestingLibrary';
+
+import TeamReleases from './teamReleases';
+
+describe('TeamReleases', () => {
+ it('should compare selected past release count with current week', async () => {
+ const team = TestStubs.Team();
+ const organization = TestStubs.Organization();
+ const project = TestStubs.Project({id: 123});
+
+ const releaseCountApi = MockApiClient.addMockResponse({
+ url: `/teams/org-slug/team-slug/release-count/`,
+ body: TestStubs.TeamReleaseCounts(),
+ });
+
+ render(
+ <TeamReleases
+ organization={organization}
+ projects={[project]}
+ teamSlug={team.slug}
+ period="2w"
+ />
+ );
+
+ expect(screen.getByText('project-slug')).toBeInTheDocument();
+ expect(await screen.findByText('3')).toBeInTheDocument();
+ expect(await screen.findByText('2')).toBeInTheDocument();
+ expect(await screen.findByText('1')).toBeInTheDocument();
+ expect(releaseCountApi).toHaveBeenCalledTimes(2);
+ });
+
+ it('should render no release counts', async () => {
+ const team = TestStubs.Team();
+ const organization = TestStubs.Organization();
+ const noReleaseProject = TestStubs.Project({id: 321});
+
+ render(
+ <TeamReleases
+ organization={organization}
+ projects={[noReleaseProject]}
+ teamSlug={team.slug}
+ period="2w"
+ />
+ );
+
+ expect(await screen.findAllByText('0')).toHaveLength(3);
+ });
+
+ it('should render multiple projects', async () => {
+ const team = TestStubs.Team();
+ const organization = TestStubs.Organization();
+ const projectA = TestStubs.Project({id: 123});
+ const projectB = TestStubs.Project({id: 234, slug: 'other-project-slug'});
+
+ const releaseCountApi = MockApiClient.addMockResponse({
+ url: `/teams/org-slug/team-slug/release-count/`,
+ body: TestStubs.TeamReleaseCounts(),
+ });
+
+ render(
+ <TeamReleases
+ organization={organization}
+ projects={[projectA, projectB]}
+ teamSlug={team.slug}
+ period="2w"
+ />
+ );
+
+ expect(screen.getByText('project-slug')).toBeInTheDocument();
+ expect(screen.getByText('other-project-slug')).toBeInTheDocument();
+ expect(await screen.findByText('3')).toBeInTheDocument();
+ expect(await screen.findByText('2')).toBeInTheDocument();
+ expect(await screen.findByText('1')).toBeInTheDocument();
+ expect(await screen.findAllByText('4')).toHaveLength(2);
+ expect(await screen.findByText('0')).toBeInTheDocument();
+ expect(releaseCountApi).toHaveBeenCalledTimes(2);
+ });
+});
diff --git a/static/app/views/organizationStats/teamInsights/teamReleases.tsx b/static/app/views/organizationStats/teamInsights/teamReleases.tsx
index 6d6735187b237a..7f4ace6e2ae9d5 100644
--- a/static/app/views/organizationStats/teamInsights/teamReleases.tsx
+++ b/static/app/views/organizationStats/teamInsights/teamReleases.tsx
@@ -1,7 +1,6 @@
-import {ComponentType, Fragment} from 'react';
+import {Fragment} from 'react';
import {css, Theme, withTheme} from '@emotion/react';
import styled from '@emotion/styled';
-import isEqual from 'lodash/isEqual';
import round from 'lodash/round';
import moment from 'moment';
@@ -9,8 +8,8 @@ import {Button} from 'sentry/components/button';
import {BarChart} from 'sentry/components/charts/barChart';
import MarkLine from 'sentry/components/charts/components/markLine';
import {DateTimeObject} from 'sentry/components/charts/utils';
-import DeprecatedAsyncComponent from 'sentry/components/deprecatedAsyncComponent';
import Link from 'sentry/components/links/link';
+import LoadingError from 'sentry/components/loadingError';
import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse';
import PanelTable from 'sentry/components/panels/panelTable';
import Placeholder from 'sentry/components/placeholder';
@@ -18,18 +17,19 @@ import {IconArrow} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {Organization, Project} from 'sentry/types';
+import {useApiQuery} from 'sentry/utils/queryClient';
import {ColorOrAlias} from 'sentry/utils/theme';
import toArray from 'sentry/utils/toArray';
import {ProjectBadge, ProjectBadgeContainer} from './styles';
import {barAxisLabel, groupByTrend, sortSeriesByDay} from './utils';
-type Props = DeprecatedAsyncComponent['props'] & {
+interface TeamReleasesProps extends DateTimeObject {
organization: Organization;
projects: Project[];
teamSlug: string;
theme: Theme;
-} & DateTimeObject;
+}
type ProjectReleaseCount = {
last_week_totals: Record<string, number>;
@@ -37,70 +37,66 @@ type ProjectReleaseCount = {
release_counts: Record<string, number>;
};
-type State = DeprecatedAsyncComponent['state'] & {
- /** weekly selected date range */
- periodReleases: ProjectReleaseCount | null;
- /** Locked to last 7 days */
- weekReleases: ProjectReleaseCount | null;
-};
-
-class TeamReleases extends DeprecatedAsyncComponent<Props, State> {
- shouldRenderBadRequests = true;
-
- getDefaultState(): State {
- return {
- ...super.getDefaultState(),
- weekReleases: null,
- periodReleases: null,
- };
- }
-
- getEndpoints() {
- const {organization, start, end, period, utc, teamSlug} = this.props;
-
- const datetime = {start, end, period, utc};
-
- const endpoints: ReturnType<DeprecatedAsyncComponent['getEndpoints']> = [
- [
- 'periodReleases',
- `/teams/${organization.slug}/${teamSlug}/release-count/`,
- {
- query: {
- ...normalizeDateTimeParams(datetime),
- },
+function TeamReleases({
+ organization,
+ projects,
+ teamSlug,
+ theme,
+ start,
+ end,
+ period,
+ utc,
+}: TeamReleasesProps) {
+ const datetime = {start, end, period, utc};
+
+ const {
+ data: periodReleases,
+ isLoading: isPeriodReleasesLoading,
+ isError: isPeriodReleasesError,
+ refetch: refetchPeriodReleases,
+ } = useApiQuery<ProjectReleaseCount>(
+ [
+ `/teams/${organization.slug}/${teamSlug}/release-count/`,
+ {
+ query: {
+ ...normalizeDateTimeParams(datetime),
},
- ],
- [
- 'weekReleases',
- `/teams/${organization.slug}/${teamSlug}/release-count/`,
- {
- query: {
- statsPeriod: '7d',
- },
+ },
+ ],
+ {staleTime: 5000}
+ );
+
+ const {
+ data: weekReleases,
+ isLoading: isWeekReleasesLoading,
+ isError: isWeekReleasesError,
+ refetch: refetchWeekReleases,
+ } = useApiQuery<ProjectReleaseCount>(
+ [
+ `/teams/${organization.slug}/${teamSlug}/release-count/`,
+ {
+ query: {
+ statsPeriod: '7d',
},
- ],
- ];
+ },
+ ],
+ {staleTime: 5000}
+ );
- return endpoints;
- }
+ const isLoading = isPeriodReleasesLoading || isWeekReleasesLoading;
- componentDidUpdate(prevProps: Props) {
- const {teamSlug, start, end, period, utc} = this.props;
-
- if (
- prevProps.start !== start ||
- prevProps.end !== end ||
- prevProps.period !== period ||
- prevProps.utc !== utc ||
- !isEqual(prevProps.teamSlug, teamSlug)
- ) {
- this.remountComponent();
- }
+ if (isPeriodReleasesError || isWeekReleasesError) {
+ return (
+ <LoadingError
+ onRetry={() => {
+ refetchPeriodReleases();
+ refetchWeekReleases();
+ }}
+ />
+ );
}
- getReleaseCount(projectId: number, dataset: 'week' | 'period'): number | null {
- const {periodReleases, weekReleases} = this.state;
-
+ function getReleaseCount(projectId: number, dataset: 'week' | 'period'): number | null {
const releasesPeriod =
dataset === 'week' ? weekReleases?.last_week_totals : periodReleases?.project_avgs;
@@ -111,9 +107,9 @@ class TeamReleases extends DeprecatedAsyncComponent<Props, State> {
return count;
}
- getTrend(projectId: number): number | null {
- const periodCount = this.getReleaseCount(projectId, 'period');
- const weekCount = this.getReleaseCount(projectId, 'week');
+ function getTrend(projectId: number): number | null {
+ const periodCount = getReleaseCount(projectId, 'period');
+ const weekCount = getReleaseCount(projectId, 'week');
if (periodCount === null || weekCount === null) {
return null;
@@ -122,14 +118,8 @@ class TeamReleases extends DeprecatedAsyncComponent<Props, State> {
return weekCount - periodCount;
}
- renderLoading() {
- return this.renderBody();
- }
-
- renderReleaseCount(projectId: string, dataset: 'week' | 'period') {
- const {loading} = this.state;
-
- if (loading) {
+ function renderReleaseCount(projectId: string, dataset: 'week' | 'period') {
+ if (isLoading) {
return (
<div>
<Placeholder width="80px" height="25px" />
@@ -137,7 +127,7 @@ class TeamReleases extends DeprecatedAsyncComponent<Props, State> {
);
}
- const count = this.getReleaseCount(Number(projectId), dataset);
+ const count = getReleaseCount(Number(projectId), dataset);
if (count === null) {
return '\u2014';
@@ -146,10 +136,8 @@ class TeamReleases extends DeprecatedAsyncComponent<Props, State> {
return count;
}
- renderTrend(projectId: string) {
- const {loading} = this.state;
-
- if (loading) {
+ function renderTrend(projectId: string) {
+ if (isLoading) {
return (
<div>
<Placeholder width="80px" height="25px" />
@@ -157,7 +145,7 @@ class TeamReleases extends DeprecatedAsyncComponent<Props, State> {
);
}
- const trend = this.getTrend(Number(projectId));
+ const trend = getTrend(Number(projectId));
if (trend === null) {
return '\u2014';
@@ -171,133 +159,128 @@ class TeamReleases extends DeprecatedAsyncComponent<Props, State> {
);
}
- renderBody() {
- const {projects, period, theme, organization} = this.props;
- const {periodReleases} = this.state;
-
- const sortedProjects = projects
- .map(project => ({project, trend: this.getTrend(Number(project.id)) ?? 0}))
- .sort((a, b) => Math.abs(b.trend) - Math.abs(a.trend));
-
- const groupedProjects = groupByTrend(sortedProjects);
-
- const data = Object.entries(periodReleases?.release_counts ?? {}).map(
- ([bucket, count]) => ({
- value: Math.ceil(count),
- name: new Date(bucket).getTime(),
- })
- );
- const seriesData = sortSeriesByDay(data);
-
- const averageValues = Object.values(periodReleases?.project_avgs ?? {});
- const projectAvgSum = averageValues.reduce(
- (total, currentData) => total + currentData,
- 0
- );
- const totalPeriodAverage = Math.ceil(projectAvgSum / averageValues.length);
-
- return (
- <div>
- <ChartWrapper>
- <BarChart
- style={{height: 190}}
- isGroupedByDate
- useShortDate
- period="7d"
- legend={{right: 3, top: 0}}
- yAxis={{minInterval: 1}}
- xAxis={barAxisLabel()}
- series={[
- {
- seriesName: t('This Period'),
+ const sortedProjects = projects
+ .map(project => ({project, trend: getTrend(Number(project.id)) ?? 0}))
+ .sort((a, b) => Math.abs(b.trend) - Math.abs(a.trend));
+
+ const groupedProjects = groupByTrend(sortedProjects);
+
+ const data = Object.entries(periodReleases?.release_counts ?? {}).map(
+ ([bucket, count]) => ({
+ value: Math.ceil(count),
+ name: new Date(bucket).getTime(),
+ })
+ );
+ const seriesData = sortSeriesByDay(data);
+
+ const averageValues = Object.values(periodReleases?.project_avgs ?? {});
+ const projectAvgSum = averageValues.reduce(
+ (total, currentData) => total + currentData,
+ 0
+ );
+ const totalPeriodAverage = Math.ceil(projectAvgSum / averageValues.length);
+
+ return (
+ <div>
+ <ChartWrapper>
+ <BarChart
+ style={{height: 190}}
+ isGroupedByDate
+ useShortDate
+ period="7d"
+ legend={{right: 3, top: 0}}
+ yAxis={{minInterval: 1}}
+ xAxis={barAxisLabel()}
+ series={[
+ {
+ seriesName: t('This Period'),
+ silent: true,
+ data: seriesData,
+ markLine: MarkLine({
silent: true,
- data: seriesData,
- markLine: MarkLine({
- silent: true,
- lineStyle: {color: theme.gray200, type: 'dashed', width: 1},
- data: [{yAxis: totalPeriodAverage}],
- label: {
- show: false,
- },
- }),
- barCategoryGap: '5%',
- },
- ]}
- tooltip={{
- formatter: seriesParams => {
- // `seriesParams` can be an array or an object :/
- const [series] = toArray(seriesParams);
-
- const dateFormat = 'MMM D';
- const startDate = moment(series.data[0]).format(dateFormat);
- const endDate = moment(series.data[0]).add(7, 'days').format(dateFormat);
- return [
- '<div class="tooltip-series">',
- `<div><span class="tooltip-label">${series.marker} <strong>${series.seriesName}</strong></span> ${series.data[1]}</div>`,
- `<div><span class="tooltip-label"><strong>Last ${period} Average</strong></span> ${totalPeriodAverage}</div>`,
- '</div>',
- `<div class="tooltip-footer">${startDate} - ${endDate}</div>`,
- '<div class="tooltip-arrow"></div>',
- ].join('');
- },
- }}
- />
- </ChartWrapper>
- <StyledPanelTable
- isEmpty={projects.length === 0}
- emptyMessage={t('No releases were setup for this team’s projects')}
- emptyAction={
- <Button
- size="sm"
- external
- href="https://docs.sentry.io/product/releases/setup/"
- >
- {t('Learn More')}
- </Button>
- }
- headers={[
- t('Releases Per Project'),
- <RightAligned key="last">
- {tct('Last [period] Average', {period})}
- </RightAligned>,
- <RightAligned key="curr">{t('Last 7 Days')}</RightAligned>,
- <RightAligned key="diff">{t('Difference')}</RightAligned>,
+ lineStyle: {color: theme.gray200, type: 'dashed', width: 1},
+ data: [{yAxis: totalPeriodAverage}],
+ label: {
+ show: false,
+ },
+ }),
+ barCategoryGap: '5%',
+ },
]}
- >
- {groupedProjects.map(({project}) => (
- <Fragment key={project.id}>
- <ProjectBadgeContainer>
- <ProjectBadge
- avatarSize={18}
- project={project}
- to={{
- pathname: `/organizations/${organization.slug}/releases/`,
- query: {project: project.id},
- }}
- />
- </ProjectBadgeContainer>
-
- <ScoreWrapper>{this.renderReleaseCount(project.id, 'period')}</ScoreWrapper>
- <ScoreWrapper>
- <Link
- to={{
- pathname: `/organizations/${organization.slug}/releases/`,
- query: {project: project.id, statsPeriod: '7d'},
- }}
- >
- {this.renderReleaseCount(project.id, 'week')}
- </Link>
- </ScoreWrapper>
- <ScoreWrapper>{this.renderTrend(project.id)}</ScoreWrapper>
- </Fragment>
- ))}
- </StyledPanelTable>
- </div>
- );
- }
+ tooltip={{
+ formatter: seriesParams => {
+ // `seriesParams` can be an array or an object :/
+ const [series] = toArray(seriesParams);
+
+ const dateFormat = 'MMM D';
+ const startDate = moment(series.data[0]).format(dateFormat);
+ const endDate = moment(series.data[0]).add(7, 'days').format(dateFormat);
+ return [
+ '<div class="tooltip-series">',
+ `<div><span class="tooltip-label">${series.marker} <strong>${series.seriesName}</strong></span> ${series.data[1]}</div>`,
+ `<div><span class="tooltip-label"><strong>Last ${period} Average</strong></span> ${totalPeriodAverage}</div>`,
+ '</div>',
+ `<div class="tooltip-footer">${startDate} - ${endDate}</div>`,
+ '<div class="tooltip-arrow"></div>',
+ ].join('');
+ },
+ }}
+ />
+ </ChartWrapper>
+ <StyledPanelTable
+ isEmpty={projects.length === 0}
+ emptyMessage={t('No releases were setup for this team’s projects')}
+ emptyAction={
+ <Button
+ size="sm"
+ external
+ href="https://docs.sentry.io/product/releases/setup/"
+ >
+ {t('Learn More')}
+ </Button>
+ }
+ headers={[
+ t('Releases Per Project'),
+ <RightAligned key="last">
+ {tct('Last [period] Average', {period})}
+ </RightAligned>,
+ <RightAligned key="curr">{t('Last 7 Days')}</RightAligned>,
+ <RightAligned key="diff">{t('Difference')}</RightAligned>,
+ ]}
+ >
+ {groupedProjects.map(({project}) => (
+ <Fragment key={project.id}>
+ <ProjectBadgeContainer>
+ <ProjectBadge
+ avatarSize={18}
+ project={project}
+ to={{
+ pathname: `/organizations/${organization.slug}/releases/`,
+ query: {project: project.id},
+ }}
+ />
+ </ProjectBadgeContainer>
+
+ <ScoreWrapper>{renderReleaseCount(project.id, 'period')}</ScoreWrapper>
+ <ScoreWrapper>
+ <Link
+ to={{
+ pathname: `/organizations/${organization.slug}/releases/`,
+ query: {project: project.id, statsPeriod: '7d'},
+ }}
+ >
+ {renderReleaseCount(project.id, 'week')}
+ </Link>
+ </ScoreWrapper>
+ <ScoreWrapper>{renderTrend(project.id)}</ScoreWrapper>
+ </Fragment>
+ ))}
+ </StyledPanelTable>
+ </div>
+ );
}
-export default withTheme(TeamReleases as ComponentType<Props>);
+export default withTheme(TeamReleases);
const ChartWrapper = styled('div')`
padding: ${space(2)} ${space(2)} 0 ${space(2)};
diff --git a/static/app/views/organizationStats/teamInsights/teamStability.spec.tsx b/static/app/views/organizationStats/teamInsights/teamStability.spec.tsx
index 18d6638d8cada6..75479e4e882d59 100644
--- a/static/app/views/organizationStats/teamInsights/teamStability.spec.tsx
+++ b/static/app/views/organizationStats/teamInsights/teamStability.spec.tsx
@@ -3,7 +3,7 @@ import {render, screen} from 'sentry-test/reactTestingLibrary';
import TeamStability from 'sentry/views/organizationStats/teamInsights/teamStability';
describe('TeamStability', () => {
- it('should comparse selected past crash rate with current week', async () => {
+ it('should compare selected past crash rate with current week', async () => {
const sessionsApi = MockApiClient.addMockResponse({
url: `/organizations/org-slug/sessions/`,
body: TestStubs.SessionStatusCountByProjectInPeriod(),
|
ef169730364cd6332ee649fed12d510e45267a47
|
2022-04-29 16:13:24
|
Joris Bayer
|
feat(sessions): Expose crash free rate (#34045)
| false
|
Expose crash free rate (#34045)
|
feat
|
diff --git a/src/sentry/release_health/base.py b/src/sentry/release_health/base.py
index 9629bf41c0903a..4a38ef2c7e473e 100644
--- a/src/sentry/release_health/base.py
+++ b/src/sentry/release_health/base.py
@@ -40,6 +40,10 @@
"p95(session.duration)",
"p99(session.duration)",
"max(session.duration)",
+ "crash_rate(session)",
+ "crash_rate(user)",
+ "crash_free_rate(session)",
+ "crash_free_rate(user)",
]
GroupByFieldName = Literal[
diff --git a/src/sentry/release_health/metrics_sessions_v2.py b/src/sentry/release_health/metrics_sessions_v2.py
index 5ca87ddbc8ae06..ce645b09dd1f93 100644
--- a/src/sentry/release_health/metrics_sessions_v2.py
+++ b/src/sentry/release_health/metrics_sessions_v2.py
@@ -329,6 +329,39 @@ def normalize(self, value: Scalar) -> Scalar:
return value
+class SimpleForwardingField(Field):
+ """A field that forwards a metrics API field 1:1.
+
+ On this type of field, grouping and filtering by session.status is impossible
+ """
+
+ field_name_to_metric_name = {
+ "crash_rate(session)": SessionMetricKey.CRASH_RATE,
+ "crash_rate(user)": SessionMetricKey.CRASH_USER_RATE,
+ "crash_free_rate(session)": SessionMetricKey.CRASH_FREE_RATE,
+ "crash_free_rate(user)": SessionMetricKey.CRASH_FREE_USER_RATE,
+ }
+
+ def __init__(self, name: str, raw_groupby: Sequence[str], status_filter: StatusFilter):
+ if "session.status" in raw_groupby:
+ raise InvalidParams(f"Cannot group field {name} by session.status")
+ if status_filter is not None:
+ raise InvalidParams(f"Cannot filter field {name} by session.status")
+
+ metric_name = self.field_name_to_metric_name[name].value
+ self._metric_field = MetricField(None, metric_name)
+
+ super().__init__(name, raw_groupby, status_filter)
+
+ def _get_session_status(self, metric_field: MetricField) -> Optional[SessionStatus]:
+ return None
+
+ def _get_metric_fields(
+ self, raw_groupby: Sequence[str], status_filter: StatusFilter
+ ) -> Sequence[MetricField]:
+ return [self._metric_field]
+
+
FIELD_MAP: Mapping[SessionsQueryFunction, Type[Field]] = {
"sum(session)": SumSessionField,
"count_unique(user)": CountUniqueUser,
@@ -339,6 +372,10 @@ def normalize(self, value: Scalar) -> Scalar:
"p95(session.duration)": DurationField,
"p99(session.duration)": DurationField,
"max(session.duration)": DurationField,
+ "crash_rate(session)": SimpleForwardingField,
+ "crash_rate(user)": SimpleForwardingField,
+ "crash_free_rate(session)": SimpleForwardingField,
+ "crash_free_rate(user)": SimpleForwardingField,
}
diff --git a/src/sentry/snuba/sessions_v2.py b/src/sentry/snuba/sessions_v2.py
index 02a5db5d88a98d..2dccc26006f37b 100644
--- a/src/sentry/snuba/sessions_v2.py
+++ b/src/sentry/snuba/sessions_v2.py
@@ -269,6 +269,12 @@ def __init__(
self.fields = {}
for key in raw_fields:
if key not in COLUMN_MAP:
+ from sentry.release_health.metrics_sessions_v2 import FIELD_MAP
+
+ if key in FIELD_MAP:
+ # HACK : Do not raise an error for metrics-only fields,
+ # Simply ignore them instead.
+ continue
raise InvalidField(f'Invalid field: "{key}"')
self.fields[key] = COLUMN_MAP[key]
diff --git a/tests/snuba/api/endpoints/test_organization_sessions.py b/tests/snuba/api/endpoints/test_organization_sessions.py
index f475348c5eb301..ab27ef7a2d5a06 100644
--- a/tests/snuba/api/endpoints/test_organization_sessions.py
+++ b/tests/snuba/api/endpoints/test_organization_sessions.py
@@ -1218,6 +1218,82 @@ def req(**kwargs):
assert response.status_code == 400, response.content
assert response.data == {"detail": "Cannot order by sum(session) with the current filters"}
+ @freeze_time(MOCK_DATETIME)
+ def test_crash_rate(self):
+ default_request = {
+ "project": [-1],
+ "statsPeriod": "1d",
+ "interval": "1d",
+ "field": ["crash_rate(session)"],
+ }
+
+ def req(**kwargs):
+ return self.do_request(dict(default_request, **kwargs))
+
+ # 1 - filter session.status
+ response = req(
+ query="session.status:[abnormal,crashed]",
+ )
+ assert response.status_code == 400, response.content
+ assert response.data == {
+ "detail": "Cannot filter field crash_rate(session) by session.status"
+ }
+
+ # 2 - group by session.status
+ response = req(
+ groupBy="session.status",
+ )
+ assert response.status_code == 400, response.content
+ assert response.data == {
+ "detail": "Cannot group field crash_rate(session) by session.status"
+ }
+
+ # 4 - fetch all
+ response = req(
+ field=[
+ "crash_rate(session)",
+ "crash_rate(user)",
+ "crash_free_rate(session)",
+ "crash_free_rate(user)",
+ ],
+ groupBy=["release", "environment"],
+ orderBy=["crash_free_rate(session)"],
+ query="release:[email protected]",
+ )
+ assert response.status_code == 200, response.content
+ assert response.data["groups"] == [
+ {
+ "by": {"environment": "production", "release": "[email protected]"},
+ "series": {
+ "crash_free_rate(session)": [0.8333333333333334],
+ "crash_free_rate(user)": [1.0],
+ "crash_rate(session)": [0.16666666666666666],
+ "crash_rate(user)": [0.0],
+ },
+ "totals": {
+ "crash_free_rate(session)": 0.8333333333333334,
+ "crash_free_rate(user)": 1.0,
+ "crash_rate(session)": 0.16666666666666666,
+ "crash_rate(user)": 0.0,
+ },
+ },
+ {
+ "by": {"environment": "development", "release": "[email protected]"},
+ "series": {
+ "crash_free_rate(session)": [1.0],
+ "crash_free_rate(user)": [None],
+ "crash_rate(session)": [0.0],
+ "crash_rate(user)": [None],
+ },
+ "totals": {
+ "crash_free_rate(session)": 1.0,
+ "crash_free_rate(user)": None,
+ "crash_rate(session)": 0.0,
+ "crash_rate(user)": None,
+ },
+ },
+ ]
+
@freeze_time(MOCK_DATETIME)
def test_pagination(self):
def do_request(cursor):
|
387b9a6eaab3549695b7c1c4e8fb11c39c36c0b0
|
2022-11-15 01:00:45
|
David Wang
|
feat(monitors): Count missed-checkins in monitor stats endpoint (#41293)
| false
|
Count missed-checkins in monitor stats endpoint (#41293)
|
feat
|
diff --git a/src/sentry/api/endpoints/monitor_stats.py b/src/sentry/api/endpoints/monitor_stats.py
index 8f8114ffc1de81..32bf7642dad608 100644
--- a/src/sentry/api/endpoints/monitor_stats.py
+++ b/src/sentry/api/endpoints/monitor_stats.py
@@ -18,16 +18,16 @@ def get(self, request: Request, project, monitor) -> Response:
current = tsdb.normalize_to_epoch(args["start"], args["rollup"])
end = tsdb.normalize_to_epoch(args["end"], args["rollup"])
- # initialize success/failure/duration stats in preparation for counting/aggregating
+ # initialize success/failure/missed/duration stats in preparation for counting/aggregating
while current <= end:
- stats[current] = {CheckInStatus.OK: 0, CheckInStatus.ERROR: 0}
+ stats[current] = {CheckInStatus.OK: 0, CheckInStatus.ERROR: 0, CheckInStatus.MISSED: 0}
duration_stats[current] = {"sum": 0, "num_checkins": 0}
current += args["rollup"]
- # retrieve the list of checkins in the time range and count success/failure/duration
+ # retrieve the list of checkins in the time range and count success/failure/missed/duration
history = MonitorCheckIn.objects.filter(
monitor=monitor,
- status__in=[CheckInStatus.OK, CheckInStatus.ERROR],
+ status__in=[CheckInStatus.OK, CheckInStatus.ERROR, CheckInStatus.MISSED],
date_added__gt=args["start"],
date_added__lte=args["end"],
).values_list("date_added", "status", "duration")
@@ -50,6 +50,7 @@ def get(self, request: Request, project, monitor) -> Response:
"ts": ts,
"ok": data[CheckInStatus.OK],
"error": data[CheckInStatus.ERROR],
+ "missed": data[CheckInStatus.MISSED],
"duration": avg_duration,
}
)
|
09e53527e953984952fbbe1abfdd0ecda458ebc5
|
2022-06-08 03:39:41
|
Dublin Anondson
|
feat(replays): added decompression for replay attachments (#35365)
| false
|
added decompression for replay attachments (#35365)
|
feat
|
diff --git a/package.json b/package.json
index 148d0cebf05c44..31a8a1672918a1 100644
--- a/package.json
+++ b/package.json
@@ -102,6 +102,7 @@
"mockdate": "3.0.5",
"moment": "2.29.3",
"moment-timezone": "0.5.34",
+ "pako": "^2.0.4",
"papaparse": "^5.3.2",
"pegjs": "^0.10.0",
"pegjs-loader": "^0.5.6",
diff --git a/static/app/utils/replays/hooks/useReplayData.tsx b/static/app/utils/replays/hooks/useReplayData.tsx
index 76cd0ebb545484..9775d205752e06 100644
--- a/static/app/utils/replays/hooks/useReplayData.tsx
+++ b/static/app/utils/replays/hooks/useReplayData.tsx
@@ -1,5 +1,6 @@
import {useCallback, useEffect, useMemo, useState} from 'react';
import * as Sentry from '@sentry/react';
+import {inflate} from 'pako';
import {IssueAttachment} from 'sentry/types';
import {EventTransaction} from 'sentry/types/event';
@@ -67,6 +68,25 @@ const IS_RRWEB_ATTACHMENT_FILENAME = /rrweb-[0-9]{13}.json/;
function isRRWebEventAttachment(attachment: IssueAttachment) {
return IS_RRWEB_ATTACHMENT_FILENAME.test(attachment.name);
}
+export function mapRRWebAttachments(unsortedReplayAttachments): ReplayAttachment {
+ const replayAttachments: ReplayAttachment = {
+ breadcrumbs: [],
+ replaySpans: [],
+ recording: [],
+ };
+
+ unsortedReplayAttachments.forEach(attachment => {
+ if (attachment.data?.tag === 'performanceSpan') {
+ replayAttachments.replaySpans.push(attachment.data.payload);
+ } else if (attachment?.data?.tag === 'breadcrumb') {
+ replayAttachments.breadcrumbs.push(attachment.data.payload);
+ } else {
+ replayAttachments.recording.push(attachment);
+ }
+ });
+
+ return replayAttachments;
+}
const INITIAL_STATE: State = Object.freeze({
event: undefined,
@@ -115,9 +135,30 @@ function useReplayData({eventSlug, orgId}: Options): Result {
const attachments = await Promise.all(
rrwebAttachmentIds.map(async attachment => {
const response = await api.requestPromise(
- `/api/0/projects/${orgId}/${projectId}/events/${eventId}/attachments/${attachment.id}/?download`
+ `/api/0/projects/${orgId}/${projectId}/events/${eventId}/attachments/${attachment.id}/?download`,
+ {
+ includeAllArgs: true,
+ }
);
- return JSON.parse(response) as ReplayAttachment;
+
+ // for non-compressed events, parse and return
+ try {
+ return JSON.parse(response[0]) as ReplayAttachment;
+ } catch (error) {
+ // swallow exception.. if we can't parse it, it's going to be compressed
+ }
+
+ // for non-compressed events, parse and return
+ try {
+ // for compressed events, inflate the blob and map the events
+ const responseBlob = await response[2]?.rawResponse.blob();
+ const responseArray = (await responseBlob?.arrayBuffer()) as Uint8Array;
+ const parsedPayload = JSON.parse(inflate(responseArray, {to: 'string'}));
+ const replayAttachments = mapRRWebAttachments(parsedPayload);
+ return replayAttachments;
+ } catch (error) {
+ return {};
+ }
})
);
diff --git a/tests/js/spec/utils/replays/useReplayData.test.jsx b/tests/js/spec/utils/replays/useReplayData.test.jsx
new file mode 100644
index 00000000000000..ddfbf6d12548fb
--- /dev/null
+++ b/tests/js/spec/utils/replays/useReplayData.test.jsx
@@ -0,0 +1,94 @@
+const {mapRRWebAttachments} = require('sentry/utils/replays/hooks/useReplayData');
+
+const testPayload = [
+ {
+ type: 3,
+ data: {
+ source: 1,
+ positions: [
+ {x: 737, y: 553, id: 46, timeOffset: -446},
+ {x: 655, y: 614, id: 52, timeOffset: -385},
+ {x: 653, y: 614, id: 52, timeOffset: -285},
+ {x: 653, y: 613, id: 52, timeOffset: -226},
+ {x: 653, y: 613, id: 52, timeOffset: -171},
+ {x: 662, y: 601, id: 50, timeOffset: -105},
+ {x: 671, y: 591, id: 50, timeOffset: -46},
+ ],
+ },
+ timestamp: 1654290037123,
+ },
+ {
+ type: 3,
+ data: {
+ source: 0,
+ texts: [],
+ attributes: [],
+ removes: [],
+ adds: [
+ {
+ parentId: 33,
+ nextId: null,
+ node: {
+ type: 2,
+ tagName: 'com-1password-button',
+ attributes: {},
+ childNodes: [],
+ id: 65,
+ },
+ },
+ ],
+ },
+ timestamp: 1654290037561,
+ },
+ {
+ type: 5,
+ timestamp: 1654290037.267,
+ data: {
+ tag: 'breadcrumb',
+ payload: {
+ timestamp: 1654290037.267,
+ type: 'default',
+ category: 'ui.click',
+ message: 'body > div#root > div.App > form',
+ data: {nodeId: 44},
+ },
+ },
+ },
+ {
+ type: 5,
+ timestamp: 1654290034.2623,
+ data: {
+ tag: 'performanceSpan',
+ payload: {
+ op: 'navigation.navigate',
+ description: 'http://localhost:3000/',
+ startTimestamp: 1654290034.2623,
+ endTimestamp: 1654290034.5808,
+ data: {size: 1150},
+ },
+ },
+ },
+ {
+ type: 5,
+ timestamp: 1654290034.2623,
+ data: {
+ tag: 'performanceSpan',
+ payload: {
+ op: 'navigation.navigate',
+ description: 'http://localhost:3000/',
+ startTimestamp: 1654290034.2623,
+ endTimestamp: 1654290034.5808,
+ data: {size: 1150},
+ },
+ },
+ },
+];
+
+describe('useReplayData Hooks', () => {
+ it('t', () => {
+ const results = mapRRWebAttachments(testPayload);
+ expect(results.breadcrumbs.length).toBe(1);
+ expect(results.recording.length).toBe(2);
+ expect(results.replaySpans.length).toBe(2);
+ });
+});
diff --git a/yarn.lock b/yarn.lock
index 52d4f950466ddf..e2563cb43ed208 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -11808,6 +11808,11 @@ p-try@^2.0.0:
resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==
+pako@^2.0.4:
+ version "2.0.4"
+ resolved "https://registry.yarnpkg.com/pako/-/pako-2.0.4.tgz#6cebc4bbb0b6c73b0d5b8d7e8476e2b2fbea576d"
+ integrity sha512-v8tweI900AUkZN6heMU/4Uy4cXRc2AYNRggVmTR+dEncawDJgCdLMximOVA2p4qO57WMynangsfGRb5WD6L1Bg==
+
papaparse@^5.3.2:
version "5.3.2"
resolved "https://registry.yarnpkg.com/papaparse/-/papaparse-5.3.2.tgz#d1abed498a0ee299f103130a6109720404fbd467"
|
071b9d595d52ed869aa6c3140e605273f762d5c9
|
2018-07-05 23:42:22
|
MeredithAnya
|
feat(integrations): Add create/link issue for GitHub (#8841)
| false
|
Add create/link issue for GitHub (#8841)
|
feat
|
diff --git a/src/sentry/api/endpoints/group_integration_details.py b/src/sentry/api/endpoints/group_integration_details.py
index 6b8dd00a5bd741..4403f3627efb6f 100644
--- a/src/sentry/api/endpoints/group_integration_details.py
+++ b/src/sentry/api/endpoints/group_integration_details.py
@@ -31,7 +31,8 @@ def get(self, request, group, integration_id):
except Integration.DoesNotExist:
return Response(status=404)
- if not integration.has_feature(IntegrationFeatures.ISSUE_SYNC):
+ if not (integration.has_feature(IntegrationFeatures.ISSUE_BASIC) or integration.has_feature(
+ IntegrationFeatures.ISSUE_SYNC)):
return Response(
{'detail': 'This feature is not supported for this integration.'}, status=400)
@@ -61,13 +62,14 @@ def put(self, request, group, integration_id):
except Integration.DoesNotExist:
return Response(status=404)
- if not integration.has_feature(IntegrationFeatures.ISSUE_SYNC):
+ if not (integration.has_feature(IntegrationFeatures.ISSUE_BASIC) or integration.has_feature(
+ IntegrationFeatures.ISSUE_SYNC)):
return Response(
{'detail': 'This feature is not supported for this integration.'}, status=400)
installation = integration.get_installation(organization_id)
try:
- data = installation.get_issue(external_issue_id)
+ data = installation.get_issue(external_issue_id, data=request.DATA)
except IntegrationError as exc:
return Response({'detail': exc.message}, status=400)
@@ -75,16 +77,20 @@ def put(self, request, group, integration_id):
'title': data.get('title'),
'description': data.get('description'),
}
+
+ external_issue_key = installation.make_external_key(data)
external_issue, created = ExternalIssue.objects.get_or_create(
organization_id=organization_id,
integration_id=integration.id,
- key=external_issue_id,
+ key=external_issue_key,
defaults=defaults,
)
if not created:
external_issue.update(**defaults)
+ installation.after_link_issue(external_issue, data=request.DATA)
+
try:
with transaction.atomic():
GroupLink.objects.create(
@@ -112,7 +118,8 @@ def post(self, request, group, integration_id):
except Integration.DoesNotExist:
return Response(status=404)
- if not integration.has_feature(IntegrationFeatures.ISSUE_SYNC):
+ if not (integration.has_feature(IntegrationFeatures.ISSUE_BASIC) or integration.has_feature(
+ IntegrationFeatures.ISSUE_SYNC)):
return Response(
{'detail': 'This feature is not supported for this integration.'}, status=400)
@@ -122,10 +129,11 @@ def post(self, request, group, integration_id):
except IntegrationError as exc:
return Response({'non_field_errors': exc.message}, status=400)
+ external_issue_key = installation.make_external_key(data)
external_issue = ExternalIssue.objects.get_or_create(
organization_id=organization_id,
integration_id=integration.id,
- key=data['key'],
+ key=external_issue_key,
defaults={
'title': data.get('title'),
'description': data.get('description'),
@@ -163,7 +171,8 @@ def delete(self, request, group, integration_id):
except Integration.DoesNotExist:
return Response(status=404)
- if not integration.has_feature(IntegrationFeatures.ISSUE_SYNC):
+ if not (integration.has_feature(IntegrationFeatures.ISSUE_BASIC) or integration.has_feature(
+ IntegrationFeatures.ISSUE_SYNC)):
return Response(
{'detail': 'This feature is not supported for this integration.'}, status=400)
diff --git a/src/sentry/api/endpoints/group_integrations.py b/src/sentry/api/endpoints/group_integrations.py
index b255036c5323c1..f812264c9731d6 100644
--- a/src/sentry/api/endpoints/group_integrations.py
+++ b/src/sentry/api/endpoints/group_integrations.py
@@ -12,7 +12,7 @@
class GroupIntegrationsEndpoint(GroupEndpoint):
def get(self, request, group):
providers = [
- i.key for i in integrations.all() if i.has_feature(IntegrationFeatures.ISSUE_SYNC)
+ i.key for i in integrations.all() if i.has_feature(IntegrationFeatures.ISSUE_BASIC) or i.has_feature(IntegrationFeatures.ISSUE_SYNC)
]
return self.paginate(
# TODO(jess): This should filter by integrations that
diff --git a/src/sentry/integrations/base.py b/src/sentry/integrations/base.py
index 1462d5ab7f134c..f4173a7d7e2dc0 100644
--- a/src/sentry/integrations/base.py
+++ b/src/sentry/integrations/base.py
@@ -30,6 +30,7 @@
class IntegrationFeatures(Enum):
NOTIFICATION = 'notification'
+ ISSUE_BASIC = 'issue_basic'
ISSUE_SYNC = 'issue_sync'
COMMITS = 'commits'
CHAT_UNFURL = 'chat_unfurl'
diff --git a/src/sentry/integrations/example/integration.py b/src/sentry/integrations/example/integration.py
index fe1b82329b20c8..c63a0bfbbf9780 100644
--- a/src/sentry/integrations/example/integration.py
+++ b/src/sentry/integrations/example/integration.py
@@ -55,7 +55,7 @@ def create_issue(self, data, **kwargs):
'description': 'This is a test external issue description',
}
- def get_issue(self, issue_id):
+ def get_issue(self, issue_id, **kwargs):
return {
'key': issue_id,
'title': 'This is a test external issue title',
diff --git a/src/sentry/integrations/github/client.py b/src/sentry/integrations/github/client.py
index 369310bc858555..80d5d94ce30e2f 100644
--- a/src/sentry/integrations/github/client.py
+++ b/src/sentry/integrations/github/client.py
@@ -52,6 +52,23 @@ def get_repositories(self):
)
return repositories['repositories']
+ def get_assignees(self, repo):
+ return self.get('/repos/{}/assignees'.format(repo))
+
+ def get_issues(self, repo):
+ return self.get('/repos/{}/issues'.format(repo))
+
+ def get_issue(self, repo, number):
+ return self.get('/repos/{}/issues/{}'.format(repo, number))
+
+ def create_issue(self, repo, data):
+ endpoint = '/repos/{}/issues'.format(repo)
+ return self.post(endpoint, data=data)
+
+ def create_comment(self, repo, issue_id, data):
+ endpoint = '/repos/{}/issues/{}/comments'.format(repo, issue_id)
+ return self.post(endpoint, data=data)
+
def get_user(self, gh_username):
return self.get('/users/{}'.format(gh_username))
diff --git a/src/sentry/integrations/github/integration.py b/src/sentry/integrations/github/integration.py
index dabe9ec247dee3..732d669a79cfe1 100644
--- a/src/sentry/integrations/github/integration.py
+++ b/src/sentry/integrations/github/integration.py
@@ -13,6 +13,7 @@
from sentry.utils.http import absolute_uri
from .client import GitHubAppsClient
+from .issues import GitHubIssueBasic
from .repository import GitHubRepositoryProvider
from .utils import get_jwt
@@ -41,7 +42,7 @@
}
-class GitHubIntegration(Integration, RepositoryMixin):
+class GitHubIntegration(Integration, GitHubIssueBasic, RepositoryMixin):
def get_client(self):
return GitHubAppsClient(external_id=self.model.external_id)
@@ -49,6 +50,9 @@ def get_client(self):
def get_repositories(self):
return self.get_client().get_repositories()
+ def make_external_key(self, data):
+ return '{}#{}'.format(data['repo'], data['key'])
+
def message_from_error(self, exc):
if isinstance(exc, ApiError):
message = API_ERRORS.get(exc.code)
@@ -69,10 +73,9 @@ class GitHubIntegrationProvider(IntegrationProvider):
name = 'GitHub'
metadata = metadata
integration_cls = GitHubIntegration
-
features = frozenset([
IntegrationFeatures.COMMITS,
- IntegrationFeatures.ISSUE_SYNC,
+ IntegrationFeatures.ISSUE_BASIC,
])
setup_dialog_config = {
diff --git a/src/sentry/integrations/github/issues.py b/src/sentry/integrations/github/issues.py
new file mode 100644
index 00000000000000..7c23cc0fea78ed
--- /dev/null
+++ b/src/sentry/integrations/github/issues.py
@@ -0,0 +1,178 @@
+from __future__ import absolute_import
+
+from sentry.integrations.exceptions import ApiError, IntegrationError
+from sentry.integrations.issues import IssueBasicMixin
+
+
+class GitHubIssueBasic(IssueBasicMixin):
+ def make_external_key(self, data):
+ return '{}#{}'.format(data['repo'], data['key'])
+
+ def after_link_issue(self, external_issue, **kwargs):
+ data = kwargs['data']
+ client = self.get_client()
+
+ repo, issue_num = external_issue.key.split('#')
+ if not repo:
+ raise IntegrationError('repo must be provided')
+
+ if not issue_num:
+ raise IntegrationError('issue number must be provided')
+
+ comment = data.get('comment')
+ if comment:
+ try:
+ client.create_comment(
+ repo=repo,
+ issue_id=issue_num,
+ data={
+ 'body': comment,
+ },
+ )
+ except ApiError as e:
+ raise IntegrationError(self.message_from_error(e))
+
+ def get_create_issue_config(self, group, **kwargs):
+ fields = super(GitHubIssueBasic, self).get_create_issue_config(group, **kwargs)
+ try:
+ repos = self.get_repositories()
+ except ApiError:
+ repo_choices = [(' ', ' ')]
+ else:
+ repo_choices = [(repo['full_name'], repo['full_name']) for repo in repos]
+
+ params = kwargs.get('params', {})
+ default_repo = params.get('repo', repo_choices[0][0])
+ assignees = self.get_allowed_assignees(default_repo)
+
+ return [
+ {
+ 'name': 'repo',
+ 'label': 'GitHub Repository',
+ 'type': 'select',
+ 'default': default_repo,
+ 'choices': repo_choices,
+ 'updatesForm': True,
+ }
+ ] + fields + [
+ {
+ 'name': 'assignee',
+ 'label': 'Assignee',
+ 'default': '',
+ 'type': 'select',
+ 'required': False,
+ 'choices': assignees,
+ }
+ ]
+
+ def create_issue(self, data, **kwargs):
+ client = self.get_client()
+
+ repo = data.get('repo')
+
+ if not repo:
+ raise IntegrationError('repo kwarg must be provided')
+
+ try:
+ issue = client.create_issue(
+ repo=repo,
+ data={
+ 'title': data['title'],
+ 'body': data['description'],
+ 'assignee': data.get('assignee'),
+ })
+ except ApiError as e:
+ raise IntegrationError(self.message_from_error(e))
+
+ return {
+ 'key': issue['number'],
+ 'title': issue['title'],
+ 'description': issue['body'],
+ 'repo': repo,
+ }
+
+ def get_link_issue_config(self, group, **kwargs):
+ try:
+ repos = self.get_repositories()
+ except ApiError:
+ repo_choices = [(' ', ' ')]
+ else:
+ repo_choices = [(repo['full_name'], repo['full_name']) for repo in repos]
+
+ params = kwargs.get('params', {})
+ default_repo = params.get('repo', repo_choices[0][0])
+ issues = self.get_repo_issues(default_repo)
+
+ return [
+ {
+ 'name': 'repo',
+ 'label': 'GitHub Repository',
+ 'type': 'select',
+ 'default': default_repo,
+ 'choices': repo_choices,
+ 'updatesForm': True,
+ },
+ {
+ 'name': 'externalIssue',
+ 'label': 'Issue',
+ 'default': '',
+ 'type': 'select',
+ 'choices': issues,
+
+ },
+ {
+ 'name': 'comment',
+ 'label': 'Comment',
+ 'default': '',
+ 'type': 'textarea',
+ 'required': False,
+ 'help': ('Leave blank if you don\'t want to '
+ 'add a comment to the GitHub issue.'),
+ }
+ ]
+
+ def get_issue(self, issue_id, **kwargs):
+ data = kwargs['data']
+ repo = data.get('repo')
+ issue_num = data.get('externalIssue')
+ client = self.get_client()
+
+ if not repo:
+ raise IntegrationError('repo must be provided')
+
+ if not issue_num:
+ raise IntegrationError('issue must be provided')
+
+ try:
+ issue = client.get_issue(repo, issue_num)
+ except ApiError as e:
+ raise IntegrationError(self.message_from_error(e))
+
+ return {
+ 'key': issue['number'],
+ 'title': issue['title'],
+ 'description': issue['body'],
+ 'repo': repo,
+ }
+
+ def get_allowed_assignees(self, repo):
+ client = self.get_client()
+ try:
+ response = client.get_assignees(repo)
+ except Exception as e:
+ self.raise_error(e)
+
+ users = tuple((u['login'], u['login']) for u in response)
+
+ return (('', 'Unassigned'), ) + users
+
+ def get_repo_issues(self, repo):
+ client = self.get_client()
+ try:
+ response = client.get_issues(repo)
+ except Exception as e:
+ self.raise_error(e)
+
+ issues = tuple((i['number'], '#{} {}'.format(i['number'], i['title'])) for i in response)
+
+ return issues
diff --git a/src/sentry/integrations/issues.py b/src/sentry/integrations/issues.py
index 198b5565f51653..47a39c2d862c6a 100644
--- a/src/sentry/integrations/issues.py
+++ b/src/sentry/integrations/issues.py
@@ -7,7 +7,8 @@
from sentry.utils.safe import safe_execute
-class IssueSyncMixin(object):
+class IssueBasicMixin(object):
+
def get_group_title(self, group, event, **kwargs):
return event.error()
@@ -112,6 +113,24 @@ def get_issue(self, issue_id, **kwargs):
"""
raise NotImplementedError
+ def after_link_issue(self, external_issue, **kwargs):
+ """
+ Takes the external issue that has been linked via `get_issue`.
+
+ Does anything needed after an issue has been linked, i.e. creating
+ a comment for a linked issue.
+ """
+ pass
+
+ def make_external_key(self, data):
+ """
+ Takes result of `get_issue` or `create_issue` and returns the formatted key
+ """
+ return data['key']
+
+
+class IssueSyncMixin(IssueBasicMixin):
+
def sync_assignee_outbound(self, external_issue, user, assign=True, **kwargs):
"""
Propagate a sentry issue's assignee to a linked issue's assignee.
diff --git a/src/sentry/static/sentry/app/components/group/externalIssues.jsx b/src/sentry/static/sentry/app/components/group/externalIssues.jsx
index bba9f84b31473a..680efc90cf03d4 100644
--- a/src/sentry/static/sentry/app/components/group/externalIssues.jsx
+++ b/src/sentry/static/sentry/app/components/group/externalIssues.jsx
@@ -79,7 +79,7 @@ class ExternalIssueForm extends AsyncComponent {
action,
};
Object.entries(dynamicFieldValues).map(([key, val]) => {
- query[key] = encodeURIComponent(val);
+ query[key] = val;
});
this.api.request(endpoint, {
method: 'GET',
diff --git a/tests/sentry/integrations/github/test_issues.py b/tests/sentry/integrations/github/test_issues.py
new file mode 100644
index 00000000000000..13dd365b6f4b62
--- /dev/null
+++ b/tests/sentry/integrations/github/test_issues.py
@@ -0,0 +1,180 @@
+from __future__ import absolute_import
+
+import responses
+
+from mock import patch
+from exam import fixture
+from django.test import RequestFactory
+
+from sentry.integrations.github.integration import GitHubIntegration
+from sentry.models import Integration, ExternalIssue
+from sentry.testutils import TestCase
+from sentry.utils import json
+
+
+class GitHubIssueBasicTest(TestCase):
+ @fixture
+ def request(self):
+ return RequestFactory()
+
+ def setUp(self):
+ self.user = self.create_user()
+ self.organization = self.create_organization(owner=self.user)
+ self.model = Integration.objects.create(
+ provider='github',
+ external_id='github_external_id',
+ name='getsentry',
+ )
+ self.model.add_organization(self.organization.id)
+ self.integration = GitHubIntegration(self.model, self.organization.id)
+
+ @responses.activate
+ @patch('sentry.integrations.github.client.get_jwt', return_value='jwt_token_1')
+ def test_get_allowed_assignees(self, mock_get_jwt):
+ responses.add(
+ responses.POST,
+ 'https://api.github.com/installations/github_external_id/access_tokens',
+ json={'token': 'token_1', 'expires_at': '2018-10-11T22:14:10Z'}
+ )
+
+ responses.add(
+ responses.GET,
+ 'https://api.github.com/repos/getsentry/sentry/assignees',
+ json=[{'login': 'MeredithAnya'}]
+ )
+
+ repo = 'getsentry/sentry'
+ assert self.integration.get_allowed_assignees(repo) == (
+ ('', 'Unassigned'),
+ ('MeredithAnya', 'MeredithAnya')
+ )
+
+ request = responses.calls[0].request
+ assert request.headers['Authorization'] == 'Bearer jwt_token_1'
+
+ request = responses.calls[1].request
+ assert request.headers['Authorization'] == 'token token_1'
+
+ @responses.activate
+ @patch('sentry.integrations.github.client.get_jwt', return_value='jwt_token_1')
+ def test_create_issue(self, mock_get_jwt):
+ responses.add(
+ responses.POST,
+ 'https://api.github.com/installations/github_external_id/access_tokens',
+ json={'token': 'token_1', 'expires_at': '2018-10-11T22:14:10Z'}
+ )
+
+ responses.add(
+ responses.POST,
+ 'https://api.github.com/repos/getsentry/sentry/issues',
+ json={'number': 321, 'title': 'hello', 'body': 'This is the description'}
+ )
+
+ form_data = {
+ 'repo': 'getsentry/sentry',
+ 'title': 'hello',
+ 'description': 'This is the description',
+ }
+
+ assert self.integration.create_issue(form_data) == {
+ 'key': 321,
+ 'description': 'This is the description',
+ 'title': 'hello',
+ 'repo': 'getsentry/sentry',
+ }
+ request = responses.calls[0].request
+ assert request.headers['Authorization'] == 'Bearer jwt_token_1'
+
+ request = responses.calls[1].request
+ assert request.headers['Authorization'] == 'token token_1'
+ payload = json.loads(request.body)
+ assert payload == {'body': 'This is the description', 'assignee': None, 'title': 'hello'}
+
+ @responses.activate
+ @patch('sentry.integrations.github.client.get_jwt', return_value='jwt_token_1')
+ def test_get_repo_issues(self, mock_get_jwt):
+ responses.add(
+ responses.POST,
+ 'https://api.github.com/installations/github_external_id/access_tokens',
+ json={'token': 'token_1', 'expires_at': '2018-10-11T22:14:10Z'}
+ )
+
+ responses.add(
+ responses.GET,
+ 'https://api.github.com/repos/getsentry/sentry/issues',
+ json=[{'number': 321, 'title': 'hello', 'body': 'This is the description'}]
+ )
+ repo = 'getsentry/sentry'
+ assert self.integration.get_repo_issues(repo) == ((321, '#321 hello'),)
+
+ request = responses.calls[0].request
+ assert request.headers['Authorization'] == 'Bearer jwt_token_1'
+
+ request = responses.calls[1].request
+ assert request.headers['Authorization'] == 'token token_1'
+
+ @responses.activate
+ @patch('sentry.integrations.github.client.get_jwt', return_value='jwt_token_1')
+ def test_link_issue(self, mock_get_jwt):
+ issue_id = 321
+ responses.add(
+ responses.POST,
+ 'https://api.github.com/installations/github_external_id/access_tokens',
+ json={'token': 'token_1', 'expires_at': '2018-10-11T22:14:10Z'}
+ )
+
+ responses.add(
+ responses.GET,
+ 'https://api.github.com/repos/getsentry/sentry/issues/321',
+ json={'number': issue_id, 'title': 'hello', 'body': 'This is the description'}
+ )
+
+ data = {
+ 'repo': 'getsentry/sentry',
+ 'externalIssue': issue_id,
+ 'comment': 'hello',
+ }
+
+ assert self.integration.get_issue(issue_id, data=data) == {
+ 'key': issue_id,
+ 'description': 'This is the description',
+ 'title': 'hello',
+ 'repo': 'getsentry/sentry',
+ }
+ request = responses.calls[0].request
+ assert request.headers['Authorization'] == 'Bearer jwt_token_1'
+
+ request = responses.calls[1].request
+ assert request.headers['Authorization'] == 'token token_1'
+
+ @responses.activate
+ @patch('sentry.integrations.github.client.get_jwt', return_value='jwt_token_1')
+ def after_link_issue(self, mock_get_jwt):
+ responses.add(
+ responses.POST,
+ 'https://api.github.com/installations/github_external_id/access_tokens',
+ json={'token': 'token_1', 'expires_at': '2018-10-11T22:14:10Z'}
+ )
+
+ responses.add(
+ responses.POST,
+ 'https://api.github.com/repos/getsentry/sentry/issues/321/comments',
+ json={'body': 'hello'}
+ )
+
+ data = {'comment': 'hello'}
+ external_issue = ExternalIssue.objects.create(
+ organization_id=self.organization.id,
+ integration_id=self.model.id,
+ key='hello#321',
+ )
+
+ self.integration.after_link_issue(external_issue, data=data)
+
+ request = responses.calls[0].request
+ assert request.headers['Authorization'] == 'Bearer jwt_token_1'
+
+ request = responses.calls[1].request
+ assert request.headers['Authorization'] == 'token token_1'
+ payload = json.loads(request.body)
+ assert payload == {'body': 'hello'}
|
49f73892cddee0676e15492f78f1aba1620276d2
|
2023-05-23 20:14:25
|
Kev
|
ref(perf): Mark long-task with sentry-tracing-init (#49481)
| false
|
Mark long-task with sentry-tracing-init (#49481)
|
ref
|
diff --git a/static/app/utils/performanceForSentry/index.tsx b/static/app/utils/performanceForSentry/index.tsx
index 7f9c9c979bf8ec..ee8f3b1ac0835c 100644
--- a/static/app/utils/performanceForSentry/index.tsx
+++ b/static/app/utils/performanceForSentry/index.tsx
@@ -484,6 +484,7 @@ export const addExtraMeasurements = (transaction: TransactionEvent) => {
try {
addAssetMeasurements(transaction);
addCustomMeasurements(transaction);
+ addSlowAppInit(transaction);
} catch (_) {
// Defensive catch since this code is auxiliary.
}
@@ -518,6 +519,27 @@ export const setGroupedEntityTag = (
setTag(`${tagName}.grouped`, `<=${groups.find(g => n <= g)}`);
};
+export const addSlowAppInit = (transaction: TransactionEvent) => {
+ const appInitSpan = transaction.spans?.find(
+ s => s.description === 'sentry-tracing-init'
+ );
+ if (!appInitSpan || !transaction.spans) {
+ return;
+ }
+ const longTaskSpan = transaction.spans.find(
+ s =>
+ s.op === 'ui.long-task' &&
+ s.endTimestamp &&
+ appInitSpan.endTimestamp &&
+ s.endTimestamp > appInitSpan.endTimestamp &&
+ s.startTimestamp < appInitSpan.startTimestamp
+ );
+ if (!longTaskSpan) {
+ return;
+ }
+ longTaskSpan.op = `ui.long-task.app-init`;
+};
+
/**
* A temporary util function used for interaction transactions that will attach a tag to the transaction, indicating the element
* that was interacted with. This will allow for querying for transactions by a specific element. This is a high cardinality tag, but
|
f886897a0729e536278b3ebdb5ccb3cd9ebbae29
|
2023-10-03 19:32:54
|
ArthurKnaus
|
ref(types): Simplify onboarding platforms definitions (#57350)
| false
|
Simplify onboarding platforms definitions (#57350)
|
ref
|
diff --git a/static/app/data/platforms.tsx b/static/app/data/platforms.tsx
index 12640c413f928a..3a6fed3b52f392 100644
--- a/static/app/data/platforms.tsx
+++ b/static/app/data/platforms.tsx
@@ -1,9 +1,156 @@
-import sortBy from 'lodash/sortBy';
+import {PlatformIntegration} from 'sentry/types';
-import {t} from 'sentry/locale';
-import type {PlatformIntegration} from 'sentry/types';
-
-const goPlatforms: PlatformIntegration[] = [
+// If you update items of this list, please remember to update the "GETTING_STARTED_DOCS_PLATFORMS" list
+// in the 'src/sentry/models/project.py' file. This way, they'll work together correctly.
+// Otherwise, creating a project will cause an error in the backend, saying "Invalid platform".
+const platforms: PlatformIntegration[] = [
+ {
+ id: 'android',
+ name: 'Android',
+ type: 'framework',
+ language: 'android',
+ link: 'https://docs.sentry.io/platforms/android/',
+ },
+ {
+ id: 'apple',
+ name: 'Apple',
+ type: 'language',
+ language: 'apple',
+ link: 'https://docs.sentry.io/platforms/apple/',
+ },
+ {
+ id: 'apple-ios',
+ name: 'iOS',
+ type: 'language',
+ language: 'apple',
+ link: 'https://docs.sentry.io/platforms/apple/',
+ },
+ {
+ id: 'apple-macos',
+ name: 'macOS',
+ type: 'language',
+ language: 'apple',
+ link: 'https://docs.sentry.io/platforms/apple/',
+ },
+ {
+ id: 'bun',
+ name: 'Bun',
+ type: 'language',
+ language: 'bun',
+ link: 'https://docs.sentry.io/platforms/javascript/guides/bun/',
+ },
+ {
+ id: 'capacitor',
+ name: 'Capacitor',
+ type: 'framework',
+ language: 'capacitor',
+ link: 'https://docs.sentry.io/platforms/javascript/guides/capacitor/',
+ },
+ {
+ id: 'cordova',
+ name: 'Cordova',
+ type: 'language',
+ language: 'cordova',
+ link: 'https://docs.sentry.io/platforms/javascript/guides/cordova/',
+ },
+ {
+ id: 'dart',
+ name: 'Dart',
+ type: 'framework',
+ language: 'dart',
+ link: 'https://docs.sentry.io/platforms/dart/',
+ },
+ {
+ id: 'dotnet',
+ name: '.NET',
+ type: 'language',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/',
+ },
+ {
+ id: 'dotnet-aspnet',
+ name: 'ASP.NET',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/aspnet/',
+ },
+ {
+ id: 'dotnet-aspnetcore',
+ name: 'ASP.NET Core',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/',
+ },
+ {
+ id: 'dotnet-awslambda',
+ name: 'AWS Lambda (.NET)',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/aws-lambda/',
+ },
+ {
+ id: 'dotnet-gcpfunctions',
+ name: 'Google Cloud Functions (.NET)',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/google-cloud-functions/',
+ },
+ {
+ id: 'dotnet-maui',
+ name: 'Multi-platform App UI (MAUI)',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/maui/',
+ },
+ {
+ id: 'dotnet-uwp',
+ name: 'UWP',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/uwp/',
+ },
+ {
+ id: 'dotnet-winforms',
+ name: 'Windows Forms',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/winforms/',
+ },
+ {
+ id: 'dotnet-wpf',
+ name: 'WPF',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/wpf/',
+ },
+ {
+ id: 'dotnet-xamarin',
+ name: 'Xamarin',
+ type: 'framework',
+ language: 'dotnet',
+ link: 'https://docs.sentry.io/platforms/dotnet/guides/xamarin/',
+ },
+ {
+ id: 'electron',
+ name: 'Electron',
+ type: 'language',
+ language: 'electron',
+ link: 'https://docs.sentry.io/platforms/javascript/guides/electron/',
+ },
+ {
+ id: 'elixir',
+ name: 'Elixir',
+ type: 'language',
+ language: 'elixir',
+ link: 'https://docs.sentry.io/platforms/elixir/',
+ },
+ {
+ id: 'flutter',
+ name: 'Flutter',
+ type: 'framework',
+ language: 'flutter',
+ link: 'https://docs.sentry.io/platforms/flutter/',
+ },
{
id: 'go',
link: 'https://docs.sentry.io/platforms/go/',
@@ -15,60 +162,92 @@ const goPlatforms: PlatformIntegration[] = [
link: 'https://docs.sentry.io/platforms/go/guides/echo/',
type: 'framework',
id: 'go-echo',
- name: t('Echo'),
+ name: 'Echo',
language: 'go',
},
{
link: 'https://docs.sentry.io/platforms/go/guides/fasthttp/',
type: 'framework',
id: 'go-fasthttp',
- name: t('FastHTTP'),
+ name: 'FastHTTP',
language: 'go',
},
{
link: 'https://docs.sentry.io/platforms/go/guides/gin/',
type: 'framework',
id: 'go-gin',
- name: t('Gin'),
+ name: 'Gin',
language: 'go',
},
{
link: 'https://docs.sentry.io/platforms/go/guides/http/',
type: 'framework',
id: 'go-http',
- name: t('Net/Http'),
+ name: 'Net/Http',
language: 'go',
},
{
link: 'https://docs.sentry.io/platforms/go/guides/iris',
type: 'framework',
id: 'go-iris',
- name: t('Iris'),
+ name: 'Iris',
language: 'go',
},
{
link: 'https://docs.sentry.io/platforms/go/guides/martini/',
type: 'framework',
id: 'go-martini',
- name: t('Martini'),
+ name: 'Martini',
language: 'go',
},
{
link: 'https://docs.sentry.io/platforms/go/guides/negroni/',
type: 'framework',
id: 'go-negroni',
- name: t('Negroni'),
+ name: 'Negroni',
language: 'go',
},
-];
-
-const javaScriptPlatforms: PlatformIntegration[] = [
{
- id: 'javascript-angular',
- name: 'Angular',
+ id: 'ionic',
+ name: 'Ionic',
type: 'framework',
- language: 'javascript',
- link: 'https://docs.sentry.io/platforms/javascript/guides/angular/',
+ language: 'ionic',
+ link: 'https://docs.sentry.io/platforms/javascript/guides/capacitor/',
+ },
+ {
+ id: 'java',
+ name: 'Java',
+ type: 'language',
+ language: 'java',
+ link: 'https://docs.sentry.io/platforms/java/',
+ },
+ {
+ id: 'java-log4j2',
+ name: 'Log4j 2.x',
+ type: 'framework',
+ language: 'java',
+ link: 'https://docs.sentry.io/platforms/java/guides/log4j2/',
+ },
+ {
+ id: 'java-logback',
+ name: 'Logback',
+ type: 'framework',
+ language: 'java',
+ link: 'https://docs.sentry.io/platforms/java/guides/logback/',
+ },
+ {
+ id: 'java-spring',
+ name: 'Spring',
+ type: 'framework',
+ language: 'java',
+ link: 'https://https://docs.sentry.io/platforms/java/guides/spring/',
+ },
+ {
+ id: 'java-spring-boot',
+ name: 'Spring Boot',
+ type: 'framework',
+ language: 'java',
+ link: 'https://docs.sentry.io/platforms/java/guides/spring-boot/',
},
{
id: 'javascript',
@@ -77,6 +256,13 @@ const javaScriptPlatforms: PlatformIntegration[] = [
language: 'javascript',
link: 'https://docs.sentry.io/platforms/javascript/',
},
+ {
+ id: 'javascript-angular',
+ name: 'Angular',
+ type: 'framework',
+ language: 'javascript',
+ link: 'https://docs.sentry.io/platforms/javascript/guides/angular/',
+ },
{
id: 'javascript-ember',
name: 'Ember',
@@ -134,53 +320,117 @@ const javaScriptPlatforms: PlatformIntegration[] = [
link: 'https://docs.sentry.io/platforms/javascript/guides/vue/',
},
{
- id: 'bun',
- name: 'Bun',
+ id: 'kotlin',
+ name: 'Kotlin',
type: 'language',
- language: 'bun',
- link: 'https://docs.sentry.io/platforms/javascript/guides/bun/',
+ language: 'kotlin',
+ link: 'https://docs.sentry.io/platforms/kotlin/',
},
-];
-
-const javaPlatforms: PlatformIntegration[] = [
{
- id: 'java',
- name: 'Java',
+ id: 'minidump',
+ name: 'Minidump',
+ type: 'framework',
+ language: 'minidump',
+ link: 'https://docs.sentry.io/platforms/native/minidump/',
+ },
+ {
+ id: 'native',
+ name: 'Native',
type: 'language',
- language: 'java',
- link: 'https://docs.sentry.io/platforms/java/',
+ language: 'native',
+ link: 'https://docs.sentry.io/platforms/native/',
},
{
- id: 'java-log4j2',
- name: 'Log4j 2.x',
+ id: 'native-qt',
+ name: 'Qt',
type: 'framework',
- language: 'java',
- link: 'https://docs.sentry.io/platforms/java/guides/log4j2/',
+ language: 'native',
+ link: 'https://docs.sentry.io/platforms/native/guides/qt/',
},
{
- id: 'java-logback',
- name: 'Logback',
- type: 'framework',
- language: 'java',
- link: 'https://docs.sentry.io/platforms/java/guides/logback/',
+ id: 'node',
+ name: 'Node.js',
+ type: 'language',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/',
},
{
- id: 'java-spring',
- name: 'Spring',
+ id: 'node-awslambda',
+ name: 'AWS Lambda (Node)',
type: 'framework',
- language: 'java',
- link: 'https://https://docs.sentry.io/platforms/java/guides/spring/',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/guides/aws-lambda/',
},
{
- id: 'java-spring-boot',
- name: 'Spring Boot',
+ id: 'node-azurefunctions',
+ name: 'Azure Functions (Node)',
type: 'framework',
- language: 'java',
- link: 'https://docs.sentry.io/platforms/java/guides/spring-boot/',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/guides/azure-functions/',
+ },
+ {
+ id: 'node-connect',
+ name: 'Connect',
+ type: 'framework',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/guides/connect/',
+ },
+ {
+ id: 'node-express',
+ name: 'Express',
+ type: 'framework',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/guides/express/',
+ },
+ {
+ id: 'node-gcpfunctions',
+ name: 'Google Cloud Functions (Node)',
+ type: 'framework',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/guides/gcp-functions/',
+ },
+ {
+ id: 'node-koa',
+ name: 'Koa',
+ type: 'framework',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/guides/koa/',
+ },
+ {
+ id: 'node-serverlesscloud',
+ name: 'Serverless (Node)',
+ type: 'framework',
+ language: 'node',
+ link: 'https://docs.sentry.io/platforms/node/guides/serverless-cloud/',
+ },
+ {
+ id: 'php',
+ name: 'PHP',
+ type: 'language',
+ language: 'php',
+ link: 'https://docs.sentry.io/platforms/php/',
+ },
+ {
+ id: 'php-laravel',
+ name: 'Laravel',
+ type: 'framework',
+ language: 'php',
+ link: 'https://docs.sentry.io/platforms/php/guides/laravel/',
+ },
+ {
+ id: 'php-symfony',
+ name: 'Symfony',
+ type: 'framework',
+ language: 'php',
+ link: 'https://docs.sentry.io/platforms/php/guides/symfony/',
+ },
+ {
+ id: 'python',
+ name: 'Python',
+ type: 'language',
+ language: 'python',
+ link: 'https://docs.sentry.io/platforms/python/',
},
-];
-
-const pythonPlatforms: PlatformIntegration[] = [
{
id: 'python-aiohttp',
name: 'AIOHTTP',
@@ -258,13 +508,6 @@ const pythonPlatforms: PlatformIntegration[] = [
language: 'python',
link: 'https://docs.sentry.io/platforms/python/guides/gcp-functions/',
},
- {
- id: 'python-pymongo',
- name: 'PyMongo',
- type: 'library',
- language: 'python',
- link: 'https://docs.sentry.io/platforms/python/guides/pymongo/',
- },
{
id: 'python-pylons',
name: 'Pylons',
@@ -272,6 +515,13 @@ const pythonPlatforms: PlatformIntegration[] = [
language: 'python',
link: 'https://docs.sentry.io/platforms/python/legacy-sdk/integrations/pylons/',
},
+ {
+ id: 'python-pymongo',
+ name: 'PyMongo',
+ type: 'library',
+ language: 'python',
+ link: 'https://docs.sentry.io/platforms/python/guides/pymongo/',
+ },
{
id: 'python-pyramid',
name: 'Pyramid',
@@ -279,13 +529,6 @@ const pythonPlatforms: PlatformIntegration[] = [
language: 'python',
link: 'https://docs.sentry.io/platforms/python/pyramid/',
},
- {
- id: 'python',
- name: 'Python',
- type: 'language',
- language: 'python',
- link: 'https://docs.sentry.io/platforms/python/',
- },
{
id: 'python-quart',
name: 'Quart',
@@ -342,189 +585,20 @@ const pythonPlatforms: PlatformIntegration[] = [
language: 'python',
link: 'https://docs.sentry.io/platforms/python/guides/wsgi/',
},
-];
-
-const phpPlatforms: PlatformIntegration[] = [
- {
- id: 'php-laravel',
- name: 'Laravel',
- type: 'framework',
- language: 'php',
- link: 'https://docs.sentry.io/platforms/php/guides/laravel/',
- },
- {
- id: 'php',
- name: 'PHP',
- type: 'language',
- language: 'php',
- link: 'https://docs.sentry.io/platforms/php/',
- },
- {
- id: 'php-symfony',
- name: 'Symfony',
- type: 'framework',
- language: 'php',
- link: 'https://docs.sentry.io/platforms/php/guides/symfony/',
- },
-];
-
-const nodePlatforms: PlatformIntegration[] = [
- {
- id: 'node-awslambda',
- name: 'AWS Lambda (Node)',
- type: 'framework',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/guides/aws-lambda/',
- },
- {
- id: 'node-azurefunctions',
- name: 'Azure Functions (Node)',
- type: 'framework',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/guides/azure-functions/',
- },
{
- id: 'node-connect',
- name: 'Connect',
- type: 'framework',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/guides/connect/',
- },
- {
- id: 'node-express',
- name: 'Express',
- type: 'framework',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/guides/express/',
- },
- {
- id: 'node-gcpfunctions',
- name: 'Google Cloud Functions (Node)',
- type: 'framework',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/guides/gcp-functions/',
- },
- {
- id: 'node-koa',
- name: 'Koa',
- type: 'framework',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/guides/koa/',
- },
- {
- id: 'node',
- name: 'Node.js',
- type: 'language',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/',
- },
- {
- id: 'node-serverlesscloud',
- name: 'Serverless (Node)',
- type: 'framework',
- language: 'node',
- link: 'https://docs.sentry.io/platforms/node/guides/serverless-cloud/',
- },
-];
-
-const dotNetPlatforms: PlatformIntegration[] = [
- {
- id: 'dotnet',
- name: '.NET',
- type: 'language',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/',
- },
- {
- id: 'dotnet-aspnet',
- name: 'ASP.NET',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/aspnet/',
- },
- {
- id: 'dotnet-aspnetcore',
- name: 'ASP.NET Core',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/aspnetcore/',
- },
- {
- id: 'dotnet-awslambda',
- name: 'AWS Lambda (.NET)',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/aws-lambda/',
- },
- {
- id: 'dotnet-gcpfunctions',
- name: 'Google Cloud Functions (.NET)',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/google-cloud-functions/',
- },
- {
- id: 'dotnet-maui',
- name: 'Multi-platform App UI (MAUI)',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/maui/',
- },
- {
- id: 'dotnet-uwp',
- name: 'UWP',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/uwp/',
- },
- {
- id: 'dotnet-wpf',
- name: 'WPF',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/wpf/',
- },
- {
- id: 'dotnet-winforms',
- name: 'Windows Forms',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/winforms/',
- },
- {
- id: 'dotnet-xamarin',
- name: 'Xamarin',
- type: 'framework',
- language: 'dotnet',
- link: 'https://docs.sentry.io/platforms/dotnet/guides/xamarin/',
- },
-];
-
-const applePlatforms: PlatformIntegration[] = [
- {
- id: 'apple',
- name: 'Apple',
- type: 'language',
- language: 'apple',
- link: 'https://docs.sentry.io/platforms/apple/',
- },
- {
- id: 'apple-ios',
- name: 'iOS',
+ id: 'react-native',
+ name: 'React Native',
type: 'language',
- language: 'apple',
- link: 'https://docs.sentry.io/platforms/apple/',
+ language: 'react-native',
+ link: 'https://docs.sentry.io/platforms/react-native/',
},
{
- id: 'apple-macos',
- name: 'macOS',
+ id: 'ruby',
+ name: 'Ruby',
type: 'language',
- language: 'apple',
- link: 'https://docs.sentry.io/platforms/apple/',
+ language: 'ruby',
+ link: 'https://docs.sentry.io/platforms/ruby/',
},
-];
-
-const rubyPlatforms: PlatformIntegration[] = [
{
id: 'ruby-rack',
name: 'Rack Middleware',
@@ -539,103 +613,6 @@ const rubyPlatforms: PlatformIntegration[] = [
language: 'ruby',
link: 'https://docs.sentry.io/platforms/ruby/guides/rails/',
},
- {
- id: 'ruby',
- name: 'Ruby',
- type: 'language',
- language: 'ruby',
- link: 'https://docs.sentry.io/platforms/ruby/',
- },
-];
-
-const nativePlatforms: PlatformIntegration[] = [
- {
- id: 'native',
- name: 'Native',
- type: 'language',
- language: 'native',
- link: 'https://docs.sentry.io/platforms/native/',
- },
- {
- id: 'native-qt',
- name: 'Qt',
- type: 'framework',
- language: 'native',
- link: 'https://docs.sentry.io/platforms/native/guides/qt/',
- },
-];
-
-const miscPlatforms: PlatformIntegration[] = [
- {
- id: 'android',
- name: 'Android',
- type: 'framework',
- language: 'android',
- link: 'https://docs.sentry.io/platforms/android/',
- },
- {
- id: 'capacitor',
- name: 'Capacitor',
- type: 'framework',
- language: 'capacitor',
- link: 'https://docs.sentry.io/platforms/javascript/guides/capacitor/',
- },
- {
- id: 'cordova',
- name: 'Cordova',
- type: 'language',
- language: 'cordova',
- link: 'https://docs.sentry.io/platforms/javascript/guides/cordova/',
- },
- {
- id: 'dart',
- name: 'Dart',
- type: 'framework',
- language: 'dart',
- link: 'https://docs.sentry.io/platforms/dart/',
- },
- {
- id: 'electron',
- name: 'Electron',
- type: 'language',
- language: 'electron',
- link: 'https://docs.sentry.io/platforms/javascript/guides/electron/',
- },
- {
- id: 'elixir',
- name: 'Elixir',
- type: 'language',
- language: 'elixir',
- link: 'https://docs.sentry.io/platforms/elixir/',
- },
- {
- id: 'flutter',
- name: 'Flutter',
- type: 'framework',
- language: 'flutter',
- link: 'https://docs.sentry.io/platforms/flutter/',
- },
- {
- id: 'ionic',
- name: 'Ionic',
- type: 'framework',
- language: 'ionic',
- link: 'https://docs.sentry.io/platforms/javascript/guides/capacitor/',
- },
- {
- id: 'kotlin',
- name: 'Kotlin',
- type: 'language',
- language: 'kotlin',
- link: 'https://docs.sentry.io/platforms/kotlin/',
- },
- {
- id: 'minidump',
- name: 'Minidump',
- type: 'framework',
- language: 'minidump',
- link: 'https://docs.sentry.io/platforms/native/minidump/',
- },
{
id: 'rust',
name: 'Rust',
@@ -657,13 +634,6 @@ const miscPlatforms: PlatformIntegration[] = [
language: 'unreal',
link: 'https://docs.sentry.io/platforms/unreal/',
},
- {
- id: 'react-native',
- name: 'React Native',
- type: 'language',
- language: 'react-native',
- link: 'https://docs.sentry.io/platforms/react-native/',
- },
];
export const otherPlatform: PlatformIntegration = {
@@ -674,27 +644,9 @@ export const otherPlatform: PlatformIntegration = {
link: 'https://docs.sentry.io/platforms/',
};
-// If you update items of this list, please remember to update the "GETTING_STARTED_DOCS_PLATFORMS" list
-// in the 'src/sentry/models/project.py' file. This way, they'll work together correctly.
-// Otherwise, creating a project will cause an error in the backend, saying "Invalid platform".
-const allPlatforms = [
- ...javaScriptPlatforms,
- ...nodePlatforms,
- ...dotNetPlatforms,
- ...applePlatforms,
- ...javaPlatforms,
- ...pythonPlatforms,
- ...phpPlatforms,
- ...goPlatforms,
- ...rubyPlatforms,
- ...nativePlatforms,
- ...miscPlatforms,
- otherPlatform,
-];
-
/**
* Array of all platforms that are displayed in the project creation flow.
*/
-const platforms = sortBy(allPlatforms, 'id');
+const allPlatforms = [...platforms, otherPlatform];
-export default platforms;
+export default allPlatforms;
|
fabad29e99770880714c63443ebbda0862791258
|
2022-06-29 01:52:50
|
Dane Grant
|
fix(replays): make buffering false when target = previous (#36144)
| false
|
make buffering false when target = previous (#36144)
|
fix
|
diff --git a/static/app/components/replays/replayContext.tsx b/static/app/components/replays/replayContext.tsx
index f6ffeac61d9a96..aa423c0f3b5985 100644
--- a/static/app/components/replays/replayContext.tsx
+++ b/static/app/components/replays/replayContext.tsx
@@ -400,7 +400,9 @@ export function Provider({children, replay, initialTimeOffset = 0, value = {}}:
const currentPlayerTime = useCurrentTime(getCurrentTime);
const [isBuffering, currentTime] =
- buffer.target !== -1 && buffer.previous === currentPlayerTime
+ buffer.target !== -1 &&
+ buffer.previous === currentPlayerTime &&
+ buffer.target !== buffer.previous
? [true, buffer.target]
: [false, currentPlayerTime];
|
12e752c7552bf889b4aef9bf372a70cd24adc505
|
2024-05-14 03:29:11
|
Scott Cooper
|
test(ui): Use built-in test providers (#70795)
| false
|
Use built-in test providers (#70795)
|
test
|
diff --git a/static/app/components/events/eventReplay/replayClipPreview.spec.tsx b/static/app/components/events/eventReplay/replayClipPreview.spec.tsx
index c75197b5595a53..02d7ce494853f0 100644
--- a/static/app/components/events/eventReplay/replayClipPreview.spec.tsx
+++ b/static/app/components/events/eventReplay/replayClipPreview.spec.tsx
@@ -1,5 +1,4 @@
import {duration} from 'moment';
-import {OrganizationFixture} from 'sentry-fixture/organization';
import {ProjectFixture} from 'sentry-fixture/project';
import {RRWebInitFrameEventsFixture} from 'sentry-fixture/replay/rrweb';
import {ReplayRecordFixture} from 'sentry-fixture/replayRecord';
@@ -11,8 +10,6 @@ import type {DetailedOrganization} from 'sentry/types/organization';
import useReplayReader from 'sentry/utils/replays/hooks/useReplayReader';
import ReplayReader from 'sentry/utils/replays/replayReader';
import type RequestError from 'sentry/utils/requestError/requestError';
-import {OrganizationContext} from 'sentry/views/organizationContext';
-import {RouteContext} from 'sentry/views/routeContext';
import ReplayClipPreview from './replayClipPreview';
@@ -68,7 +65,8 @@ const render = (
children: React.ReactElement,
orgParams: Partial<DetailedOrganization> = {}
) => {
- const {router, routerContext} = initializeOrg({
+ const {routerContext, organization} = initializeOrg({
+ organization: {slug: mockOrgSlug, ...orgParams},
router: {
routes: [
{path: '/'},
@@ -82,23 +80,10 @@ const render = (
},
});
- return baseRender(
- <RouteContext.Provider
- value={{
- router,
- location: router.location,
- params: router.params,
- routes: router.routes,
- }}
- >
- <OrganizationContext.Provider
- value={OrganizationFixture({slug: mockOrgSlug, ...orgParams})}
- >
- {children}
- </OrganizationContext.Provider>
- </RouteContext.Provider>,
- {context: routerContext}
- );
+ return baseRender(children, {
+ context: routerContext,
+ organization,
+ });
};
const mockIsFullscreen = jest.fn();
diff --git a/static/app/components/featureFeedback/feedbackModal.spec.tsx b/static/app/components/featureFeedback/feedbackModal.spec.tsx
index 61e8ea0ea490ae..4a8fc43769426a 100644
--- a/static/app/components/featureFeedback/feedbackModal.spec.tsx
+++ b/static/app/components/featureFeedback/feedbackModal.spec.tsx
@@ -1,7 +1,6 @@
import {Fragment} from 'react';
import * as Sentry from '@sentry/react';
-import {initializeOrg} from 'sentry-test/initializeOrg';
import {
act,
renderGlobalModal,
@@ -14,24 +13,6 @@ import * as indicators from 'sentry/actionCreators/indicator';
import {openModal} from 'sentry/actionCreators/modal';
import {FeedbackModal} from 'sentry/components/featureFeedback/feedbackModal';
import TextField from 'sentry/components/forms/fields/textField';
-import {RouteContext} from 'sentry/views/routeContext';
-
-function ComponentProviders({children}: {children: React.ReactNode}) {
- const {router} = initializeOrg();
-
- return (
- <RouteContext.Provider
- value={{
- router,
- location: router.location,
- params: {},
- routes: [],
- }}
- >
- {children}
- </RouteContext.Provider>
- );
-}
describe('FeatureFeedback', function () {
describe('default', function () {
@@ -47,11 +28,7 @@ describe('FeatureFeedback', function () {
renderGlobalModal();
act(() =>
- openModal(modalProps => (
- <ComponentProviders>
- <FeedbackModal {...modalProps} featureName="test" />
- </ComponentProviders>
- ))
+ openModal(modalProps => <FeedbackModal {...modalProps} featureName="test" />)
);
// Form fields
@@ -105,13 +82,11 @@ describe('FeatureFeedback', function () {
act(() =>
openModal(modalProps => (
- <ComponentProviders>
- <FeedbackModal
- {...modalProps}
- featureName="test"
- feedbackTypes={['Custom feedback type A', 'Custom feedback type B']}
- />
- </ComponentProviders>
+ <FeedbackModal
+ {...modalProps}
+ featureName="test"
+ feedbackTypes={['Custom feedback type A', 'Custom feedback type B']}
+ />
))
);
@@ -130,13 +105,11 @@ describe('FeatureFeedback', function () {
act(() =>
openModal(modalProps => (
- <ComponentProviders>
- <FeedbackModal
- {...modalProps}
- featureName="test"
- secondaryAction={<a href="#">Test Secondary Action Link</a>}
- />
- </ComponentProviders>
+ <FeedbackModal
+ {...modalProps}
+ featureName="test"
+ secondaryAction={<a href="#">Test Secondary Action Link</a>}
+ />
))
);
@@ -161,53 +134,51 @@ describe('FeatureFeedback', function () {
act(() =>
openModal(modalProps => (
- <ComponentProviders>
- <FeedbackModal
- {...modalProps}
- featureName="test"
- initialData={{step: 0, name: null, surname: null}}
- >
- {({Header, Body, Footer, state, onFieldChange}) => {
- if (state.step === 0) {
- return (
- <Fragment>
- <Header>First Step</Header>
- <Body>
- <TextField
- label="Name"
- value={state.name}
- name="name"
- onChange={value => onFieldChange('name', value)}
- />
- </Body>
- <Footer onNext={() => onFieldChange('step', 1)} />
- </Fragment>
- );
- }
-
+ <FeedbackModal
+ {...modalProps}
+ featureName="test"
+ initialData={{step: 0, name: null, surname: null}}
+ >
+ {({Header, Body, Footer, state, onFieldChange}) => {
+ if (state.step === 0) {
return (
<Fragment>
- <Header>Last Step</Header>
+ <Header>First Step</Header>
<Body>
<TextField
- label="Surname"
- value={state.surname}
- name="surname"
- onChange={value => onFieldChange('surname', value)}
+ label="Name"
+ value={state.name}
+ name="name"
+ onChange={value => onFieldChange('name', value)}
/>
</Body>
- <Footer
- onBack={() => onFieldChange('step', 0)}
- primaryDisabledReason={
- !state.surname ? 'Please answer at least one question' : undefined
- }
- submitEventData={{message: 'Feedback: test'}}
- />
+ <Footer onNext={() => onFieldChange('step', 1)} />
</Fragment>
);
- }}
- </FeedbackModal>
- </ComponentProviders>
+ }
+
+ return (
+ <Fragment>
+ <Header>Last Step</Header>
+ <Body>
+ <TextField
+ label="Surname"
+ value={state.surname}
+ name="surname"
+ onChange={value => onFieldChange('surname', value)}
+ />
+ </Body>
+ <Footer
+ onBack={() => onFieldChange('step', 0)}
+ primaryDisabledReason={
+ !state.surname ? 'Please answer at least one question' : undefined
+ }
+ submitEventData={{message: 'Feedback: test'}}
+ />
+ </Fragment>
+ );
+ }}
+ </FeedbackModal>
))
);
diff --git a/static/app/views/performance/content.spec.tsx b/static/app/views/performance/content.spec.tsx
index a0124ec5498893..cace2fd9d5bb1d 100644
--- a/static/app/views/performance/content.spec.tsx
+++ b/static/app/views/performance/content.spec.tsx
@@ -2,7 +2,6 @@ import {OrganizationFixture} from 'sentry-fixture/organization';
import {ProjectFixture} from 'sentry-fixture/project';
import {initializeOrg} from 'sentry-test/initializeOrg';
-import {makeTestQueryClient} from 'sentry-test/queryClient';
import {act, render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
import * as pageFilters from 'sentry/actionCreators/pageFilters';
@@ -11,32 +10,16 @@ import ProjectsStore from 'sentry/stores/projectsStore';
import TeamStore from 'sentry/stores/teamStore';
import {browserHistory} from 'sentry/utils/browserHistory';
import {MEPSettingProvider} from 'sentry/utils/performance/contexts/metricsEnhancedSetting';
-import {QueryClientProvider} from 'sentry/utils/queryClient';
-import {OrganizationContext} from 'sentry/views/organizationContext';
import PerformanceContent from 'sentry/views/performance/content';
import {DEFAULT_MAX_DURATION} from 'sentry/views/performance/trends/utils';
-import {RouteContext} from 'sentry/views/routeContext';
const FEATURES = ['performance-view'];
-function WrappedComponent({organization, router}) {
+function WrappedComponent({router}) {
return (
- <QueryClientProvider client={makeTestQueryClient()}>
- <RouteContext.Provider
- value={{
- location: router.location,
- params: {},
- router,
- routes: [],
- }}
- >
- <OrganizationContext.Provider value={organization}>
- <MEPSettingProvider>
- <PerformanceContent router={router} location={router.location} />
- </MEPSettingProvider>
- </OrganizationContext.Provider>
- </RouteContext.Provider>
- </QueryClientProvider>
+ <MEPSettingProvider>
+ <PerformanceContent router={router} location={router.location} />
+ </MEPSettingProvider>
);
}
@@ -293,7 +276,7 @@ describe('Performance > Content', function () {
const projects = [ProjectFixture({firstTransactionEvent: true})];
const data = initializeData(projects, {});
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
@@ -309,7 +292,7 @@ describe('Performance > Content', function () {
];
const data = initializeData(projects, {project: [1]});
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
@@ -325,7 +308,7 @@ describe('Performance > Content', function () {
];
const data = initializeData(projects, {project: ['-1']});
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
expect(await screen.findByTestId('performance-landing-v3')).toBeInTheDocument();
@@ -336,7 +319,7 @@ describe('Performance > Content', function () {
const projects = [ProjectFixture({id: '1', firstTransactionEvent: true})];
const data = initializeData(projects, {project: ['1'], query: 'sentry:yes'});
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
@@ -357,7 +340,7 @@ describe('Performance > Content', function () {
it('Default period for trends does not call updateDateTime', async function () {
const data = initializeTrendsData({query: 'tag:value'}, false);
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
@@ -372,7 +355,7 @@ describe('Performance > Content', function () {
statsPeriod: '24h',
});
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
@@ -401,7 +384,7 @@ describe('Performance > Content', function () {
];
const data = initializeData(projects, {view: undefined});
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
expect(await screen.findByTestId('performance-landing-v3')).toBeInTheDocument();
@@ -412,7 +395,7 @@ describe('Performance > Content', function () {
it('Default page (transactions) with trends feature will not update filters if none are set', async function () {
const data = initializeTrendsData({view: undefined}, false);
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
expect(await screen.findByTestId('performance-landing-v3')).toBeInTheDocument();
@@ -422,7 +405,7 @@ describe('Performance > Content', function () {
it('Tags are replaced with trends default query if navigating to trends', async function () {
const data = initializeTrendsData({query: 'device.family:Mac'}, false);
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
@@ -447,7 +430,7 @@ describe('Performance > Content', function () {
];
const data = initializeData(projects, {view: undefined});
- render(<WrappedComponent organization={data.organization} router={data.router} />, {
+ render(<WrappedComponent router={data.router} />, {
context: data.routerContext,
});
diff --git a/static/app/views/performance/transactionSummary/transactionReplays/index.spec.tsx b/static/app/views/performance/transactionSummary/transactionReplays/index.spec.tsx
index 211c8d52113be6..82e193fff6fc17 100644
--- a/static/app/views/performance/transactionSummary/transactionReplays/index.spec.tsx
+++ b/static/app/views/performance/transactionSummary/transactionReplays/index.spec.tsx
@@ -10,9 +10,7 @@ import {
SPAN_OP_BREAKDOWN_FIELDS,
SPAN_OP_RELATIVE_BREAKDOWN_FIELD,
} from 'sentry/utils/discover/fields';
-import {OrganizationContext} from 'sentry/views/organizationContext';
import TransactionReplays from 'sentry/views/performance/transactionSummary/transactionReplays';
-import {RouteContext} from 'sentry/views/routeContext';
type InitializeOrgProps = {
location?: {
@@ -32,16 +30,11 @@ jest.mock('sentry/utils/useMedia', () => ({
const mockEventsUrl = '/organizations/org-slug/events/';
const mockReplaysUrl = '/organizations/org-slug/replays/';
-let mockRouterContext: {
- childContextTypes?: any;
- context?: any;
-} = {};
-
-const getComponent = ({
+const renderComponent = ({
location,
organizationProps = {features: ['performance-view', 'session-replay']},
-}: InitializeOrgProps) => {
- const {router, organization, routerContext} = initializeOrg({
+}: InitializeOrgProps = {}) => {
+ const {organization, routerContext} = initializeOrg({
organization: {
...organizationProps,
},
@@ -67,26 +60,7 @@ const getComponent = ({
ProjectsStore.init();
ProjectsStore.loadInitialData(organization.projects);
- mockRouterContext = routerContext;
-
- return (
- <OrganizationContext.Provider value={organization}>
- <RouteContext.Provider
- value={{
- router,
- location: router.location,
- params: router.params,
- routes: router.routes,
- }}
- >
- <TransactionReplays />
- </RouteContext.Provider>
- </OrganizationContext.Provider>
- );
-};
-
-const renderComponent = (componentProps: InitializeOrgProps = {}) => {
- return render(getComponent(componentProps), {context: mockRouterContext});
+ return render(<TransactionReplays />, {context: routerContext, organization});
};
describe('TransactionReplays', () => {
diff --git a/static/app/views/performance/transactionSummary/transactionVitals/index.spec.tsx b/static/app/views/performance/transactionSummary/transactionVitals/index.spec.tsx
index 902cebc664591d..d063bc715c9a70 100644
--- a/static/app/views/performance/transactionSummary/transactionVitals/index.spec.tsx
+++ b/static/app/views/performance/transactionSummary/transactionVitals/index.spec.tsx
@@ -1,4 +1,4 @@
-import type {Location, Query} from 'history';
+import type {Query} from 'history';
import {OrganizationFixture} from 'sentry-fixture/organization';
import {ProjectFixture} from 'sentry-fixture/project';
@@ -12,9 +12,8 @@ import {
} from 'sentry-test/reactTestingLibrary';
import ProjectsStore from 'sentry/stores/projectsStore';
-import type {Organization as TOrganization, Project} from 'sentry/types';
+import type {Project} from 'sentry/types';
import {browserHistory} from 'sentry/utils/browserHistory';
-import {OrganizationContext} from 'sentry/views/organizationContext';
import TransactionVitals from 'sentry/views/performance/transactionSummary/transactionVitals';
import {
VITAL_GROUPS,
@@ -59,20 +58,6 @@ function initialize({
return data;
}
-function WrappedComponent({
- location,
- organization,
-}: {
- location: Location;
- organization: TOrganization;
-}) {
- return (
- <OrganizationContext.Provider value={organization}>
- <TransactionVitals location={location} organization={organization} />
- </OrganizationContext.Provider>
- );
-}
-
/**
* These values are what we expect to see on the page based on the
* mocked api responses below.
@@ -193,8 +178,9 @@ describe('Performance > Web Vitals', function () {
features: [],
});
- render(<WrappedComponent organization={organization} location={router.location} />, {
+ render(<TransactionVitals organization={organization} location={router.location} />, {
context: routerContext,
+ organization,
});
expect(screen.getByText("You don't have access to this feature")).toBeInTheDocument();
});
@@ -204,8 +190,9 @@ describe('Performance > Web Vitals', function () {
transaction: '/organizations/:orgId/',
});
- render(<WrappedComponent organization={organization} location={router.location} />, {
+ render(<TransactionVitals organization={organization} location={router.location} />, {
context: routerContext,
+ organization,
});
expect(
@@ -220,8 +207,9 @@ describe('Performance > Web Vitals', function () {
it('renders the correct bread crumbs', function () {
const {organization, router, routerContext} = initialize();
- render(<WrappedComponent organization={organization} location={router.location} />, {
+ render(<TransactionVitals organization={organization} location={router.location} />, {
context: routerContext,
+ organization,
});
expect(screen.getByRole('navigation')).toHaveTextContent('PerformanceWeb Vitals');
@@ -232,8 +220,8 @@ describe('Performance > Web Vitals', function () {
beforeEach(() => {
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
});
@@ -248,8 +236,8 @@ describe('Performance > Web Vitals', function () {
const {organization, router, routerContext} = initialize();
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
expect(screen.getByRole('button', {name: 'Reset View'})).toBeDisabled();
@@ -263,8 +251,8 @@ describe('Performance > Web Vitals', function () {
});
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
expect(screen.getByRole('button', {name: 'Reset View'})).toBeEnabled();
@@ -278,8 +266,8 @@ describe('Performance > Web Vitals', function () {
});
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
expect(screen.getByRole('button', {name: 'Reset View'})).toBeEnabled();
@@ -294,8 +282,8 @@ describe('Performance > Web Vitals', function () {
});
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
expect(screen.getByRole('button', {name: 'Reset View'})).toBeEnabled();
@@ -310,8 +298,8 @@ describe('Performance > Web Vitals', function () {
});
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
await userEvent.click(screen.getByRole('button', {name: 'Reset View'}));
@@ -342,8 +330,8 @@ describe('Performance > Web Vitals', function () {
});
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
await waitForElementToBeRemoved(() =>
@@ -365,8 +353,8 @@ describe('Performance > Web Vitals', function () {
});
render(
- <WrappedComponent organization={organization} location={router.location} />,
- {context: routerContext}
+ <TransactionVitals organization={organization} location={router.location} />,
+ {context: routerContext, organization}
);
await waitForElementToBeRemoved(() =>
@@ -399,8 +387,9 @@ describe('Performance > Web Vitals', function () {
},
});
- render(<WrappedComponent organization={organization} location={router.location} />, {
+ render(<TransactionVitals organization={organization} location={router.location} />, {
context: routerContext,
+ organization,
});
await waitForElementToBeRemoved(() => screen.queryAllByTestId('loading-placeholder'));
diff --git a/static/app/views/releases/thresholdsList/thresholdGroupRows.spec.tsx b/static/app/views/releases/thresholdsList/thresholdGroupRows.spec.tsx
index 4e02090169b2c5..9cb3f37654e584 100644
--- a/static/app/views/releases/thresholdsList/thresholdGroupRows.spec.tsx
+++ b/static/app/views/releases/thresholdsList/thresholdGroupRows.spec.tsx
@@ -4,7 +4,6 @@ import {initializeOrg} from 'sentry-test/initializeOrg';
import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
import type {Organization} from 'sentry/types/organization';
-import {OrganizationContext} from 'sentry/views/organizationContext';
import type {Threshold} from 'sentry/views/releases/utils/types';
import {ThresholdGroupRows, type ThresholdGroupRowsProps} from './thresholdGroupRows';
@@ -34,35 +33,21 @@ describe('ThresholdGroupRows', () => {
...thresholdData,
});
- const wrapper = (org: Organization = organization) => {
- return function WrappedComponent({children}) {
- return (
- <OrganizationContext.Provider value={org}>
- {children}
- </OrganizationContext.Provider>
- );
- };
- };
-
- type RenderProps = ThresholdGroupRowsProps & {org: Organization};
- const DEFAULT_PROPS: RenderProps = {
+ const DEFAULT_PROPS: ThresholdGroupRowsProps = {
allEnvironmentNames: ['test'],
project: ProjectFixture(),
refetch: () => {},
setTempError: () => {},
- org: organization,
threshold: undefined,
};
- const renderComponent = (props: Partial<RenderProps> = DEFAULT_PROPS) => {
- const {org, ...thresholdProps} = props;
- const Wrapper = wrapper(org);
-
- return render(
- <Wrapper>
- <ThresholdGroupRows {...DEFAULT_PROPS} {...thresholdProps} />
- </Wrapper>
- );
+ const renderComponent = (
+ thresholdProps: Partial<ThresholdGroupRowsProps> = DEFAULT_PROPS,
+ org: Organization = organization
+ ) => {
+ return render(<ThresholdGroupRows {...DEFAULT_PROPS} {...thresholdProps} />, {
+ organization: org,
+ });
};
const mockThresholdApis = (data = {}) => {
@@ -145,7 +130,7 @@ describe('ThresholdGroupRows', () => {
});
const mocks = mockThresholdApis();
- renderComponent({threshold, org});
+ renderComponent({threshold}, org);
expect(await screen.findByText(threshold.value)).toBeInTheDocument();
@@ -183,7 +168,7 @@ describe('ThresholdGroupRows', () => {
});
const mocks = mockThresholdApis();
- renderComponent({threshold, org});
+ renderComponent({threshold}, org);
expect(await screen.findByText(threshold.value)).toBeInTheDocument();
@@ -229,7 +214,7 @@ describe('ThresholdGroupRows', () => {
},
});
- renderComponent({threshold, org});
+ renderComponent({threshold}, org);
await createThreshold();
expect(mockApi).toHaveBeenCalled();
|
b011292424c5555d3f3f4d95a7e9f4b3720a77da
|
2025-02-03 14:54:54
|
Priscila Oliveira
|
ref(issue-guides-content): Add quick start pendo item to issue (#84414)
| false
|
Add quick start pendo item to issue (#84414)
|
ref
|
diff --git a/static/app/components/assistant/getGuidesContent.tsx b/static/app/components/assistant/getGuidesContent.tsx
index 0f4d1f8a7d9d9f..c8058320eb49f8 100644
--- a/static/app/components/assistant/getGuidesContent.tsx
+++ b/static/app/components/assistant/getGuidesContent.tsx
@@ -66,6 +66,13 @@ export default function getGuidesContent(
and triage through issue management tools like Jira. `
),
},
+ {
+ title: t('Quick Setup'),
+ target: 'onboarding_sidebar',
+ description: t(
+ 'Walk through this guide to get the most out of Sentry right away.'
+ ),
+ },
],
},
{
diff --git a/static/app/components/sidebar/onboardingStatus.tsx b/static/app/components/sidebar/onboardingStatus.tsx
index bdda2498cef835..a5f97c60051ac9 100644
--- a/static/app/components/sidebar/onboardingStatus.tsx
+++ b/static/app/components/sidebar/onboardingStatus.tsx
@@ -1,8 +1,9 @@
-import {Fragment, useCallback, useContext, useEffect} from 'react';
+import {useCallback, useContext, useEffect} from 'react';
import type {Theme} from '@emotion/react';
import {css} from '@emotion/react';
import styled from '@emotion/styled';
+import GuideAnchor from 'sentry/components/assistant/guideAnchor';
import {OnboardingContext} from 'sentry/components/onboarding/onboardingContext';
import {OnboardingSidebar} from 'sentry/components/onboardingWizard/sidebar';
import {getMergedTasks} from 'sentry/components/onboardingWizard/taskConfig';
@@ -115,7 +116,7 @@ export function OnboardingStatus({
}
return (
- <Fragment>
+ <GuideAnchor target="onboarding_sidebar" position="right">
<Container
role="button"
aria-label={label}
@@ -166,7 +167,7 @@ export function OnboardingStatus({
beyondBasicsTasks={beyondBasicsTasks}
/>
)}
- </Fragment>
+ </GuideAnchor>
);
}
|
2d553e3c19fb130381f74877be85e7a3803a413c
|
2020-12-10 06:56:47
|
NisanthanNanthakumar
|
feat(integrations): Create instrumented internal ApiClient and extend for Heroku (#22564)
| false
|
Create instrumented internal ApiClient and extend for Heroku (#22564)
|
feat
|
diff --git a/src/sentry/shared_integrations/client.py b/src/sentry/shared_integrations/client.py
index c955bf2bbdaccc..4bc5675240a1fa 100644
--- a/src/sentry/shared_integrations/client.py
+++ b/src/sentry/shared_integrations/client.py
@@ -15,6 +15,7 @@
from sentry.utils import metrics, json
from sentry.utils.hashlib import md5_text
from sentry.utils.decorators import classproperty
+from sentry.api.client import ApiClient
from .exceptions import ApiHostError, ApiTimeoutError, ApiError, UnsupportedResponseType
@@ -115,25 +116,7 @@ def json(self):
return self
-class BaseApiClient(object):
- base_url = None
-
- allow_text = False
-
- allow_redirects = None
-
- integration_type = None
-
- log_path = None
-
- datadog_prefix = None
-
- cache_time = 900
-
- def __init__(self, verify_ssl=True, logging_context=None):
- self.verify_ssl = verify_ssl
- self.logging_context = logging_context
-
+class TrackResponseMixin(object):
@cached_property
def logger(self):
return logging.getLogger(self.log_path)
@@ -146,9 +129,6 @@ def name_field(cls):
def name(cls):
return getattr(cls, cls.name_field)
- def get_cache_prefix(self):
- return u"%s.%s.client:" % (self.integration_type, self.name)
-
def track_response_data(self, code, span, error=None, resp=None):
metrics.incr(
u"%s.http_response" % (self.datadog_prefix),
@@ -171,6 +151,29 @@ def track_response_data(self, code, span, error=None, resp=None):
extra.update(getattr(self, "logging_context", None) or {})
self.logger.info(u"%s.http_response" % (self.integration_type), extra=extra)
+
+class BaseApiClient(TrackResponseMixin):
+ base_url = None
+
+ allow_text = False
+
+ allow_redirects = None
+
+ integration_type = None
+
+ log_path = None
+
+ datadog_prefix = None
+
+ cache_time = 900
+
+ def __init__(self, verify_ssl=True, logging_context=None):
+ self.verify_ssl = verify_ssl
+ self.logging_context = logging_context
+
+ def get_cache_prefix(self):
+ return u"%s.%s.client:" % (self.integration_type, self.name)
+
def build_url(self, path):
if path.startswith("/"):
if not self.base_url:
@@ -310,3 +313,38 @@ def head_cached(self, path, *args, **kwargs):
result = self.head(path, *args, **kwargs)
cache.set(key, result, self.cache_time)
return result
+
+
+class BaseInternalApiClient(ApiClient, TrackResponseMixin):
+ integration_type = None
+
+ log_path = None
+
+ datadog_prefix = None
+
+ def request(self, *args, **kwargs):
+
+ metrics.incr(
+ u"%s.http_request" % self.datadog_prefix,
+ sample_rate=1.0,
+ tags={self.integration_type: self.name},
+ )
+
+ try:
+ with sentry_sdk.configure_scope() as scope:
+ parent_span_id = scope.span.span_id
+ trace_id = scope.span.trace_id
+ except AttributeError:
+ parent_span_id = None
+ trace_id = None
+
+ with sentry_sdk.start_transaction(
+ op=u"{}.http".format(self.integration_type),
+ name=u"{}.http_response.{}".format(self.integration_type, self.name),
+ parent_span_id=parent_span_id,
+ trace_id=trace_id,
+ sampled=True,
+ ) as span:
+ resp = ApiClient.request(self, *args, **kwargs)
+ self.track_response_data(resp.status_code, span, None, resp)
+ return resp
diff --git a/src/sentry_plugins/client.py b/src/sentry_plugins/client.py
index da68efbc3a1f57..e27f51d0e00176 100644
--- a/src/sentry_plugins/client.py
+++ b/src/sentry_plugins/client.py
@@ -1,7 +1,7 @@
from __future__ import absolute_import
-from sentry.shared_integrations.client import BaseApiClient
+from sentry.shared_integrations.client import BaseApiClient, BaseInternalApiClient
from sentry.shared_integrations.exceptions import ApiUnauthorized
@@ -62,3 +62,13 @@ def _request(self, method, path, **kwargs):
self.auth.refresh_token()
kwargs = self.bind_auth(**kwargs)
return ApiClient._request(self, method, path, **kwargs)
+
+
+class InternalApiClient(BaseInternalApiClient):
+ integration_type = "plugin"
+
+ datadog_prefix = "sentry-plugins"
+
+ log_path = "sentry.plugins.client"
+
+ plugin_name = "undefined"
diff --git a/src/sentry_plugins/heroku/client.py b/src/sentry_plugins/heroku/client.py
new file mode 100644
index 00000000000000..c39592b0df9ee0
--- /dev/null
+++ b/src/sentry_plugins/heroku/client.py
@@ -0,0 +1,10 @@
+from __future__ import absolute_import
+
+from sentry_plugins.client import InternalApiClient
+
+
+class HerokuApiClient(InternalApiClient):
+ plugin_name = "heroku"
+
+ def __init__(self):
+ super(HerokuApiClient, self).__init__()
diff --git a/src/sentry_plugins/heroku/plugin.py b/src/sentry_plugins/heroku/plugin.py
index 0fff027423b522..7a3bc9bd14bddf 100644
--- a/src/sentry_plugins/heroku/plugin.py
+++ b/src/sentry_plugins/heroku/plugin.py
@@ -2,8 +2,6 @@
import logging
-from sentry.api import client
-
from sentry.models import ApiKey, User, ProjectOption, Repository
from sentry.plugins.interfaces.releasehook import ReleaseHook
from sentry_plugins.base import CorePluginMixin
@@ -11,11 +9,21 @@
from sentry.plugins.bases import ReleaseTrackingPlugin
from sentry.integrations import FeatureDescription, IntegrationFeatures
+from .client import HerokuApiClient
logger = logging.getLogger("sentry.plugins.heroku")
class HerokuReleaseHook(ReleaseHook):
+ def get_auth(self):
+ try:
+ return ApiKey(organization=self.project.organization, scope_list=["project:write"])
+ except ApiKey.DoesNotExist:
+ return None
+
+ def get_client(self):
+ return HerokuApiClient()
+
def handle(self, request):
email = None
if "user" in request.POST:
@@ -77,8 +85,8 @@ def set_refs(self, release, **values):
endpoint = u"/organizations/{}/releases/{}/deploys/".format(
self.project.organization.slug, release.version
)
- auth = ApiKey(organization=self.project.organization, scope_list=["project:write"])
- client.post(endpoint, data={"environment": deploy_project_option}, auth=auth)
+ client = self.get_client()
+ client.post(endpoint, data={"environment": deploy_project_option}, auth=self.get_auth())
class HerokuPlugin(CorePluginMixin, ReleaseTrackingPlugin):
|
0ef309ba170fcb1d1d77bede33ea908923a8ec84
|
2024-04-10 21:32:04
|
anthony sottile
|
ref: fix xdist (#68565)
| false
|
fix xdist (#68565)
|
ref
|
diff --git a/src/sentry/utils/env.py b/src/sentry/utils/env.py
index 1c790a3753a888..777ac3efcdf110 100644
--- a/src/sentry/utils/env.py
+++ b/src/sentry/utils/env.py
@@ -13,6 +13,7 @@ def in_test_environment() -> bool:
"pytest" in sys.argv[0]
or "vscode" in sys.argv[0]
or os.environ.get("SENTRY_IN_TEST_ENVIRONMENT") in {"1", "true"}
+ or "PYTEST_XDIST_WORKER" in os.environ
)
|
9380ffe944cf250f77991a5e903511c60be3941f
|
2021-10-25 20:13:07
|
Priscila Oliveira
|
ref(yarn): Add update version (#29541)
| false
|
Add update version (#29541)
|
ref
|
diff --git a/yarn.lock b/yarn.lock
index 141d24eea15a21..b9229d1c2a2262 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2287,32 +2287,6 @@
ts-dedent "^2.0.0"
util-deprecate "^1.0.2"
-"@storybook/[email protected]":
- version "6.3.7"
- resolved "https://registry.yarnpkg.com/@storybook/api/-/api-6.3.7.tgz#88b8a51422cd0739c91bde0b1d65fb6d8a8485d0"
- integrity sha512-57al8mxmE9agXZGo8syRQ8UhvGnDC9zkuwkBPXchESYYVkm3Mc54RTvdAOYDiy85VS4JxiGOywHayCaRwgUddQ==
- dependencies:
- "@reach/router" "^1.3.4"
- "@storybook/channels" "6.3.7"
- "@storybook/client-logger" "6.3.7"
- "@storybook/core-events" "6.3.7"
- "@storybook/csf" "0.0.1"
- "@storybook/router" "6.3.7"
- "@storybook/semver" "^7.3.2"
- "@storybook/theming" "6.3.7"
- "@types/reach__router" "^1.3.7"
- core-js "^3.8.2"
- fast-deep-equal "^3.1.3"
- global "^4.4.0"
- lodash "^4.17.20"
- memoizerific "^1.11.3"
- qs "^6.10.0"
- regenerator-runtime "^0.13.7"
- store2 "^2.12.0"
- telejson "^5.3.2"
- ts-dedent "^2.0.0"
- util-deprecate "^1.0.2"
-
"@storybook/[email protected]":
version "6.3.12"
resolved "https://registry.yarnpkg.com/@storybook/builder-webpack4/-/builder-webpack4-6.3.12.tgz#288d541e2801892721c975259476022da695dbfe"
@@ -2473,15 +2447,6 @@
ts-dedent "^2.0.0"
util-deprecate "^1.0.2"
-"@storybook/[email protected]":
- version "6.3.7"
- resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-6.3.7.tgz#85ed5925522b802d959810f78d37aacde7fea66e"
- integrity sha512-aErXO+SRO8MPp2wOkT2n9d0fby+8yM35tq1tI633B4eQsM74EykbXPv7EamrYPqp1AI4BdiloyEpr0hmr2zlvg==
- dependencies:
- core-js "^3.8.2"
- ts-dedent "^2.0.0"
- util-deprecate "^1.0.2"
-
"@storybook/[email protected]":
version "6.3.12"
resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-6.3.12.tgz#a0c6d72a871d1cb02b4b98675472839061e39b5b"
@@ -2514,14 +2479,6 @@
core-js "^3.8.2"
global "^4.4.0"
-"@storybook/[email protected]":
- version "6.3.7"
- resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-6.3.7.tgz#ff17b7494e7e9e23089b0d5c5364c371c726bdd1"
- integrity sha512-BQRErHE3nIEuUJN/3S3dO1LzxAknOgrFeZLd4UVcH/fvjtS1F4EkhcbH+jNyUWvcWGv66PZYN0oFPEn/g3Savg==
- dependencies:
- core-js "^3.8.2"
- global "^4.4.0"
-
"@storybook/[email protected]", "@storybook/components@^6.3.0":
version "6.3.12"
resolved "https://registry.yarnpkg.com/@storybook/components/-/components-6.3.12.tgz#0c7967c60354c84afa20dfab4753105e49b1927d"
@@ -2636,13 +2593,6 @@
dependencies:
core-js "^3.8.2"
-"@storybook/[email protected]":
- version "6.3.7"
- resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-6.3.7.tgz#c5bc7cae7dc295de73b6b9f671ecbe582582e9bd"
- integrity sha512-l5Hlhe+C/dqxjobemZ6DWBhTOhQoFF3F1Y4kjFGE7pGZl/mas4M72I5I/FUcYCmbk2fbLfZX8hzKkUqS1hdyLA==
- dependencies:
- core-js "^3.8.2"
-
"@storybook/[email protected]":
version "6.3.12"
resolved "https://registry.yarnpkg.com/@storybook/core-server/-/core-server-6.3.12.tgz#d906f823b263d78a4b087be98810b74191d263cd"
@@ -2878,22 +2828,6 @@
qs "^6.10.0"
ts-dedent "^2.0.0"
-"@storybook/[email protected]":
- version "6.3.7"
- resolved "https://registry.yarnpkg.com/@storybook/router/-/router-6.3.7.tgz#1714a99a58a7b9f08b6fcfe2b678dad6ca896736"
- integrity sha512-6tthN8op7H0NoYoE1SkQFJKC42pC4tGaoPn7kEql8XGeUJnxPtVFjrnywlTrRnKuxZKIvbilQBAwDml97XH23Q==
- dependencies:
- "@reach/router" "^1.3.4"
- "@storybook/client-logger" "6.3.7"
- "@types/reach__router" "^1.3.7"
- core-js "^3.8.2"
- fast-deep-equal "^3.1.3"
- global "^4.4.0"
- lodash "^4.17.20"
- memoizerific "^1.11.3"
- qs "^6.10.0"
- ts-dedent "^2.0.0"
-
"@storybook/semver@^7.3.2":
version "7.3.2"
resolved "https://registry.yarnpkg.com/@storybook/semver/-/semver-7.3.2.tgz#f3b9c44a1c9a0b933c04e66d0048fcf2fa10dac0"
@@ -2936,24 +2870,6 @@
resolve-from "^5.0.0"
ts-dedent "^2.0.0"
-"@storybook/[email protected]":
- version "6.3.7"
- resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-6.3.7.tgz#6daf9a21b26ed607f3c28a82acd90c0248e76d8b"
- integrity sha512-GXBdw18JJd5jLLcRonAZWvGGdwEXByxF1IFNDSOYCcpHWsMgTk4XoLjceu9MpXET04pVX51LbVPLCvMdggoohg==
- dependencies:
- "@emotion/core" "^10.1.1"
- "@emotion/is-prop-valid" "^0.8.6"
- "@emotion/styled" "^10.0.27"
- "@storybook/client-logger" "6.3.7"
- core-js "^3.8.2"
- deep-object-diff "^1.1.0"
- emotion-theming "^10.0.27"
- global "^4.4.0"
- memoizerific "^1.11.3"
- polished "^4.0.5"
- resolve-from "^5.0.0"
- ts-dedent "^2.0.0"
-
"@storybook/[email protected]":
version "6.3.12"
resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-6.3.12.tgz#349e1a4c58c4fd18ea65b2ab56269a7c3a164ee7"
@@ -4255,7 +4171,7 @@ anymatch@^2.0.0:
micromatch "^3.1.4"
normalize-path "^2.1.1"
-anymatch@^3.0.0, anymatch@^3.0.3, anymatch@~3.1.1, anymatch@~3.1.2:
+anymatch@^3.0.0, anymatch@^3.0.3, anymatch@~3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716"
integrity sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==
@@ -5460,7 +5376,7 @@ colord@^2.0.1, colord@^2.6:
resolved "https://registry.yarnpkg.com/colord/-/colord-2.8.0.tgz#64fb7aa03de7652b5a39eee50271a104c2783b12"
integrity sha512-kNkVV4KFta3TYQv0bzs4xNwLaeag261pxgzGQSh4cQ1rEhYjcTJfFRP0SDlbhLONg0eSoLzrDd79PosjbltufA==
-colorette@^1.2.1, colorette@^1.2.2, colorette@^1.3.0:
+colorette@^1.2.1, colorette@^1.3.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/colorette/-/colorette-1.4.0.tgz#5190fbb87276259a86ad700bff2c6d6faa3fca40"
integrity sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==
@@ -5800,11 +5716,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-4.0.0.tgz#2904ab2677a9d042856a2ea2ef80de92e4a36dcc"
integrity sha512-bzHZN8Pn+gS7DQA6n+iUmBfl0hO5DJq++QP3U6uTucDtk/0iGpXd/Gg7CGR0p8tJhofJyaKoWBuJI4eAO00BBg==
-css-color-names@^0.0.4:
- version "0.0.4"
- resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0"
- integrity sha1-gIrcLnnPhHOAabZGyyDsJ762KeA=
-
css-color-names@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-1.0.1.tgz#6ff7ee81a823ad46e020fa2fd6ab40a887e2ba67"
@@ -5910,7 +5821,7 @@ cssfontparser@^1.2.1:
resolved "https://registry.yarnpkg.com/cssfontparser/-/cssfontparser-1.2.1.tgz#f4022fc8f9700c68029d542084afbaf425a3f3e3"
integrity sha1-9AIvyPlwDGgCnVQghK+69CWj8+M=
-cssnano-preset-default@^5.1.3, cssnano-preset-default@^5.1.4:
+cssnano-preset-default@^5.1.4:
version "5.1.4"
resolved "https://registry.yarnpkg.com/cssnano-preset-default/-/cssnano-preset-default-5.1.4.tgz#359943bf00c5c8e05489f12dd25f3006f2c1cbd2"
integrity sha512-sPpQNDQBI3R/QsYxQvfB4mXeEcWuw0wGtKtmS5eg8wudyStYMgKOQT39G07EbW1LB56AOYrinRS9f0ig4Y3MhQ==
@@ -7661,7 +7572,7 @@ fsevents@^1.2.7:
bindings "^1.5.0"
nan "^2.12.1"
-fsevents@^2.1.2, fsevents@^2.1.3, fsevents@^2.3.2, fsevents@~2.3.1, fsevents@~2.3.2:
+fsevents@^2.1.2, fsevents@^2.1.3, fsevents@^2.3.2, fsevents@~2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.2.tgz#8a526f78b8fdf4623b709e0b975c52c24c02fd1a"
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==
@@ -7814,7 +7725,7 @@ glob-parent@^3.1.0:
is-glob "^3.1.0"
path-dirname "^1.0.0"
-glob-parent@^5.1.0, glob-parent@~5.1.0, glob-parent@~5.1.2:
+glob-parent@^5.1.0, glob-parent@~5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4"
integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==
@@ -8155,11 +8066,6 @@ he@^1.2.0:
resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f"
integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==
-hex-color-regex@^1.1.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/hex-color-regex/-/hex-color-regex-1.1.0.tgz#4c06fccb4602fe2602b3c93df82d7e7dbf1a8a8e"
- integrity sha512-l9sfDFsuqtOqKDsQdqrMRk0U85RZc0RtOR9yPI7mRVOa4FsR/BVnZ0shmQRM96Ji99kYZP/7hn1cedc1+ApsTQ==
-
hey-listen@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/hey-listen/-/hey-listen-1.0.8.tgz#8e59561ff724908de1aa924ed6ecc84a56a9aa68"
@@ -8228,16 +8134,6 @@ hpack.js@^2.1.6:
readable-stream "^2.0.1"
wbuf "^1.1.0"
-hsl-regex@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/hsl-regex/-/hsl-regex-1.0.0.tgz#d49330c789ed819e276a4c0d272dffa30b18fe6e"
- integrity sha1-1JMwx4ntgZ4nakwNJy3/owsY/m4=
-
-hsla-regex@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/hsla-regex/-/hsla-regex-1.0.0.tgz#c1ce7a3168c8c6614033a4b5f7877f3b225f9c38"
- integrity sha1-wc56MWjIxmFAM6S194d/OyJfnDg=
-
html-element-map@^1.2.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/html-element-map/-/html-element-map-1.3.0.tgz#fcf226985d7111e6c2b958169312ec750d02f0d3"
@@ -8705,18 +8601,6 @@ is-ci@^3.0.0:
dependencies:
ci-info "^3.1.1"
-is-color-stop@^1.1.0:
- version "1.1.0"
- resolved "https://registry.yarnpkg.com/is-color-stop/-/is-color-stop-1.1.0.tgz#cfff471aee4dd5c9e158598fbe12967b5cdad345"
- integrity sha1-z/9HGu5N1cnhWFmPvhKWe1za00U=
- dependencies:
- css-color-names "^0.0.4"
- hex-color-regex "^1.1.0"
- hsl-regex "^1.0.0"
- hsla-regex "^1.0.0"
- rgb-regex "^1.0.1"
- rgba-regex "^1.0.0"
-
is-core-module@^2.2.0, is-core-module@^2.4.0:
version "2.6.0"
resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.6.0.tgz#d7553b2526fe59b92ba3e40c8df757ec8a709e19"
@@ -10679,7 +10563,7 @@ nanocolors@^0.2.2:
resolved "https://registry.yarnpkg.com/nanocolors/-/nanocolors-0.2.12.tgz#4d05932e70116078673ea4cc6699a1c56cc77777"
integrity sha512-SFNdALvzW+rVlzqexid6epYdt8H9Zol7xDoQarioEFcFN0JHo4CYNztAxmtfgGTVRCmFlEOqqhBpoFGKqSAMug==
-nanoid@^3.1.23, nanoid@^3.1.25, nanoid@^3.1.28:
+nanoid@^3.1.25, nanoid@^3.1.28:
version "3.1.28"
resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.28.tgz#3c01bac14cb6c5680569014cc65a2f26424c6bd4"
integrity sha512-gSu9VZ2HtmoKYe/lmyPFES5nknFrHa+/DT9muUFWFMi6Jh9E1I7bkvlQ8xxf1Kos9pi9o8lBnIOkatMhKX/YUw==
@@ -11643,7 +11527,7 @@ postcss-minify-font-values@^5.0.1:
dependencies:
postcss-value-parser "^4.1.0"
-postcss-minify-gradients@^5.0.1, postcss-minify-gradients@^5.0.2:
+postcss-minify-gradients@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/postcss-minify-gradients/-/postcss-minify-gradients-5.0.2.tgz#7c175c108f06a5629925d698b3c4cf7bd3864ee5"
integrity sha512-7Do9JP+wqSD6Prittitt2zDLrfzP9pqKs2EcLX7HJYxsxCOwrrcLt4x/ctQTsiOw+/8HYotAoqNkrzItL19SdQ==
@@ -12648,13 +12532,6 @@ readdirp@^2.2.1:
micromatch "^3.1.10"
readable-stream "^2.0.2"
-readdirp@~3.5.0:
- version "3.5.0"
- resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.5.0.tgz#9ba74c019b15d365278d2e91bb8c48d7b4d42c9e"
- integrity sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==
- dependencies:
- picomatch "^2.2.1"
-
readdirp@~3.6.0:
version "3.6.0"
resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7"
@@ -13013,16 +12890,6 @@ reusify@^1.0.4:
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
integrity sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
-rgb-regex@^1.0.1:
- version "1.0.1"
- resolved "https://registry.yarnpkg.com/rgb-regex/-/rgb-regex-1.0.1.tgz#c0e0d6882df0e23be254a475e8edd41915feaeb1"
- integrity sha1-wODWiC3w4jviVKR16O3UGRX+rrE=
-
-rgba-regex@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/rgba-regex/-/rgba-regex-1.0.0.tgz#43374e2e2ca0968b0ef1523460b7d730ff22eeb3"
- integrity sha1-QzdOLiyglosO8VI0YLfXMP8i7rM=
-
[email protected], rimraf@^3.0.0, rimraf@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a"
|
7f647037c1d0c0cf9ce096670a5065a7c1a415a4
|
2024-03-19 21:17:13
|
Matthew T
|
fix: add unique constraint to hashed columns (#67210)
| false
|
add unique constraint to hashed columns (#67210)
|
fix
|
diff --git a/fixtures/backup/model_dependencies/detailed.json b/fixtures/backup/model_dependencies/detailed.json
index 134b7a0b616d6d..fa3ca114c111ff 100644
--- a/fixtures/backup/model_dependencies/detailed.json
+++ b/fixtures/backup/model_dependencies/detailed.json
@@ -706,6 +706,12 @@
],
"table_name": "sentry_apitoken",
"uniques": [
+ [
+ "hashed_refresh_token"
+ ],
+ [
+ "hashed_token"
+ ],
[
"refresh_token"
],
diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt
index 71933dca9ae7f0..a3f4d1d0468f6e 100644
--- a/migrations_lockfile.txt
+++ b/migrations_lockfile.txt
@@ -9,5 +9,5 @@ feedback: 0004_index_together
hybridcloud: 0015_apitokenreplica_hashed_token_index
nodestore: 0002_nodestore_no_dictfield
replays: 0004_index_together
-sentry: 0675_dashboard_widget_query_rename_priority_sort_to_trends
+sentry: 0676_apitoken_hashed_indexes
social_auth: 0002_default_auto_field
diff --git a/src/sentry/migrations/0676_apitoken_hashed_indexes.py b/src/sentry/migrations/0676_apitoken_hashed_indexes.py
new file mode 100644
index 00000000000000..03b4122b32e6f0
--- /dev/null
+++ b/src/sentry/migrations/0676_apitoken_hashed_indexes.py
@@ -0,0 +1,36 @@
+# Generated by Django 5.0.2 on 2024-03-18 23:08
+
+from django.db import migrations, models
+
+from sentry.new_migrations.migrations import CheckedMigration
+
+
+class Migration(CheckedMigration):
+ # This flag is used to mark that a migration shouldn't be automatically run in production. For
+ # the most part, this should only be used for operations where it's safe to run the migration
+ # after your code has deployed. So this should not be used for most operations that alter the
+ # schema of a table.
+ # Here are some things that make sense to mark as dangerous:
+ # - Large data migrations. Typically we want these to be run manually by ops so that they can
+ # be monitored and not block the deploy for a long period of time while they run.
+ # - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
+ # have ops run this and not block the deploy. Note that while adding an index is a schema
+ # change, it's completely safe to run the operation after the code has deployed.
+ is_dangerous = True
+
+ dependencies = [
+ ("sentry", "0675_dashboard_widget_query_rename_priority_sort_to_trends"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="apitoken",
+ name="hashed_refresh_token",
+ field=models.CharField(max_length=128, null=True, unique=True),
+ ),
+ migrations.AlterField(
+ model_name="apitoken",
+ name="hashed_token",
+ field=models.CharField(max_length=128, null=True, unique=True),
+ ),
+ ]
diff --git a/src/sentry/models/apitoken.py b/src/sentry/models/apitoken.py
index c4fe6988e25a3d..1c66823f020496 100644
--- a/src/sentry/models/apitoken.py
+++ b/src/sentry/models/apitoken.py
@@ -42,11 +42,11 @@ class ApiToken(ReplicatedControlModel, HasApiScopes):
user = FlexibleForeignKey("sentry.User")
name = models.CharField(max_length=255, null=True)
token = models.CharField(max_length=71, unique=True, default=generate_token)
- hashed_token = models.CharField(max_length=128, null=True)
+ hashed_token = models.CharField(max_length=128, unique=True, null=True)
token_type = models.CharField(max_length=7, choices=AuthTokenType, null=True)
token_last_characters = models.CharField(max_length=4, null=True)
refresh_token = models.CharField(max_length=71, unique=True, null=True, default=generate_token)
- hashed_refresh_token = models.CharField(max_length=128, null=True)
+ hashed_refresh_token = models.CharField(max_length=128, unique=True, null=True)
expires_at = models.DateTimeField(null=True, default=default_expiration)
date_added = models.DateTimeField(default=timezone.now)
|
9e6456af58f7300d3d5dbb29cca083c130e2c53e
|
2022-09-08 22:42:13
|
Matt Quinn
|
fix(perf-issues): Add space between performance issue type and description (#38569)
| false
|
Add space between performance issue type and description (#38569)
|
fix
|
diff --git a/src/sentry/event_manager.py b/src/sentry/event_manager.py
index 8e2c748240c0b2..8b40c58a75a2a7 100644
--- a/src/sentry/event_manager.py
+++ b/src/sentry/event_manager.py
@@ -2018,7 +2018,7 @@ def _save_aggregate_performance(jobs: Sequence[Performance_Job], projects):
problem = performance_problems_by_fingerprint[new_grouphash]
kwargs["type"] = problem.type.value
- kwargs["data"]["metadata"]["title"] = f"N+1 Query:{problem.desc}"
+ kwargs["data"]["metadata"]["title"] = f"N+1 Query: {problem.desc}"
group = _create_group(project, event, **kwargs)
GroupHash.objects.create(project=project, hash=new_grouphash, group=group)
@@ -2048,7 +2048,7 @@ def _save_aggregate_performance(jobs: Sequence[Performance_Job], projects):
is_new = False
description = performance_problems_by_fingerprint[existing_grouphash.hash].desc
- kwargs["data"]["metadata"]["title"] = f"N+1 Query:{description}"
+ kwargs["data"]["metadata"]["title"] = f"N+1 Query: {description}"
is_regression = _process_existing_aggregate(
group=group, event=job["event"], data=kwargs, release=job["release"]
diff --git a/tests/sentry/performance_issues/test_performance_issues.py b/tests/sentry/performance_issues/test_performance_issues.py
index 40e8cfc48dc02b..7f32b9c477a7b8 100644
--- a/tests/sentry/performance_issues/test_performance_issues.py
+++ b/tests/sentry/performance_issues/test_performance_issues.py
@@ -54,14 +54,14 @@ def test_perf_issue_creation(self):
group = event.groups[0]
assert (
group.title
- == "N+1 Query:SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21"
+ == "N+1 Query: SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21"
)
assert group.message == "/books/"
assert group.culprit == "/books/"
assert group.get_event_type() == "transaction"
assert group.get_event_metadata() == {
"location": "/books/",
- "title": "N+1 Query:SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21",
+ "title": "N+1 Query: SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21",
}
assert group.location() == "/books/"
assert group.level == 40
@@ -101,11 +101,11 @@ def test_perf_issue_update(self):
group.refresh_from_db()
assert (
group.title
- == "N+1 Query:SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21"
+ == "N+1 Query: SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21"
)
assert group.get_event_metadata() == {
"location": "/books/",
- "title": "N+1 Query:SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21",
+ "title": "N+1 Query: SELECT `books_author`.`id`, `books_author`.`name` FROM `books_author` WHERE `books_author`.`id` = %s LIMIT 21",
}
assert group.location() == "/books/"
assert group.message == "/books/"
|
20c54ce5396e40831fa129fa3d9f71d510c73a21
|
2024-04-04 22:09:35
|
Abdkhan14
|
feat(new-trace): Routing directly to trace view from event id and trace id clicks. (#68197)
| false
|
Routing directly to trace view from event id and trace id clicks. (#68197)
|
feat
|
diff --git a/static/app/utils/discover/urls.tsx b/static/app/utils/discover/urls.tsx
index db631e2ade4a92..7887acdfa7ef66 100644
--- a/static/app/utils/discover/urls.tsx
+++ b/static/app/utils/discover/urls.tsx
@@ -1,5 +1,12 @@
-import type {OrganizationSummary} from 'sentry/types';
+import type {Location, LocationDescriptorObject} from 'history';
+import type {Organization, OrganizationSummary} from 'sentry/types';
+import {getTraceDetailsUrl} from 'sentry/views/performance/traceDetails/utils';
+
+import {getTimeStampFromTableDateField} from '../dates';
+import {getTransactionDetailsUrl} from '../performance/urls';
+
+import type {TableDataRow} from './discoverQuery';
import type {EventData} from './eventView';
import type EventView from './eventView';
@@ -27,6 +34,71 @@ export function eventDetailsRoute({
return `/organizations/${orgSlug}/discover/${eventSlug}/`;
}
+/**
+ * Return a URL to the trace view or the event details view depending on the
+ * feature flag.
+ *
+ * TODO Abdullah Khan: Add link to new trace view doc explaining why we route to the traceview.
+ */
+export function generateLinkToEventInTraceView({
+ dataRow,
+ organization,
+ eventView,
+ isHomepage,
+ location,
+ spanId,
+ eventSlug,
+ type = 'performance',
+}: {
+ dataRow: TableDataRow;
+ eventSlug: string;
+ eventView: EventView;
+ location: Location;
+ organization: Organization;
+ isHomepage?: boolean;
+ spanId?: string;
+ type?: 'performance' | 'discover';
+}) {
+ const dateSelection = eventView.normalizeDateSelection(location);
+ const timestamp = getTimeStampFromTableDateField(dataRow.timestamp);
+
+ if (organization.features.includes('trace-view-v1')) {
+ return getTraceDetailsUrl(
+ organization,
+ String(dataRow.trace),
+ dateSelection,
+ {},
+ timestamp,
+ dataRow.id,
+ spanId
+ );
+ }
+
+ if (type === 'performance') {
+ return getTransactionDetailsUrl(
+ organization.slug,
+ eventSlug,
+ undefined,
+ location.query,
+ spanId
+ );
+ }
+
+ const target: LocationDescriptorObject = {
+ pathname: eventDetailsRoute({
+ orgSlug: organization.slug,
+ eventSlug,
+ }),
+ query: {...eventView.generateQueryStringObject(), homepage: isHomepage},
+ };
+
+ if (spanId) {
+ target.hash = `span-${spanId}`;
+ }
+
+ return target;
+}
+
/**
* Create a URL target to event details with an event view in the query string.
*/
diff --git a/static/app/views/discover/table/index.tsx b/static/app/views/discover/table/index.tsx
index b6cd57293d37d5..d7db5f0636a100 100644
--- a/static/app/views/discover/table/index.tsx
+++ b/static/app/views/discover/table/index.tsx
@@ -134,6 +134,12 @@ class Table extends PureComponent<TableProps, TableState> {
apiPayload.field.push('timestamp');
}
+ // We are now routing to the trace view on clicking event ids. Therefore, we need the trace slug associated to the event id.
+ // Note: Event ID or 'id' is added to the fields in the API payload response by default for all non-aggregate queries.
+ if (!eventView.hasAggregateField()) {
+ apiPayload.field.push('trace');
+ }
+
apiPayload.referrer = 'api.discover.query-table';
setError('', 200);
diff --git a/static/app/views/discover/table/tableView.tsx b/static/app/views/discover/table/tableView.tsx
index 5d41cfa0d58fd2..1048ed57653b39 100644
--- a/static/app/views/discover/table/tableView.tsx
+++ b/static/app/views/discover/table/tableView.tsx
@@ -38,8 +38,8 @@ import {
} from 'sentry/utils/discover/fields';
import {DisplayModes, TOP_N} from 'sentry/utils/discover/types';
import {
- eventDetailsRouteWithEventView,
generateEventSlug,
+ generateLinkToEventInTraceView,
} from 'sentry/utils/discover/urls';
import ViewReplayLink from 'sentry/utils/discover/viewReplayLink';
import {getShortEventId} from 'sentry/utils/events';
@@ -189,13 +189,14 @@ function TableView(props: TableViewProps) {
value = fieldRenderer(dataRow, {organization, location});
}
- const eventSlug = generateEventSlug(dataRow);
-
- const target = eventDetailsRouteWithEventView({
- orgSlug: organization.slug,
- eventSlug,
+ const target = generateLinkToEventInTraceView({
+ eventSlug: generateEventSlug(dataRow),
+ dataRow,
+ organization,
eventView,
isHomepage,
+ location,
+ type: 'discover',
});
const eventIdLink = (
@@ -296,13 +297,14 @@ function TableView(props: TableViewProps) {
let cell = fieldRenderer(dataRow, {organization, location, unit});
if (columnKey === 'id') {
- const eventSlug = generateEventSlug(dataRow);
-
- const target = eventDetailsRouteWithEventView({
- orgSlug: organization.slug,
- eventSlug,
+ const target = generateLinkToEventInTraceView({
+ eventSlug: generateEventSlug(dataRow),
+ dataRow,
+ organization,
eventView,
isHomepage,
+ location,
+ type: 'discover',
});
const idLink = (
diff --git a/static/app/views/performance/browser/webVitals/pageOverviewWebVitalsDetailPanel.tsx b/static/app/views/performance/browser/webVitals/pageOverviewWebVitalsDetailPanel.tsx
index a38045aa96b111..761d0865993023 100644
--- a/static/app/views/performance/browser/webVitals/pageOverviewWebVitalsDetailPanel.tsx
+++ b/static/app/views/performance/browser/webVitals/pageOverviewWebVitalsDetailPanel.tsx
@@ -12,11 +12,14 @@ import GridEditable, {COL_WIDTH_UNDEFINED} from 'sentry/components/gridEditable'
import {Tooltip} from 'sentry/components/tooltip';
import {t} from 'sentry/locale';
import {defined} from 'sentry/utils';
-import {generateEventSlug} from 'sentry/utils/discover/urls';
+import EventView from 'sentry/utils/discover/eventView';
+import {
+ generateEventSlug,
+ generateLinkToEventInTraceView,
+} from 'sentry/utils/discover/urls';
import {getShortEventId} from 'sentry/utils/events';
import {getDuration} from 'sentry/utils/formatters';
import {PageAlert, PageAlertProvider} from 'sentry/utils/performance/contexts/pageAlert';
-import {getTransactionDetailsUrl} from 'sentry/utils/performance/urls';
import {generateProfileFlamechartRoute} from 'sentry/utils/profiling/routes';
import useReplayExists from 'sentry/utils/replayCount/useReplayExists';
import {useLocation} from 'sentry/utils/useLocation';
@@ -206,8 +209,13 @@ export function PageOverviewWebVitalsDetailPanel({
return <AlignRight>{formattedValue}</AlignRight>;
}
if (key === 'id') {
- const eventSlug = generateEventSlug({...row, project: projectSlug});
- const eventTarget = getTransactionDetailsUrl(organization.slug, eventSlug);
+ const eventTarget = generateLinkToEventInTraceView({
+ eventSlug: generateEventSlug({id: row.id, project: projectSlug}),
+ dataRow: row,
+ organization,
+ eventView: EventView.fromLocation(location),
+ location,
+ });
return (
<NoOverflow>
<Link to={eventTarget}>{getShortEventId(row.id)}</Link>
diff --git a/static/app/views/performance/browser/webVitals/pageSamplePerformanceTable.tsx b/static/app/views/performance/browser/webVitals/pageSamplePerformanceTable.tsx
index bd24c51b535273..f1db685a15d561 100644
--- a/static/app/views/performance/browser/webVitals/pageSamplePerformanceTable.tsx
+++ b/static/app/views/performance/browser/webVitals/pageSamplePerformanceTable.tsx
@@ -17,11 +17,14 @@ import {IconChevron, IconPlay, IconProfiling} from 'sentry/icons';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import {defined} from 'sentry/utils';
+import EventView from 'sentry/utils/discover/eventView';
import type {Sort} from 'sentry/utils/discover/fields';
-import {generateEventSlug} from 'sentry/utils/discover/urls';
+import {
+ generateEventSlug,
+ generateLinkToEventInTraceView,
+} from 'sentry/utils/discover/urls';
import {getShortEventId} from 'sentry/utils/events';
import {getDuration} from 'sentry/utils/formatters';
-import {getTransactionDetailsUrl} from 'sentry/utils/performance/urls';
import {generateProfileFlamechartRoute} from 'sentry/utils/profiling/routes';
import {decodeScalar} from 'sentry/utils/queryString';
import useReplayExists from 'sentry/utils/replayCount/useReplayExists';
@@ -372,8 +375,14 @@ export function PageSamplePerformanceTable({transaction, search, limit = 9}: Pro
}
if (key === 'id' && 'id' in row) {
- const eventSlug = generateEventSlug({...row, project: row.projectSlug});
- const eventTarget = getTransactionDetailsUrl(organization.slug, eventSlug);
+ const eventTarget = generateLinkToEventInTraceView({
+ eventSlug: generateEventSlug({...row, project: row.projectSlug}),
+ dataRow: row,
+ eventView: EventView.fromLocation(location),
+ organization,
+ location,
+ });
+
return (
<NoOverflow>
<Tooltip title={t('View Transaction')}>
diff --git a/static/app/views/performance/browser/webVitals/utils/queries/rawWebVitalsQueries/useTransactionRawSamplesWebVitalsQuery.tsx b/static/app/views/performance/browser/webVitals/utils/queries/rawWebVitalsQueries/useTransactionRawSamplesWebVitalsQuery.tsx
index d667fdf0cc2c57..306694310dab7e 100644
--- a/static/app/views/performance/browser/webVitals/utils/queries/rawWebVitalsQueries/useTransactionRawSamplesWebVitalsQuery.tsx
+++ b/static/app/views/performance/browser/webVitals/utils/queries/rawWebVitalsQueries/useTransactionRawSamplesWebVitalsQuery.tsx
@@ -62,6 +62,7 @@ export const useTransactionRawSamplesWebVitalsQuery = ({
'id',
'user.display',
'transaction',
+ 'trace',
'measurements.lcp',
'measurements.fcp',
'measurements.cls',
@@ -103,6 +104,7 @@ export const useTransactionRawSamplesWebVitalsQuery = ({
? data.data
.map(row => ({
id: row.id?.toString(),
+ trace: row.trace?.toString(),
'user.display': row['user.display']?.toString(),
transaction: row.transaction?.toString(),
'measurements.lcp': toNumber(row['measurements.lcp']),
diff --git a/static/app/views/performance/browser/webVitals/utils/queries/storedScoreQueries/useTransactionSamplesWebVitalsScoresQuery.tsx b/static/app/views/performance/browser/webVitals/utils/queries/storedScoreQueries/useTransactionSamplesWebVitalsScoresQuery.tsx
index 49fe34942674d4..384a7fd813de92 100644
--- a/static/app/views/performance/browser/webVitals/utils/queries/storedScoreQueries/useTransactionSamplesWebVitalsScoresQuery.tsx
+++ b/static/app/views/performance/browser/webVitals/utils/queries/storedScoreQueries/useTransactionSamplesWebVitalsScoresQuery.tsx
@@ -61,6 +61,7 @@ export const useTransactionSamplesWebVitalsScoresQuery = ({
{
fields: [
'id',
+ 'trace',
'user.display',
'transaction',
'measurements.lcp',
@@ -112,6 +113,7 @@ export const useTransactionSamplesWebVitalsScoresQuery = ({
? (data.data.map(
row => ({
id: row.id?.toString(),
+ trace: row.trace?.toString(),
'user.display': row['user.display']?.toString(),
transaction: row.transaction?.toString(),
'measurements.lcp': toNumber(row['measurements.lcp']),
diff --git a/static/app/views/performance/browser/webVitals/utils/types.tsx b/static/app/views/performance/browser/webVitals/utils/types.tsx
index b4af4b2dec1a68..6cc7af5a352d26 100644
--- a/static/app/views/performance/browser/webVitals/utils/types.tsx
+++ b/static/app/views/performance/browser/webVitals/utils/types.tsx
@@ -18,6 +18,7 @@ export type TransactionSampleRow = {
projectSlug: string;
replayId: string;
timestamp: string;
+ trace: string;
transaction: string;
'user.display': string;
'measurements.cls'?: number;
diff --git a/static/app/views/performance/traceDetails/utils.tsx b/static/app/views/performance/traceDetails/utils.tsx
index a17468d79ea33c..6870724fabdd4a 100644
--- a/static/app/views/performance/traceDetails/utils.tsx
+++ b/static/app/views/performance/traceDetails/utils.tsx
@@ -10,6 +10,7 @@ import type {
TraceSplitResults,
} from 'sentry/utils/performance/quickTrace/types';
import {isTraceSplitResult, reduceTrace} from 'sentry/utils/performance/quickTrace/utils';
+import {normalizeUrl} from 'sentry/utils/withDomainRequired';
import {DEFAULT_TRACE_ROWS_LIMIT} from './limitExceededMessage';
import type {TraceInfo} from './types';
@@ -20,7 +21,8 @@ export function getTraceDetailsUrl(
dateSelection,
query: Query,
timestamp?: string | number,
- eventId?: string
+ eventId?: string,
+ spanId?: string
): LocationDescriptorObject {
const {start, end, statsPeriod} = dateSelection;
@@ -32,8 +34,13 @@ export function getTraceDetailsUrl(
};
if (organization.features.includes('trace-view-v1')) {
+ if (spanId) {
+ queryParams.node = [`span:${spanId}`, `txn:${eventId}`];
+ }
return {
- pathname: `/organizations/${organization.slug}/performance/trace/${traceSlug}/`,
+ pathname: normalizeUrl(
+ `/organizations/${organization.slug}/performance/trace/${traceSlug}/`
+ ),
query: {
...queryParams,
timestamp,
@@ -47,7 +54,9 @@ export function getTraceDetailsUrl(
}
return {
- pathname: `/organizations/${organization.slug}/performance/trace/${traceSlug}/`,
+ pathname: normalizeUrl(
+ `/organizations/${organization.slug}/performance/trace/${traceSlug}/`
+ ),
query: queryParams,
};
}
diff --git a/static/app/views/starfish/components/samplesTable/spanSamplesTable.tsx b/static/app/views/starfish/components/samplesTable/spanSamplesTable.tsx
index 72f89d5a3fb31c..5c2e725d68c203 100644
--- a/static/app/views/starfish/components/samplesTable/spanSamplesTable.tsx
+++ b/static/app/views/starfish/components/samplesTable/spanSamplesTable.tsx
@@ -8,6 +8,11 @@ import GridEditable, {COL_WIDTH_UNDEFINED} from 'sentry/components/gridEditable'
import {Tooltip} from 'sentry/components/tooltip';
import {IconProfiling} from 'sentry/icons/iconProfiling';
import {t} from 'sentry/locale';
+import EventView from 'sentry/utils/discover/eventView';
+import {
+ generateEventSlug,
+ generateLinkToEventInTraceView,
+} from 'sentry/utils/discover/urls';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import {normalizeUrl} from 'sentry/utils/withDomainRequired';
@@ -57,6 +62,7 @@ type SpanTableRow = {
id: string;
'project.name': string;
timestamp: string;
+ trace: string;
'transaction.duration': number;
};
} & SpanSample;
@@ -122,9 +128,21 @@ export function SpanSamplesTable({
if (column.key === 'transaction_id') {
return (
<Link
- to={normalizeUrl(
- `/organizations/${organization.slug}/performance/${row.project}:${row['transaction.id']}#span-${row.span_id}`
- )}
+ to={generateLinkToEventInTraceView({
+ eventSlug: generateEventSlug({
+ id: row['transaction.id'],
+ project: row.project,
+ }),
+ organization,
+ location,
+ eventView: EventView.fromLocation(location),
+ dataRow: {
+ id: row['transaction.id'],
+ trace: row.transaction?.trace,
+ timestamp: row.timestamp,
+ },
+ spanId: row.span_id,
+ })}
{...commonProps}
>
{row['transaction.id'].slice(0, 8)}
diff --git a/static/app/views/starfish/components/samplesTable/transactionSamplesTable.tsx b/static/app/views/starfish/components/samplesTable/transactionSamplesTable.tsx
index 9852ba2ecbfdd1..f56448c504617d 100644
--- a/static/app/views/starfish/components/samplesTable/transactionSamplesTable.tsx
+++ b/static/app/views/starfish/components/samplesTable/transactionSamplesTable.tsx
@@ -13,6 +13,10 @@ import EventView from 'sentry/utils/discover/eventView';
import {getFieldRenderer} from 'sentry/utils/discover/fieldRenderers';
import {SPAN_OP_RELATIVE_BREAKDOWN_FIELD} from 'sentry/utils/discover/fields';
import {DiscoverDatasets} from 'sentry/utils/discover/types';
+import {
+ generateEventSlug,
+ generateLinkToEventInTraceView,
+} from 'sentry/utils/discover/urls';
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
@@ -181,9 +185,13 @@ export function TransactionSamplesTable({
return (
<Link
{...commonProps}
- to={normalizeUrl(
- `/organizations/${organization.slug}/performance/${row['project.name']}:${row.id}`
- )}
+ to={generateLinkToEventInTraceView({
+ eventSlug: generateEventSlug(row),
+ organization,
+ location,
+ eventView,
+ dataRow: row,
+ })}
>
{row.id.slice(0, 8)}
</Link>
diff --git a/static/app/views/starfish/components/samplesTable/useSlowMedianFastSamplesQuery.tsx b/static/app/views/starfish/components/samplesTable/useSlowMedianFastSamplesQuery.tsx
index c29aeb075fb9a9..d9b78d3a30f9af 100644
--- a/static/app/views/starfish/components/samplesTable/useSlowMedianFastSamplesQuery.tsx
+++ b/static/app/views/starfish/components/samplesTable/useSlowMedianFastSamplesQuery.tsx
@@ -29,6 +29,10 @@ export default function useSlowMedianFastSamplesQuery(
const organization = useOrganization();
const commonColumns: QueryFieldValue[] = [
+ {
+ field: 'trace',
+ kind: 'field',
+ },
{
field: 'transaction.duration',
kind: 'field',
diff --git a/static/app/views/starfish/queries/useSpanSamples.tsx b/static/app/views/starfish/queries/useSpanSamples.tsx
index e17b780ae6f1a0..c46f853b34d59e 100644
--- a/static/app/views/starfish/queries/useSpanSamples.tsx
+++ b/static/app/views/starfish/queries/useSpanSamples.tsx
@@ -37,6 +37,7 @@ export type SpanSample = Pick<
| SpanIndexedField.ID
| SpanIndexedField.PROFILE_ID
| SpanIndexedField.HTTP_RESPONSE_CONTENT_LENGTH
+ | SpanIndexedField.TRACE
>;
export const useSpanSamples = (options: Options) => {
diff --git a/static/app/views/starfish/queries/useTransactions.tsx b/static/app/views/starfish/queries/useTransactions.tsx
index 111c6077726a51..04b040450f05d4 100644
--- a/static/app/views/starfish/queries/useTransactions.tsx
+++ b/static/app/views/starfish/queries/useTransactions.tsx
@@ -11,6 +11,7 @@ type Transaction = {
id: string;
'project.name': string;
timestamp: string;
+ trace: string;
'transaction.duration': number;
};
@@ -20,7 +21,7 @@ export function useTransactions(eventIDs: string[], referrer = 'use-transactions
const eventView = EventView.fromNewQueryWithLocation(
{
- fields: ['id', 'timestamp', 'project.name', 'transaction.duration'],
+ fields: ['id', 'timestamp', 'project.name', 'transaction.duration', 'trace'],
name: 'Transactions',
version: 2,
query: `id:[${eventIDs.join(',')}]`,
diff --git a/static/app/views/starfish/views/appStartup/screenSummary/eventSamples.spec.tsx b/static/app/views/starfish/views/appStartup/screenSummary/eventSamples.spec.tsx
index 1a217c1459929d..a95d52791fdd27 100644
--- a/static/app/views/starfish/views/appStartup/screenSummary/eventSamples.spec.tsx
+++ b/static/app/views/starfish/views/appStartup/screenSummary/eventSamples.spec.tsx
@@ -103,7 +103,7 @@ describe('ScreenLoadEventSamples', function () {
// Transaction is a link
expect(await screen.findByRole('link', {name: '76af98a3'})).toHaveAttribute(
'href',
- '/organizations/org-slug/performance/sentry-cocoa:76af98a3ac9d4448b894e44b1819970e'
+ '/organizations/org-slug/performance/sentry-cocoa:76af98a3ac9d4448b894e44b1819970e/?'
);
// Profile is a button
diff --git a/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.spec.tsx b/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.spec.tsx
index a44373abedddfc..8802371f745c26 100644
--- a/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.spec.tsx
+++ b/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.spec.tsx
@@ -104,7 +104,7 @@ describe('ScreenLoadEventSamples', function () {
// Transaction is a link
expect(await screen.findByRole('link', {name: '4142de70'})).toHaveAttribute(
'href',
- '/organizations/org-slug/performance/project1:4142de70494989c04f023ce1727ac856f31b7f92'
+ '/organizations/org-slug/performance/project1:4142de70494989c04f023ce1727ac856f31b7f92/?'
);
// Profile is a button
diff --git a/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.tsx b/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.tsx
index b1b546a8197689..9193286a530317 100644
--- a/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.tsx
+++ b/static/app/views/starfish/views/screens/screenLoadSpans/eventSamples.tsx
@@ -99,6 +99,7 @@ export function ScreenLoadEventSamples({
name: '',
fields: [
'id',
+ 'trace',
'project.name',
'profile.id',
'measurements.time_to_initial_display',
diff --git a/static/app/views/starfish/views/screens/screenLoadSpans/eventSamplesTable.tsx b/static/app/views/starfish/views/screens/screenLoadSpans/eventSamplesTable.tsx
index 3392856acdf0cc..9730159a007a3e 100644
--- a/static/app/views/starfish/views/screens/screenLoadSpans/eventSamplesTable.tsx
+++ b/static/app/views/starfish/views/screens/screenLoadSpans/eventSamplesTable.tsx
@@ -16,15 +16,17 @@ import {space} from 'sentry/styles/space';
import {defined} from 'sentry/utils';
import type {TableData, TableDataRow} from 'sentry/utils/discover/discoverQuery';
import type {MetaType} from 'sentry/utils/discover/eventView';
-import type EventView from 'sentry/utils/discover/eventView';
-import {isFieldSortable} from 'sentry/utils/discover/eventView';
+import EventView, {isFieldSortable} from 'sentry/utils/discover/eventView';
import {getFieldRenderer} from 'sentry/utils/discover/fieldRenderers';
import type {Sort} from 'sentry/utils/discover/fields';
import {fieldAlignment} from 'sentry/utils/discover/fields';
+import {
+ generateEventSlug,
+ generateLinkToEventInTraceView,
+} from 'sentry/utils/discover/urls';
import {generateProfileFlamechartRoute} from 'sentry/utils/profiling/routes';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
-import {normalizeUrl} from 'sentry/utils/withDomainRequired';
import type {TableColumn} from 'sentry/views/discover/table/types';
import {DeviceClassSelector} from 'sentry/views/starfish/views/screens/screenLoadSpans/deviceClassSelector';
@@ -72,9 +74,13 @@ export function EventSamplesTable({
if (column.key === eventIdKey) {
return (
<Link
- to={normalizeUrl(
- `/organizations/${organization.slug}/performance/${row['project.name']}:${row[eventIdKey]}`
- )}
+ to={generateLinkToEventInTraceView({
+ eventSlug: generateEventSlug({...row, id: row[eventIdKey]}),
+ organization,
+ location,
+ eventView: EventView.fromLocation(location),
+ dataRow: row,
+ })}
>
{row[eventIdKey].slice(0, 8)}
</Link>
|
abfcfa8e30ff915b45b62c258c50a21ddb441f4c
|
2021-10-28 01:15:58
|
Tony Xiao
|
fix(suspect-spans): Change default sort to total cumulative duration (#29606)
| false
|
Change default sort to total cumulative duration (#29606)
|
fix
|
diff --git a/static/app/views/performance/transactionSummary/transactionSpans/utils.tsx b/static/app/views/performance/transactionSummary/transactionSpans/utils.tsx
index e19ef4c04a6af8..1a89cd231b5fe7 100644
--- a/static/app/views/performance/transactionSummary/transactionSpans/utils.tsx
+++ b/static/app/views/performance/transactionSummary/transactionSpans/utils.tsx
@@ -72,7 +72,7 @@ export const SPAN_SORT_OPTIONS: SpanSortOption[] = [
},
];
-const DEFAULT_SORT = SpanSortPercentiles.P75_EXCLUSIVE_TIME;
+const DEFAULT_SORT = SpanSortOthers.SUM_EXCLUSIVE_TIME;
function getSuspectSpanSort(sort: string): SpanSortOption {
const selected = SPAN_SORT_OPTIONS.find(option => option.field === sort);
|
e6a8d3060be672590d85dff1cf8af5ff94b29700
|
2021-07-06 22:17:20
|
Scott Cooper
|
fix(workflow): Overflow long issue tags (#27104)
| false
|
Overflow long issue tags (#27104)
|
fix
|
diff --git a/static/app/components/events/contextSummary/item.tsx b/static/app/components/events/contextSummary/item.tsx
index c4b326ea8334db..07cb6010886fd4 100644
--- a/static/app/components/events/contextSummary/item.tsx
+++ b/static/app/components/events/contextSummary/item.tsx
@@ -34,8 +34,10 @@ const Wrapper = styled('div')`
margin-right: ${space(3)};
align-items: center;
position: relative;
+ min-width: 0;
@media (min-width: ${p => p.theme.breakpoints[0]}) {
+ max-width: 25%;
border: 0;
padding: 0px 0px 0px 42px;
}
|
825502d24cb5897042e3e1cf7e9de6b700c0a97f
|
2025-03-20 04:12:56
|
Richard Roggenkemper
|
chore(issue-details): Don't default to `false` for streamlined ui (#87337)
| false
|
Don't default to `false` for streamlined ui (#87337)
|
chore
|
diff --git a/src/sentry/users/api/serializers/user.py b/src/sentry/users/api/serializers/user.py
index edd460b3b23600..a84e8d25af572d 100644
--- a/src/sentry/users/api/serializers/user.py
+++ b/src/sentry/users/api/serializers/user.py
@@ -65,7 +65,7 @@ class _UserOptions(TypedDict):
defaultIssueEvent: str
timezone: str
clock24Hours: bool
- prefersIssueDetailsStreamlinedUI: bool
+ prefersIssueDetailsStreamlinedUI: bool | None
prefersSpecializedProjectOverview: dict[str, bool]
prefersStackedNavigation: bool
quickStartDisplay: dict[str, int]
@@ -199,7 +199,7 @@ def serialize(
"timezone": options.get("timezone") or settings.SENTRY_DEFAULT_TIME_ZONE,
"clock24Hours": options.get("clock_24_hours") or False,
"prefersIssueDetailsStreamlinedUI": options.get(
- "prefers_issue_details_streamlined_ui", False
+ "prefers_issue_details_streamlined_ui"
),
"prefersSpecializedProjectOverview": options.get(
"prefers_specialized_project_overview", {}
|
14b3fd099f7c563f9bb4a469a51df99ed5d32948
|
2020-08-28 23:26:58
|
Evan Purkhiser
|
ref(py3): Compare objects vs bytes in test_project_rules (#20469)
| false
|
Compare objects vs bytes in test_project_rules (#20469)
|
ref
|
diff --git a/tests/sentry/api/endpoints/test_project_rules.py b/tests/sentry/api/endpoints/test_project_rules.py
index f77442dae1b2b0..bee389a35326c6 100644
--- a/tests/sentry/api/endpoints/test_project_rules.py
+++ b/tests/sentry/api/endpoints/test_project_rules.py
@@ -4,6 +4,7 @@
from sentry.models import Environment, Integration, Rule, RuleActivity, RuleActivityType
from sentry.testutils import APITestCase
+from sentry.utils import json
class ProjectRuleListTest(APITestCase):
@@ -368,7 +369,6 @@ def test_with_filters_without_match(self):
)
assert response.status_code == 400
- assert (
- response.content
- == '{"filterMatch":["Must select a filter match (all, any, none) if filters are supplied"]}'
- )
+ assert json.loads(response.content) == {
+ "filterMatch": ["Must select a filter match (all, any, none) if filters are supplied"]
+ }
|
ea1023245fa1962fc3989cb5bb016f6c70b3ea57
|
2023-10-27 09:46:36
|
Zach Collins
|
ref(hc): Replica external actor to control silo (#58900)
| false
|
Replica external actor to control silo (#58900)
|
ref
|
diff --git a/fixtures/backup/model_dependencies/detailed.json b/fixtures/backup/model_dependencies/detailed.json
index 5bf492ef99cc67..321dff04e6f028 100644
--- a/fixtures/backup/model_dependencies/detailed.json
+++ b/fixtures/backup/model_dependencies/detailed.json
@@ -87,6 +87,57 @@
"table_name": "hybridcloud_apitokenreplica",
"uniques": []
},
+ "hybridcloud.externalactorreplica": {
+ "dangling": false,
+ "foreign_keys": {
+ "externalactor_id": {
+ "kind": "ImplicitForeignKey",
+ "model": "sentry.externalactor",
+ "nullable": false
+ },
+ "integration": {
+ "kind": "FlexibleForeignKey",
+ "model": "sentry.integration",
+ "nullable": false
+ },
+ "organization_id": {
+ "kind": "HybridCloudForeignKey",
+ "model": "sentry.organization",
+ "nullable": false
+ },
+ "team_id": {
+ "kind": "HybridCloudForeignKey",
+ "model": "sentry.team",
+ "nullable": true
+ },
+ "user": {
+ "kind": "FlexibleForeignKey",
+ "model": "sentry.user",
+ "nullable": true
+ }
+ },
+ "model": "hybridcloud.externalactorreplica",
+ "relocation_dependencies": [],
+ "relocation_scope": "Excluded",
+ "silos": [
+ "Control"
+ ],
+ "table_name": "hybridcloud_externalactorreplica",
+ "uniques": [
+ [
+ "external_name",
+ "organization_id",
+ "provider",
+ "team_id"
+ ],
+ [
+ "external_name",
+ "organization_id",
+ "provider",
+ "user_id"
+ ]
+ ]
+ },
"hybridcloud.organizationslugreservationreplica": {
"dangling": false,
"foreign_keys": {
diff --git a/fixtures/backup/model_dependencies/flat.json b/fixtures/backup/model_dependencies/flat.json
index 15eebc09903c57..6629e36aaa0a96 100644
--- a/fixtures/backup/model_dependencies/flat.json
+++ b/fixtures/backup/model_dependencies/flat.json
@@ -14,6 +14,13 @@
"sentry.organization",
"sentry.user"
],
+ "hybridcloud.externalactorreplica": [
+ "sentry.externalactor",
+ "sentry.integration",
+ "sentry.organization",
+ "sentry.team",
+ "sentry.user"
+ ],
"hybridcloud.organizationslugreservationreplica": [
"sentry.organization",
"sentry.organizationslugreservation",
diff --git a/fixtures/backup/model_dependencies/sorted.json b/fixtures/backup/model_dependencies/sorted.json
index 410460543b3393..7dd7826558b671 100644
--- a/fixtures/backup/model_dependencies/sorted.json
+++ b/fixtures/backup/model_dependencies/sorted.json
@@ -113,6 +113,7 @@
"replays.replayrecordingsegment",
"hybridcloud.orgauthtokenreplica",
"hybridcloud.organizationslugreservationreplica",
+ "hybridcloud.externalactorreplica",
"hybridcloud.apikeyreplica",
"feedback.feedback",
"sentry.userreport",
diff --git a/fixtures/backup/model_dependencies/truncate.json b/fixtures/backup/model_dependencies/truncate.json
index 7e2e2f604400f0..aea7b05e9a9c75 100644
--- a/fixtures/backup/model_dependencies/truncate.json
+++ b/fixtures/backup/model_dependencies/truncate.json
@@ -113,6 +113,7 @@
"replays_replayrecordingsegment",
"hybridcloud_orgauthtokenreplica",
"hybridcloud_organizationslugreservationreplica",
+ "hybridcloud_externalactorreplica",
"hybridcloud_apikeyreplica",
"feedback_feedback",
"sentry_userreport",
diff --git a/migrations_lockfile.txt b/migrations_lockfile.txt
index 35434f9975e725..1f0fbd74e97d9c 100644
--- a/migrations_lockfile.txt
+++ b/migrations_lockfile.txt
@@ -6,7 +6,7 @@ To resolve this, rebase against latest master and regenerate your migration. Thi
will then be regenerated, and you should be able to merge without conflicts.
feedback: 0003_feedback_add_env
-hybridcloud: 0007_add_orgauthtokenreplica
+hybridcloud: 0008_add_externalactorreplica
nodestore: 0002_nodestore_no_dictfield
replays: 0003_add_size_to_recording_segment
sentry: 0583_add_early_adopter_to_organization_mapping
diff --git a/src/sentry/hybridcloud/migrations/0008_add_externalactorreplica.py b/src/sentry/hybridcloud/migrations/0008_add_externalactorreplica.py
new file mode 100644
index 00000000000000..29fc0a23bda1d4
--- /dev/null
+++ b/src/sentry/hybridcloud/migrations/0008_add_externalactorreplica.py
@@ -0,0 +1,81 @@
+# Generated by Django 3.2.20 on 2023-10-26 20:17
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+import sentry.db.models.fields.bounded
+import sentry.db.models.fields.foreignkey
+import sentry.db.models.fields.hybrid_cloud_foreign_key
+from sentry.new_migrations.migrations import CheckedMigration
+
+
+class Migration(CheckedMigration):
+ # This flag is used to mark that a migration shouldn't be automatically run in production. For
+ # the most part, this should only be used for operations where it's safe to run the migration
+ # after your code has deployed. So this should not be used for most operations that alter the
+ # schema of a table.
+ # Here are some things that make sense to mark as dangerous:
+ # - Large data migrations. Typically we want these to be run manually by ops so that they can
+ # be monitored and not block the deploy for a long period of time while they run.
+ # - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
+ # have ops run this and not block the deploy. Note that while adding an index is a schema
+ # change, it's completely safe to run the operation after the code has deployed.
+ is_dangerous = False
+
+ dependencies = [
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ("sentry", "0583_add_early_adopter_to_organization_mapping"),
+ ("hybridcloud", "0007_add_orgauthtokenreplica"),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="ExternalActorReplica",
+ fields=[
+ (
+ "id",
+ sentry.db.models.fields.bounded.BoundedBigAutoField(
+ primary_key=True, serialize=False
+ ),
+ ),
+ (
+ "team_id",
+ sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey(
+ "sentry.Team", db_index=True, null=True, on_delete="CASCADE"
+ ),
+ ),
+ (
+ "organization_id",
+ sentry.db.models.fields.hybrid_cloud_foreign_key.HybridCloudForeignKey(
+ "sentry.Organization", db_index=True, on_delete="CASCADE"
+ ),
+ ),
+ ("provider", sentry.db.models.fields.bounded.BoundedPositiveIntegerField()),
+ ("externalactor_id", sentry.db.models.fields.bounded.BoundedPositiveIntegerField()),
+ ("external_name", models.TextField()),
+ ("external_id", models.TextField(null=True)),
+ (
+ "integration",
+ sentry.db.models.fields.foreignkey.FlexibleForeignKey(
+ on_delete=django.db.models.deletion.CASCADE, to="sentry.integration"
+ ),
+ ),
+ (
+ "user",
+ sentry.db.models.fields.foreignkey.FlexibleForeignKey(
+ null=True,
+ on_delete=django.db.models.deletion.CASCADE,
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ ],
+ options={
+ "db_table": "hybridcloud_externalactorreplica",
+ "unique_together": {
+ ("organization_id", "provider", "external_name", "user_id"),
+ ("organization_id", "provider", "external_name", "team_id"),
+ },
+ },
+ ),
+ ]
diff --git a/src/sentry/hybridcloud/models/__init__.py b/src/sentry/hybridcloud/models/__init__.py
index 65d6a1aa1d49cf..b63cb5853b0f89 100644
--- a/src/sentry/hybridcloud/models/__init__.py
+++ b/src/sentry/hybridcloud/models/__init__.py
@@ -4,9 +4,11 @@
"OrgAuthTokenReplica",
"CacheVersionBase",
"RegionCacheVersion",
+ "ExternalActorReplica",
]
from .apikeyreplica import ApiKeyReplica # noqa
from .apitokenreplica import ApiTokenReplica # noqa
from .cacheversion import CacheVersionBase, RegionCacheVersion # noqa
+from .externalactorreplica import ExternalActorReplica # noqa
from .orgauthtokenreplica import OrgAuthTokenReplica # noqa
diff --git a/src/sentry/hybridcloud/models/externalactorreplica.py b/src/sentry/hybridcloud/models/externalactorreplica.py
new file mode 100644
index 00000000000000..d48aeb9dd76b89
--- /dev/null
+++ b/src/sentry/hybridcloud/models/externalactorreplica.py
@@ -0,0 +1,36 @@
+from django.db import models
+
+from sentry.backup.scopes import RelocationScope
+from sentry.db.models import (
+ BoundedPositiveIntegerField,
+ FlexibleForeignKey,
+ Model,
+ control_silo_only_model,
+)
+from sentry.db.models.fields.hybrid_cloud_foreign_key import HybridCloudForeignKey
+
+
+@control_silo_only_model
+class ExternalActorReplica(Model):
+ __relocation_scope__ = RelocationScope.Excluded
+
+ externalactor_id = BoundedPositiveIntegerField()
+ team_id = HybridCloudForeignKey("sentry.Team", null=True, db_index=True, on_delete="CASCADE")
+ user = FlexibleForeignKey("sentry.User", null=True, db_index=True, on_delete=models.CASCADE)
+ organization_id = HybridCloudForeignKey("sentry.Organization", on_delete="CASCADE")
+ integration = FlexibleForeignKey("sentry.Integration", on_delete=models.CASCADE)
+
+ provider = BoundedPositiveIntegerField()
+
+ # The display name i.e. username, team name, channel name.
+ external_name = models.TextField()
+ # The unique identifier i.e user ID, channel ID.
+ external_id = models.TextField(null=True)
+
+ class Meta:
+ app_label = "hybridcloud"
+ db_table = "hybridcloud_externalactorreplica"
+ unique_together = (
+ ("organization_id", "provider", "external_name", "team_id"),
+ ("organization_id", "provider", "external_name", "user_id"),
+ )
diff --git a/src/sentry/hybridcloud/options.py b/src/sentry/hybridcloud/options.py
index 0047fdd71bb997..ee3873e5d0d8cc 100644
--- a/src/sentry/hybridcloud/options.py
+++ b/src/sentry/hybridcloud/options.py
@@ -141,6 +141,13 @@
flags=FLAG_AUTOMATOR_MODIFIABLE,
)
+register(
+ "outbox_replication.sentry_externalactor.replication_version",
+ type=Int,
+ default=0,
+ flags=FLAG_AUTOMATOR_MODIFIABLE,
+)
+
register(
"hybrid_cloud.authentication.use_rpc_user",
type=Int,
diff --git a/src/sentry/models/integrations/external_actor.py b/src/sentry/models/integrations/external_actor.py
index 97f4c53dcbb8ae..28b47d623977b8 100644
--- a/src/sentry/models/integrations/external_actor.py
+++ b/src/sentry/models/integrations/external_actor.py
@@ -3,25 +3,29 @@
from django.db import models, router, transaction
from django.db.models import Q
from django.db.models.signals import post_delete, post_save
+from django.utils import timezone
from sentry.backup.scopes import RelocationScope
-from sentry.db.models import (
- BoundedPositiveIntegerField,
- DefaultFieldsModel,
- FlexibleForeignKey,
- region_silo_only_model,
-)
+from sentry.db.models import BoundedPositiveIntegerField, FlexibleForeignKey, region_silo_only_model
from sentry.db.models.fields.hybrid_cloud_foreign_key import HybridCloudForeignKey
+from sentry.db.models.outboxes import ReplicatedRegionModel
+from sentry.models.outbox import OutboxCategory
from sentry.services.hybrid_cloud.notifications import notifications_service
+from sentry.services.hybrid_cloud.replica import control_replica_service
from sentry.types.integrations import ExternalProviders
logger = logging.getLogger(__name__)
@region_silo_only_model
-class ExternalActor(DefaultFieldsModel):
+class ExternalActor(ReplicatedRegionModel):
__relocation_scope__ = RelocationScope.Excluded
+ category = OutboxCategory.EXTERNAL_ACTOR_UPDATE
+
+ date_updated = models.DateTimeField(default=timezone.now)
+ date_added = models.DateTimeField(default=timezone.now, null=True)
+
team = FlexibleForeignKey("sentry.Team", null=True, db_index=True, on_delete=models.CASCADE)
user_id = HybridCloudForeignKey("sentry.User", null=True, db_index=True, on_delete="CASCADE")
organization = FlexibleForeignKey("sentry.Organization")
@@ -76,6 +80,13 @@ def delete(self, **kwargs):
return super().delete(**kwargs)
+ def handle_async_replication(self, shard_identifier: int) -> None:
+ from sentry.services.hybrid_cloud.notifications.serial import serialize_external_actor
+
+ control_replica_service.upsert_external_actor_replica(
+ external_actor=serialize_external_actor(self)
+ )
+
def process_resource_change(instance, **kwargs):
from sentry.models.organization import Organization
diff --git a/src/sentry/models/outbox.py b/src/sentry/models/outbox.py
index 520f5e30f69328..ad67412a8117c9 100644
--- a/src/sentry/models/outbox.py
+++ b/src/sentry/models/outbox.py
@@ -111,6 +111,7 @@ class OutboxCategory(IntEnum):
API_TOKEN_UPDATE = 32
ORG_AUTH_TOKEN_UPDATE = 33
ISSUE_COMMENT_UPDATE = 34
+ EXTERNAL_ACTOR_UPDATE = 35
@classmethod
def as_choices(cls):
@@ -237,6 +238,7 @@ def infer_identifiers(
shard_identifier: int | None,
) -> Tuple[int, int]:
from sentry.models.apiapplication import ApiApplication
+ from sentry.models.integrations import Integration
from sentry.models.organization import Organization
from sentry.models.user import User
@@ -265,6 +267,11 @@ def infer_identifiers(
shard_identifier = model.id
elif hasattr(model, "api_application_id"):
shard_identifier = model.api_application_id
+ if scope == OutboxScope.INTEGRATION_SCOPE:
+ if isinstance(model, Integration):
+ shard_identifier = model.id
+ elif hasattr(model, "integration_id"):
+ shard_identifier = model.integration_id
assert (
model is not None
@@ -330,9 +337,7 @@ class OutboxScope(IntEnum):
)
INTEGRATION_SCOPE = scope_categories(
5,
- {
- OutboxCategory.INTEGRATION_UPDATE,
- },
+ {OutboxCategory.INTEGRATION_UPDATE, OutboxCategory.EXTERNAL_ACTOR_UPDATE},
)
APP_SCOPE = scope_categories(
6,
diff --git a/src/sentry/services/hybrid_cloud/notifications/model.py b/src/sentry/services/hybrid_cloud/notifications/model.py
index 0b58d19a6e33d6..d57f0e71292e9a 100644
--- a/src/sentry/services/hybrid_cloud/notifications/model.py
+++ b/src/sentry/services/hybrid_cloud/notifications/model.py
@@ -35,3 +35,17 @@ class RpcNotificationSetting(RpcModel):
provider: ExternalProviders = ExternalProviders.EMAIL
type: NotificationSettingTypes = NotificationSettingTypes.WORKFLOW
value: NotificationSettingOptionValues = NotificationSettingOptionValues.DEFAULT
+
+
+class RpcExternalActor(RpcModel):
+ id: int = -1
+ team_id: Optional[int] = None
+ user_id: Optional[int] = None
+ organization_id: int = -1
+ integration_id: int = -1
+
+ provider: int = int(ExternalProviders.UNUSED_GH.value)
+ # The display name i.e. username, team name, channel name.
+ external_name: str = ""
+ # The unique identifier i.e user ID, channel ID.
+ external_id: Optional[str] = None
diff --git a/src/sentry/services/hybrid_cloud/notifications/serial.py b/src/sentry/services/hybrid_cloud/notifications/serial.py
index 1f090b0cbc3ae1..4095c38ceadf47 100644
--- a/src/sentry/services/hybrid_cloud/notifications/serial.py
+++ b/src/sentry/services/hybrid_cloud/notifications/serial.py
@@ -1,5 +1,6 @@
+from sentry.models.integrations.external_actor import ExternalActor
from sentry.models.notificationsetting import NotificationSetting
-from sentry.services.hybrid_cloud.notifications import RpcNotificationSetting
+from sentry.services.hybrid_cloud.notifications import RpcExternalActor, RpcNotificationSetting
def serialize_notification_setting(setting: NotificationSetting) -> RpcNotificationSetting:
@@ -14,3 +15,16 @@ def serialize_notification_setting(setting: NotificationSetting) -> RpcNotificat
type=setting.type,
value=setting.value,
)
+
+
+def serialize_external_actor(actor: ExternalActor) -> RpcExternalActor:
+ return RpcExternalActor(
+ id=actor.id,
+ team_id=actor.team_id,
+ user_id=actor.user_id,
+ organization_id=actor.organization_id,
+ integration_id=actor.integration_id,
+ provider=actor.provider,
+ external_name=actor.external_name,
+ external_id=actor.external_id,
+ )
diff --git a/src/sentry/services/hybrid_cloud/replica/impl.py b/src/sentry/services/hybrid_cloud/replica/impl.py
index 4a6f2481143a30..b8bb1112a83a0c 100644
--- a/src/sentry/services/hybrid_cloud/replica/impl.py
+++ b/src/sentry/services/hybrid_cloud/replica/impl.py
@@ -7,7 +7,12 @@
from sentry.db.models.fields.hybrid_cloud_foreign_key import HybridCloudForeignKey
from sentry.db.models.outboxes import ReplicatedControlModel, ReplicatedRegionModel
from sentry.db.postgres.transactions import enforce_constraints
-from sentry.hybridcloud.models import ApiKeyReplica, ApiTokenReplica, OrgAuthTokenReplica
+from sentry.hybridcloud.models import (
+ ApiKeyReplica,
+ ApiTokenReplica,
+ ExternalActorReplica,
+ OrgAuthTokenReplica,
+)
from sentry.hybridcloud.rpc_services.control_organization_provisioning import (
RpcOrganizationSlugReservation,
)
@@ -17,6 +22,8 @@
from sentry.models.authidentityreplica import AuthIdentityReplica
from sentry.models.authprovider import AuthProvider
from sentry.models.authproviderreplica import AuthProviderReplica
+from sentry.models.integrations.external_actor import ExternalActor
+from sentry.models.integrations.integration import Integration
from sentry.models.organization import Organization
from sentry.models.organizationmemberteam import OrganizationMemberTeam
from sentry.models.organizationmemberteamreplica import OrganizationMemberTeamReplica
@@ -32,6 +39,7 @@
RpcAuthIdentity,
RpcAuthProvider,
)
+from sentry.services.hybrid_cloud.notifications import RpcExternalActor
from sentry.services.hybrid_cloud.organization import RpcOrganizationMemberTeam, RpcTeam
from sentry.services.hybrid_cloud.orgauthtoken.model import RpcOrgAuthToken
from sentry.services.hybrid_cloud.replica.service import ControlReplicaService, RegionReplicaService
@@ -92,6 +100,10 @@ def get_conflicting_unique_columns(
scope_controlled_columns = list(
get_foreign_key_columns(destination, Organization, AuthProvider)
)
+ elif scope == scope.INTEGRATION_SCOPE:
+ scope_controlled_columns = list(
+ get_foreign_key_columns(destination, Organization, Integration)
+ )
else:
raise TypeError(
f"replication to {destination_model} includes unique index that is not scoped by shard!"
@@ -266,6 +278,27 @@ def delete_replicated_org_slug_reservation(
class DatabaseBackedControlReplicaService(ControlReplicaService):
+ def upsert_external_actor_replica(self, *, external_actor: RpcExternalActor) -> None:
+ try:
+ if external_actor.user_id is not None:
+ # Validating existence of user
+ User.objects.get(id=external_actor.user_id)
+ integration = Integration.objects.get(id=external_actor.integration_id)
+ except (User.DoesNotExist, Integration.DoesNotExist):
+ return
+
+ destination = ExternalActorReplica(
+ externalactor_id=external_actor.id,
+ external_id=external_actor.external_id,
+ external_name=external_actor.external_name,
+ organization_id=external_actor.organization_id,
+ user_id=external_actor.user_id,
+ provider=external_actor.provider,
+ team_id=external_actor.team_id, # type: ignore
+ integration_id=integration.id,
+ )
+ handle_replication(ExternalActor, destination, "externalactor_id")
+
def remove_replicated_organization_member_team(
self, *, organization_id: int, organization_member_team_id: int
) -> None:
diff --git a/src/sentry/services/hybrid_cloud/replica/service.py b/src/sentry/services/hybrid_cloud/replica/service.py
index 935c457f03a899..e59ac26900336f 100644
--- a/src/sentry/services/hybrid_cloud/replica/service.py
+++ b/src/sentry/services/hybrid_cloud/replica/service.py
@@ -9,6 +9,7 @@
RpcAuthIdentity,
RpcAuthProvider,
)
+from sentry.services.hybrid_cloud.notifications import RpcExternalActor
from sentry.services.hybrid_cloud.organization import RpcOrganizationMemberTeam, RpcTeam
from sentry.services.hybrid_cloud.orgauthtoken.model import RpcOrgAuthToken
from sentry.services.hybrid_cloud.region import ByRegionName
@@ -37,6 +38,11 @@ def remove_replicated_organization_member_team(
) -> None:
pass
+ @rpc_method
+ @abc.abstractmethod
+ def upsert_external_actor_replica(self, *, external_actor: RpcExternalActor) -> None:
+ pass
+
@classmethod
def get_local_implementation(cls) -> RpcService:
from .impl import DatabaseBackedControlReplicaService
diff --git a/tests/sentry/hybrid_cloud/test_replica.py b/tests/sentry/hybrid_cloud/test_replica.py
index f51f725996936e..989a526dfd99a1 100644
--- a/tests/sentry/hybrid_cloud/test_replica.py
+++ b/tests/sentry/hybrid_cloud/test_replica.py
@@ -1,4 +1,4 @@
-from sentry.hybridcloud.models import ApiKeyReplica
+from sentry.hybridcloud.models import ApiKeyReplica, ExternalActorReplica
from sentry.models.authidentity import AuthIdentity
from sentry.models.authidentityreplica import AuthIdentityReplica
from sentry.models.authprovider import AuthProvider
@@ -15,6 +15,55 @@
from sentry.testutils.silo import all_silo_test, assume_test_silo_mode
+@django_db_all(transaction=True)
+@all_silo_test(stable=True)
+def test_replicate_external_actor():
+ org = Factories.create_organization()
+ integration = Factories.create_integration(organization=org, external_id="hohohomerrychristmas")
+ user = Factories.create_user()
+ team = Factories.create_team(organization=org)
+
+ with assume_test_silo_mode(SiloMode.CONTROL):
+ assert ExternalActorReplica.objects.count() == 0
+
+ xa1 = Factories.create_external_team(team=team, integration_id=integration.id, organization=org)
+ xa2 = Factories.create_external_user(
+ user=user, integration_id=integration.id, organization=org, external_id="12345"
+ )
+
+ with assume_test_silo_mode(SiloMode.CONTROL):
+ xar1 = ExternalActorReplica.objects.get(externalactor_id=xa1.id)
+ xar2 = ExternalActorReplica.objects.get(externalactor_id=xa2.id)
+
+ assert xar1.user_id is None
+ assert xar1.team_id == team.id
+ assert xar1.externalactor_id == xa1.id
+ assert xar1.organization_id == xa1.organization_id
+ assert xar1.integration_id == xa1.integration_id
+ assert xar1.provider == xa1.provider
+ assert xar1.external_name == xa1.external_name
+ assert xar1.external_id == xa1.external_id
+
+ assert xar2.user_id == user.id
+ assert xar2.team_id is None
+ assert xar2.externalactor_id == xa2.id
+ assert xar2.organization_id == xa2.organization_id
+ assert xar2.integration_id == xa2.integration_id
+ assert xar2.provider == xa2.provider
+ assert xar2.external_name == xa2.external_name
+ assert xar2.external_id == xa2.external_id
+
+ with assume_test_silo_mode(SiloMode.REGION):
+ xa2.user_id = 12382317 # not a user id
+ xa2.save()
+
+ with assume_test_silo_mode(SiloMode.CONTROL):
+ xar2 = ExternalActorReplica.objects.get(externalactor_id=xa2.id)
+
+ # Did not update with bad user id.
+ assert xar2.user_id == user.id
+
+
@django_db_all(transaction=True)
@all_silo_test(stable=True)
def test_replicate_auth_provider():
diff --git a/tests/sentry/migrations/test_0550_migrate_no_action_dupe_issue_alerts.py b/tests/sentry/migrations/test_0550_migrate_no_action_dupe_issue_alerts.py
index 4a611d359b64a4..c2fe10ba9b350f 100644
--- a/tests/sentry/migrations/test_0550_migrate_no_action_dupe_issue_alerts.py
+++ b/tests/sentry/migrations/test_0550_migrate_no_action_dupe_issue_alerts.py
@@ -1,7 +1,10 @@
+import pytest
+
from sentry.constants import ObjectStatus
from sentry.testutils.cases import TestMigrations
[email protected]("External actor replication won't work with project rule factories")
class MigrateNoActionDupleIssueAlerts(TestMigrations):
migrate_from = "0549_re_add_groupsubscription_columns"
migrate_to = "0550_migrate_no_action_dupe_issue_alerts"
diff --git a/tests/sentry/migrations/test_0565_fix_diff_env_dupe_alerts.py b/tests/sentry/migrations/test_0565_fix_diff_env_dupe_alerts.py
index 48815996c85f3a..da0dd9d650a8e2 100644
--- a/tests/sentry/migrations/test_0565_fix_diff_env_dupe_alerts.py
+++ b/tests/sentry/migrations/test_0565_fix_diff_env_dupe_alerts.py
@@ -1,8 +1,11 @@
+import pytest
+
from sentry.constants import ObjectStatus
from sentry.models.outbox import outbox_context
from sentry.testutils.cases import TestMigrations
[email protected]("External actor replication won't work with project rule factories")
class FixDiffEnvDupeAlerts(TestMigrations):
migrate_from = "0564_commitfilechange_delete_language_column"
migrate_to = "0565_fix_diff_env_dupe_alerts"
diff --git a/tests/sentry/migrations/test_0574_bacfkill_weekly_report_settings.py b/tests/sentry/migrations/test_0574_bacfkill_weekly_report_settings.py
index 3487e944e5e12c..74693f0cc8e66a 100644
--- a/tests/sentry/migrations/test_0574_bacfkill_weekly_report_settings.py
+++ b/tests/sentry/migrations/test_0574_bacfkill_weekly_report_settings.py
@@ -1,9 +1,12 @@
from uuid import uuid4
+import pytest
+
from sentry.models.notificationsettingoption import NotificationSettingOption
from sentry.testutils.cases import TestMigrations
[email protected]("External actor replication won't work with notification settings changes")
class BackfillWeeklyReportSettingsMigrationTest(TestMigrations):
migrate_from = "0573_add_first_seen_index_groupedmessage"
migrate_to = "0574_backfill_weekly_report_settings"
|
9c34d9af732d61645baef4d91fdfbd65291170e8
|
2022-01-14 02:18:14
|
Scott Cooper
|
test(ui): Convert hook component tests to RTL (#31005)
| false
|
Convert hook component tests to RTL (#31005)
|
test
|
diff --git a/tests/js/spec/components/hook.spec.jsx b/tests/js/spec/components/hook.spec.jsx
index ff9971b7be16f7..70d8ffd3df1ea4 100644
--- a/tests/js/spec/components/hook.spec.jsx
+++ b/tests/js/spec/components/hook.spec.jsx
@@ -1,13 +1,13 @@
-import {mountWithTheme} from 'sentry-test/enzyme';
+import {mountWithTheme, screen} from 'sentry-test/reactTestingLibrary';
import Hook from 'sentry/components/hook';
import HookStore from 'sentry/stores/hookStore';
describe('Hook', function () {
const Wrapper = function Wrapper(props) {
- return <div {...props} />;
+ return <div data-test-id="wrapper" {...props} />;
};
- const routerContext = TestStubs.routerContext();
+ const context = TestStubs.routerContext();
beforeEach(function () {
HookStore.add('footer', ({organization} = {}) => (
@@ -23,39 +23,40 @@ describe('Hook', function () {
});
it('renders component from a hook', function () {
- const wrapper = mountWithTheme(
+ mountWithTheme(
<div>
<Hook name="footer" organization={TestStubs.Organization()} />
</div>,
- routerContext
+ {context}
);
expect(HookStore.hooks.footer).toHaveLength(1);
- expect(wrapper.find('Wrapper')).toHaveLength(1);
- expect(wrapper.find('Wrapper').prop('organization').slug).toBe('org-slug');
+ expect(screen.getByTestId('wrapper')).toBeInTheDocument();
+ expect(screen.getByTestId('wrapper')).toHaveTextContent('org-slug');
});
it('renders an invalid hook', function () {
- const wrapper = mountWithTheme(
+ mountWithTheme(
<div>
<Hook name="invalid-hook" organization={TestStubs.Organization()} />
+ invalid
</div>,
- routerContext
+ {context}
);
- expect(wrapper.find('Wrapper')).toHaveLength(0);
- expect(wrapper.find('div')).toHaveLength(1);
+ expect(screen.queryByText('org-slug')).not.toBeInTheDocument();
+ expect(screen.getByText('invalid')).toBeInTheDocument();
});
it('can re-render when hooks get after initial render', function () {
- const wrapper = mountWithTheme(
+ mountWithTheme(
<div>
<Hook name="footer" organization={TestStubs.Organization()} />
</div>,
- routerContext
+ {context}
);
- expect(wrapper.find('Wrapper')).toHaveLength(1);
+ expect(screen.getByTestId('wrapper')).toBeInTheDocument();
HookStore.add('footer', () => (
<Wrapper key="new" organization={null}>
@@ -63,21 +64,19 @@ describe('Hook', function () {
</Wrapper>
));
- wrapper.update();
-
expect(HookStore.hooks.footer).toHaveLength(2);
- expect(wrapper.find('Wrapper')).toHaveLength(2);
- expect(wrapper.find('Wrapper').at(1).prop('organization')).toEqual(null);
+ expect(screen.getAllByTestId('wrapper')).toHaveLength(2);
+ expect(screen.getAllByTestId('wrapper')[1]).toHaveTextContent('New Hook');
});
it('can use children as a render prop', function () {
- const wrapper = mountWithTheme(
+ mountWithTheme(
<div>
<Hook name="footer" organization={TestStubs.Organization()}>
{({hooks}) => hooks.map((hook, i) => <Wrapper key={i}>{hook}</Wrapper>)}
</Hook>
</div>,
- routerContext
+ {context}
);
HookStore.add('footer', () => (
@@ -86,9 +85,7 @@ describe('Hook', function () {
</Wrapper>
));
- wrapper.update();
-
// Has 2 Wrappers from store, and each is wrapped by another Wrapper
- expect(wrapper.find('Wrapper')).toHaveLength(4);
+ expect(screen.getAllByTestId('wrapper')).toHaveLength(4);
});
});
|
6d1e27d24a980d856f4f973024b4662e6d00034b
|
2024-05-24 02:14:33
|
Katie Byers
|
chore(seer): Rename `seer/utils.py` to `seer/breakpoints.py` (#71352)
| false
|
Rename `seer/utils.py` to `seer/breakpoints.py` (#71352)
|
chore
|
diff --git a/src/sentry/api/endpoints/organization_events_trends_v2.py b/src/sentry/api/endpoints/organization_events_trends_v2.py
index d6446dcc2b0b74..6fdd426f996ff2 100644
--- a/src/sentry/api/endpoints/organization_events_trends_v2.py
+++ b/src/sentry/api/endpoints/organization_events_trends_v2.py
@@ -14,7 +14,7 @@
from sentry.api.paginator import GenericOffsetPaginator
from sentry.api.utils import handle_query_errors
from sentry.search.events.constants import METRICS_GRANULARITIES
-from sentry.seer.utils import detect_breakpoints
+from sentry.seer.breakpoints import detect_breakpoints
from sentry.snuba import metrics_performance
from sentry.snuba.discover import create_result_key, zerofill
from sentry.snuba.metrics_performance import query as metrics_query
diff --git a/src/sentry/api/endpoints/organization_profiling_functions.py b/src/sentry/api/endpoints/organization_profiling_functions.py
index bfa40b618a7a8b..c6605fc817621c 100644
--- a/src/sentry/api/endpoints/organization_profiling_functions.py
+++ b/src/sentry/api/endpoints/organization_profiling_functions.py
@@ -19,7 +19,7 @@
from sentry.models.organization import Organization
from sentry.search.events.builder import ProfileTopFunctionsTimeseriesQueryBuilder
from sentry.search.events.types import QueryBuilderConfig
-from sentry.seer.utils import BreakpointData, detect_breakpoints
+from sentry.seer.breakpoints import BreakpointData, detect_breakpoints
from sentry.snuba import functions
from sentry.snuba.dataset import Dataset
from sentry.snuba.referrer import Referrer
diff --git a/src/sentry/seer/utils.py b/src/sentry/seer/breakpoints.py
similarity index 100%
rename from src/sentry/seer/utils.py
rename to src/sentry/seer/breakpoints.py
diff --git a/src/sentry/statistical_detectors/detector.py b/src/sentry/statistical_detectors/detector.py
index 153dac720a0529..6a0f72660399bb 100644
--- a/src/sentry/statistical_detectors/detector.py
+++ b/src/sentry/statistical_detectors/detector.py
@@ -25,7 +25,7 @@
get_regression_groups,
)
from sentry.search.events.fields import get_function_alias
-from sentry.seer.utils import BreakpointData, detect_breakpoints
+from sentry.seer.breakpoints import BreakpointData, detect_breakpoints
from sentry.statistical_detectors.algorithm import DetectorAlgorithm
from sentry.statistical_detectors.base import DetectorPayload, DetectorState, TrendType
from sentry.statistical_detectors.issue_platform_adapter import fingerprint_regression
diff --git a/src/sentry/statistical_detectors/issue_platform_adapter.py b/src/sentry/statistical_detectors/issue_platform_adapter.py
index f0dea5b587ddf9..f1c1173d57ca1d 100644
--- a/src/sentry/statistical_detectors/issue_platform_adapter.py
+++ b/src/sentry/statistical_detectors/issue_platform_adapter.py
@@ -5,7 +5,7 @@
from sentry.issues.grouptype import GroupType, PerformanceP95EndpointRegressionGroupType
from sentry.issues.issue_occurrence import IssueEvidence, IssueOccurrence
from sentry.issues.producer import PayloadType, produce_occurrence_to_kafka
-from sentry.seer.utils import BreakpointData
+from sentry.seer.breakpoints import BreakpointData
from sentry.utils import metrics
diff --git a/src/sentry/tasks/statistical_detectors.py b/src/sentry/tasks/statistical_detectors.py
index 31aea94309d409..edc4df69770634 100644
--- a/src/sentry/tasks/statistical_detectors.py
+++ b/src/sentry/tasks/statistical_detectors.py
@@ -35,7 +35,7 @@
from sentry.models.statistical_detectors import RegressionType
from sentry.profiles.utils import get_from_profiling_service
from sentry.search.events.types import ParamsType
-from sentry.seer.utils import BreakpointData
+from sentry.seer.breakpoints import BreakpointData
from sentry.sentry_metrics import indexer
from sentry.sentry_metrics.use_case_id_registry import UseCaseID
from sentry.snuba import functions
diff --git a/tests/sentry/seer/test_utils.py b/tests/sentry/seer/test_breakpoints.py
similarity index 86%
rename from tests/sentry/seer/test_utils.py
rename to tests/sentry/seer/test_breakpoints.py
index d709784302cabc..70d1aae21bc4fd 100644
--- a/tests/sentry/seer/test_utils.py
+++ b/tests/sentry/seer/test_breakpoints.py
@@ -3,11 +3,11 @@
import pytest
from urllib3.response import HTTPResponse
-from sentry.seer.utils import detect_breakpoints
+from sentry.seer.breakpoints import detect_breakpoints
from sentry.utils import json
[email protected]("sentry.seer.utils.seer_breakpoint_connection_pool.urlopen")
[email protected]("sentry.seer.breakpoints.seer_breakpoint_connection_pool.urlopen")
def test_detect_breakpoints(mock_urlopen):
data = {
"data": [
@@ -39,7 +39,7 @@ def test_detect_breakpoints(mock_urlopen):
],
)
@mock.patch("sentry_sdk.capture_exception")
[email protected]("sentry.seer.utils.seer_breakpoint_connection_pool.urlopen")
[email protected]("sentry.seer.breakpoints.seer_breakpoint_connection_pool.urlopen")
def test_detect_breakpoints_errors(mock_urlopen, mock_capture_exception, body, status):
mock_urlopen.return_value = HTTPResponse(body, status=status)
diff --git a/tests/sentry/statistical_detectors/test_issue_platform_adapter.py b/tests/sentry/statistical_detectors/test_issue_platform_adapter.py
index fd07819a627a77..367023e3561ced 100644
--- a/tests/sentry/statistical_detectors/test_issue_platform_adapter.py
+++ b/tests/sentry/statistical_detectors/test_issue_platform_adapter.py
@@ -1,7 +1,7 @@
from unittest import mock
from sentry.issues.grouptype import PerformanceP95EndpointRegressionGroupType
-from sentry.seer.utils import BreakpointData
+from sentry.seer.breakpoints import BreakpointData
from sentry.statistical_detectors.issue_platform_adapter import send_regression_to_platform
diff --git a/tests/sentry/tasks/test_statistical_detectors.py b/tests/sentry/tasks/test_statistical_detectors.py
index dd7da9d1d7676e..c151b9b56a6278 100644
--- a/tests/sentry/tasks/test_statistical_detectors.py
+++ b/tests/sentry/tasks/test_statistical_detectors.py
@@ -22,7 +22,7 @@
RegressionType,
get_regression_groups,
)
-from sentry.seer.utils import BreakpointData
+from sentry.seer.breakpoints import BreakpointData
from sentry.sentry_metrics.use_case_id_registry import UseCaseID
from sentry.snuba.discover import zerofill
from sentry.snuba.metrics.naming_layer.mri import TransactionMRI
|
d5615b92197c8378679d067ddb7cba489695e7d5
|
2023-08-17 20:07:53
|
Priscila Oliveira
|
ref(getting-started-docs): Source sdks version from sentry release registry (#54675)
| false
|
Source sdks version from sentry release registry (#54675)
|
ref
|
diff --git a/static/app/components/onboarding/gettingStartedDoc/sdkDocumentation.tsx b/static/app/components/onboarding/gettingStartedDoc/sdkDocumentation.tsx
index 0f82c09b7ea826..6262eb9f405748 100644
--- a/static/app/components/onboarding/gettingStartedDoc/sdkDocumentation.tsx
+++ b/static/app/components/onboarding/gettingStartedDoc/sdkDocumentation.tsx
@@ -1,6 +1,7 @@
import {useEffect, useState} from 'react';
import LoadingIndicator from 'sentry/components/loadingIndicator';
+import {useSourcePackageRegistries} from 'sentry/components/onboarding/gettingStartedDoc/useSourcePackageRegistries';
import {ProductSolution} from 'sentry/components/onboarding/productSelection';
import {PlatformKey} from 'sentry/data/platformCategories';
import type {Organization, PlatformIntegration, Project, ProjectKey} from 'sentry/types';
@@ -22,6 +23,7 @@ export type ModuleProps = {
organization?: Organization;
platformKey?: PlatformKey;
projectId?: Project['id'];
+ sourcePackageRegistries?: ReturnType<typeof useSourcePackageRegistries>;
};
// Loads the component containing the documentation for the specified platform
@@ -33,6 +35,8 @@ export function SdkDocumentation({
organization,
projectId,
}: SdkDocumentationProps) {
+ const sourcePackageRegistries = useSourcePackageRegistries();
+
const [module, setModule] = useState<null | {
default: React.ComponentType<ModuleProps>;
}>(null);
@@ -95,6 +99,7 @@ export function SdkDocumentation({
}
const {default: GettingStartedDoc} = module;
+
return (
<GettingStartedDoc
dsn={projectKeys[0].dsn.public}
@@ -103,6 +108,7 @@ export function SdkDocumentation({
platformKey={platform?.id}
organization={organization}
projectId={projectId}
+ sourcePackageRegistries={sourcePackageRegistries}
/>
);
}
diff --git a/static/app/components/onboarding/gettingStartedDoc/step.tsx b/static/app/components/onboarding/gettingStartedDoc/step.tsx
index d8368aa117fdc1..5142aa36933762 100644
--- a/static/app/components/onboarding/gettingStartedDoc/step.tsx
+++ b/static/app/components/onboarding/gettingStartedDoc/step.tsx
@@ -47,6 +47,10 @@ type ConfigurationType = {
* A callback to be invoked when the configuration is selected and copied to the clipboard
*/
onSelectAndCopy?: () => void;
+ /**
+ * Whether or not the configuration or parts of it are currently being loaded
+ */
+ partialLoading?: boolean;
};
interface BaseStepProps {
@@ -79,6 +83,7 @@ function getConfiguration({
additionalInfo,
onCopy,
onSelectAndCopy,
+ partialLoading,
}: ConfigurationType) {
return (
<Configuration>
@@ -89,6 +94,8 @@ function getConfiguration({
language={language}
onCopy={onCopy}
onSelectAndCopy={onSelectAndCopy}
+ hideCopyButton={partialLoading}
+ disableUserSelection={partialLoading}
>
{language === 'javascript'
? beautify.js(code, {indent_size: 2, e4x: true})
diff --git a/static/app/components/onboarding/gettingStartedDoc/useSourcePackageRegistries.tsx b/static/app/components/onboarding/gettingStartedDoc/useSourcePackageRegistries.tsx
new file mode 100644
index 00000000000000..6ca38666436d90
--- /dev/null
+++ b/static/app/components/onboarding/gettingStartedDoc/useSourcePackageRegistries.tsx
@@ -0,0 +1,45 @@
+import {useEffect} from 'react';
+
+import {Client} from 'sentry/api';
+import {handleXhrErrorResponse} from 'sentry/utils/handleXhrErrorResponse';
+import {useApiQuery} from 'sentry/utils/queryClient';
+
+type ReleaseRegistrySdk = Record<
+ string,
+ {
+ canonical: string;
+ main_docs_url: string;
+ name: string;
+ package_url: string;
+ repo_url: string;
+ version: string;
+ }
+>;
+
+// This exists because /extensions/type/search API is not prefixed with
+// /api/0/, but the default API client on the abstract issue form is...
+const API_CLIENT = new Client({baseUrl: '', headers: {}, credentials: 'omit'});
+
+/**
+ * Fetches the release registry list for SDKs
+ */
+export function useSourcePackageRegistries() {
+ const releaseRegistrySdk = useApiQuery<ReleaseRegistrySdk>(
+ ['https://release-registry.services.sentry.io/sdks'],
+ {
+ staleTime: Infinity,
+ },
+ API_CLIENT
+ );
+
+ useEffect(() => {
+ if (releaseRegistrySdk.error) {
+ handleXhrErrorResponse(
+ 'Failed to fetch sentry release registry',
+ releaseRegistrySdk.error
+ );
+ }
+ }, [releaseRegistrySdk.error]);
+
+ return releaseRegistrySdk;
+}
diff --git a/static/app/gettingStartedDocs/android/android.tsx b/static/app/gettingStartedDocs/android/android.tsx
index 39270cd927d779..42db27c3365990 100644
--- a/static/app/gettingStartedDocs/android/android.tsx
+++ b/static/app/gettingStartedDocs/android/android.tsx
@@ -7,9 +7,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -28,10 +29,16 @@ export const steps = ({
configurations: [
{
language: 'groovy',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
plugins {
id "com.android.application" // should be in the same module
- id "io.sentry.android.gradle" version "3.12.0"
+ id "io.sentry.android.gradle" version "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.android.gradle-plugin']?.version ??
+ '3.12.0'
+ }"
}
`,
},
@@ -139,8 +146,18 @@ export const nextSteps = [
];
// Configuration End
-export function GettingStartedWithAndroid({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} nextSteps={nextSteps} {...props} />;
+export function GettingStartedWithAndroid({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ nextSteps={nextSteps}
+ {...props}
+ />
+ );
}
export default GettingStartedWithAndroid;
diff --git a/static/app/gettingStartedDocs/apple/apple-ios.tsx b/static/app/gettingStartedDocs/apple/apple-ios.tsx
index 99df9c4c38d860..2af24193e090c8 100644
--- a/static/app/gettingStartedDocs/apple/apple-ios.tsx
+++ b/static/app/gettingStartedDocs/apple/apple-ios.tsx
@@ -7,9 +7,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -44,8 +45,13 @@ https://github.com/getsentry/sentry-cocoa.git
</p>
),
language: 'swift',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
-.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.9.3"),
+.package(url: "https://github.com/getsentry/sentry-cocoa", from: "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.cocoa']?.version ?? '8.9.3'
+ }"),
`,
},
],
@@ -231,8 +237,18 @@ export const nextSteps = [
];
// Configuration End
-export function GettingStartedWithIos({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} nextSteps={nextSteps} {...props} />;
+export function GettingStartedWithIos({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ nextSteps={nextSteps}
+ {...props}
+ />
+ );
}
export default GettingStartedWithIos;
diff --git a/static/app/gettingStartedDocs/apple/apple-macos.tsx b/static/app/gettingStartedDocs/apple/apple-macos.tsx
index 6682bd74c1024a..71772ec9f0b92f 100644
--- a/static/app/gettingStartedDocs/apple/apple-macos.tsx
+++ b/static/app/gettingStartedDocs/apple/apple-macos.tsx
@@ -7,9 +7,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -44,8 +45,13 @@ https://github.com/getsentry/sentry-cocoa.git
</p>
),
language: 'swift',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
-.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.9.3"),
+.package(url: "https://github.com/getsentry/sentry-cocoa", from: "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.cocoa']?.version ?? '8.9.3'
+ }"),
`,
},
],
@@ -183,8 +189,18 @@ export const nextSteps = [
];
// Configuration End
-export function GettingStartedWithMacos({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} nextSteps={nextSteps} {...props} />;
+export function GettingStartedWithMacos({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ nextSteps={nextSteps}
+ {...props}
+ />
+ );
}
export default GettingStartedWithMacos;
diff --git a/static/app/gettingStartedDocs/apple/apple.tsx b/static/app/gettingStartedDocs/apple/apple.tsx
index 0eb650fee44729..6c87618736441f 100644
--- a/static/app/gettingStartedDocs/apple/apple.tsx
+++ b/static/app/gettingStartedDocs/apple/apple.tsx
@@ -7,9 +7,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -44,8 +45,13 @@ https://github.com/getsentry/sentry-cocoa.git
</p>
),
language: 'swift',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
-.package(url: "https://github.com/getsentry/sentry-cocoa", from: "8.9.3"),
+.package(url: "https://github.com/getsentry/sentry-cocoa", from: "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.cocoa']?.version ?? '8.9.3'
+ }"),
`,
},
],
@@ -183,8 +189,18 @@ export const nextSteps = [
];
// Configuration End
-export function GettingStartedWithApple({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} nextSteps={nextSteps} {...props} />;
+export function GettingStartedWithApple({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ nextSteps={nextSteps}
+ {...props}
+ />
+ );
}
export default GettingStartedWithApple;
diff --git a/static/app/gettingStartedDocs/capacitor/capacitor.tsx b/static/app/gettingStartedDocs/capacitor/capacitor.tsx
index 53d4d52aed5fb2..100bbc68c4bdf3 100644
--- a/static/app/gettingStartedDocs/capacitor/capacitor.tsx
+++ b/static/app/gettingStartedDocs/capacitor/capacitor.tsx
@@ -8,9 +8,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t(
diff --git a/static/app/gettingStartedDocs/cordova/cordova.tsx b/static/app/gettingStartedDocs/cordova/cordova.tsx
index ce2d20142e618a..dca421017c1f9a 100644
--- a/static/app/gettingStartedDocs/cordova/cordova.tsx
+++ b/static/app/gettingStartedDocs/cordova/cordova.tsx
@@ -9,9 +9,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t('Install our SDK using the cordova command:'),
diff --git a/static/app/gettingStartedDocs/dart/dart.tsx b/static/app/gettingStartedDocs/dart/dart.tsx
index b4b85ee768e5b1..a3f7ccfde68669 100644
--- a/static/app/gettingStartedDocs/dart/dart.tsx
+++ b/static/app/gettingStartedDocs/dart/dart.tsx
@@ -7,9 +7,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -25,9 +26,14 @@ export const steps = ({
configurations: [
{
language: 'yml',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
dependencies:
- sentry: ^7.8.0
+ sentry: ^${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dart']?.version ?? '7.8.0'
+ }
`,
},
],
@@ -162,8 +168,12 @@ Future<void> processOrderBatch(ISentrySpan span) async {
];
// Configuration End
-export function GettingStartedWithDart({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithDart({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithDart;
diff --git a/static/app/gettingStartedDocs/dotnet/aspnet.tsx b/static/app/gettingStartedDocs/dotnet/aspnet.tsx
index 0b809f3b7bf7fb..995b1deedb9785 100644
--- a/static/app/gettingStartedDocs/dotnet/aspnet.tsx
+++ b/static/app/gettingStartedDocs/dotnet/aspnet.tsx
@@ -13,9 +13,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -28,13 +29,23 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t('Package Manager:'),
- code: 'Install-Package Sentry.AspNet -Version 3.34.0',
+ code: `Install-Package Sentry.AspNet -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.aspnet']?.version ?? '3.34.0'
+ }`,
},
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t('Using Entity Framework 6?'),
- code: 'Install-Package Sentry.EntityFramework -Version 3.34.0',
+ code: `Install-Package Sentry.EntityFramework -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.ef']?.version ?? '3.34.0'
+ }`,
},
],
additionalInfo: (
@@ -164,8 +175,12 @@ public class MvcApplication : HttpApplication
];
// Configuration End
-export function GettingStartedWithAspnet({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithAspnet({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithAspnet;
diff --git a/static/app/gettingStartedDocs/dotnet/aspnetcore.tsx b/static/app/gettingStartedDocs/dotnet/aspnetcore.tsx
index 9b391728a2f265..5208096ee2cfe8 100644
--- a/static/app/gettingStartedDocs/dotnet/aspnetcore.tsx
+++ b/static/app/gettingStartedDocs/dotnet/aspnetcore.tsx
@@ -11,9 +11,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -26,13 +27,25 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t('Package Manager:'),
- code: 'Install-Package Sentry.AspNetCore -Version 3.34.0',
+ code: `Install-Package Sentry.AspNetCore -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.aspnetcore']?.version ??
+ '3.34.0'
+ }`,
},
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t('Or .NET Core CLI:'),
- code: 'dotnet add package Sentry.AspNetCore -v 3.34.0',
+ code: `dotnet add package Sentry.AspNetCore -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.aspnetcore']?.version ??
+ '3.34.0'
+ }`,
},
],
},
@@ -215,8 +228,12 @@ public class HomeController : Controller
];
// Configuration End
-export function GettingStartedWithAspnetcore({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithAspnetcore({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithAspnetcore;
diff --git a/static/app/gettingStartedDocs/dotnet/awslambda.tsx b/static/app/gettingStartedDocs/dotnet/awslambda.tsx
index e3f669abe40ecf..c90df049f2c77e 100644
--- a/static/app/gettingStartedDocs/dotnet/awslambda.tsx
+++ b/static/app/gettingStartedDocs/dotnet/awslambda.tsx
@@ -19,20 +19,33 @@ const introduction = (
);
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t('Add the Sentry dependency:'),
configurations: [
{
language: 'powershell',
- code: 'Install-Package Sentry.AspNetCore -Version 3.34.0',
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `Install-Package Sentry.AspNetCore -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.aspnetcore']?.version ??
+ '3.34.0'
+ }`,
},
{
language: 'shell',
- code: 'dotnet add package Sentry.AspNetCore -v 3.34.0',
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `dotnet add package Sentry.AspNetCore -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.aspnetcore']?.version ??
+ '3.34.0'
+ }`,
},
],
additionalInfo: (
@@ -131,8 +144,18 @@ public class BadController
];
// Configuration End
-export function GettingStartedAwsLambda({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
+export function GettingStartedAwsLambda({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ introduction={introduction}
+ {...props}
+ />
+ );
}
export default GettingStartedAwsLambda;
diff --git a/static/app/gettingStartedDocs/dotnet/dotnet.tsx b/static/app/gettingStartedDocs/dotnet/dotnet.tsx
index a0b9432b937434..0daaff0e5cefa7 100644
--- a/static/app/gettingStartedDocs/dotnet/dotnet.tsx
+++ b/static/app/gettingStartedDocs/dotnet/dotnet.tsx
@@ -22,9 +22,10 @@ const introduction = (
);
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -37,12 +38,21 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
# Using Package Manager
-Install-Package Sentry -Version 3.34.0
+Install-Package Sentry -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
# Or using .NET Core CLI
-dotnet add package Sentry -v 3.34.0
+dotnet add package Sentry -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
`,
},
],
@@ -186,8 +196,18 @@ transaction.Finish(); // Mark the transaction as finished and send it to Sentry
];
// Configuration End
-export function GettingStartedWithDotnet({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
+export function GettingStartedWithDotnet({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ introduction={introduction}
+ {...props}
+ />
+ );
}
export default GettingStartedWithDotnet;
diff --git a/static/app/gettingStartedDocs/dotnet/gcpfunctions.tsx b/static/app/gettingStartedDocs/dotnet/gcpfunctions.tsx
index a8b86279de2473..db15671d332d45 100644
--- a/static/app/gettingStartedDocs/dotnet/gcpfunctions.tsx
+++ b/static/app/gettingStartedDocs/dotnet/gcpfunctions.tsx
@@ -11,9 +11,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -26,20 +27,38 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t('Package Manager:'),
- code: 'Install-Package Sentry.Google.Cloud.Functions -Version 3.34.0',
+ code: `Install-Package Sentry.Google.Cloud.Functions -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.google-cloud-function']
+ ?.version ?? '3.34.0'
+ }`,
},
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t('Or .NET Core CLI:'),
- code: 'dotnet add package Sentry.Google.Cloud.Functions -v 3.34.0',
+ code: `dotnet add package Sentry.Google.Cloud.Functions -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.google-cloud-function']
+ ?.version ?? '3.34.0'
+ }`,
},
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t('Or, manually add the Sentry dependency into your csproj file:'),
code: `
<ItemGroup>
- <PackageReference Include="Sentry.Google.Cloud.Functions" Version="3.34.0"/>
+ <PackageReference Include="Sentry.Google.Cloud.Functions" Version="${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.google-cloud-function']?.version ??
+ '3.34.0'
+ }"/>
</ItemGroup>
`,
},
@@ -162,8 +181,12 @@ public Task HandleAsync(HttpContext context)
];
// Configuration End
-export function GettingStartedWithGCPFunctions({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithGCPFunctions({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithGCPFunctions;
diff --git a/static/app/gettingStartedDocs/dotnet/maui.tsx b/static/app/gettingStartedDocs/dotnet/maui.tsx
index ddaf7cc626df63..5b6427ce03fcb2 100644
--- a/static/app/gettingStartedDocs/dotnet/maui.tsx
+++ b/static/app/gettingStartedDocs/dotnet/maui.tsx
@@ -9,9 +9,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -24,11 +25,21 @@ export const steps = ({
configurations: [
{
language: 'shell',
- code: 'dotnet add package Sentry.Maui -v 3.34.0',
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `dotnet add package Sentry.Maui -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.maui']?.version ?? '3.34.0'
+ }`,
},
{
language: 'powershell',
- code: 'Install-Package Sentry.Maui -Version 3.34.0',
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `Install-Package Sentry.Maui -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.maui']?.version ?? '3.34.0'
+ }`,
},
],
},
@@ -186,8 +197,12 @@ transaction.Finish(); // Mark the transaction as finished and send it to Sentry
];
// Configuration End
-export function GettingStartedWithMaui({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithMaui({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithMaui;
diff --git a/static/app/gettingStartedDocs/dotnet/uwp.tsx b/static/app/gettingStartedDocs/dotnet/uwp.tsx
index df795aa405a381..e3b5d661d9e20f 100644
--- a/static/app/gettingStartedDocs/dotnet/uwp.tsx
+++ b/static/app/gettingStartedDocs/dotnet/uwp.tsx
@@ -13,9 +13,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -28,12 +29,21 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
# Using Package Manager
-Install-Package Sentry -Version 3.34.0
+Install-Package Sentry -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
# Or using .NET Core CLI
-dotnet add package Sentry -v 3.34.0
+dotnet add package Sentry -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
`,
},
],
@@ -224,8 +234,12 @@ transaction.Finish(); // Mark the transaction as finished and send it to Sentry
];
// Configuration End
-export function GettingStartedWithUwp({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithUwp({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithUwp;
diff --git a/static/app/gettingStartedDocs/dotnet/winforms.tsx b/static/app/gettingStartedDocs/dotnet/winforms.tsx
index 258a6595f11055..d604ac45826794 100644
--- a/static/app/gettingStartedDocs/dotnet/winforms.tsx
+++ b/static/app/gettingStartedDocs/dotnet/winforms.tsx
@@ -13,9 +13,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -28,12 +29,21 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
# Using Package Manager
-Install-Package Sentry -Version 3.34.0
+Install-Package Sentry -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
# Or using .NET Core CLI
-dotnet add package Sentry -v 3.34.0
+dotnet add package Sentry -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
`,
},
],
@@ -192,8 +202,12 @@ transaction.Finish(); // Mark the transaction as finished and send it to Sentry
];
// Configuration End
-export function GettingStartedWithWinForms({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithWinForms({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithWinForms;
diff --git a/static/app/gettingStartedDocs/dotnet/wpf.tsx b/static/app/gettingStartedDocs/dotnet/wpf.tsx
index 0d222e9771c7e7..189de96a882978 100644
--- a/static/app/gettingStartedDocs/dotnet/wpf.tsx
+++ b/static/app/gettingStartedDocs/dotnet/wpf.tsx
@@ -13,9 +13,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -28,12 +29,21 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
# Using Package Manager
-Install-Package Sentry -Version 3.34.0
+Install-Package Sentry -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
# Or using .NET Core CLI
-dotnet add package Sentry -v 3.34.0
+dotnet add package Sentry -v ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet']?.version ?? '3.34.0'
+ }
`,
},
],
@@ -192,8 +202,12 @@ transaction.Finish(); // Mark the transaction as finished and send it to Sentry
];
// Configuration End
-export function GettingStartedWithWpf({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithWpf({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithWpf;
diff --git a/static/app/gettingStartedDocs/dotnet/xamarin.tsx b/static/app/gettingStartedDocs/dotnet/xamarin.tsx
index 964c333571ea00..567384f4a29370 100644
--- a/static/app/gettingStartedDocs/dotnet/xamarin.tsx
+++ b/static/app/gettingStartedDocs/dotnet/xamarin.tsx
@@ -9,9 +9,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -24,12 +25,22 @@ export const steps = ({
configurations: [
{
language: 'shell',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
# For Xamarin.Forms
-Install-Package Sentry.Xamarin.Forms -Version 1.5.2
+Install-Package Sentry.Xamarin.Forms -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.xamarin-forms']?.version ??
+ '1.5.2'
+ }
# If you are not using Xamarin.Forms, but only Xamarin:
-Install-Package Sentry.Xamarin -Version 1.5.2
+Install-Package Sentry.Xamarin -Version ${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.xamarin']?.version ?? '1.5.2'
+ }
`,
},
],
@@ -239,8 +250,12 @@ transaction.Finish(); // Mark the transaction as finished and send it to Sentry
];
// Configuration End
-export function GettingStartedWithXamarin({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithXamarin({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithXamarin;
diff --git a/static/app/gettingStartedDocs/elixir/elixir.tsx b/static/app/gettingStartedDocs/elixir/elixir.tsx
index 126c913d20700c..9909e9ba3800ae 100644
--- a/static/app/gettingStartedDocs/elixir/elixir.tsx
+++ b/static/app/gettingStartedDocs/elixir/elixir.tsx
@@ -9,9 +9,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/flutter/flutter.tsx b/static/app/gettingStartedDocs/flutter/flutter.tsx
index 484c5ab83452e7..d918228688ebfb 100644
--- a/static/app/gettingStartedDocs/flutter/flutter.tsx
+++ b/static/app/gettingStartedDocs/flutter/flutter.tsx
@@ -7,9 +7,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -25,9 +26,14 @@ export const steps = ({
configurations: [
{
language: 'yml',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
dependencies:
- sentry_flutter: ^7.8.0
+ sentry_flutter: ^${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dart.flutter']?.version ?? '7.8.0'
+ }
`,
},
],
@@ -239,8 +245,12 @@ Future<void> processOrderBatch(ISentrySpan span) async {
];
// Configuration End
-export function GettingStartedWithFlutter({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithFlutter({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithFlutter;
diff --git a/static/app/gettingStartedDocs/go/echo.tsx b/static/app/gettingStartedDocs/go/echo.tsx
index 140dd39168c7c7..a3cc8c80549f43 100644
--- a/static/app/gettingStartedDocs/go/echo.tsx
+++ b/static/app/gettingStartedDocs/go/echo.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/go/fasthttp.tsx b/static/app/gettingStartedDocs/go/fasthttp.tsx
index f86b77edb1e325..552bce38f66c26 100644
--- a/static/app/gettingStartedDocs/go/fasthttp.tsx
+++ b/static/app/gettingStartedDocs/go/fasthttp.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/go/gin.tsx b/static/app/gettingStartedDocs/go/gin.tsx
index 0e739d76a77599..bade7bcb0b1f90 100644
--- a/static/app/gettingStartedDocs/go/gin.tsx
+++ b/static/app/gettingStartedDocs/go/gin.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/go/go.tsx b/static/app/gettingStartedDocs/go/go.tsx
index ca03c435b8e9bc..f8e55ef8dc51f4 100644
--- a/static/app/gettingStartedDocs/go/go.tsx
+++ b/static/app/gettingStartedDocs/go/go.tsx
@@ -6,9 +6,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/go/http.tsx b/static/app/gettingStartedDocs/go/http.tsx
index bfcf188fe3b791..5b27124b7f48da 100644
--- a/static/app/gettingStartedDocs/go/http.tsx
+++ b/static/app/gettingStartedDocs/go/http.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/go/iris.tsx b/static/app/gettingStartedDocs/go/iris.tsx
index 724a74ade4f19a..c6cc724b179f74 100644
--- a/static/app/gettingStartedDocs/go/iris.tsx
+++ b/static/app/gettingStartedDocs/go/iris.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/go/martini.tsx b/static/app/gettingStartedDocs/go/martini.tsx
index 430815811d9f27..9f7c7c3fc5a52e 100644
--- a/static/app/gettingStartedDocs/go/martini.tsx
+++ b/static/app/gettingStartedDocs/go/martini.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/go/negroni.tsx b/static/app/gettingStartedDocs/go/negroni.tsx
index ff36ad84ab4b4d..ae002acd00eb36 100644
--- a/static/app/gettingStartedDocs/go/negroni.tsx
+++ b/static/app/gettingStartedDocs/go/negroni.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/ionic/ionic.tsx b/static/app/gettingStartedDocs/ionic/ionic.tsx
index 5a293443d884e1..a821acb0718384 100644
--- a/static/app/gettingStartedDocs/ionic/ionic.tsx
+++ b/static/app/gettingStartedDocs/ionic/ionic.tsx
@@ -8,9 +8,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/java/java.tsx b/static/app/gettingStartedDocs/java/java.tsx
index 4ea52b022049de..360e6db16276ce 100644
--- a/static/app/gettingStartedDocs/java/java.tsx
+++ b/static/app/gettingStartedDocs/java/java.tsx
@@ -21,9 +21,10 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t('Install the SDK via Gradle, Maven, or SBT:'),
@@ -33,6 +34,7 @@ export const steps = ({
configurations: [
{
language: 'groovy',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: (
<p>
{tct('For Gradle, add to your [code:build.gradle] file:', {
@@ -48,12 +50,17 @@ repositories {
// Add Sentry's SDK as a dependency.
dependencies {
- implementation 'io.sentry:sentry:6.27.0'
+ implementation 'io.sentry:sentry:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java']?.version ?? '6.27.0'
+ }'
}
`,
},
{
language: 'groovy',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t(
'To upload your source code to Sentry so it can be shown in stack traces, use our Gradle plugin.'
),
@@ -65,7 +72,12 @@ buildscript {
}
plugins {
- id "io.sentry.jvm.gradle" version "3.11.1"
+ id "io.sentry.jvm.gradle" version "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.android.gradle-plugin']?.version ??
+ '3.11.1'
+ }"
}
sentry {
@@ -87,6 +99,7 @@ sentry {
configurations: [
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: (
<p>
{tct('For Maven, add to your [code:pom.xml] file:', {code: <code />})}
@@ -96,12 +109,17 @@ sentry {
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java']?.version ?? '6.27.0'
+ }</version>
</dependency>
`,
},
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t(
'To upload your source code to Sentry so it can be shown in stack traces, use our Maven plugin.'
),
@@ -111,7 +129,11 @@ sentry {
<plugin>
<groupId>io.sentry</groupId>
<artifactId>sentry-maven-plugin</artifactId>
- <version>0.0.3</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.mavenplugin']?.version ?? '0.0.3'
+ }</version>
<configuration>
<!-- for showing output of sentry-cli -->
<debugSentryCli>true</debugSentryCli>
@@ -154,7 +176,12 @@ sentry {
{
description: <p>{tct('For [strong:SBT]:', {strong: <strong />})}</p>,
language: 'scala',
- code: `libraryDependencies += "io.sentry" % "sentry" % "6.27.0"`,
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `libraryDependencies += "io.sentry" % "sentry" % "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java']?.version ?? '6.27.0'
+ }"`,
},
],
},
@@ -276,8 +303,18 @@ transaction.finish();
];
// Configuration End
-export function GettingStartedWithJava({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
+export function GettingStartedWithJava({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ introduction={introduction}
+ {...props}
+ />
+ );
}
export default GettingStartedWithJava;
diff --git a/static/app/gettingStartedDocs/java/log4j2.tsx b/static/app/gettingStartedDocs/java/log4j2.tsx
index 12ec2ee1062b68..a34e47ca4de5d5 100644
--- a/static/app/gettingStartedDocs/java/log4j2.tsx
+++ b/static/app/gettingStartedDocs/java/log4j2.tsx
@@ -24,9 +24,10 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t(
@@ -38,16 +39,22 @@ export const steps = ({
configurations: [
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-log4j2</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.log4j2']?.version ?? '6.27.0'
+ }</version>
</dependency>
`,
},
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t(
'To upload your source code to Sentry so it can be shown in stack traces, use our Maven plugin.'
),
@@ -57,7 +64,11 @@ export const steps = ({
<plugin>
<groupId>io.sentry</groupId>
<artifactId>sentry-maven-plugin</artifactId>
- <version>0.0.3</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.mavenplugin']?.version ?? '0.0.3'
+ }</version>
<configuration>
<!-- for showing output of sentry-cli -->
<debugSentryCli>true</debugSentryCli>
@@ -99,7 +110,13 @@ export const steps = ({
configurations: [
{
language: 'groovy',
- code: "implementation 'io.sentry:sentry-log4j2:6.27.0'",
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `implementation 'io.sentry:sentry-log4j2:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.log4j2']?.version ??
+ '6.27.0'
+ }'`,
},
{
description: t(
@@ -114,7 +131,12 @@ buildscript {
}
plugins {
- id "io.sentry.jvm.gradle" version "3.11.1"
+ id "io.sentry.jvm.gradle" version "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.android.gradle-plugin']?.version ??
+ '3.11.1'
+ }"
}
sentry {
@@ -268,8 +290,18 @@ try {
];
// Configuration End
-export function GettingStartedWithLog4j2({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
+export function GettingStartedWithLog4j2({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ introduction={introduction}
+ {...props}
+ />
+ );
}
export default GettingStartedWithLog4j2;
diff --git a/static/app/gettingStartedDocs/java/logback.tsx b/static/app/gettingStartedDocs/java/logback.tsx
index cbf6ab2711416f..93ac2e1dd78983 100644
--- a/static/app/gettingStartedDocs/java/logback.tsx
+++ b/static/app/gettingStartedDocs/java/logback.tsx
@@ -22,9 +22,10 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t(
@@ -36,16 +37,22 @@ export const steps = ({
configurations: [
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-logback</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.logback']?.version ?? '6.27.0'
+ }</version>
</dependency>
`,
},
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t(
'To upload your source code to Sentry so it can be shown in stack traces, use our Maven plugin.'
),
@@ -55,7 +62,11 @@ export const steps = ({
<plugin>
<groupId>io.sentry</groupId>
<artifactId>sentry-maven-plugin</artifactId>
- <version>0.0.3</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.mavenplugin']?.version ?? '0.0.3'
+ }</version>
<configuration>
<!-- for showing output of sentry-cli -->
<debugSentryCli>true</debugSentryCli>
@@ -97,13 +108,20 @@ export const steps = ({
configurations: [
{
language: 'groovy',
- code: "implementation 'io.sentry:sentry-logback:6.27.0'",
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `implementation 'io.sentry:sentry-logback:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.logback']?.version ??
+ '6.27.0'
+ }'`,
},
{
description: t(
'To upload your source code to Sentry so it can be shown in stack traces, use our Maven plugin.'
),
language: 'groovy',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
buildscript {
repositories {
@@ -112,7 +130,12 @@ buildscript {
}
plugins {
- id "io.sentry.jvm.gradle" version "3.11.1"
+ id "io.sentry.jvm.gradle" version "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.android.gradle-plugin']?.version ??
+ '3.11.1'
+ }"
}
sentry {
@@ -274,8 +297,18 @@ try {
];
// Configuration End
-export function GettingStartedWithLogBack({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
+export function GettingStartedWithLogBack({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ introduction={introduction}
+ {...props}
+ />
+ );
}
export default GettingStartedWithLogBack;
diff --git a/static/app/gettingStartedDocs/java/spring-boot.tsx b/static/app/gettingStartedDocs/java/spring-boot.tsx
index 716b919563e486..dfbbd13da47402 100644
--- a/static/app/gettingStartedDocs/java/spring-boot.tsx
+++ b/static/app/gettingStartedDocs/java/spring-boot.tsx
@@ -29,9 +29,10 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t('Install using either Maven or Gradle:'),
@@ -41,23 +42,34 @@ export const steps = ({
configurations: [
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: <strong>{t('Spring Boot 2')}</strong>,
code: `
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-boot-starter</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring-boot']?.version ?? '6.27.0'
+ }</version>
</dependency>
`,
},
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: <strong>{t('Spring Boot 3')}</strong>,
code: `
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-boot-starter-jakarta</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring-boot.jakarta']?.version ??
+ '6.27.0'
+ }</version>
</dependency>
`,
},
@@ -69,12 +81,24 @@ export const steps = ({
{
language: 'properties',
description: <strong>{t('Spring Boot 2')}</strong>,
- code: "implementation 'io.sentry:sentry-spring-boot-starter:6.27.0'",
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `implementation 'io.sentry:sentry-spring-boot-starter:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring-boot']?.version ??
+ '6.27.0'
+ }'`,
},
{
language: 'properties',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: <strong>{t('Spring Boot 3')}</strong>,
- code: "implementation 'io.sentry:sentry-spring-boot-starter-jakarta:6.27.0'",
+ code: `implementation 'io.sentry:sentry-spring-boot-starter-jakarta:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring-boot.jakarta']
+ ?.version ?? '6.27.0'
+ }'`,
},
],
},
@@ -136,7 +160,11 @@ sentry:
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-logback</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.logback']?.version ?? '6.27.0'
+ }</version>
</dependency>
`,
},
@@ -151,7 +179,11 @@ sentry:
<plugin>
<groupId>io.sentry</groupId>
<artifactId>sentry-maven-plugin</artifactId>
- <version>0.0.3</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.mavenplugin']?.version ?? '0.0.3'
+ }</version>
<configuration>
<!-- for showing output of sentry-cli -->
<debugSentryCli>true</debugSentryCli>
@@ -193,7 +225,13 @@ sentry:
configurations: [
{
language: 'properties',
- code: "implementation 'io.sentry:sentry-logback:6.27.0'",
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `implementation 'io.sentry:sentry-logback:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.logback']?.version ??
+ '6.27.0'
+ }'`,
},
{
language: 'javascript', // TODO: This shouldn't be javascript but because of better formatting we use it for now
@@ -208,7 +246,12 @@ buildscript {
}
plugins {
- id "io.sentry.jvm.gradle" version "3.11.1"
+ id "io.sentry.jvm.gradle" version "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.android.gradle-plugin']?.version ??
+ '3.11.1'
+ }"
}
sentry {
diff --git a/static/app/gettingStartedDocs/java/spring.tsx b/static/app/gettingStartedDocs/java/spring.tsx
index d2273f41f82408..dcf16d23944b72 100644
--- a/static/app/gettingStartedDocs/java/spring.tsx
+++ b/static/app/gettingStartedDocs/java/spring.tsx
@@ -28,9 +28,10 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t(
@@ -42,23 +43,33 @@ export const steps = ({
configurations: [
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: <strong>{t('Spring 5')}</strong>,
code: `
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring']?.version ?? '6.27.0'
+ }</version>
</dependency>
`,
},
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: <strong>{t('Spring 6')}</strong>,
code: `
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-spring-jakarta</artifactId>
- <version>6.27.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring.jakarta']?.version ?? '6.27.0'
+ }</version>
</dependency>
`,
},
@@ -155,6 +166,7 @@ import org.springframework.core.Ordered
configurations: [
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t(
'To upload your source code to Sentry so it can be shown in stack traces, use our Maven plugin.'
),
@@ -164,7 +176,11 @@ import org.springframework.core.Ordered
<plugin>
<groupId>io.sentry</groupId>
<artifactId>sentry-maven-plugin</artifactId>
- <version>0.0.3</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.mavenplugin']?.version ?? '0.0.3'
+ }</version>
<configuration>
<!-- for showing output of sentry-cli -->
<debugSentryCli>true</debugSentryCli>
@@ -206,12 +222,23 @@ import org.springframework.core.Ordered
{
description: <strong>{t('Spring 5')}</strong>,
language: 'groovy',
- code: `implementation 'io.sentry:sentry-spring:6.27.0'`,
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `implementation 'io.sentry:sentry-spring:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring']?.version ??
+ '6.27.0'
+ }'`,
},
{
description: <strong>{t('Spring 6')}</strong>,
language: 'groovy',
- code: `implementation 'io.sentry:sentry-spring-jakarta:6.27.0'`,
+ code: `implementation 'io.sentry:sentry-spring-jakarta:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.spring.jakarta']
+ ?.version ?? '6.27.0'
+ }'`,
},
],
},
@@ -272,6 +299,7 @@ try {
configurations: [
{
language: 'groovy',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: t(
'To upload your source code to Sentry so it can be shown in stack traces, use our Gradle plugin.'
),
@@ -283,7 +311,12 @@ repositories {
}
plugins {
-id "io.sentry.jvm.gradle" version "3.11.1"
+id "io.sentry.jvm.gradle" version "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java.android.gradle-plugin']
+ ?.version ?? '3.11.1'
+ }"
}
sentry {
@@ -334,8 +367,18 @@ authToken = "your-sentry-auth-token"
];
// Configuration End
-export function GettingStartedWithSpring({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
+export function GettingStartedWithSpring({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ introduction={introduction}
+ {...props}
+ />
+ );
}
export default GettingStartedWithSpring;
diff --git a/static/app/gettingStartedDocs/kotlin/kotlin.tsx b/static/app/gettingStartedDocs/kotlin/kotlin.tsx
index abf6b8fd0edd2e..ee13cf141fc342 100644
--- a/static/app/gettingStartedDocs/kotlin/kotlin.tsx
+++ b/static/app/gettingStartedDocs/kotlin/kotlin.tsx
@@ -26,9 +26,10 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: t('Install the SDK via Gradle or Maven:'),
@@ -43,6 +44,7 @@ export const steps = ({
})}
</p>
),
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
// Make sure mavenCentral is there.
repositories {
@@ -50,12 +52,17 @@ repositories {
}
dependencies {
- implementation 'io.sentry:sentry:{{@inject packages.version('sentry.java', '4.0.0') }}'
+ implementation 'io.sentry:sentry:${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java']?.version ?? '4.0.0'
+ }'
}
`,
},
{
language: 'xml',
+ partialLoading: sourcePackageRegistries?.isLoading,
description: (
<p>
{tct('For [strong:Maven], add to your [code:pom.xml] file:', {
@@ -68,7 +75,11 @@ dependencies {
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry</artifactId>
- <version>6.25.0</version>
+ <version>${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.java']?.version ?? '6.25.0'
+ }</version>
</dependency>
`,
},
@@ -175,8 +186,18 @@ throw e
];
// Configuration End
-export function GettingStartedWithKotlin({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} introduction={introduction} {...props} />;
+export function GettingStartedWithKotlin({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return (
+ <Layout
+ steps={steps({dsn, sourcePackageRegistries})}
+ introduction={introduction}
+ {...props}
+ />
+ );
}
export default GettingStartedWithKotlin;
diff --git a/static/app/gettingStartedDocs/minidump/minidump.tsx b/static/app/gettingStartedDocs/minidump/minidump.tsx
index f17f6f877338cd..976f1847cfd3a1 100644
--- a/static/app/gettingStartedDocs/minidump/minidump.tsx
+++ b/static/app/gettingStartedDocs/minidump/minidump.tsx
@@ -10,9 +10,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
title: t('Creating and Uploading Minidumps'),
description: (
diff --git a/static/app/gettingStartedDocs/native/native-qt.tsx b/static/app/gettingStartedDocs/native/native-qt.tsx
index 3ed24a76068f5a..0cc964de8d79d4 100644
--- a/static/app/gettingStartedDocs/native/native-qt.tsx
+++ b/static/app/gettingStartedDocs/native/native-qt.tsx
@@ -9,9 +9,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/native/native.tsx b/static/app/gettingStartedDocs/native/native.tsx
index 62422470ded7e1..3f1be795fd3423 100644
--- a/static/app/gettingStartedDocs/native/native.tsx
+++ b/static/app/gettingStartedDocs/native/native.tsx
@@ -9,9 +9,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/php/laravel.tsx b/static/app/gettingStartedDocs/php/laravel.tsx
index 135856a11394f0..667b1a66f7b8b9 100644
--- a/static/app/gettingStartedDocs/php/laravel.tsx
+++ b/static/app/gettingStartedDocs/php/laravel.tsx
@@ -25,9 +25,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
configurations: [
diff --git a/static/app/gettingStartedDocs/php/php.tsx b/static/app/gettingStartedDocs/php/php.tsx
index a0e430f050c098..db838002c3a0fd 100644
--- a/static/app/gettingStartedDocs/php/php.tsx
+++ b/static/app/gettingStartedDocs/php/php.tsx
@@ -7,9 +7,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/php/symfony.tsx b/static/app/gettingStartedDocs/php/symfony.tsx
index 512490ef56ed01..23cfae05b7dac4 100644
--- a/static/app/gettingStartedDocs/php/symfony.tsx
+++ b/static/app/gettingStartedDocs/php/symfony.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
configurations: [
diff --git a/static/app/gettingStartedDocs/python/aiohttp.tsx b/static/app/gettingStartedDocs/python/aiohttp.tsx
index 63ffc829fa01b2..acea5ca5c2cf7f 100644
--- a/static/app/gettingStartedDocs/python/aiohttp.tsx
+++ b/static/app/gettingStartedDocs/python/aiohttp.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/asgi.tsx b/static/app/gettingStartedDocs/python/asgi.tsx
index 182a0311216359..d4449607d68413 100644
--- a/static/app/gettingStartedDocs/python/asgi.tsx
+++ b/static/app/gettingStartedDocs/python/asgi.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.CONFIGURE,
description: (
diff --git a/static/app/gettingStartedDocs/python/awslambda.tsx b/static/app/gettingStartedDocs/python/awslambda.tsx
index 14773afe92eeb5..f2563efc656390 100644
--- a/static/app/gettingStartedDocs/python/awslambda.tsx
+++ b/static/app/gettingStartedDocs/python/awslambda.tsx
@@ -25,9 +25,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/bottle.tsx b/static/app/gettingStartedDocs/python/bottle.tsx
index 7ee4a4a08fd902..bab134199e265e 100644
--- a/static/app/gettingStartedDocs/python/bottle.tsx
+++ b/static/app/gettingStartedDocs/python/bottle.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/celery.tsx b/static/app/gettingStartedDocs/python/celery.tsx
index 5648d294157d60..53ebe57dea3e0a 100644
--- a/static/app/gettingStartedDocs/python/celery.tsx
+++ b/static/app/gettingStartedDocs/python/celery.tsx
@@ -17,9 +17,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.CONFIGURE,
description: (
diff --git a/static/app/gettingStartedDocs/python/chalice.tsx b/static/app/gettingStartedDocs/python/chalice.tsx
index dca8949a2c0846..24c1c97a6ec997 100644
--- a/static/app/gettingStartedDocs/python/chalice.tsx
+++ b/static/app/gettingStartedDocs/python/chalice.tsx
@@ -7,9 +7,7 @@ import {tct} from 'sentry/locale';
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/falcon.tsx b/static/app/gettingStartedDocs/python/falcon.tsx
index 4b2b913ca8be17..e3fa713c34eebd 100644
--- a/static/app/gettingStartedDocs/python/falcon.tsx
+++ b/static/app/gettingStartedDocs/python/falcon.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/fastapi.tsx b/static/app/gettingStartedDocs/python/fastapi.tsx
index 965bc32ba58a0b..c8a8c3c7f0af0f 100644
--- a/static/app/gettingStartedDocs/python/fastapi.tsx
+++ b/static/app/gettingStartedDocs/python/fastapi.tsx
@@ -15,9 +15,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/flask.tsx b/static/app/gettingStartedDocs/python/flask.tsx
index 339986c359adca..83ad6ba926c975 100644
--- a/static/app/gettingStartedDocs/python/flask.tsx
+++ b/static/app/gettingStartedDocs/python/flask.tsx
@@ -7,9 +7,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/gcpfunctions.tsx b/static/app/gettingStartedDocs/python/gcpfunctions.tsx
index fc0a73a466cc84..31a165a0698c12 100644
--- a/static/app/gettingStartedDocs/python/gcpfunctions.tsx
+++ b/static/app/gettingStartedDocs/python/gcpfunctions.tsx
@@ -12,9 +12,7 @@ import {space} from 'sentry/styles/space';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/mongo.tsx b/static/app/gettingStartedDocs/python/mongo.tsx
index 93cdd46182d8bd..30057b6ea7b36d 100644
--- a/static/app/gettingStartedDocs/python/mongo.tsx
+++ b/static/app/gettingStartedDocs/python/mongo.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/pylons.tsx b/static/app/gettingStartedDocs/python/pylons.tsx
index 394e3bb815a5f4..a775da153d8ede 100644
--- a/static/app/gettingStartedDocs/python/pylons.tsx
+++ b/static/app/gettingStartedDocs/python/pylons.tsx
@@ -6,9 +6,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/pyramid.tsx b/static/app/gettingStartedDocs/python/pyramid.tsx
index 71d389a4cbfe0f..7fb8994f8d8491 100644
--- a/static/app/gettingStartedDocs/python/pyramid.tsx
+++ b/static/app/gettingStartedDocs/python/pyramid.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: <p>{tct('Install [code:sentry-sdk] from PyPI:', {code: <code />})}</p>,
diff --git a/static/app/gettingStartedDocs/python/python.tsx b/static/app/gettingStartedDocs/python/python.tsx
index 63e6db6332e1a7..ddc3e231349933 100644
--- a/static/app/gettingStartedDocs/python/python.tsx
+++ b/static/app/gettingStartedDocs/python/python.tsx
@@ -6,9 +6,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/quart.tsx b/static/app/gettingStartedDocs/python/quart.tsx
index d5408f0d2b47d0..9295db403c08da 100644
--- a/static/app/gettingStartedDocs/python/quart.tsx
+++ b/static/app/gettingStartedDocs/python/quart.tsx
@@ -23,9 +23,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: <p>{tct('Install [code:sentry-sdk] from PyPI:', {code: <code />})}</p>,
diff --git a/static/app/gettingStartedDocs/python/rq.tsx b/static/app/gettingStartedDocs/python/rq.tsx
index 3075e4f9448b1e..53beac47fbf502 100644
--- a/static/app/gettingStartedDocs/python/rq.tsx
+++ b/static/app/gettingStartedDocs/python/rq.tsx
@@ -15,9 +15,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.CONFIGURE,
description: (
diff --git a/static/app/gettingStartedDocs/python/sanic.tsx b/static/app/gettingStartedDocs/python/sanic.tsx
index c6ae52492be394..632b287b39442a 100644
--- a/static/app/gettingStartedDocs/python/sanic.tsx
+++ b/static/app/gettingStartedDocs/python/sanic.tsx
@@ -41,9 +41,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: <p>{tct('Install [code:sentry-sdk] from PyPI:', {code: <code />})}</p>,
diff --git a/static/app/gettingStartedDocs/python/serverless.tsx b/static/app/gettingStartedDocs/python/serverless.tsx
index 8fbe79a6c057cf..e8ee834185a065 100644
--- a/static/app/gettingStartedDocs/python/serverless.tsx
+++ b/static/app/gettingStartedDocs/python/serverless.tsx
@@ -14,9 +14,7 @@ import {t, tct} from 'sentry/locale';
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/starlette.tsx b/static/app/gettingStartedDocs/python/starlette.tsx
index 857b250c4a325a..fbcfc06f7cee78 100644
--- a/static/app/gettingStartedDocs/python/starlette.tsx
+++ b/static/app/gettingStartedDocs/python/starlette.tsx
@@ -13,9 +13,7 @@ const introduction = tct(
);
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/python/tornado.tsx b/static/app/gettingStartedDocs/python/tornado.tsx
index 423d85a5d98d80..3c8fa7779bce9d 100644
--- a/static/app/gettingStartedDocs/python/tornado.tsx
+++ b/static/app/gettingStartedDocs/python/tornado.tsx
@@ -18,9 +18,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: <p>{tct('Install [code:sentry-sdk] from PyPI:', {code: <code />})}</p>,
diff --git a/static/app/gettingStartedDocs/python/tryton.tsx b/static/app/gettingStartedDocs/python/tryton.tsx
index 27853d836e9963..b090a14bdb4b86 100644
--- a/static/app/gettingStartedDocs/python/tryton.tsx
+++ b/static/app/gettingStartedDocs/python/tryton.tsx
@@ -15,9 +15,7 @@ const introduction = (
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.CONFIGURE,
description: (
diff --git a/static/app/gettingStartedDocs/python/wsgi.tsx b/static/app/gettingStartedDocs/python/wsgi.tsx
index 3cb90fc32f21d4..7fe3b4a7f000c4 100644
--- a/static/app/gettingStartedDocs/python/wsgi.tsx
+++ b/static/app/gettingStartedDocs/python/wsgi.tsx
@@ -9,9 +9,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/react-native/react-native.tsx b/static/app/gettingStartedDocs/react-native/react-native.tsx
index 7a01a14c5ce7c4..da2983fd845f77 100644
--- a/static/app/gettingStartedDocs/react-native/react-native.tsx
+++ b/static/app/gettingStartedDocs/react-native/react-native.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/ruby/rack.tsx b/static/app/gettingStartedDocs/ruby/rack.tsx
index eaa7d72cea2bfc..b6b1e53fd1a82e 100644
--- a/static/app/gettingStartedDocs/ruby/rack.tsx
+++ b/static/app/gettingStartedDocs/ruby/rack.tsx
@@ -6,9 +6,7 @@ import {tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/ruby/rails.tsx b/static/app/gettingStartedDocs/ruby/rails.tsx
index 896b402b7fd74a..99fa49bb758923 100644
--- a/static/app/gettingStartedDocs/ruby/rails.tsx
+++ b/static/app/gettingStartedDocs/ruby/rails.tsx
@@ -14,9 +14,7 @@ const introduction = (
);
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/ruby/ruby.tsx b/static/app/gettingStartedDocs/ruby/ruby.tsx
index ca47af80ab46b3..ad028f6beb5dfe 100644
--- a/static/app/gettingStartedDocs/ruby/ruby.tsx
+++ b/static/app/gettingStartedDocs/ruby/ruby.tsx
@@ -6,9 +6,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/gettingStartedDocs/rust/rust.tsx b/static/app/gettingStartedDocs/rust/rust.tsx
index 006d344539bf26..d68643da4d5400 100644
--- a/static/app/gettingStartedDocs/rust/rust.tsx
+++ b/static/app/gettingStartedDocs/rust/rust.tsx
@@ -6,9 +6,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -22,9 +23,14 @@ export const steps = ({
configurations: [
{
language: 'toml',
+ partialLoading: sourcePackageRegistries?.isLoading,
code: `
[dependencies]
-sentry = "0.31.5"
+sentry = "${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.rust'] ?? '0.31.5'
+ }"
`,
},
],
@@ -76,8 +82,12 @@ fn main() {
];
// Configuration End
-export function GettingStartedWithRust({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithRust({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithRust;
diff --git a/static/app/gettingStartedDocs/unity/unity.tsx b/static/app/gettingStartedDocs/unity/unity.tsx
index ed45d80806e485..f04a9376322c2c 100644
--- a/static/app/gettingStartedDocs/unity/unity.tsx
+++ b/static/app/gettingStartedDocs/unity/unity.tsx
@@ -11,9 +11,10 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+ sourcePackageRegistries,
+}: Partial<
+ Pick<ModuleProps, 'dsn' | 'sourcePackageRegistries'>
+> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
@@ -31,7 +32,12 @@ export const steps = ({
configurations: [
{
language: 'bash',
- code: 'https://github.com/getsentry/unity.git#1.5.0',
+ partialLoading: sourcePackageRegistries?.isLoading,
+ code: `https://github.com/getsentry/unity.git#${
+ sourcePackageRegistries?.isLoading
+ ? t('\u2026loading')
+ : sourcePackageRegistries?.data?.['sentry.dotnet.unity']?.version ?? '1.5.0'
+ }`,
},
],
additionalInfo: (
@@ -120,8 +126,12 @@ SentrySdk.CaptureMessage("Test event");
];
// Configuration End
-export function GettingStartedWithUnity({dsn, ...props}: ModuleProps) {
- return <Layout steps={steps({dsn})} {...props} />;
+export function GettingStartedWithUnity({
+ dsn,
+ sourcePackageRegistries,
+ ...props
+}: ModuleProps) {
+ return <Layout steps={steps({dsn, sourcePackageRegistries})} {...props} />;
}
export default GettingStartedWithUnity;
diff --git a/static/app/gettingStartedDocs/unreal/unreal.tsx b/static/app/gettingStartedDocs/unreal/unreal.tsx
index 212bf731b48f38..474068b6cf96a3 100644
--- a/static/app/gettingStartedDocs/unreal/unreal.tsx
+++ b/static/app/gettingStartedDocs/unreal/unreal.tsx
@@ -11,9 +11,7 @@ import {t, tct} from 'sentry/locale';
// Configuration Start
export const steps = ({
dsn,
-}: {
- dsn?: string;
-} = {}): LayoutProps['steps'] => [
+}: Partial<Pick<ModuleProps, 'dsn'>> = {}): LayoutProps['steps'] => [
{
type: StepType.INSTALL,
description: (
diff --git a/static/app/utils/queryClient.tsx b/static/app/utils/queryClient.tsx
index 0c88b80e1d0372..20a0e34aa11255 100644
--- a/static/app/utils/queryClient.tsx
+++ b/static/app/utils/queryClient.tsx
@@ -1,7 +1,7 @@
import * as reactQuery from '@tanstack/react-query';
import {QueryClientConfig} from '@tanstack/react-query';
-import {ApiResult, ResponseMeta} from 'sentry/api';
+import {ApiResult, Client, ResponseMeta} from 'sentry/api';
import RequestError from 'sentry/utils/requestError/requestError';
import useApi from 'sentry/utils/useApi';
@@ -81,7 +81,14 @@ type UseApiQueryResult<TData, TError> = reactQuery.UseQueryResult<TData, TError>
*/
function useApiQuery<TResponseData, TError = RequestError>(
queryKey: ApiQueryKey,
- options: UseApiQueryOptions<TResponseData, TError>
+ options: UseApiQueryOptions<TResponseData, TError>,
+ /**
+ * An existing API client may be provided.
+ *
+ * This is a continent way to re-use clients and still inherit the
+ * persistInFlight configuration.
+ */
+ providedApi?: Client
): UseApiQueryResult<TResponseData, TError> {
const api = useApi({
// XXX: We need to set persistInFlight to disable query cancellation on
@@ -98,6 +105,7 @@ function useApiQuery<TResponseData, TError = RequestError>(
//
// [0]: https://tanstack.com/query/v4/docs/guides/query-cancellation#default-behavior
persistInFlight: true,
+ api: providedApi,
});
const [path, endpointOptions] = queryKey;
diff --git a/static/app/views/onboarding/onboarding.spec.tsx b/static/app/views/onboarding/onboarding.spec.tsx
index ca13169f3454d1..9cea1f977ac2d3 100644
--- a/static/app/views/onboarding/onboarding.spec.tsx
+++ b/static/app/views/onboarding/onboarding.spec.tsx
@@ -85,6 +85,11 @@ describe('Onboarding', function () {
},
});
+ MockApiClient.addMockResponse({
+ url: 'https://release-registry.services.sentry.io/sdks',
+ body: {},
+ });
+
MockApiClient.addMockResponse({
url: `/projects/${organization.slug}/${nextJsProject.slug}/docs/javascript-nextjs-with-error-monitoring/`,
body: null,
@@ -170,6 +175,11 @@ describe('Onboarding', function () {
},
});
+ MockApiClient.addMockResponse({
+ url: 'https://release-registry.services.sentry.io/sdks',
+ body: {},
+ });
+
MockApiClient.addMockResponse({
url: `/projects/org-slug/${reactProject.slug}/`,
body: [reactProject],
@@ -260,6 +270,11 @@ describe('Onboarding', function () {
},
});
+ MockApiClient.addMockResponse({
+ url: 'https://release-registry.services.sentry.io/sdks',
+ body: {},
+ });
+
MockApiClient.addMockResponse({
url: `/projects/org-slug/${reactProject.slug}/`,
body: [reactProject],
diff --git a/static/app/views/onboarding/setupDocs.spec.tsx b/static/app/views/onboarding/setupDocs.spec.tsx
index 7cc01ffac444d3..86d4369f3eabe9 100644
--- a/static/app/views/onboarding/setupDocs.spec.tsx
+++ b/static/app/views/onboarding/setupDocs.spec.tsx
@@ -31,6 +31,20 @@ function renderMockRequests({
body: [],
});
+ MockApiClient.addMockResponse({
+ url: 'https://release-registry.services.sentry.io/sdks',
+ body: {
+ 'sentry.java': {
+ canonical: 'maven:io.sentry:sentry',
+ main_docs_url: 'https://docs.sentry.io/platforms/java',
+ name: 'io.sentry:sentry',
+ package_url: 'https://search.maven.org/artifact/io.sentry/sentry',
+ repo_url: 'https://github.com/getsentry/sentry-java',
+ version: '6.28.0',
+ },
+ },
+ });
+
if (project.slug !== 'javascript-react') {
MockApiClient.addMockResponse({
url: `/projects/${orgSlug}/${project.slug}/docs/${project.platform}/`,
@@ -88,6 +102,48 @@ describe('Onboarding Setup Docs', function () {
).not.toBeInTheDocument();
});
+ it('renders SDK version from the sentry release registry', async function () {
+ const {router, route, routerContext, organization, project} = initializeOrg({
+ projects: [
+ {
+ ...initializeOrg().project,
+ slug: 'java',
+ platform: 'java',
+ },
+ ],
+ });
+
+ ProjectsStore.init();
+ ProjectsStore.loadInitialData([project]);
+
+ renderMockRequests({project, orgSlug: organization.slug});
+
+ render(
+ <OnboardingContextProvider>
+ <SetupDocs
+ active
+ onComplete={() => {}}
+ stepIndex={2}
+ router={router}
+ route={route}
+ location={router.location}
+ genSkipOnboardingLink={() => ''}
+ orgId={organization.slug}
+ search=""
+ recentCreatedProject={project}
+ />
+ </OnboardingContextProvider>,
+ {
+ context: routerContext,
+ organization,
+ }
+ );
+
+ expect(
+ await screen.findByText(/implementation 'io.sentry:sentry:6.28.0'/)
+ ).toBeInTheDocument();
+ });
+
describe('renders Product Selection', function () {
it('all products checked', async function () {
const {router, route, routerContext, organization, project} = initializeOrg({
|
c89a0deafac9e2d32aa622060464c4fdb72ef5fd
|
2022-06-28 19:58:19
|
anthony sottile
|
ref: increase self-hosted e2e test timeout (#36127)
| false
|
increase self-hosted e2e test timeout (#36127)
|
ref
|
diff --git a/docker/cloudbuild.yaml b/docker/cloudbuild.yaml
index 844701eba6613b..6f99dce91e5fa7 100644
--- a/docker/cloudbuild.yaml
+++ b/docker/cloudbuild.yaml
@@ -65,7 +65,7 @@ steps:
docker-compose logs;
exit $test_return;
fi
- timeout: 660s
+ timeout: 900s
- name: 'gcr.io/cloud-builders/docker'
id: docker-push
waitFor:
|
68158071b4b2ac9aa4e4800dff36710bd62500cf
|
2021-03-31 22:19:46
|
Scott Cooper
|
feat(alerts): Allow sorting alert rules by name (#24839)
| false
|
Allow sorting alert rules by name (#24839)
|
feat
|
diff --git a/src/sentry/static/sentry/app/views/alerts/rules/index.tsx b/src/sentry/static/sentry/app/views/alerts/rules/index.tsx
index f2a21a0d73a955..ffeaec5edbc4db 100644
--- a/src/sentry/static/sentry/app/views/alerts/rules/index.tsx
+++ b/src/sentry/static/sentry/app/views/alerts/rules/index.tsx
@@ -32,10 +32,6 @@ import {isIssueAlert} from '../utils';
import Filter from './filter';
import RuleListRow from './row';
-const DEFAULT_SORT: {asc: boolean; field: 'date_added'} = {
- asc: false,
- field: 'date_added',
-};
const DOCS_URL = 'https://docs.sentry.io/product/alerts-notifications/metric-alerts/';
const ALERT_LIST_QUERY_DEFAULT_TEAMS = ['myteams', 'unassigned'];
@@ -210,10 +206,9 @@ class AlertRulesList extends AsyncComponent<Props, State & AsyncComponent['state
flatten(ruleList?.map(({projects}) => projects))
);
- const sort = {
- ...DEFAULT_SORT,
+ const sort: {asc: boolean; field: 'date_added' | 'name'} = {
asc: query.asc === '1',
- // Currently only supported sorting field is 'date_added'
+ field: query.sort || 'date_added',
};
const userTeams = new Set(teams.filter(({isMember}) => isMember).map(({id}) => id));
@@ -230,26 +225,48 @@ class AlertRulesList extends AsyncComponent<Props, State & AsyncComponent['state
<StyledPanelTable
headers={[
t('Type'),
- t('Alert Name'),
+ // eslint-disable-next-line react/jsx-key
+ <StyledSortLink
+ to={{
+ pathname: location.pathname,
+ query: {
+ ...query,
+ asc: sort.field === 'name' && sort.asc ? undefined : '1',
+ sort: 'name',
+ },
+ }}
+ >
+ {t('Alert Name')}{' '}
+ {sort.field === 'name' && (
+ <IconArrow
+ color="gray300"
+ size="xs"
+ direction={sort.asc ? 'up' : 'down'}
+ />
+ )}
+ </StyledSortLink>,
t('Project'),
...(hasFeature ? [t('Team')] : []),
t('Created By'),
// eslint-disable-next-line react/jsx-key
<StyledSortLink
to={{
- pathname: `/organizations/${orgId}/alerts/rules/`,
+ pathname: location.pathname,
query: {
...query,
- asc: sort.asc ? undefined : '1',
+ asc: sort.field === 'date_added' && sort.asc ? undefined : '1',
+ sort: 'date_added',
},
}}
>
{t('Created')}{' '}
- <IconArrow
- color="gray300"
- size="xs"
- direction={sort.asc ? 'up' : 'down'}
- />
+ {sort.field === 'date_added' && (
+ <IconArrow
+ color="gray300"
+ size="xs"
+ direction={sort.asc ? 'up' : 'down'}
+ />
+ )}
</StyledSortLink>,
t('Actions'),
]}
diff --git a/tests/js/spec/views/alerts/rules/index.spec.jsx b/tests/js/spec/views/alerts/rules/index.spec.jsx
index ee97d117d35fe1..e773f7aa443e35 100644
--- a/tests/js/spec/views/alerts/rules/index.spec.jsx
+++ b/tests/js/spec/views/alerts/rules/index.spec.jsx
@@ -111,6 +111,33 @@ describe('OrganizationRuleList', () => {
);
});
+ it('sorts by name', async () => {
+ const wrapper = await createWrapper();
+
+ const nameHeader = wrapper.find('StyledSortLink').first();
+ expect(nameHeader.text()).toContain('Alert Name');
+ expect(nameHeader.props().to).toEqual(
+ expect.objectContaining({
+ query: {
+ sort: 'name',
+ asc: '1',
+ },
+ })
+ );
+
+ wrapper.setProps({
+ location: {query: {asc: '1', sort: 'name'}, search: '?asc=1&sort=name`'},
+ });
+
+ expect(wrapper.find('StyledSortLink').first().props().to).toEqual(
+ expect.objectContaining({
+ query: {
+ sort: 'name',
+ },
+ })
+ );
+ });
+
it('disables the new alert button for members', async () => {
const noAccessOrg = {
...organization,
|
a4ea23bf72b6cb90acef01f547062131504e8324
|
2023-06-03 02:24:52
|
Evan Purkhiser
|
ref(routes): Avoid named exports for routes for now (#50255)
| false
|
Avoid named exports for routes for now (#50255)
|
ref
|
diff --git a/static/app/routes.tsx b/static/app/routes.tsx
index adfbff4ae3e4bf..24ace50dd24f75 100644
--- a/static/app/routes.tsx
+++ b/static/app/routes.tsx
@@ -508,63 +508,28 @@ function buildRoutes() {
/>
<Route path="source-maps/" name={t('Source Maps')}>
<IndexRoute
- component={make(async () => {
- const {ProjectSourceMapsContainer} = await import(
- 'sentry/views/settings/projectSourceMaps'
- );
- return {
- default: ProjectSourceMapsContainer,
- };
- })}
+ component={make(() => import('sentry/views/settings/projectSourceMaps'))}
/>
<Route
path="artifact-bundles/"
name={t('Artifact Bundles')}
- component={make(async () => {
- const {ProjectSourceMapsContainer} = await import(
- 'sentry/views/settings/projectSourceMaps'
- );
- return {
- default: ProjectSourceMapsContainer,
- };
- })}
+ component={make(() => import('sentry/views/settings/projectSourceMaps'))}
>
<Route
name={t('Artifact Bundle')}
path=":bundleId/"
- component={make(async () => {
- const {ProjectSourceMapsContainer} = await import(
- 'sentry/views/settings/projectSourceMaps'
- );
- return {
- default: ProjectSourceMapsContainer,
- };
- })}
+ component={make(() => import('sentry/views/settings/projectSourceMaps'))}
/>
</Route>
<Route
path="release-bundles/"
name={t('Release Bundles')}
- component={make(async () => {
- const {ProjectSourceMapsContainer} = await import(
- 'sentry/views/settings/projectSourceMaps'
- );
- return {
- default: ProjectSourceMapsContainer,
- };
- })}
+ component={make(() => import('sentry/views/settings/projectSourceMaps'))}
>
<Route
name={t('Release Bundle')}
path=":bundleId/"
- component={make(async () => {
- const {ProjectSourceMapsContainer} = await import(
- 'sentry/views/settings/projectSourceMaps'
- );
- return {
- default: ProjectSourceMapsContainer,
- };
- })}
+ component={make(() => import('sentry/views/settings/projectSourceMaps'))}
/>
</Route>
<Route
@@ -1041,12 +1006,7 @@ function buildRoutes() {
{usingCustomerDomain && (
<Route
path="/projects/"
- component={make(async () => {
- const {Projects} = await import('sentry/views/projects/');
- return {
- default: Projects,
- };
- })}
+ component={make(() => import('sentry/views/projects/'))}
key="orgless-projects-route"
>
{projectsChildRoutes}
@@ -1054,12 +1014,7 @@ function buildRoutes() {
)}
<Route
path="/organizations/:orgId/projects/"
- component={make(async () => {
- const {Projects} = await import('sentry/views/projects/');
- return {
- default: Projects,
- };
- })}
+ component={make(() => import('sentry/views/projects/'))}
key="org-projects"
>
{projectsChildRoutes}
diff --git a/static/app/views/projects/index.tsx b/static/app/views/projects/index.tsx
index 0c4e31aba6d84d..a666d8e9b909c8 100644
--- a/static/app/views/projects/index.tsx
+++ b/static/app/views/projects/index.tsx
@@ -4,7 +4,7 @@ type Props = {
children: React.ReactNode;
};
-export function Projects({children}: Props) {
+export default function Projects({children}: Props) {
return (
<GettingStartedWithProjectContextProvider>
{children}
diff --git a/static/app/views/settings/projectSourceMaps/index.tsx b/static/app/views/settings/projectSourceMaps/index.tsx
index c771dba1ce9f3d..a9d1f86d42b131 100644
--- a/static/app/views/settings/projectSourceMaps/index.tsx
+++ b/static/app/views/settings/projectSourceMaps/index.tsx
@@ -16,7 +16,7 @@ type Props = RouteComponentProps<
project: Project;
};
-export function ProjectSourceMapsContainer({params, location, ...props}: Props) {
+export default function ProjectSourceMapsContainer({params, location, ...props}: Props) {
const organization = useOrganization();
const sourceMapsDebugIds = organization.features.includes('source-maps-debug-ids');
|
d66c885260449f84bacf80deba5bc514fd0f8bcc
|
2024-02-07 19:43:41
|
Francesco Novy
|
feat: Update browser tracing integration usage (#64761)
| false
|
Update browser tracing integration usage (#64761)
|
feat
|
diff --git a/static/app/gettingStartedDocs/ionic/ionic.tsx b/static/app/gettingStartedDocs/ionic/ionic.tsx
index c1546aab6d061f..a00e498b2e4815 100644
--- a/static/app/gettingStartedDocs/ionic/ionic.tsx
+++ b/static/app/gettingStartedDocs/ionic/ionic.tsx
@@ -23,14 +23,12 @@ Sentry.init(
// We recommend adjusting this value in production.
tracesSampleRate: 1.0,
integrations: [
- new SentrySibling.BrowserTracing({
- // Set "tracePropagationTargets" to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: [
- "localhost",
- /^https:\/\/yourserver\.io\/api/,
- ],
- routingInstrumentation: SentrySibling.routingInstrumentation,
- }),
+ SentrySibling.browserTracingIntegration(),
+ ],
+ // Set "tracePropagationTargets" to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: [
+ "localhost",
+ /^https:\/\/yourserver\.io\/api/,
],
},
// Forward the init method to the sibling Framework.
diff --git a/static/app/gettingStartedDocs/javascript/angular.tsx b/static/app/gettingStartedDocs/javascript/angular.tsx
index b5a64923a9ae76..3ea81971ab508c 100644
--- a/static/app/gettingStartedDocs/javascript/angular.tsx
+++ b/static/app/gettingStartedDocs/javascript/angular.tsx
@@ -206,10 +206,7 @@ function getSdkSetupSnippet(params: Params) {
integrations: [${
params.isPerformanceSelected
? `
- new Sentry.BrowserTracing({
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],
- }),`
+ Sentry.browserTracingIntegration(),`
: ''
}${
params.isReplaySelected
@@ -221,7 +218,9 @@ function getSdkSetupSnippet(params: Params) {
params.isPerformanceSelected
? `
// Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions`
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isReplaySelected
diff --git a/static/app/gettingStartedDocs/javascript/ember.tsx b/static/app/gettingStartedDocs/javascript/ember.tsx
index e82421c96c6c3d..76d4d786ded1a8 100644
--- a/static/app/gettingStartedDocs/javascript/ember.tsx
+++ b/static/app/gettingStartedDocs/javascript/ember.tsx
@@ -26,14 +26,6 @@ import * as Sentry from "@sentry/ember";
Sentry.init({
dsn: "${params.dsn}",
integrations: [${
- params.isPerformanceSelected
- ? `
- new Sentry.BrowserTracing({
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],
- }),`
- : ''
- }${
params.isReplaySelected
? `
Sentry.replayIntegration(${getReplayConfigOptions(params.replayOptions)}),`
@@ -43,7 +35,9 @@ Sentry.init({
params.isPerformanceSelected
? `
// Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions`
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isReplaySelected
diff --git a/static/app/gettingStartedDocs/javascript/gatsby.tsx b/static/app/gettingStartedDocs/javascript/gatsby.tsx
index ae41859e519c19..31163ddf6e218b 100644
--- a/static/app/gettingStartedDocs/javascript/gatsby.tsx
+++ b/static/app/gettingStartedDocs/javascript/gatsby.tsx
@@ -25,10 +25,7 @@ Sentry.init({
integrations: [${
params.isPerformanceSelected
? `
- new Sentry.BrowserTracing({
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],
- }),`
+ Sentry.browserTracingIntegration(),`
: ''
}${
params.isReplaySelected
@@ -40,7 +37,9 @@ Sentry.init({
params.isPerformanceSelected
? `
// Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions`
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isReplaySelected
diff --git a/static/app/gettingStartedDocs/javascript/javascript.tsx b/static/app/gettingStartedDocs/javascript/javascript.tsx
index a58adbef3f517a..a9116fa594377e 100644
--- a/static/app/gettingStartedDocs/javascript/javascript.tsx
+++ b/static/app/gettingStartedDocs/javascript/javascript.tsx
@@ -24,10 +24,7 @@ Sentry.init({
integrations: [${
params.isPerformanceSelected
? `
- new Sentry.BrowserTracing({
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],
- }),`
+ Sentry.browserTracingIntegration(),`
: ''
}${
params.isReplaySelected
@@ -39,7 +36,9 @@ Sentry.init({
params.isPerformanceSelected
? `
// Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions`
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isReplaySelected
diff --git a/static/app/gettingStartedDocs/javascript/react.tsx b/static/app/gettingStartedDocs/javascript/react.tsx
index f06f2de4f4953a..138cec1fefe44d 100644
--- a/static/app/gettingStartedDocs/javascript/react.tsx
+++ b/static/app/gettingStartedDocs/javascript/react.tsx
@@ -24,10 +24,7 @@ Sentry.init({
integrations: [${
params.isPerformanceSelected
? `
- new Sentry.BrowserTracing({
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],
- }),`
+ Sentry.browserTracingIntegration(),`
: ''
}${
params.isReplaySelected
@@ -39,7 +36,9 @@ Sentry.init({
params.isPerformanceSelected
? `
// Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions`
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isReplaySelected
diff --git a/static/app/gettingStartedDocs/javascript/svelte.tsx b/static/app/gettingStartedDocs/javascript/svelte.tsx
index 66503d6fd6ba29..b0fea483b1fa34 100644
--- a/static/app/gettingStartedDocs/javascript/svelte.tsx
+++ b/static/app/gettingStartedDocs/javascript/svelte.tsx
@@ -26,10 +26,7 @@ Sentry.init({
integrations: [${
params.isPerformanceSelected
? `
- new Sentry.BrowserTracing({
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],
- }),`
+ Sentry.browserTracingIntegration(),`
: ''
}${
params.isReplaySelected
@@ -41,7 +38,9 @@ Sentry.init({
params.isPerformanceSelected
? `
// Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions`
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isReplaySelected
diff --git a/static/app/gettingStartedDocs/javascript/vue.tsx b/static/app/gettingStartedDocs/javascript/vue.tsx
index fd63c9685a22fb..d04953da227685 100644
--- a/static/app/gettingStartedDocs/javascript/vue.tsx
+++ b/static/app/gettingStartedDocs/javascript/vue.tsx
@@ -47,10 +47,7 @@ const getSentryInitLayout = (params: Params, siblingOption: string): string => {
integrations: [${
params.isPerformanceSelected
? `
- new Sentry.BrowserTracing({
- // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
- tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],
- }),`
+ Sentry.browserTracingIntergation(),`
: ''
}${
params.isReplaySelected
@@ -62,7 +59,9 @@ const getSentryInitLayout = (params: Params, siblingOption: string): string => {
params.isPerformanceSelected
? `
// Performance Monitoring
- tracesSampleRate: 1.0, // Capture 100% of the transactions`
+ tracesSampleRate: 1.0, // Capture 100% of the transactions
+ // Set 'tracePropagationTargets' to control for which URLs distributed tracing should be enabled
+ tracePropagationTargets: ["localhost", /^https:\\/\\/yourserver\\.io\\/api/],`
: ''
}${
params.isReplaySelected
|
cd67a89269c3c1d17e2acb3248c0e96438a496a2
|
2024-07-31 00:03:34
|
Tony Xiao
|
ref(profiling): Split transaction summary profile into new component (#75274)
| false
|
Split transaction summary profile into new component (#75274)
|
ref
|
diff --git a/static/app/views/performance/transactionSummary/transactionProfiles/content.tsx b/static/app/views/performance/transactionSummary/transactionProfiles/content.tsx
new file mode 100644
index 00000000000000..4f25b79bbde8dd
--- /dev/null
+++ b/static/app/views/performance/transactionSummary/transactionProfiles/content.tsx
@@ -0,0 +1,255 @@
+import {useCallback, useMemo} from 'react';
+import styled from '@emotion/styled';
+
+import {Button} from 'sentry/components/button';
+import {CompactSelect} from 'sentry/components/compactSelect';
+import type {SelectOption} from 'sentry/components/compactSelect/types';
+import LoadingIndicator from 'sentry/components/loadingIndicator';
+import {AggregateFlamegraph} from 'sentry/components/profiling/flamegraph/aggregateFlamegraph';
+import {AggregateFlamegraphTreeTable} from 'sentry/components/profiling/flamegraph/aggregateFlamegraphTreeTable';
+import {FlamegraphSearch} from 'sentry/components/profiling/flamegraph/flamegraphToolbar/flamegraphSearch';
+import {SegmentedControl} from 'sentry/components/segmentedControl';
+import {t} from 'sentry/locale';
+import {space} from 'sentry/styles/space';
+import type {DeepPartial} from 'sentry/types/utils';
+import type {CanvasScheduler} from 'sentry/utils/profiling/canvasScheduler';
+import {
+ CanvasPoolManager,
+ useCanvasScheduler,
+} from 'sentry/utils/profiling/canvasScheduler';
+import type {FlamegraphState} from 'sentry/utils/profiling/flamegraph/flamegraphStateProvider/flamegraphContext';
+import {FlamegraphStateProvider} from 'sentry/utils/profiling/flamegraph/flamegraphStateProvider/flamegraphContextProvider';
+import {FlamegraphThemeProvider} from 'sentry/utils/profiling/flamegraph/flamegraphThemeProvider';
+import type {Frame} from 'sentry/utils/profiling/frame';
+import {useAggregateFlamegraphQuery} from 'sentry/utils/profiling/hooks/useAggregateFlamegraphQuery';
+import {useLocalStorageState} from 'sentry/utils/useLocalStorageState';
+import {
+ FlamegraphProvider,
+ useFlamegraph,
+} from 'sentry/views/profiling/flamegraphProvider';
+import {ProfileGroupProvider} from 'sentry/views/profiling/profileGroupProvider';
+
+const DEFAULT_FLAMEGRAPH_PREFERENCES: DeepPartial<FlamegraphState> = {
+ preferences: {
+ sorting: 'alphabetical' satisfies FlamegraphState['preferences']['sorting'],
+ },
+};
+
+const noop = () => void 0;
+
+interface TransactionProfilesContentProps {
+ query: string;
+}
+
+export function TransactionProfilesContent({query}: TransactionProfilesContentProps) {
+ const {data, isLoading, isError} = useAggregateFlamegraphQuery({
+ query,
+ });
+
+ const [frameFilter, setFrameFilter] = useLocalStorageState<
+ 'system' | 'application' | 'all'
+ >('flamegraph-frame-filter', 'application');
+
+ const onFrameFilterChange = useCallback(
+ (value: 'system' | 'application' | 'all') => {
+ setFrameFilter(value);
+ },
+ [setFrameFilter]
+ );
+
+ const flamegraphFrameFilter: ((frame: Frame) => boolean) | undefined = useMemo(() => {
+ if (frameFilter === 'all') {
+ return () => true;
+ }
+ if (frameFilter === 'application') {
+ return frame => frame.is_application;
+ }
+ return frame => !frame.is_application;
+ }, [frameFilter]);
+
+ const [visualization, setVisualization] = useLocalStorageState<
+ 'flamegraph' | 'call tree'
+ >('flamegraph-visualization', 'flamegraph');
+
+ const onVisualizationChange = useCallback(
+ (value: 'flamegraph' | 'call tree') => {
+ setVisualization(value);
+ },
+ [setVisualization]
+ );
+
+ const canvasPoolManager = useMemo(() => new CanvasPoolManager(), []);
+ const scheduler = useCanvasScheduler(canvasPoolManager);
+
+ return (
+ <ProfileVisualization>
+ <ProfileGroupProvider
+ traceID=""
+ type="flamegraph"
+ input={data ?? null}
+ frameFilter={flamegraphFrameFilter}
+ >
+ <FlamegraphStateProvider initialState={DEFAULT_FLAMEGRAPH_PREFERENCES}>
+ <FlamegraphThemeProvider>
+ <FlamegraphProvider>
+ <AggregateFlamegraphToolbar
+ scheduler={scheduler}
+ canvasPoolManager={canvasPoolManager}
+ visualization={visualization}
+ onVisualizationChange={onVisualizationChange}
+ frameFilter={frameFilter}
+ onFrameFilterChange={onFrameFilterChange}
+ hideSystemFrames={false}
+ setHideSystemFrames={noop}
+ />
+ <FlamegraphContainer>
+ {visualization === 'flamegraph' ? (
+ <AggregateFlamegraph
+ canvasPoolManager={canvasPoolManager}
+ scheduler={scheduler}
+ />
+ ) : (
+ <AggregateFlamegraphTreeTable
+ recursion={null}
+ expanded={false}
+ frameFilter={frameFilter}
+ canvasPoolManager={canvasPoolManager}
+ withoutBorders
+ />
+ )}
+ </FlamegraphContainer>
+ {isLoading ? (
+ <RequestStateMessageContainer>
+ <LoadingIndicator />
+ </RequestStateMessageContainer>
+ ) : isError ? (
+ <RequestStateMessageContainer>
+ {t('There was an error loading the flamegraph.')}
+ </RequestStateMessageContainer>
+ ) : null}
+ </FlamegraphProvider>
+ </FlamegraphThemeProvider>
+ </FlamegraphStateProvider>
+ </ProfileGroupProvider>
+ </ProfileVisualization>
+ );
+}
+
+interface AggregateFlamegraphToolbarProps {
+ canvasPoolManager: CanvasPoolManager;
+ frameFilter: 'system' | 'application' | 'all';
+ hideSystemFrames: boolean;
+ onFrameFilterChange: (value: 'system' | 'application' | 'all') => void;
+ onVisualizationChange: (value: 'flamegraph' | 'call tree') => void;
+ scheduler: CanvasScheduler;
+ setHideSystemFrames: (value: boolean) => void;
+ visualization: 'flamegraph' | 'call tree';
+}
+
+function AggregateFlamegraphToolbar(props: AggregateFlamegraphToolbarProps) {
+ const flamegraph = useFlamegraph();
+ const flamegraphs = useMemo(() => [flamegraph], [flamegraph]);
+ const spans = useMemo(() => [], []);
+
+ const frameSelectOptions: SelectOption<'system' | 'application' | 'all'>[] =
+ useMemo(() => {
+ return [
+ {value: 'system', label: t('System Frames')},
+ {value: 'application', label: t('Application Frames')},
+ {value: 'all', label: t('All Frames')},
+ ];
+ }, []);
+
+ const onResetZoom = useCallback(() => {
+ props.scheduler.dispatch('reset zoom');
+ }, [props.scheduler]);
+
+ const onFrameFilterChange = useCallback(
+ (value: {value: 'application' | 'system' | 'all'}) => {
+ props.onFrameFilterChange(value.value);
+ },
+ [props]
+ );
+
+ return (
+ <AggregateFlamegraphToolbarContainer>
+ <ViewSelectContainer>
+ <SegmentedControl
+ aria-label={t('View')}
+ size="xs"
+ value={props.visualization}
+ onChange={props.onVisualizationChange}
+ >
+ <SegmentedControl.Item key="flamegraph">
+ {t('Flamegraph')}
+ </SegmentedControl.Item>
+ <SegmentedControl.Item key="call tree">{t('Call Tree')}</SegmentedControl.Item>
+ </SegmentedControl>
+ </ViewSelectContainer>
+ <AggregateFlamegraphSearch
+ spans={spans}
+ canvasPoolManager={props.canvasPoolManager}
+ flamegraphs={flamegraphs}
+ />
+ <Button size="xs" onClick={onResetZoom}>
+ {t('Reset Zoom')}
+ </Button>
+ <CompactSelect
+ onChange={onFrameFilterChange}
+ value={props.frameFilter}
+ size="xs"
+ options={frameSelectOptions}
+ />
+ </AggregateFlamegraphToolbarContainer>
+ );
+}
+
+const ProfileVisualization = styled('div')`
+ display: grid;
+ grid-template-rows: min-content 1fr;
+ height: 100%;
+ flex: 1;
+ border: 1px solid ${p => p.theme.border};
+ border-radius: ${p => p.theme.borderRadius};
+ overflow: hidden;
+`;
+
+const FlamegraphContainer = styled('div')`
+ overflow: hidden;
+ display: flex;
+`;
+
+const RequestStateMessageContainer = styled('div')`
+ position: absolute;
+ left: 0;
+ right: 0;
+ top: 0;
+ bottom: 0;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ color: ${p => p.theme.subText};
+ pointer-events: none;
+`;
+
+const AggregateFlamegraphToolbarContainer = styled('div')`
+ display: flex;
+ justify-content: space-between;
+ gap: ${space(1)};
+ padding: ${space(1)};
+ background-color: ${p => p.theme.background};
+ /*
+ force height to be the same as profile digest header,
+ but subtract 1px for the border that doesnt exist on the header
+ */
+ height: 41px;
+ border-bottom: 1px solid ${p => p.theme.border};
+`;
+
+const ViewSelectContainer = styled('div')`
+ min-width: 160px;
+`;
+
+const AggregateFlamegraphSearch = styled(FlamegraphSearch)`
+ max-width: 300px;
+`;
diff --git a/static/app/views/performance/transactionSummary/transactionProfiles/index.tsx b/static/app/views/performance/transactionSummary/transactionProfiles/index.tsx
index 2072c935540183..18139132e68325 100644
--- a/static/app/views/performance/transactionSummary/transactionProfiles/index.tsx
+++ b/static/app/views/performance/transactionSummary/transactionProfiles/index.tsx
@@ -1,40 +1,21 @@
import {useCallback, useMemo, useState} from 'react';
import styled from '@emotion/styled';
-import {Button} from 'sentry/components/button';
-import {CompactSelect} from 'sentry/components/compactSelect';
-import type {SelectOption} from 'sentry/components/compactSelect/types';
import SearchBar from 'sentry/components/events/searchBar';
import * as Layout from 'sentry/components/layouts/thirds';
-import LoadingIndicator from 'sentry/components/loadingIndicator';
import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
-import {AggregateFlamegraph} from 'sentry/components/profiling/flamegraph/aggregateFlamegraph';
-import {AggregateFlamegraphTreeTable} from 'sentry/components/profiling/flamegraph/aggregateFlamegraphTreeTable';
-import {FlamegraphSearch} from 'sentry/components/profiling/flamegraph/flamegraphToolbar/flamegraphSearch';
import {ProfileEventsTable} from 'sentry/components/profiling/profileEventsTable';
-import {SegmentedControl} from 'sentry/components/segmentedControl';
import type {SmartSearchBarProps} from 'sentry/components/smartSearchBar';
import {MAX_QUERY_LENGTH} from 'sentry/constants';
import {t} from 'sentry/locale';
import {space} from 'sentry/styles/space';
import type {Organization} from 'sentry/types/organization';
-import type {DeepPartial} from 'sentry/types/utils';
import {defined} from 'sentry/utils';
import {browserHistory} from 'sentry/utils/browserHistory';
import EventView from 'sentry/utils/discover/eventView';
import {isAggregateField} from 'sentry/utils/discover/fields';
-import type {CanvasScheduler} from 'sentry/utils/profiling/canvasScheduler';
-import {
- CanvasPoolManager,
- useCanvasScheduler,
-} from 'sentry/utils/profiling/canvasScheduler';
-import type {FlamegraphState} from 'sentry/utils/profiling/flamegraph/flamegraphStateProvider/flamegraphContext';
-import {FlamegraphStateProvider} from 'sentry/utils/profiling/flamegraph/flamegraphStateProvider/flamegraphContextProvider';
-import {FlamegraphThemeProvider} from 'sentry/utils/profiling/flamegraph/flamegraphThemeProvider';
-import type {Frame} from 'sentry/utils/profiling/frame';
-import {useAggregateFlamegraphQuery} from 'sentry/utils/profiling/hooks/useAggregateFlamegraphQuery';
import type {ProfilingFieldType} from 'sentry/utils/profiling/hooks/useProfileEvents';
import {
getProfilesTableFields,
@@ -43,19 +24,15 @@ import {
import {formatSort} from 'sentry/utils/profiling/hooks/utils';
import {decodeScalar} from 'sentry/utils/queryString';
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
-import {useLocalStorageState} from 'sentry/utils/useLocalStorageState';
import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
import useProjects from 'sentry/utils/useProjects';
import Tab from 'sentry/views/performance/transactionSummary/tabs';
-import {
- FlamegraphProvider,
- useFlamegraph,
-} from 'sentry/views/profiling/flamegraphProvider';
-import {ProfileGroupProvider} from 'sentry/views/profiling/profileGroupProvider';
import PageLayout, {redirectToPerformanceHomepage} from '../pageLayout';
+import {TransactionProfilesContent} from './content';
+
function ProfilesLegacy() {
const location = useLocation();
const organization = useOrganization();
@@ -167,14 +144,6 @@ function ProfilesWrapper() {
return <Profiles organization={organization} transaction={transaction} />;
}
-const DEFAULT_FLAMEGRAPH_PREFERENCES: DeepPartial<FlamegraphState> = {
- preferences: {
- sorting: 'alphabetical' satisfies FlamegraphState['preferences']['sorting'],
- },
-};
-
-const noop = () => void 0;
-
interface ProfilesProps {
organization: Organization;
transaction: string;
@@ -213,45 +182,6 @@ function Profiles({organization, transaction}: ProfilesProps) {
[location]
);
- const [visualization, setVisualization] = useLocalStorageState<
- 'flamegraph' | 'call tree'
- >('flamegraph-visualization', 'flamegraph');
-
- const onVisualizationChange = useCallback(
- (value: 'flamegraph' | 'call tree') => {
- setVisualization(value);
- },
- [setVisualization]
- );
-
- const [frameFilter, setFrameFilter] = useLocalStorageState<
- 'system' | 'application' | 'all'
- >('flamegraph-frame-filter', 'application');
-
- const onFrameFilterChange = useCallback(
- (value: 'system' | 'application' | 'all') => {
- setFrameFilter(value);
- },
- [setFrameFilter]
- );
-
- const flamegraphFrameFilter: ((frame: Frame) => boolean) | undefined = useMemo(() => {
- if (frameFilter === 'all') {
- return () => true;
- }
- if (frameFilter === 'application') {
- return frame => frame.is_application;
- }
- return frame => !frame.is_application;
- }, [frameFilter]);
-
- const {data, isLoading, isError} = useAggregateFlamegraphQuery({
- query,
- });
-
- const canvasPoolManager = useMemo(() => new CanvasPoolManager(), []);
- const scheduler = useCanvasScheduler(canvasPoolManager);
-
return (
<PageLayout
location={location}
@@ -278,56 +208,7 @@ function Profiles({organization, transaction}: ProfilesProps) {
maxQueryLength={MAX_QUERY_LENGTH}
/>
</FilterActions>
- <ProfileVisualization>
- <ProfileGroupProvider
- traceID=""
- type="flamegraph"
- input={data ?? null}
- frameFilter={flamegraphFrameFilter}
- >
- <FlamegraphStateProvider initialState={DEFAULT_FLAMEGRAPH_PREFERENCES}>
- <FlamegraphThemeProvider>
- <FlamegraphProvider>
- <AggregateFlamegraphToolbar
- scheduler={scheduler}
- canvasPoolManager={canvasPoolManager}
- visualization={visualization}
- onVisualizationChange={onVisualizationChange}
- frameFilter={frameFilter}
- onFrameFilterChange={onFrameFilterChange}
- hideSystemFrames={false}
- setHideSystemFrames={noop}
- />
- <FlamegraphContainer>
- {visualization === 'flamegraph' ? (
- <AggregateFlamegraph
- canvasPoolManager={canvasPoolManager}
- scheduler={scheduler}
- />
- ) : (
- <AggregateFlamegraphTreeTable
- recursion={null}
- expanded={false}
- frameFilter={frameFilter}
- canvasPoolManager={canvasPoolManager}
- withoutBorders
- />
- )}
- </FlamegraphContainer>
- {isLoading ? (
- <RequestStateMessageContainer>
- <LoadingIndicator />
- </RequestStateMessageContainer>
- ) : isError ? (
- <RequestStateMessageContainer>
- {t('There was an error loading the flamegraph.')}
- </RequestStateMessageContainer>
- ) : null}
- </FlamegraphProvider>
- </FlamegraphThemeProvider>
- </FlamegraphStateProvider>
- </ProfileGroupProvider>
- </ProfileVisualization>
+ <TransactionProfilesContent query={query} />
</StyledMain>
);
}}
@@ -335,75 +216,6 @@ function Profiles({organization, transaction}: ProfilesProps) {
);
}
-interface AggregateFlamegraphToolbarProps {
- canvasPoolManager: CanvasPoolManager;
- frameFilter: 'system' | 'application' | 'all';
- hideSystemFrames: boolean;
- onFrameFilterChange: (value: 'system' | 'application' | 'all') => void;
- onVisualizationChange: (value: 'flamegraph' | 'call tree') => void;
- scheduler: CanvasScheduler;
- setHideSystemFrames: (value: boolean) => void;
- visualization: 'flamegraph' | 'call tree';
-}
-
-function AggregateFlamegraphToolbar(props: AggregateFlamegraphToolbarProps) {
- const flamegraph = useFlamegraph();
- const flamegraphs = useMemo(() => [flamegraph], [flamegraph]);
- const spans = useMemo(() => [], []);
-
- const frameSelectOptions: SelectOption<'system' | 'application' | 'all'>[] =
- useMemo(() => {
- return [
- {value: 'system', label: t('System Frames')},
- {value: 'application', label: t('Application Frames')},
- {value: 'all', label: t('All Frames')},
- ];
- }, []);
-
- const onResetZoom = useCallback(() => {
- props.scheduler.dispatch('reset zoom');
- }, [props.scheduler]);
-
- const onFrameFilterChange = useCallback(
- (value: {value: 'application' | 'system' | 'all'}) => {
- props.onFrameFilterChange(value.value);
- },
- [props]
- );
-
- return (
- <AggregateFlamegraphToolbarContainer>
- <ViewSelectContainer>
- <SegmentedControl
- aria-label={t('View')}
- size="xs"
- value={props.visualization}
- onChange={props.onVisualizationChange}
- >
- <SegmentedControl.Item key="flamegraph">
- {t('Flamegraph')}
- </SegmentedControl.Item>
- <SegmentedControl.Item key="call tree">{t('Call Tree')}</SegmentedControl.Item>
- </SegmentedControl>
- </ViewSelectContainer>
- <AggregateFlamegraphSearch
- spans={spans}
- canvasPoolManager={props.canvasPoolManager}
- flamegraphs={flamegraphs}
- />
- <Button size="xs" onClick={onResetZoom}>
- {t('Reset Zoom')}
- </Button>
- <CompactSelect
- onChange={onFrameFilterChange}
- value={props.frameFilter}
- size="xs"
- options={frameSelectOptions}
- />
- </AggregateFlamegraphToolbarContainer>
- );
-}
-
const FilterActions = styled('div')`
margin-bottom: ${space(2)};
gap: ${space(2)};
@@ -429,56 +241,6 @@ const StyledMain = styled(Layout.Main)`
flex: 1;
`;
-const ProfileVisualization = styled('div')`
- display: grid;
- grid-template-rows: min-content 1fr;
- height: 100%;
- flex: 1;
- border: 1px solid ${p => p.theme.border};
- border-radius: ${p => p.theme.borderRadius};
- overflow: hidden;
-`;
-
-const RequestStateMessageContainer = styled('div')`
- position: absolute;
- left: 0;
- right: 0;
- top: 0;
- bottom: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- color: ${p => p.theme.subText};
- pointer-events: none;
-`;
-
-const AggregateFlamegraphToolbarContainer = styled('div')`
- display: flex;
- justify-content: space-between;
- gap: ${space(1)};
- padding: ${space(1)};
- background-color: ${p => p.theme.background};
- /*
- force height to be the same as profile digest header,
- but subtract 1px for the border that doesnt exist on the header
- */
- height: 41px;
- border-bottom: 1px solid ${p => p.theme.border};
-`;
-
-const ViewSelectContainer = styled('div')`
- min-width: 160px;
-`;
-
-const AggregateFlamegraphSearch = styled(FlamegraphSearch)`
- max-width: 300px;
-`;
-
-const FlamegraphContainer = styled('div')`
- overflow: hidden;
- display: flex;
-`;
-
function ProfilesIndex() {
const organization = useOrganization();
|
e683bc27847d59d50d26246e8a54a9bdb607fe8a
|
2019-10-02 01:31:58
|
Lyn Nagara
|
ref(unmerge): Refactor unmerge task to use Snuba (#14776)
| false
|
Refactor unmerge task to use Snuba (#14776)
|
ref
|
diff --git a/src/sentry/tasks/unmerge.py b/src/sentry/tasks/unmerge.py
index 3a907e3be3a2ff..0b88b86a3f3c23 100644
--- a/src/sentry/tasks/unmerge.py
+++ b/src/sentry/tasks/unmerge.py
@@ -4,8 +4,9 @@
from collections import defaultdict, OrderedDict
from django.db import transaction
+from django.conf import settings
-from sentry import eventstream, tagstore
+from sentry import eventstore, eventstream, tagstore
from sentry.app import tsdb
from sentry.constants import DEFAULT_LOGGER_NAME, LOG_LEVELS_MAP
from sentry.event_manager import generate_culprit
@@ -214,16 +215,21 @@ def migrate_events(
destination = Group.objects.get(id=destination_id)
destination.update(**get_group_backfill_attributes(caches, destination, events))
- event_id_set = set(event.id for event in events)
-
- Event.objects.filter(project_id=project.id, id__in=event_id_set).update(group_id=destination_id)
+ event_id_set = set(event.event_id for event in events)
for event in events:
event.group = destination
- tagstore.update_group_for_events(
- project_id=project.id, event_ids=event_id_set, destination_id=destination_id
- )
+ if settings.SENTRY_TAGSTORE == "sentry.tagstore.legacy.LegacyTagStorage":
+ postgres_id_set = set(
+ Event.objects.filter(project_id=project.id, event_id__in=event_id_set).values_list(
+ "id", flat=True
+ )
+ )
+
+ tagstore.update_group_for_events(
+ project_id=project.id, event_ids=postgres_id_set, destination_id=destination_id
+ )
event_event_id_set = set(event.event_id for event in events)
@@ -495,7 +501,7 @@ def unmerge(
destination_id,
fingerprints,
actor_id,
- cursor=None,
+ last_event=None,
batch_size=500,
source_fields_reset=False,
eventstream_state=None,
@@ -510,7 +516,7 @@ def unmerge(
# On the first iteration of this loop, we clear out all of the
# denormalizations from the source group so that we can have a clean slate
# for the new, repaired data.
- if cursor is None:
+ if last_event is None:
fingerprints = lock_hashes(project_id, source_id, fingerprints)
truncate_denormalizations(source)
@@ -518,20 +524,41 @@ def unmerge(
project = caches["Project"](project_id)
- # We fetch the events in descending order by their primary key to get the
- # best approximation of the most recently received events.
- queryset = Event.objects.filter(project_id=project_id, group_id=source_id).order_by("-id")
-
- if cursor is not None:
- queryset = queryset.filter(id__lt=cursor)
+ # We process events sorted in descending order by -timestamp, -event_id. We need
+ # to include event_id as well as timestamp in the ordering criteria since:
+ #
+ # - Event timestamps are rounded to the second so multiple events are likely
+ # to have the same timestamp.
+ #
+ # - When sorting by timestamp alone, Snuba may not give us a deterministic
+ # order for events with the same timestamp.
+ #
+ # - We need to ensure that we do not skip any events between batches. If we
+ # only sorted by timestamp < last_event.timestamp it would be possible to
+ # have missed an event with the same timestamp as the last item in the
+ # previous batch.
+
+ conditions = []
+ if last_event is not None:
+ conditions.extend(
+ [
+ ["timestamp", "<=", last_event.timestamp],
+ [["timestamp", "<", last_event.timestamp], ["event_id", "<", last_event.event_id]],
+ ]
+ )
- events = list(queryset[:batch_size])
+ events = eventstore.get_events(
+ filter_keys={"project_id": [project_id], "issue": [source.id]},
+ conditions=conditions,
+ limit=batch_size,
+ referrer="unmerge",
+ orderby=["-timestamp", "-event_id"],
+ )
# If there are no more events to process, we're done with the migration.
if not events:
tagstore.update_group_tag_key_values_seen(project_id, [source_id, destination_id])
unlock_hashes(project_id, fingerprints)
-
logger.warning("Unmerge complete (eventstream state: %s)", eventstream_state)
if eventstream_state:
eventstream.end_unmerge(eventstream_state)
@@ -574,7 +601,7 @@ def unmerge(
destination_id,
fingerprints,
actor_id,
- cursor=events[-1].id,
+ last_event=events[-1],
batch_size=batch_size,
source_fields_reset=source_fields_reset,
eventstream_state=eventstream_state,
diff --git a/tests/sentry/tasks/test_unmerge.py b/tests/snuba/tasks/test_unmerge.py
similarity index 62%
rename from tests/sentry/tasks/test_unmerge.py
rename to tests/snuba/tasks/test_unmerge.py
index 5a4f3941be0e24..d56f1488e273e5 100644
--- a/tests/sentry/tasks/test_unmerge.py
+++ b/tests/snuba/tasks/test_unmerge.py
@@ -7,25 +7,13 @@
import uuid
from collections import OrderedDict
from datetime import datetime, timedelta
-
import pytz
-from django.utils import timezone
-from mock import patch, Mock
-from sentry import tagstore
-from sentry.tagstore.models import GroupTagValue
+from mock import patch
+
+from sentry import eventstream
from sentry.app import tsdb
-from sentry.models import (
- Activity,
- Environment,
- EnvironmentProject,
- Event,
- Group,
- GroupHash,
- GroupRelease,
- Release,
- UserReport,
-)
+from sentry.models import Environment, Event, Group, GroupHash, GroupRelease, Release, UserReport
from sentry.similarity import features, _make_index_backend
from sentry.tasks.unmerge import (
get_caches,
@@ -35,9 +23,12 @@
get_group_creation_attributes,
unmerge,
)
-from sentry.testutils import TestCase
+from sentry.testutils import SnubaTestCase, TestCase
from sentry.utils.dates import to_timestamp
from sentry.utils import redis
+from sentry.testutils.helpers.datetime import before_now, iso_format
+from sentry.tasks.merge import merge_groups
+from sentry.tagstore.snuba.backend import SnubaTagStorage
from six.moves import xrange
@@ -60,7 +51,7 @@ def test_get_fingerprint():
@patch("sentry.similarity.features.index", new=index)
-class UnmergeTestCase(TestCase):
+class UnmergeTestCase(TestCase, SnubaTestCase):
def test_get_group_creation_attributes(self):
now = datetime(2017, 5, 3, 6, 6, 6, tzinfo=pytz.utc)
events = [
@@ -161,89 +152,53 @@ def test_get_group_backfill_attributes(self):
"first_release": None,
}
- @patch("sentry.tasks.unmerge.eventstream")
- def test_unmerge(self, mock_eventstream):
- eventstream_state = object()
- mock_eventstream.start_unmerge = Mock(return_value=eventstream_state)
-
- def shift(i):
- return timedelta(seconds=1 << i)
+ def test_unmerge(self):
+ tagstore = SnubaTagStorage() # Snuba is not the default tag storage for tests yet
+ now = before_now(seconds=20).replace(microsecond=0, tzinfo=pytz.utc)
- now = timezone.now() - shift(16)
+ def time_from_now(offset=0):
+ return now + timedelta(seconds=offset)
project = self.create_project()
- source = self.create_group(project)
sequence = itertools.count(0)
tag_values = itertools.cycle(["red", "green", "blue"])
user_values = itertools.cycle([{"id": 1}, {"id": 2}])
- for environment in ("production", ""):
- EnvironmentProject.objects.create(
- environment=Environment.objects.create(
- organization_id=project.organization_id, name=environment
- ),
- project=project,
- )
-
- def create_message_event(template, parameters, environment, release):
+ def create_message_event(template, parameters, environment, release, fingerprint="group1"):
i = next(sequence)
event_id = uuid.UUID(fields=(i, 0x0, 0x1000, 0x80, 0x80, 0x808080808080)).hex
tags = [["color", next(tag_values)]]
- if environment:
- tags.append(["environment", environment])
-
if release:
tags.append(["sentry:release", release])
- event = Event.objects.create(
- project_id=project.id,
- group_id=source.id,
- event_id=event_id,
- message="%s" % (id,),
- datetime=now + shift(i),
+ event = self.store_event(
data={
- "environment": environment,
+ "event_id": event_id,
+ "message": template % parameters,
"type": "default",
- "metadata": {"title": template % parameters},
- "logentry": {
- "message": template,
- "params": parameters,
- "formatted": template % parameters,
- },
"user": next(user_values),
"tags": tags,
+ "fingerprint": [fingerprint],
+ "timestamp": iso_format(now + timedelta(seconds=i)),
+ "environment": environment,
+ "release": release,
},
+ project_id=project.id,
)
- with self.tasks():
- Group.objects.add_tags(
- source,
- Environment.objects.get(
- organization_id=project.organization_id, name=environment
- ),
- tags=event.tags,
- )
-
UserReport.objects.create(
project_id=project.id,
- group_id=source.id,
+ group_id=event.group.id,
event_id=event_id,
name="Log Hat",
email="[email protected]",
comments="Quack",
)
- if release:
- Release.get_or_create(
- project=project,
- version=event.get_tag("sentry:release"),
- date_added=event.datetime,
- )
-
features.record([event])
return event
@@ -260,185 +215,143 @@ def create_message_event(template, parameters, environment, release):
for event in (
create_message_event(
- "This is message #%s!", i, environment="production", release="version"
+ "This is message #%s!",
+ i,
+ environment="production",
+ release="version2",
+ fingerprint="group2",
)
for i in xrange(10, 16)
):
events.setdefault(get_fingerprint(event), []).append(event)
- event = create_message_event("This is message #%s!", 17, environment="", release=None)
+ event = create_message_event(
+ "This is message #%s!",
+ 17,
+ environment="staging",
+ release="version3",
+ fingerprint="group3",
+ )
+
events.setdefault(get_fingerprint(event), []).append(event)
- assert len(events) == 2
- assert sum(map(len, events.values())) == 17
+ merge_source, source, destination = list(Group.objects.all())
- # XXX: This is super contrived considering that it doesn't actually go
- # through the event pipeline, but them's the breaks, eh?
- for fingerprint in events.keys():
- GroupHash.objects.create(project=project, group=source, hash=fingerprint)
+ assert len(events) == 3
+ assert sum(map(len, events.values())) == 17
production_environment = Environment.objects.get(
organization_id=project.organization_id, name="production"
)
- assert set(
- [
- (gtk.key, gtk.values_seen)
- for gtk in tagstore.get_group_tag_keys(
- source.project_id, source.id, [production_environment.id]
- )
- ]
- ) == set([(u"color", 3), (u"environment", 1), (u"sentry:release", 1)])
+ with self.tasks():
+ eventstream_state = eventstream.start_merge(project.id, [merge_source.id], source.id)
+ merge_groups.delay([merge_source.id], source.id)
+ eventstream.end_merge(eventstream_state)
assert set(
[
- (gtv.key, gtv.value, gtv.times_seen)
- for gtv in GroupTagValue.objects.filter(
- project_id=source.project_id, group_id=source.id
+ (gtv.value, gtv.times_seen)
+ for gtv in tagstore.get_group_tag_values(
+ project.id, source.id, production_environment.id, "color"
)
]
- ) == set(
- [
- (u"color", u"red", 6),
- (u"color", u"green", 6),
- (u"color", u"blue", 5),
- (u"environment", u"production", 16),
- (u"sentry:release", u"version", 16),
- ]
- )
+ ) == set([("red", 6), ("green", 5), ("blue", 5)])
- assert features.compare(source) == [
- (
- source.id,
- {
- "exception:message:character-shingles": None,
- "exception:stacktrace:application-chunks": None,
- "exception:stacktrace:pairs": None,
- "message:message:character-shingles": 1.0,
- },
- )
- ]
+ similar_items = features.compare(source)
+ assert len(similar_items) == 2
+ assert similar_items[0][0] == source.id
+ assert similar_items[0][1]["message:message:character-shingles"] == 1.0
+ assert similar_items[1][0] == destination.id
+ assert similar_items[1][1]["message:message:character-shingles"] < 1.0
with self.tasks():
+ eventstream_state = eventstream.start_unmerge(
+ project.id, [events.keys()[0]], source.id, destination.id
+ )
unmerge.delay(
- source.project_id, source.id, None, [events.keys()[1]], None, batch_size=5
+ project.id, source.id, destination.id, [events.keys()[0]], None, batch_size=5
)
+ eventstream.end_unmerge(eventstream_state)
- assert list(
- Group.objects.filter(id=source.id).values_list("times_seen", "first_seen", "last_seen")
- ) == [(10, now + shift(0), now + shift(9))]
-
- source_activity = Activity.objects.get(group_id=source.id, type=Activity.UNMERGE_SOURCE)
-
- destination = Group.objects.get(id=source_activity.data["destination_id"])
-
- mock_eventstream.start_unmerge.assert_called_once_with(
- source.project_id, [events.keys()[1]], source.id, destination.id
+ assert (
+ list(
+ Group.objects.filter(id=merge_source.id).values_list(
+ "times_seen", "first_seen", "last_seen"
+ )
+ )
+ == []
)
- mock_eventstream.end_unmerge.assert_called_once_with(eventstream_state)
+ assert list(
+ Group.objects.filter(id=source.id).values_list("times_seen", "first_seen", "last_seen")
+ ) == [(6, time_from_now(10), time_from_now(15))]
assert list(
Group.objects.filter(id=destination.id).values_list(
"times_seen", "first_seen", "last_seen"
)
- ) == [(7, now + shift(10), now + shift(16))]
-
- assert source_activity.data == {
- "destination_id": destination.id,
- "fingerprints": [events.keys()[1]],
- }
+ ) == [(11, time_from_now(0), time_from_now(16))]
assert source.id != destination.id
assert source.project == destination.project
- assert Activity.objects.get(
- group_id=destination.id, type=Activity.UNMERGE_DESTINATION
- ).data == {"source_id": source.id, "fingerprints": [events.keys()[1]]}
-
- source_event_event_ids = map(lambda event: event.event_id, events.values()[0])
+ destination_event_ids = map(lambda event: event.event_id, events.values()[1])
assert set(
UserReport.objects.filter(group_id=source.id).values_list("event_id", flat=True)
- ) == set(source_event_event_ids)
+ ) == set(destination_event_ids)
assert set(
GroupHash.objects.filter(group_id=source.id).values_list("hash", flat=True)
- ) == set([events.keys()[0]])
+ ) == set([events.keys()[0], events.keys()[1]])
assert set(
GroupRelease.objects.filter(group_id=source.id).values_list(
"environment", "first_seen", "last_seen"
)
- ) == set([(u"production", now + shift(0), now + shift(9))])
+ ) == set([(u"production", time_from_now(10), time_from_now(15))])
assert set(
[
- (gtk.key, gtk.values_seen)
- for gtk in tagstore.get_group_tag_keys(
- source.project_id, source.id, [production_environment.id]
+ (gtv.value, gtv.times_seen)
+ for gtv in tagstore.get_group_tag_values(
+ project.id, destination.id, production_environment.id, "color"
)
]
- ) == set([(u"color", 3), (u"environment", 1), (u"sentry:release", 1)])
+ ) == set([(u"red", 4), (u"green", 3), (u"blue", 3)])
- assert set(
- [
- (gtv.key, gtv.value, gtv.times_seen, gtv.first_seen, gtv.last_seen)
- for gtv in GroupTagValue.objects.filter(
- project_id=source.project_id, group_id=source.id
- )
- ]
- ) == set(
- [
- (u"color", u"red", 4, now + shift(0), now + shift(9)),
- (u"color", u"green", 3, now + shift(1), now + shift(7)),
- (u"color", u"blue", 3, now + shift(2), now + shift(8)),
- (u"environment", u"production", 10, now + shift(0), now + shift(9)),
- (u"sentry:release", u"version", 10, now + shift(0), now + shift(9)),
- ]
+ destination_event_ids = map(
+ lambda event: event.event_id, events.values()[0] + events.values()[2]
)
- destination_event_event_ids = map(lambda event: event.event_id, events.values()[1])
-
assert set(
UserReport.objects.filter(group_id=destination.id).values_list("event_id", flat=True)
- ) == set(destination_event_event_ids)
+ ) == set(destination_event_ids)
assert set(
GroupHash.objects.filter(group_id=destination.id).values_list("hash", flat=True)
- ) == set([events.keys()[1]])
+ ) == set([events.keys()[2]])
assert set(
GroupRelease.objects.filter(group_id=destination.id).values_list(
"environment", "first_seen", "last_seen"
)
- ) == set([(u"production", now + shift(10), now + shift(15))])
-
- assert set(
+ ) == set(
[
- (gtk.key, gtk.values_seen)
- for gtk in tagstore.get_group_tag_keys(
- source.project_id, source.id, [production_environment.id]
- )
+ ("production", time_from_now(0), time_from_now(9)),
+ ("staging", time_from_now(16), time_from_now(16)),
]
- ) == set([(u"color", 3), (u"environment", 1), (u"sentry:release", 1)])
+ )
assert set(
[
- (gtv.key, gtv.value, gtv.times_seen, gtv.first_seen, gtv.last_seen)
- for gtv in GroupTagValue.objects.filter(
- project_id=destination.project_id, group_id=destination.id
+ (gtk.value, gtk.times_seen)
+ for gtk in tagstore.get_group_tag_values(
+ project.id, destination.id, production_environment.id, "color"
)
]
- ) == set(
- [
- (u"color", u"red", 2, now + shift(12), now + shift(15)),
- (u"color", u"green", 3, now + shift(10), now + shift(16)),
- (u"color", u"blue", 2, now + shift(11), now + shift(14)),
- (u"environment", u"production", 6, now + shift(10), now + shift(15)),
- (u"sentry:release", u"version", 6, now + shift(10), now + shift(15)),
- ]
- )
+ ) == set([("red", 4), ("blue", 3), ("green", 3)])
rollup_duration = 3600
@@ -446,7 +359,7 @@ def create_message_event(template, parameters, environment, release):
tsdb.models.group,
[source.id, destination.id],
now - timedelta(seconds=rollup_duration),
- now + shift(15),
+ time_from_now(17),
rollup_duration,
)
@@ -454,7 +367,7 @@ def create_message_event(template, parameters, environment, release):
tsdb.models.group,
[source.id, destination.id],
now - timedelta(seconds=rollup_duration),
- now + shift(15),
+ time_from_now(17),
rollup_duration,
environment_ids=[production_environment.id],
)
@@ -481,24 +394,37 @@ def assert_series_contains(expected, actual, default=0):
for key in set(actual.keys()) - set(expected.keys()):
assert actual.get(key, 0) == default
- for series in [time_series, environment_time_series]:
- assert_series_contains(
- get_expected_series_values(rollup_duration, events.values()[0]),
- series[source.id],
- 0,
- )
+ assert_series_contains(
+ get_expected_series_values(rollup_duration, events.values()[1]),
+ time_series[source.id],
+ 0,
+ )
- assert_series_contains(
- get_expected_series_values(rollup_duration, events.values()[1][:-1]),
- series[destination.id],
- 0,
- )
+ assert_series_contains(
+ get_expected_series_values(rollup_duration, events.values()[0] + events.values()[2]),
+ time_series[destination.id],
+ 0,
+ )
+
+ assert_series_contains(
+ get_expected_series_values(rollup_duration, events.values()[1]),
+ environment_time_series[source.id],
+ 0,
+ )
+
+ assert_series_contains(
+ get_expected_series_values(
+ rollup_duration, events.values()[0][:-1] + events.values()[2]
+ ),
+ environment_time_series[destination.id],
+ 0,
+ )
time_series = tsdb.get_distinct_counts_series(
tsdb.models.users_affected_by_group,
[source.id, destination.id],
now - timedelta(seconds=rollup_duration),
- now + shift(16),
+ time_from_now(17),
rollup_duration,
)
@@ -506,7 +432,7 @@ def assert_series_contains(expected, actual, default=0):
tsdb.models.users_affected_by_group,
[source.id, destination.id],
now - timedelta(seconds=rollup_duration),
- now + shift(16),
+ time_from_now(17),
rollup_duration,
environment_id=production_environment.id,
)
@@ -521,7 +447,7 @@ def collect_by_user_tag(aggregate, event):
{
timestamp: len(values)
for timestamp, values in get_expected_series_values(
- rollup_duration, events.values()[0], collect_by_user_tag
+ rollup_duration, events.values()[1], collect_by_user_tag
).items()
},
series[source.id],
@@ -531,19 +457,22 @@ def collect_by_user_tag(aggregate, event):
{
timestamp: len(values)
for timestamp, values in get_expected_series_values(
- rollup_duration, events.values()[1], collect_by_user_tag
+ rollup_duration,
+ events.values()[0] + events.values()[2],
+ collect_by_user_tag,
).items()
},
time_series[destination.id],
)
- time_series = tsdb.get_most_frequent_series(
- tsdb.models.frequent_releases_by_group,
- [source.id, destination.id],
- now - timedelta(seconds=rollup_duration),
- now + shift(16),
- rollup_duration,
- )
+ def strip_zeroes(data):
+ for group_id, series in data.items():
+ for _, values in series:
+ for key, val in values.items():
+ if val == 0:
+ values.pop(key)
+
+ return data
def collect_by_release(group, aggregate, event):
aggregate = aggregate if aggregate is not None else {}
@@ -560,9 +489,23 @@ def collect_by_release(group, aggregate, event):
aggregate[release] = aggregate.get(release, 0) + 1
return aggregate
+ items = {}
+ for i in [source.id, destination.id]:
+ items[i] = list(GroupRelease.objects.filter(group_id=i).values_list("id", flat=True))
+
+ time_series = strip_zeroes(
+ tsdb.get_frequency_series(
+ tsdb.models.frequent_releases_by_group,
+ items,
+ now - timedelta(seconds=rollup_duration),
+ time_from_now(17),
+ rollup_duration,
+ )
+ )
+
assert_series_contains(
get_expected_series_values(
- rollup_duration, events.values()[0], functools.partial(collect_by_release, source)
+ rollup_duration, events.values()[1], functools.partial(collect_by_release, source)
),
time_series[source.id],
{},
@@ -571,19 +514,25 @@ def collect_by_release(group, aggregate, event):
assert_series_contains(
get_expected_series_values(
rollup_duration,
- events.values()[1],
+ events.values()[0] + events.values()[2],
functools.partial(collect_by_release, destination),
),
time_series[destination.id],
{},
)
- time_series = tsdb.get_most_frequent_series(
- tsdb.models.frequent_environments_by_group,
- [source.id, destination.id],
- now - timedelta(seconds=rollup_duration),
- now + shift(16),
- rollup_duration,
+ items = {}
+ for i in [source.id, destination.id]:
+ items[i] = list(Environment.objects.all().values_list("id", flat=True))
+
+ time_series = strip_zeroes(
+ tsdb.get_frequency_series(
+ tsdb.models.frequent_environments_by_group,
+ items,
+ now - timedelta(seconds=rollup_duration),
+ time_from_now(17),
+ rollup_duration,
+ )
)
def collect_by_environment(aggregate, event):
@@ -595,13 +544,15 @@ def collect_by_environment(aggregate, event):
return aggregate
assert_series_contains(
- get_expected_series_values(rollup_duration, events.values()[0], collect_by_environment),
+ get_expected_series_values(rollup_duration, events.values()[1], collect_by_environment),
time_series[source.id],
{},
)
assert_series_contains(
- get_expected_series_values(rollup_duration, events.values()[1], collect_by_environment),
+ get_expected_series_values(
+ rollup_duration, events.values()[0] + events.values()[2], collect_by_environment
+ ),
time_series[destination.id],
{},
)
|
2f505635cce37230aa8e4e3cf247cf87911aa0f8
|
2025-02-28 00:28:44
|
Malachi Willey
|
feat(nav): Add logging for unexpected redirects (#86000)
| false
|
Add logging for unexpected redirects (#86000)
|
feat
|
diff --git a/static/app/components/nav/useRedirectNavV2Routes.tsx b/static/app/components/nav/useRedirectNavV2Routes.tsx
index 6dcde7f3b98f18..7bcec0adaf2949 100644
--- a/static/app/components/nav/useRedirectNavV2Routes.tsx
+++ b/static/app/components/nav/useRedirectNavV2Routes.tsx
@@ -1,8 +1,13 @@
-import {useLocation} from 'react-router-dom';
+import {useEffect} from 'react';
+import * as Sentry from '@sentry/react';
import {usePrefersStackedNav} from 'sentry/components/nav/prefersStackedNav';
import {USING_CUSTOMER_DOMAIN} from 'sentry/constants';
+import getRouteStringFromRoutes from 'sentry/utils/getRouteStringFromRoutes';
+import {useLocation} from 'sentry/utils/useLocation';
import useOrganization from 'sentry/utils/useOrganization';
+import {useRoutes} from 'sentry/utils/useRoutes';
+import {useLastKnownRoute} from 'sentry/views/lastKnownRouteContextProvider';
type Props = {
newPathPrefix: `/${string}`;
@@ -12,6 +17,11 @@ type Props = {
function useShouldRedirect(oldPathPrefix: `/${string}`) {
const organization = useOrganization();
const location = useLocation();
+ const prefersStackedNav = usePrefersStackedNav();
+
+ if (!prefersStackedNav) {
+ return false;
+ }
if (USING_CUSTOMER_DOMAIN) {
return location.pathname.startsWith(oldPathPrefix);
@@ -22,6 +32,28 @@ function useShouldRedirect(oldPathPrefix: `/${string}`) {
);
}
+/**
+ * All links should use the new paths (e.g. /profiling -> /explore/profiling).
+ * This creates a Sentry issue if we detect any links that haven't been updated.
+ */
+function useLogUnexpectedNavigationRedirect({shouldRedirect}: {shouldRedirect: boolean}) {
+ const lastKnownRoute = useLastKnownRoute();
+ const route = useRoutes();
+ const routeString = getRouteStringFromRoutes(route);
+
+ useEffect(() => {
+ if (shouldRedirect && lastKnownRoute !== routeString) {
+ Sentry.captureMessage('Unexpected navigation redirect', {
+ level: 'warning',
+ tags: {
+ last_known_route: lastKnownRoute,
+ route: routeString,
+ },
+ });
+ }
+ }, [lastKnownRoute, shouldRedirect, routeString]);
+}
+
/**
* Helps determine if we are on a legacy route and should redirect to the new route.
* Some products have been moved under new groups, such as feedback -> issues/feedback
@@ -39,10 +71,11 @@ export function useRedirectNavV2Routes({
}: Props): string | null {
const location = useLocation();
const organization = useOrganization();
- const prefersStackedNav = usePrefersStackedNav();
const shouldRedirect = useShouldRedirect(oldPathPrefix);
- if (!prefersStackedNav || !shouldRedirect) {
+ useLogUnexpectedNavigationRedirect({shouldRedirect});
+
+ if (!shouldRedirect) {
return null;
}
|
bb9eff5d1987d0a82ebddfe6dcbd27d56b85cd16
|
2018-11-16 00:23:13
|
Lyn Nagara
|
feat(discover): Allow lowercase condition operator input (#10603)
| false
|
Allow lowercase condition operator input (#10603)
|
feat
|
diff --git a/src/sentry/static/sentry/app/views/organizationDiscover/conditions/condition.jsx b/src/sentry/static/sentry/app/views/organizationDiscover/conditions/condition.jsx
index f279e6d57a5001..261cf671b35f12 100644
--- a/src/sentry/static/sentry/app/views/organizationDiscover/conditions/condition.jsx
+++ b/src/sentry/static/sentry/app/views/organizationDiscover/conditions/condition.jsx
@@ -4,7 +4,7 @@ import {Box} from 'grid-emotion';
import {t} from 'app/locale';
import SelectControl from 'app/components/forms/selectControl';
-import {getInternal, getExternal, isValidCondition} from './utils';
+import {getInternal, getExternal, isValidCondition, ignoreCase} from './utils';
import {CONDITION_OPERATORS, ARRAY_FIELD_PREFIXES} from '../data';
import {PlaceholderText} from '../styles';
@@ -86,8 +86,8 @@ export default class Condition extends React.Component {
});
}
- filterOptions = (options, input) => {
- input = input || this.state.inputValue;
+ filterOptions = options => {
+ const input = this.state.inputValue;
let optionList = options;
const external = getExternal(input, this.props.columns);
@@ -122,6 +122,7 @@ export default class Condition extends React.Component {
};
isValidNewOption = ({label}) => {
+ label = ignoreCase(label);
return isValidCondition(getExternal(label, this.props.columns), this.props.columns);
};
@@ -148,12 +149,20 @@ export default class Condition extends React.Component {
handleInputChange = value => {
this.setState({
- inputValue: value,
+ inputValue: ignoreCase(value),
});
return value;
};
+ newOptionCreator = ({label, labelKey, valueKey}) => {
+ label = ignoreCase(label);
+ return {
+ [valueKey]: label,
+ [labelKey]: label,
+ };
+ };
+
render() {
return (
<Box w={1}>
@@ -179,6 +188,7 @@ export default class Condition extends React.Component {
promptTextCreator={text => text}
shouldKeyDownEventCreateNewOption={this.shouldKeyDownEventCreateNewOption}
disabled={this.props.disabled}
+ newOptionCreator={this.newOptionCreator}
/>
</Box>
);
diff --git a/src/sentry/static/sentry/app/views/organizationDiscover/conditions/utils.jsx b/src/sentry/static/sentry/app/views/organizationDiscover/conditions/utils.jsx
index 0cbce90a4c52cc..b2db1dab127914 100644
--- a/src/sentry/static/sentry/app/views/organizationDiscover/conditions/utils.jsx
+++ b/src/sentry/static/sentry/app/views/organizationDiscover/conditions/utils.jsx
@@ -107,3 +107,35 @@ export function getExternal(internal, columns) {
return external;
}
+
+/**
+* Transform casing of condition operators to uppercase. Applies to the operators
+* IS NULL, IS NOT NULL, LIKE and NOT LIKE
+*
+* @param {String} input Condition string as input by user
+* @returns {String}
+*/
+
+export function ignoreCase(input = '') {
+ const colName = input.split(' ')[0];
+
+ // Strip column name from the start
+ const match = input.match(/^[\w._]+\s(.*)/);
+ let remaining = match ? match[1] : null;
+
+ if (!remaining) {
+ return input;
+ }
+
+ for (let i = 0; i < CONDITION_OPERATORS.length; i++) {
+ const operator = CONDITION_OPERATORS[i];
+
+ if (operator.startsWith(remaining.toUpperCase())) {
+ return `${colName} ${remaining.toUpperCase()}`;
+ } else if (remaining.toUpperCase().startsWith(operator)) {
+ return `${colName} ${operator} ${remaining.slice(operator.length + 1)}`;
+ }
+ }
+
+ return input;
+}
diff --git a/tests/js/spec/views/organizationDiscover/conditions/condition.spec.jsx b/tests/js/spec/views/organizationDiscover/conditions/condition.spec.jsx
index dbb969b2e4744d..f1810414cac1fb 100644
--- a/tests/js/spec/views/organizationDiscover/conditions/condition.spec.jsx
+++ b/tests/js/spec/views/organizationDiscover/conditions/condition.spec.jsx
@@ -45,19 +45,22 @@ describe('Condition', function() {
});
it('renders operator options for string column', function() {
- const options = wrapper.instance().filterOptions([], 'col1');
+ wrapper.setState({inputValue: 'col1'});
+ const options = wrapper.instance().filterOptions([]);
expect(options).toHaveLength(6);
expect(options[0]).toEqual({value: 'col1 =', label: 'col1 ='});
});
it('renders operator options for number column', function() {
- const options = wrapper.instance().filterOptions([], 'col2');
+ wrapper.setState({inputValue: 'col2'});
+ const options = wrapper.instance().filterOptions([]);
expect(options).toHaveLength(8);
expect(options[0]).toEqual({value: 'col2 >', label: 'col2 >'});
});
it('renders operator options for datetime column', function() {
- const options = wrapper.instance().filterOptions([], 'col3');
+ wrapper.setState({inputValue: 'col3'});
+ const options = wrapper.instance().filterOptions([]);
expect(options).toHaveLength(8);
expect(options[0]).toEqual({value: 'col3 >', label: 'col3 >'});
expect(options[1]).toEqual({value: 'col3 <', label: 'col3 <'});
@@ -70,7 +73,8 @@ describe('Condition', function() {
});
it('limits operators to = and != for array fields', function() {
- const options = wrapper.instance().filterOptions([], 'error.type');
+ wrapper.setState({inputValue: 'error.type'});
+ const options = wrapper.instance().filterOptions([]);
expect(options).toHaveLength(2);
expect(options[0].value).toEqual('error.type =');
expect(options[1].value).toEqual('error.type !=');
diff --git a/tests/js/spec/views/organizationDiscover/conditions/utils.spec.jsx b/tests/js/spec/views/organizationDiscover/conditions/utils.spec.jsx
index 7037f3bc00bcee..5ef5d222ce1d05 100644
--- a/tests/js/spec/views/organizationDiscover/conditions/utils.spec.jsx
+++ b/tests/js/spec/views/organizationDiscover/conditions/utils.spec.jsx
@@ -2,6 +2,7 @@ import {
getInternal,
getExternal,
isValidCondition,
+ ignoreCase,
} from 'app/views/organizationDiscover/conditions/utils';
import {COLUMNS} from 'app/views/organizationDiscover/data';
@@ -80,4 +81,35 @@ describe('Conditions', function() {
expect(isValidCondition(['device_name', 'iS', '%something%'], COLUMNS)).toBe(false);
});
});
+
+ describe('ignoreCase()', function() {
+ const conditionCases = [
+ {
+ input: '',
+ output: '',
+ },
+ {
+ input: 'event_id like %test%',
+ output: 'event_id LIKE %test%',
+ },
+ {
+ input: 'event_id IS Nul',
+ output: 'event_id IS NUL',
+ },
+ {
+ input: 'event_id = asdf',
+ output: 'event_id = asdf',
+ },
+ {
+ input: 'event_id IS not null',
+ output: 'event_id IS NOT NULL',
+ },
+ ];
+
+ it('uppercases condition operators', function() {
+ conditionCases.forEach(({input, output}) => {
+ expect(ignoreCase(input)).toBe(output);
+ });
+ });
+ });
});
|
8b66cebceba4fe98d77d1f1c1a58876114370bba
|
2018-05-05 03:34:53
|
Eric Feng
|
fix(assistant): Fixing Members Guide (#8295)
| false
|
Fixing Members Guide (#8295)
|
fix
|
diff --git a/src/sentry/static/sentry/app/views/settings/organization/members/organizationMemberRow.jsx b/src/sentry/static/sentry/app/views/settings/organization/members/organizationMemberRow.jsx
index c95c5039acf03f..bca27ce1c6c71c 100644
--- a/src/sentry/static/sentry/app/views/settings/organization/members/organizationMemberRow.jsx
+++ b/src/sentry/static/sentry/app/views/settings/organization/members/organizationMemberRow.jsx
@@ -14,6 +14,7 @@ import LoadingIndicator from 'app/components/loadingIndicator';
import SentryTypes from 'app/proptypes';
import Tooltip from 'app/components/tooltip';
import recreateRoute from 'app/utils/recreateRoute';
+import {conditionalGuideAnchor} from 'app/components/assistant/guideAnchor';
const UserName = styled(Link)`
font-size: 16px;
@@ -39,6 +40,7 @@ export default class OrganizationMemberRow extends React.PureComponent {
canAddMembers: PropTypes.bool,
currentUser: SentryTypes.User,
status: PropTypes.oneOf(['', 'loading', 'success', 'error']),
+ firstRow: PropTypes.bool,
};
constructor(...args) {
@@ -115,50 +117,55 @@ export default class OrganizationMemberRow extends React.PureComponent {
</Box>
<Box px={2} w={180}>
- {needsSso || pending ? (
- <div>
+ {conditionalGuideAnchor(
+ this.props.firstRow,
+ 'member_status',
+ 'text',
+ needsSso || pending ? (
<div>
- {pending ? (
- <strong>{t('Invited')}</strong>
- ) : (
- <strong>{t('Missing SSO Link')}</strong>
+ <div>
+ {pending ? (
+ <strong>{t('Invited')}</strong>
+ ) : (
+ <strong>{t('Missing SSO Link')}</strong>
+ )}
+ </div>
+
+ {isInviting && (
+ <div style={{padding: '4px 0 3px'}}>
+ <LoadingIndicator mini />
+ </div>
)}
+ {isInviteSuccessful && <span>Sent!</span>}
+ {!isInviting &&
+ !isInviteSuccessful &&
+ canAddMembers &&
+ (pending || needsSso) && (
+ <ResendInviteButton
+ priority="primary"
+ size="xsmall"
+ onClick={this.handleSendInvite}
+ >
+ {t('Resend invite')}
+ </ResendInviteButton>
+ )}
</div>
-
- {isInviting && (
- <div style={{padding: '4px 0 3px'}}>
- <LoadingIndicator mini />
- </div>
- )}
- {isInviteSuccessful && <span>Sent!</span>}
- {!isInviting &&
- !isInviteSuccessful &&
- canAddMembers &&
- (pending || needsSso) && (
- <ResendInviteButton
- priority="primary"
- size="xsmall"
- onClick={this.handleSendInvite}
- >
- {t('Resend invite')}
- </ResendInviteButton>
+ ) : (
+ <div>
+ {!has2fa ? (
+ <Tooltip title={t('Two-factor auth not enabled')}>
+ <NoTwoFactorIcon />
+ </Tooltip>
+ ) : (
+ <HasTwoFactorIcon />
)}
- </div>
- ) : (
- <div>
- {!has2fa ? (
- <Tooltip title={t('Two-factor auth not enabled')}>
- <NoTwoFactorIcon />
- </Tooltip>
- ) : (
- <HasTwoFactorIcon />
- )}
- </div>
+ </div>
+ )
)}
</Box>
<Box px={2} w={140}>
- {roleName}
+ {conditionalGuideAnchor(this.props.firstRow, 'member_role', 'text', roleName)}
</Box>
{showRemoveButton || showLeaveButton ? (
diff --git a/src/sentry/static/sentry/app/views/settings/organization/members/organizationMembersView.jsx b/src/sentry/static/sentry/app/views/settings/organization/members/organizationMembersView.jsx
index c7d0bb4b1a78ec..e0041c8459a3cc 100644
--- a/src/sentry/static/sentry/app/views/settings/organization/members/organizationMembersView.jsx
+++ b/src/sentry/static/sentry/app/views/settings/organization/members/organizationMembersView.jsx
@@ -310,6 +310,7 @@ class OrganizationMembersView extends AsyncView {
onSendInvite={this.handleSendInvite}
onRemove={this.handleRemove}
onLeave={this.handleLeave}
+ firstRow={members.indexOf(member) === 0}
/>
);
})}
|
96ad1cf3218ab1376226702bf6bc1fc5d549d738
|
2024-07-25 23:03:28
|
Alex Zaslavsky
|
fix(relocation): Better UUID typing for tasks (#74971)
| false
|
Better UUID typing for tasks (#74971)
|
fix
|
diff --git a/src/sentry/tasks/relocation.py b/src/sentry/tasks/relocation.py
index 0f6744335a5260..92407ebd5d8e38 100644
--- a/src/sentry/tasks/relocation.py
+++ b/src/sentry/tasks/relocation.py
@@ -158,7 +158,7 @@
retry_backoff_jitter=True,
soft_time_limit=FAST_TIME_LIMIT,
)
-def uploading_start(uuid: str, replying_region_name: str | None, org_slug: str | None) -> None:
+def uploading_start(uuid: UUID, replying_region_name: str | None, org_slug: str | None) -> None:
"""
The very first action in the relocation pipeline. In the case of a `SAAS_TO_SAAS` relocation, it
will trigger the export of the requested organization from the region it currently live in. If
@@ -279,7 +279,7 @@ def uploading_start(uuid: str, replying_region_name: str | None, org_slug: str |
# Send out the cross-region request.
control_relocation_export_service.request_new_export(
- relocation_uuid=uuid,
+ relocation_uuid=str(uuid),
requesting_region_name=get_local_region().name,
replying_region_name=replying_region_name,
org_slug=org_slug,
@@ -314,7 +314,7 @@ def uploading_start(uuid: str, replying_region_name: str | None, org_slug: str |
silo_mode=SiloMode.REGION,
)
def fulfill_cross_region_export_request(
- uuid: str,
+ uuid_str: str,
requesting_region_name: str,
replying_region_name: str,
org_slug: str,
@@ -341,7 +341,7 @@ def fulfill_cross_region_export_request(
logger.error(
"Cross region relocation fulfillment timeout",
extra={
- "uuid": uuid,
+ "uuid": uuid_str,
"requesting_region_name": requesting_region_name,
"replying_region_name": replying_region_name,
"org_slug": org_slug,
@@ -352,6 +352,7 @@ def fulfill_cross_region_export_request(
return
log_gcp_credentials_details(logger)
+ uuid = UUID(uuid_str)
path = f"runs/{uuid}/saas_to_saas_export/{org_slug}.tar"
relocation_storage = get_relocation_storage()
fp = BytesIO()
@@ -364,14 +365,14 @@ def fulfill_cross_region_export_request(
fp.seek(0)
relocation_storage.save(path, fp)
- identifier = uuid_to_identifier(UUID(uuid))
+ identifier = uuid_to_identifier(uuid)
RegionOutbox(
shard_scope=OutboxScope.RELOCATION_SCOPE,
category=OutboxCategory.RELOCATION_EXPORT_REPLY,
shard_identifier=identifier,
object_identifier=identifier,
payload=RelocationExportReplyWithExportParameters(
- relocation_uuid=uuid,
+ relocation_uuid=uuid_str,
requesting_region_name=requesting_region_name,
replying_region_name=replying_region_name,
org_slug=org_slug,
@@ -390,7 +391,7 @@ def fulfill_cross_region_export_request(
silo_mode=SiloMode.REGION,
)
def cross_region_export_timeout_check(
- uuid: str,
+ uuid: UUID,
) -> None:
"""
Not part of the primary `OrderedTask` queue. This task is only used to ensure that cross-region
@@ -403,7 +404,7 @@ def cross_region_export_timeout_check(
logger.exception("Could not locate Relocation model by UUID: %s", uuid)
return
- logger_data = {"uuid": relocation.uuid, "task": "cross_region_export_timeout_check"}
+ logger_data = {"uuid": str(relocation.uuid), "task": "cross_region_export_timeout_check"}
logger.info(
"Cross region timeout check: started",
extra=logger_data,
@@ -446,7 +447,7 @@ def cross_region_export_timeout_check(
retry_backoff_jitter=True,
soft_time_limit=FAST_TIME_LIMIT,
)
-def uploading_complete(uuid: str) -> None:
+def uploading_complete(uuid: UUID) -> None:
"""
Just check to ensure that uploading the (potentially very large!) backup file has completed
before we try to do all sorts of fun stuff with it.
@@ -495,7 +496,7 @@ def uploading_complete(uuid: str) -> None:
soft_time_limit=MEDIUM_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def preprocessing_scan(uuid: str) -> None:
+def preprocessing_scan(uuid: UUID) -> None:
"""
Performs the very first part of the `PREPROCESSING` step of a `Relocation`, which involves
decrypting the user-supplied tarball and picking out some useful information for it. This let's
@@ -671,7 +672,7 @@ def preprocessing_scan(uuid: str) -> None:
soft_time_limit=MEDIUM_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def preprocessing_transfer(uuid: str) -> None:
+def preprocessing_transfer(uuid: UUID) -> None:
"""
We currently have the user's relocation data stored in the main filestore bucket, but we need to
move it to the relocation bucket. This task handles that transfer.
@@ -761,7 +762,7 @@ def preprocessing_transfer(uuid: str) -> None:
soft_time_limit=MEDIUM_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def preprocessing_baseline_config(uuid: str) -> None:
+def preprocessing_baseline_config(uuid: UUID) -> None:
"""
Pulls down the global config data we'll need to check for collisions and global data integrity.
@@ -814,7 +815,7 @@ def preprocessing_baseline_config(uuid: str) -> None:
soft_time_limit=MEDIUM_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def preprocessing_colliding_users(uuid: str) -> None:
+def preprocessing_colliding_users(uuid: UUID) -> None:
"""
Pulls down any already existing users whose usernames match those found in the import - we'll
need to validate that none of these are mutated during import.
@@ -865,7 +866,7 @@ def preprocessing_colliding_users(uuid: str) -> None:
soft_time_limit=MEDIUM_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def preprocessing_complete(uuid: str) -> None:
+def preprocessing_complete(uuid: UUID) -> None:
"""
This task ensures that every file CloudBuild will need to do its work is actually present and
available. Even if we've "finished" our uploads from the previous step, they may still not (yet)
@@ -988,15 +989,18 @@ def _update_relocation_validation_attempt(
router.db_for_write(RelocationValidationAttempt),
)
):
+ uuid_str = str(relocation.uuid)
+ uuid = UUID(uuid_str)
+
# If no interesting status updates occurred, check again in a minute.
if status == ValidationStatus.IN_PROGRESS:
logger.info(
"Validation polling: scheduled",
- extra={"uuid": relocation.uuid, "task": task.name},
+ extra={"uuid": uuid_str, "task": task.name},
)
return NextTask(
task=validating_poll,
- args=[relocation.uuid, str(relocation_validation_attempt.build_id)],
+ args=[uuid, str(relocation_validation_attempt.build_id)],
countdown=60,
)
@@ -1017,10 +1021,10 @@ def _update_relocation_validation_attempt(
logger.info(
"Validation timed out",
- extra={"uuid": relocation.uuid, "task": task.name},
+ extra={"uuid": uuid_str, "task": task.name},
)
- return NextTask(task=validating_start, args=[relocation.uuid])
+ return NextTask(task=validating_start, args=[uuid])
# Always accept the numerically higher `ValidationStatus`, since that is a more definite
# result.
@@ -1048,7 +1052,7 @@ def _update_relocation_validation_attempt(
if status == ValidationStatus.INVALID:
logger.info(
"Validation result: invalid",
- extra={"uuid": relocation.uuid, "task": task.name},
+ extra={"uuid": uuid_str, "task": task.name},
)
transaction.on_commit(
lambda: fail_relocation(
@@ -1066,10 +1070,10 @@ def _update_relocation_validation_attempt(
logger.info(
"Validation result: valid",
- extra={"uuid": relocation.uuid, "task": task.name},
+ extra={"uuid": uuid_str, "task": task.name},
)
- return NextTask(task=importing, args=[relocation.uuid])
+ return NextTask(task=importing, args=[uuid])
@instrumented_task(
@@ -1082,7 +1086,7 @@ def _update_relocation_validation_attempt(
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def validating_start(uuid: str) -> None:
+def validating_start(uuid: UUID) -> None:
"""
Calls into Google CloudBuild and kicks off a validation run.
@@ -1159,7 +1163,7 @@ def camel_to_snake_keep_underscores(value):
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def validating_poll(uuid: str, build_id: str) -> None:
+def validating_poll(uuid: UUID, build_id: str) -> None:
"""
Checks the progress of a Google CloudBuild validation run.
@@ -1189,7 +1193,7 @@ def validating_poll(uuid: str, build_id: str) -> None:
logger.info(
"Validation polling: active",
extra={
- "uuid": relocation.uuid,
+ "uuid": str(relocation.uuid),
"task": OrderedTask.VALIDATING_POLL.name,
"build_id": build_id,
},
@@ -1259,7 +1263,7 @@ def validating_poll(uuid: str, build_id: str) -> None:
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def validating_complete(uuid: str, build_id: str) -> None:
+def validating_complete(uuid: UUID, build_id: str) -> None:
"""
Wraps up a validation run, and reports on what we found. If this task is being called, the
CloudBuild run as completed successfully, so we just need to figure out if there were any
@@ -1349,7 +1353,7 @@ def validating_complete(uuid: str, build_id: str) -> None:
soft_time_limit=SLOW_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def importing(uuid: str) -> None:
+def importing(uuid: UUID) -> None:
"""
Perform the import on the actual live instance we are targeting.
@@ -1413,7 +1417,7 @@ def importing(uuid: str) -> None:
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def postprocessing(uuid: str) -> None:
+def postprocessing(uuid: UUID) -> None:
"""
Make the owner of this relocation an owner of all of the organizations we just imported.
"""
@@ -1434,9 +1438,10 @@ def postprocessing(uuid: str) -> None:
attempts_left,
ERR_POSTPROCESSING_INTERNAL,
):
+ uuid_str = str(uuid)
imported_org_ids: set[int] = set()
for chunk in RegionImportChunk.objects.filter(
- import_uuid=str(uuid), model="sentry.organization"
+ import_uuid=uuid_str, model="sentry.organization"
):
imported_org_ids = imported_org_ids.union(set(chunk.inserted_map.values()))
@@ -1468,7 +1473,7 @@ def postprocessing(uuid: str) -> None:
# Last, but certainly not least: trigger signals, so that interested subscribers in eg:
# getsentry can do whatever postprocessing they need to. If even a single one fails, we fail
# the entire task.
- for _, result in relocated.send_robust(sender=postprocessing, relocation_uuid=uuid):
+ for _, result in relocated.send_robust(sender=postprocessing, relocation_uuid=uuid_str):
if isinstance(result, Exception):
raise result
@@ -1477,7 +1482,7 @@ def postprocessing(uuid: str) -> None:
relocation_redeem_promo_code.send_robust(
sender=postprocessing,
user_id=relocation.owner_id,
- relocation_uuid=uuid,
+ relocation_uuid=uuid_str,
orgs=list(imported_orgs),
)
@@ -1486,7 +1491,7 @@ def postprocessing(uuid: str) -> None:
analytics.record(
"relocation.organization_imported",
organization_id=org.id,
- relocation_uuid=str(relocation.uuid),
+ relocation_uuid=uuid_str,
slug=org.slug,
owner_id=relocation.owner_id,
)
@@ -1506,7 +1511,7 @@ def postprocessing(uuid: str) -> None:
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def notifying_unhide(uuid: str) -> None:
+def notifying_unhide(uuid: UUID) -> None:
"""
Un-hide the just-imported organizations, making them visible to users in the UI.
"""
@@ -1554,7 +1559,7 @@ def notifying_unhide(uuid: str) -> None:
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def notifying_users(uuid: str) -> None:
+def notifying_users(uuid: UUID) -> None:
"""
Send an email to all users that have been imported, telling them to claim their accounts.
"""
@@ -1575,16 +1580,15 @@ def notifying_users(uuid: str) -> None:
attempts_left,
ERR_NOTIFYING_INTERNAL,
):
+ uuid_str = str(uuid)
imported_user_ids: set[int] = set()
- chunks = ControlImportChunkReplica.objects.filter(
- import_uuid=str(uuid), model="sentry.user"
- )
+ chunks = ControlImportChunkReplica.objects.filter(import_uuid=uuid_str, model="sentry.user")
for control_chunk in chunks:
imported_user_ids = imported_user_ids.union(set(control_chunk.inserted_map.values()))
imported_org_slugs: set[int] = set()
for region_chunk in RegionImportChunk.objects.filter(
- import_uuid=str(uuid), model="sentry.organization"
+ import_uuid=uuid_str, model="sentry.organization"
):
imported_org_slugs = imported_org_slugs.union(
set(region_chunk.inserted_identifiers.values())
@@ -1631,7 +1635,7 @@ def notifying_users(uuid: str) -> None:
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def notifying_owner(uuid: str) -> None:
+def notifying_owner(uuid: UUID) -> None:
"""
Send an email to the creator and owner, telling them that their relocation was successful.
"""
@@ -1652,9 +1656,10 @@ def notifying_owner(uuid: str) -> None:
attempts_left,
ERR_NOTIFYING_INTERNAL,
):
+ uuid_str = str(uuid)
imported_org_slugs: set[int] = set()
for chunk in RegionImportChunk.objects.filter(
- import_uuid=str(uuid), model="sentry.organization"
+ import_uuid=uuid_str, model="sentry.organization"
):
imported_org_slugs = imported_org_slugs.union(set(chunk.inserted_identifiers.values()))
@@ -1662,7 +1667,7 @@ def notifying_owner(uuid: str) -> None:
relocation,
Relocation.EmailKind.SUCCEEDED,
{
- "uuid": str(relocation.uuid),
+ "uuid": uuid_str,
"orgs": list(imported_org_slugs),
},
)
@@ -1680,7 +1685,7 @@ def notifying_owner(uuid: str) -> None:
soft_time_limit=FAST_TIME_LIMIT,
silo_mode=SiloMode.REGION,
)
-def completed(uuid: str) -> None:
+def completed(uuid: UUID) -> None:
"""
Finish up a relocation by marking it a success.
"""
diff --git a/src/sentry/utils/relocation.py b/src/sentry/utils/relocation.py
index 4adf16b5646003..475ed90c3f2598 100644
--- a/src/sentry/utils/relocation.py
+++ b/src/sentry/utils/relocation.py
@@ -311,7 +311,7 @@ class OrderedTask(Enum):
# A custom logger that roughly matches the parts of the `click.echo` interface that the
# `import_*` methods rely on.
class LoggingPrinter(Printer):
- def __init__(self, uuid: str):
+ def __init__(self, uuid: UUID):
self.uuid = uuid
super().__init__()
@@ -326,13 +326,13 @@ def echo(
logger.error(
"Import failed: %s",
text,
- extra={"uuid": self.uuid, "task": OrderedTask.IMPORTING.name},
+ extra={"uuid": str(self.uuid), "task": OrderedTask.IMPORTING.name},
)
else:
logger.info(
"Import info: %s",
text,
- extra={"uuid": self.uuid, "task": OrderedTask.IMPORTING.name},
+ extra={"uuid": str(self.uuid), "task": OrderedTask.IMPORTING.name},
)
@@ -365,7 +365,7 @@ def send_relocation_update_email(
def start_relocation_task(
- uuid: str, task: OrderedTask, allowed_task_attempts: int
+ uuid: UUID, task: OrderedTask, allowed_task_attempts: int
) -> tuple[Relocation | None, int]:
"""
All tasks for relocation are done sequentially, and take the UUID of the `Relocation` model as
@@ -374,7 +374,7 @@ def start_relocation_task(
Returns a tuple of relocation model and the number of attempts remaining for this task.
"""
- logger_data = {"uuid": uuid}
+ logger_data = {"uuid": str(uuid)}
try:
relocation: Relocation = Relocation.objects.get(uuid=uuid)
except Relocation.DoesNotExist:
@@ -489,7 +489,9 @@ def fail_relocation(relocation: Relocation, task: OrderedTask, reason: str = "")
relocation.status = Relocation.Status.FAILURE.value
relocation.save()
- logger.info("Task failed", extra={"uuid": relocation.uuid, "task": task.name, "reason": reason})
+ logger.info(
+ "Task failed", extra={"uuid": str(relocation.uuid), "task": task.name, "reason": reason}
+ )
send_relocation_update_email(
relocation,
Relocation.EmailKind.FAILED,
@@ -514,7 +516,7 @@ def retry_task_or_fail_relocation(
instead.
"""
- logger_data = {"uuid": relocation.uuid, "task": task.name, "attempts_left": attempts_left}
+ logger_data = {"uuid": str(relocation.uuid), "task": task.name, "attempts_left": attempts_left}
try:
yield
except Exception:
diff --git a/tests/sentry/tasks/test_relocation.py b/tests/sentry/tasks/test_relocation.py
index dc46cbe2f550c4..63b9740b981472 100644
--- a/tests/sentry/tasks/test_relocation.py
+++ b/tests/sentry/tasks/test_relocation.py
@@ -5,7 +5,7 @@
from tempfile import TemporaryDirectory
from types import SimpleNamespace
from unittest.mock import MagicMock, Mock, patch
-from uuid import uuid4
+from uuid import UUID, uuid4
import pytest
import yaml
@@ -145,7 +145,7 @@ def setUp(self):
file=self.file,
kind=RelocationFile.Kind.RAW_USER_DATA.value,
)
- self.uuid = str(self.relocation.uuid)
+ self.uuid = UUID(str(self.relocation.uuid))
@cached_property
def file(self):
@@ -268,7 +268,7 @@ def setUp(self):
latest_task=OrderedTask.UPLOADING_START.name,
provenance=Relocation.Provenance.SAAS_TO_SAAS,
)
- self.uuid = str(self.relocation.uuid)
+ self.uuid = UUID(str(self.relocation.uuid))
@override_settings(
SENTRY_MONOLITH_REGION=REQUESTING_TEST_REGION, SENTRY_REGION=REQUESTING_TEST_REGION
@@ -1807,7 +1807,7 @@ def test_fail_if_no_attempts_left(
assert relocation.failure_reason == ERR_VALIDATING_INTERNAL
-def mock_invalid_finding(storage: Storage, uuid: str):
+def mock_invalid_finding(storage: Storage, uuid: UUID):
storage.save(
f"runs/{uuid}/findings/import-baseline-config.json",
BytesIO(
diff --git a/tests/sentry/utils/test_relocation.py b/tests/sentry/utils/test_relocation.py
index 4a564b305eb5f5..cbc973d05ea8c1 100644
--- a/tests/sentry/utils/test_relocation.py
+++ b/tests/sentry/utils/test_relocation.py
@@ -39,7 +39,7 @@ class RelocationStartTestCase(RelocationUtilsTestCase):
def test_bad_relocation_not_found(self, fake_message_builder: Mock):
self.mock_message_builder(fake_message_builder)
- uuid = uuid4().hex
+ uuid = uuid4()
(rel, attempts_left) = start_relocation_task(uuid, OrderedTask.UPLOADING_COMPLETE, 3)
assert fake_message_builder.call_count == 0
|
f95080e2ac10e26ff220da6f7eb158d4b9aac10c
|
2022-04-19 19:35:21
|
Shruthi
|
chore: Add a comment explaning error message default (#33673)
| false
|
Add a comment explaning error message default (#33673)
|
chore
|
diff --git a/static/app/actionCreators/indicator.tsx b/static/app/actionCreators/indicator.tsx
index d363f92ebecc46..d21606d1729fd9 100644
--- a/static/app/actionCreators/indicator.tsx
+++ b/static/app/actionCreators/indicator.tsx
@@ -86,6 +86,10 @@ export function addErrorMessage(msg: React.ReactNode, options?: Options) {
if (typeof msg === 'string' || React.isValidElement(msg)) {
return addMessageWithType('error')(msg, options);
}
+ // When non string, non-react element responses are passed, addErrorMessage
+ // crashes the entire page because it falls outside any error
+ // boundaries defined for the components on the page. Adding a fallback
+ // to prevent page crashes.
return addMessageWithType('error')(
t(
"You've hit an issue, fortunately we use Sentry to monitor Sentry. So it's likely we're already looking into this!"
|
47ff637c4fe231d65319b650cfb32f7ae8def0a0
|
2023-03-16 03:11:30
|
Tony Xiao
|
ref(profiling): Reword to most frequent stacks (#45882)
| false
|
Reword to most frequent stacks (#45882)
|
ref
|
diff --git a/static/app/components/events/interfaces/spans/spanProfileDetails.tsx b/static/app/components/events/interfaces/spans/spanProfileDetails.tsx
index 682937bc041cdc..6480dc172db4e1 100644
--- a/static/app/components/events/interfaces/spans/spanProfileDetails.tsx
+++ b/static/app/components/events/interfaces/spans/spanProfileDetails.tsx
@@ -145,7 +145,7 @@ export function SpanProfileDetails({event, span}: SpanProfileDetailsProps) {
<Fragment>
<SpanDetails>
<SpanDetailsItem grow>
- <SectionHeading>{t('Top Contributors to this Span')}</SectionHeading>
+ <SectionHeading>{t('Most Frequent Stacks in this Span')}</SectionHeading>
</SpanDetailsItem>
<SpanDetailsItem>
<SectionSubtext>
|
3f2cb55d9c4d997a5b331708b262cd35c71ff27d
|
2024-05-17 14:08:40
|
anthony sottile
|
ref: kill unused to_unicode and pprint template filter (#71062)
| false
|
kill unused to_unicode and pprint template filter (#71062)
|
ref
|
diff --git a/src/sentry/interfaces/http.py b/src/sentry/interfaces/http.py
index 981b4a20fd41da..cbbc73fb2d14c6 100644
--- a/src/sentry/interfaces/http.py
+++ b/src/sentry/interfaces/http.py
@@ -5,10 +5,8 @@
from django.utils.translation import gettext as _
from sentry.interfaces.base import Interface
-from sentry.utils import json
from sentry.utils.json import prune_empty_keys
from sentry.utils.safe import get_path, safe_urlencode
-from sentry.utils.strings import to_unicode
from sentry.web.helpers import render_to_string
@@ -63,10 +61,6 @@ def fix_broken_encoding(value):
return value
-def jsonify(value):
- return to_unicode(value) if isinstance(value, str) else json.dumps(value)
-
-
class Http(Interface):
"""
The Request information is stored in the Http interface. Two arguments
diff --git a/src/sentry/templatetags/sentry_helpers.py b/src/sentry/templatetags/sentry_helpers.py
index d52e9ee4faf75f..4115246663bd96 100644
--- a/src/sentry/templatetags/sentry_helpers.py
+++ b/src/sentry/templatetags/sentry_helpers.py
@@ -9,8 +9,6 @@
from django import template
from django.template.defaultfilters import stringfilter
from django.utils import timezone as django_timezone
-from django.utils.html import escape
-from django.utils.safestring import mark_safe
from django.utils.translation import gettext as _
from packaging.version import parse as parse_version
@@ -18,7 +16,7 @@
from sentry.api.serializers import serialize as serialize_func
from sentry.utils import json
from sentry.utils.strings import soft_break as _soft_break
-from sentry.utils.strings import soft_hyphenate, to_unicode, truncatechars
+from sentry.utils.strings import soft_hyphenate, truncatechars
SentryVersion = namedtuple("SentryVersion", ["current", "latest", "update_available", "build"])
@@ -139,21 +137,6 @@ def security_contact():
return options.get("system.security-email") or options.get("system.admin-email")
[email protected]
-def pprint(value, break_after=10):
- """
- break_after is used to define how often a <span> is
- inserted (for soft wrapping).
- """
-
- value = to_unicode(value)
- return mark_safe(
- "<span></span>".join(
- escape(value[i : (i + break_after)]) for i in range(0, len(value), break_after)
- )
- )
-
-
@register.filter
def is_url(value):
if not isinstance(value, str):
diff --git a/src/sentry/utils/strings.py b/src/sentry/utils/strings.py
index 43a7b491a1e207..e7fd2e97c4205b 100644
--- a/src/sentry/utils/strings.py
+++ b/src/sentry/utils/strings.py
@@ -7,9 +7,9 @@
import string
import zlib
from collections.abc import Callable
-from typing import Any, overload
+from typing import overload
-from django.utils.encoding import force_str, smart_str
+from django.utils.encoding import smart_str
_sprintf_placeholder_re = re.compile(
r"%(?:\d+\$)?[+-]?(?:[ 0]|\'.{1})?-?\d*(?:\.\d+)?[bcdeEufFgGosxX]"
@@ -116,19 +116,6 @@ def soft_break_delimiter(match: re.Match[str]) -> str:
return re.sub(rf"\S{{{length},}}", soft_break_delimiter, value)
-def to_unicode(value: Any) -> str:
- try:
- value = str(force_str(value))
- except (UnicodeEncodeError, UnicodeDecodeError):
- value = "(Error decoding value)"
- except Exception: # in some cases we get a different exception
- try:
- value = str(repr(type(value)))
- except Exception:
- value = "(Error decoding value)"
- return value
-
-
valid_dot_atom_characters = frozenset(string.ascii_letters + string.digits + ".!#$%&'*+-/=?^_`{|}~")
|
9e7677a94fe6c6f12116af37d08b9a5ce55bd543
|
2023-05-03 00:11:16
|
Scott Cooper
|
fix(escalating): Adjust resolve and archive tooltip copy (#48222)
| false
|
Adjust resolve and archive tooltip copy (#48222)
|
fix
|
diff --git a/static/app/components/actions/archive.tsx b/static/app/components/actions/archive.tsx
index c15a4388cede60..69e1d8ca80cb41 100644
--- a/static/app/components/actions/archive.tsx
+++ b/static/app/components/actions/archive.tsx
@@ -115,10 +115,8 @@ function ArchiveActions({
<ButtonBar className={className} merged>
<ArchiveButton
size={size}
- tooltipProps={{delay: 300, disabled: disabled || disableTooltip}}
- title={t(
- 'Silences alerts for this issue and removes it from the issue stream by default.'
- )}
+ tooltipProps={{delay: 1000, disabled: disabled || disableTooltip}}
+ title={t('Hides the issue until the sh*t hits the fan and events escalate.')}
icon={hideIcon ? null : <IconArchive size={size} />}
onClick={() => onArchive(ARCHIVE_UNTIL_ESCALATING)}
disabled={disabled}
diff --git a/static/app/components/actions/resolve.tsx b/static/app/components/actions/resolve.tsx
index 1d67438f47d687..689f44f5ec485d 100644
--- a/static/app/components/actions/resolve.tsx
+++ b/static/app/components/actions/resolve.tsx
@@ -244,10 +244,8 @@ function ResolveActions({
<ResolveButton
priority={priority}
size={size}
- title={t(
- 'Resolves the issue. The issue will get unresolved if it happens again.'
- )}
- tooltipProps={{delay: 300, disabled: disabled || disableTooltip}}
+ title={t("We'll nag you with a notification if the issue's seen again.")}
+ tooltipProps={{delay: 1000, disabled: disabled || disableTooltip}}
icon={hideIcon ? null : <IconCheckmark size={size} />}
onClick={() =>
openConfirmModal({
|
f6fefabbd20461199538fbcf0728f93a26b551a7
|
2019-11-08 05:23:01
|
Evan Purkhiser
|
chore(ts): Convert text (#15497)
| false
|
Convert text (#15497)
|
chore
|
diff --git a/src/sentry/static/sentry/app/components/text.jsx b/src/sentry/static/sentry/app/components/text.tsx
similarity index 100%
rename from src/sentry/static/sentry/app/components/text.jsx
rename to src/sentry/static/sentry/app/components/text.tsx
|
a47d84b1e7a17d400291519d2837a8e54499f752
|
2023-04-14 03:28:22
|
Colleen O'Rourke
|
feat(rulesnooze): Add delete endpoint (#47285)
| false
|
Add delete endpoint (#47285)
|
feat
|
diff --git a/src/sentry/api/endpoints/rule_snooze.py b/src/sentry/api/endpoints/rule_snooze.py
index 926300dd269b00..cff21a4533a120 100644
--- a/src/sentry/api/endpoints/rule_snooze.py
+++ b/src/sentry/api/endpoints/rule_snooze.py
@@ -1,6 +1,7 @@
import datetime
from rest_framework import serializers, status
+from rest_framework.exceptions import AuthenticationFailed
from rest_framework.request import Request
from rest_framework.response import Response
@@ -15,8 +16,6 @@
class RuleSnoozeValidator(CamelSnakeSerializer):
target = serializers.CharField(required=True, allow_null=False)
- rule = serializers.BooleanField(required=False, allow_null=True)
- alert_rule = serializers.BooleanField(required=False, allow_null=True)
until = serializers.DateTimeField(required=False, allow_null=True)
@@ -50,14 +49,22 @@ def can_edit_alert_rule(rule, organization, user_id, user):
@region_silo_endpoint
-class RuleSnoozeEndpoint(ProjectEndpoint):
+class BaseRuleSnoozeEndpoint(ProjectEndpoint):
permission_classes = (ProjectAlertRulePermission,)
+ def get_rule(self, rule_id):
+ try:
+ rule = self.rule_model.objects.get(id=rule_id)
+ except self.rule_model.DoesNotExist:
+ raise serializers.ValidationError("Rule does not exist")
+
+ return rule
+
def post(self, request: Request, project, rule_id) -> Response:
- if not features.has("organizations:mute-alerts", project.organization, actor=None):
- return Response(
- {"detail": "This feature is not available for this organization."},
- status=status.HTTP_401_UNAUTHORIZED,
+ if not features.has("organizations:mute-alerts", project.organization, actor=request.user):
+ raise AuthenticationFailed(
+ detail="This feature is not available for this organization.",
+ code=status.HTTP_401_UNAUTHORIZED,
)
serializer = RuleSnoozeValidator(data=request.data)
@@ -65,43 +72,24 @@ def post(self, request: Request, project, rule_id) -> Response:
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
data = serializer.validated_data
-
- if data.get("rule") and data.get("alert_rule"):
- raise serializers.ValidationError("Pass either rule or alert rule, not both.")
-
- issue_alert_rule = None
- metric_alert_rule = None
+ rule = self.get_rule(rule_id)
user_id = request.user.id if data.get("target") == "me" else None
-
- if data.get("rule"):
- try:
- issue_alert_rule = Rule.objects.get(id=rule_id)
- except Rule.DoesNotExist:
- raise serializers.ValidationError("Rule does not exist")
-
- if data.get("alert_rule"):
- try:
- metric_alert_rule = AlertRule.objects.get(id=rule_id)
- except AlertRule.DoesNotExist:
- raise serializers.ValidationError("Rule does not exist")
-
- rule = issue_alert_rule or metric_alert_rule
if not can_edit_alert_rule(rule, project.organization, user_id, request.user):
- return Response(
- {"detail": "Requesting user cannot mute this rule."},
- status=status.HTTP_401_UNAUTHORIZED,
+ raise AuthenticationFailed(
+ detail="Requesting user cannot mute this rule.", code=status.HTTP_401_UNAUTHORIZED
)
+ kwargs = {self.rule_field: rule}
+
rule_snooze, created = RuleSnooze.objects.get_or_create(
user_id=user_id,
- rule=issue_alert_rule,
- alert_rule=metric_alert_rule,
defaults={
"owner_id": request.user.id,
"until": data.get("until"),
"date_added": datetime.datetime.now(),
},
+ **kwargs,
)
# don't allow editing of a rulesnooze object for a given rule and user (or no user)
if not created:
@@ -112,7 +100,7 @@ def post(self, request: Request, project, rule_id) -> Response:
if not user_id:
# create an audit log entry if the rule is snoozed for everyone
- audit_log_event = "RULE_SNOOZE" if issue_alert_rule else "ALERT_RULE_SNOOZE"
+ audit_log_event = "RULE_SNOOZE" if self.rule_model == Rule else "ALERT_RULE_SNOOZE"
self.create_audit_entry(
request=request,
@@ -126,3 +114,53 @@ def post(self, request: Request, project, rule_id) -> Response:
serialize(rule_snooze, request.user, RuleSnoozeSerializer()),
status=status.HTTP_201_CREATED,
)
+
+ def delete(self, request: Request, project, rule_id) -> Response:
+ if not features.has("organizations:mute-alerts", project.organization, actor=request.user):
+ raise AuthenticationFailed(
+ detail="This feature is not available for this organization.",
+ code=status.HTTP_401_UNAUTHORIZED,
+ )
+
+ serializer = RuleSnoozeValidator(data=request.data)
+ if not serializer.is_valid():
+ return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
+
+ data = serializer.validated_data
+ rule = self.get_rule(rule_id)
+ user_id = request.user.id if data.get("target") == "me" else None
+
+ if not can_edit_alert_rule(rule, project.organization, user_id, request.user):
+ raise AuthenticationFailed(
+ detail="Requesting user cannot mute this rule.", code=status.HTTP_401_UNAUTHORIZED
+ )
+
+ kwargs = {self.rule_field: rule}
+
+ try:
+ rulesnooze = RuleSnooze.objects.get(
+ user_id=user_id,
+ owner_id=request.user.id,
+ until=data.get("until"),
+ **kwargs,
+ )
+ except RuleSnooze.DoesNotExist:
+ return Response(
+ {"detail": "This rulesnooze object doesn't exist."},
+ status=status.HTTP_404_NOT_FOUND,
+ )
+
+ rulesnooze.delete()
+ return Response(status=status.HTTP_204_NO_CONTENT)
+
+
+@region_silo_endpoint
+class RuleSnoozeEndpoint(BaseRuleSnoozeEndpoint):
+ rule_model = Rule
+ rule_field = "rule"
+
+
+@region_silo_endpoint
+class MetricRuleSnoozeEndpoint(BaseRuleSnoozeEndpoint):
+ rule_model = AlertRule
+ rule_field = "alert_rule"
diff --git a/src/sentry/api/urls.py b/src/sentry/api/urls.py
index 4ce4d9825efc15..0bf17203463bcb 100644
--- a/src/sentry/api/urls.py
+++ b/src/sentry/api/urls.py
@@ -475,7 +475,7 @@
RelayRegisterResponseEndpoint,
)
from .endpoints.release_deploys import ReleaseDeploysEndpoint
-from .endpoints.rule_snooze import RuleSnoozeEndpoint
+from .endpoints.rule_snooze import MetricRuleSnoozeEndpoint, RuleSnoozeEndpoint
from .endpoints.setup_wizard import SetupWizard
from .endpoints.shared_group_details import SharedGroupDetailsEndpoint
from .endpoints.source_map_debug import SourceMapDebugEndpoint
@@ -2070,6 +2070,11 @@
RuleSnoozeEndpoint.as_view(),
name="sentry-api-0-rule-snooze",
),
+ url(
+ r"^(?P<organization_slug>[^\/]+)/(?P<project_slug>[^\/]+)/alert-rules/(?P<rule_id>[^\/]+)/snooze/$",
+ MetricRuleSnoozeEndpoint.as_view(),
+ name="sentry-api-0-metric-rule-snooze",
+ ),
url(
r"^(?P<organization_slug>[^\/]+)/(?P<project_slug>[^\/]+)/rules/preview$",
ProjectRulePreviewEndpoint.as_view(),
diff --git a/tests/sentry/api/endpoints/test_rule_snooze.py b/tests/sentry/api/endpoints/test_rule_snooze.py
index d70a450e21f743..fcc671262f04ba 100644
--- a/tests/sentry/api/endpoints/test_rule_snooze.py
+++ b/tests/sentry/api/endpoints/test_rule_snooze.py
@@ -6,14 +6,12 @@
from sentry.models import AuditLogEntry, Rule, RuleSnooze
from sentry.models.actor import ActorTuple
from sentry.testutils import APITestCase
+from sentry.testutils.helpers import with_feature
from sentry.testutils.silo import region_silo_test
@region_silo_test
-class RuleSnoozeTest(APITestCase):
- endpoint = "sentry-api-0-rule-snooze"
- method = "post"
-
+class BaseRuleSnoozeTest(APITestCase):
def setUp(self):
self.issue_alert_rule = Rule.objects.create(
label="test rule", project=self.project, owner=self.team.actor
@@ -24,13 +22,22 @@ def setUp(self):
self.until = datetime.now(pytz.UTC) + timedelta(days=10)
self.login_as(user=self.user)
+
+@region_silo_test
+class PostRuleSnoozeTest(BaseRuleSnoozeTest):
+ endpoint = "sentry-api-0-rule-snooze"
+ method = "post"
+
+ @with_feature("organizations:mute-alerts")
def test_mute_issue_alert_user_forever(self):
"""Test that a user can mute an issue alert rule for themselves forever"""
- data = {"target": "me", "rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(rule=self.issue_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -40,13 +47,16 @@ def test_mute_issue_alert_user_forever(self):
assert response.data["alertRuleId"] is None
assert response.data["until"] == "forever"
+ @with_feature("organizations:mute-alerts")
def test_mute_issue_alert_user_until(self):
"""Test that a user can mute an issue alert rule for themselves a period of time"""
- data = {"target": "me", "rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(rule=self.issue_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -56,13 +66,16 @@ def test_mute_issue_alert_user_until(self):
assert response.data["alertRuleId"] is None
assert response.data["until"] == self.until
+ @with_feature("organizations:mute-alerts")
def test_mute_issue_alert_everyone_forever(self):
"""Test that an issue alert rule can be muted for everyone forever"""
- data = {"target": "everyone", "rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(rule=self.issue_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -78,13 +91,16 @@ def test_mute_issue_alert_everyone_forever(self):
target_object=self.issue_alert_rule.id,
)
+ @with_feature("organizations:mute-alerts")
def test_mute_issue_alert_everyone_until(self):
"""Test that an issue alert rule can be muted for everyone for a period of time"""
- data = {"target": "everyone", "rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "everyone", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(rule=self.issue_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -100,120 +116,234 @@ def test_mute_issue_alert_everyone_until(self):
target_object=self.issue_alert_rule.id,
)
+ @with_feature("organizations:mute-alerts")
def test_mute_issue_alert_user_then_everyone(self):
"""Test that a user can mute an issue alert for themselves and then the same alert can be muted for everyone"""
- data = {"target": "me", "rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
rule=self.issue_alert_rule.id, user_id=self.user.id, until=self.until
).exists()
assert response.status_code == 201
everyone_until = datetime.now(pytz.UTC) + timedelta(days=1)
- data = {"target": "everyone", "rule": True, "until": everyone_until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "everyone", "until": everyone_until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
rule=self.issue_alert_rule.id, user_id=None, until=everyone_until
).exists()
assert response.status_code == 201
+ @with_feature("organizations:mute-alerts")
def test_mute_issue_alert_everyone_then_user(self):
"""Test that an issue alert can be muted for everyone and then a user can mute the same alert for themselves"""
everyone_until = datetime.now(pytz.UTC) + timedelta(days=1)
- data = {"target": "everyone", "rule": True, "until": everyone_until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "everyone", "until": everyone_until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
rule=self.issue_alert_rule.id, user_id=None, until=everyone_until
).exists()
assert response.status_code == 201
- data = {"target": "me", "rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
rule=self.issue_alert_rule.id, user_id=self.user.id, until=self.until
).exists()
assert response.status_code == 201
+ @with_feature("organizations:mute-alerts")
def test_edit_issue_alert_mute(self):
"""Test that we throw an error if an issue alert rule has already been muted by a user"""
- data = {"target": "me", "rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(rule=self.issue_alert_rule.id).exists()
assert response.status_code == 201
- data = {"target": "me", "rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.issue_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
assert len(RuleSnooze.objects.all()) == 1
assert response.status_code == 410
assert "RuleSnooze already exists for this rule and scope." in response.data["detail"]
+ @with_feature("organizations:mute-alerts")
def test_user_cant_mute_issue_alert_for_everyone(self):
"""Test that if a user doesn't belong to the team that can edit an issue alert rule, we throw an error when they try to mute it for everyone."""
other_team = self.create_team()
other_issue_alert_rule = Rule.objects.create(
label="test rule", project=self.project, owner=other_team.actor
)
- data = {"target": "everyone", "rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, other_issue_alert_rule.id, **data
- )
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_issue_alert_rule.id,
+ **data,
+ )
assert not RuleSnooze.objects.filter(rule=other_issue_alert_rule.id).exists()
assert response.status_code == 401
assert "Requesting user cannot mute this rule" in response.data["detail"]
+ @with_feature("organizations:mute-alerts")
def test_user_can_mute_issue_alert_for_self(self):
"""Test that if a user doesn't belong to the team that can edit an issue alert rule, they can still mute it for just themselves."""
other_team = self.create_team()
other_issue_alert_rule = Rule.objects.create(
label="test rule", project=self.project, owner=other_team.actor
)
- data = {"target": "me", "rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, other_issue_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(rule=other_issue_alert_rule.id).exists()
assert response.status_code == 201
+ @with_feature("organizations:mute-alerts")
def test_user_can_mute_unassigned_issue_alert(self):
"""Test that if an issue alert rule's owner is unassigned, the user can mute it."""
other_issue_alert_rule = Rule.objects.create(
label="test rule", project=self.project, owner=None
)
- data = {"target": "me", "rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, other_issue_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_issue_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(rule=other_issue_alert_rule.id).exists()
assert response.status_code == 201
+ @with_feature("organizations:mute-alerts")
+ def test_no_issue_alert(self):
+ """Test that we throw an error when an issue alert rule doesn't exist"""
+ data = {"target": "me"}
+ response = self.get_response(self.organization.slug, self.project.slug, 777, **data)
+ assert not RuleSnooze.objects.filter(alert_rule=self.issue_alert_rule.id).exists()
+ assert response.status_code == 400
+ assert "Rule does not exist" in response.data
+
+ @with_feature("organizations:mute-alerts")
+ def test_invalid_data_issue_alert(self):
+ """Test that we throw an error when passed invalid data"""
+ data = {"target": "me", "until": 123}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
+ assert not RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
+ assert response.status_code == 400
+ assert "Datetime has wrong format." in response.data["until"][0]
+
+
+@region_silo_test
+class DeleteRuleSnoozeTest(BaseRuleSnoozeTest):
+ endpoint = "sentry-api-0-rule-snooze"
+ method = "delete"
+
+ @with_feature("organizations:mute-alerts")
+ def test_delete_issue_alert_rule_mute_myself(self):
+ """Test that a user can unsnooze a rule they've snoozed for just themselves"""
+ RuleSnooze.objects.create(
+ user_id=self.user.id, rule=self.issue_alert_rule, owner_id=self.user.id
+ )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
+ assert not RuleSnooze.objects.filter(
+ rule=self.issue_alert_rule.id, user_id=self.user.id
+ ).exists()
+ assert response.status_code == 204
+
+ @with_feature("organizations:mute-alerts")
+ def test_delete_issue_alert_rule_mute_everyone(self):
+ """Test that a user can unsnooze a rule they've snoozed for everyone"""
+ RuleSnooze.objects.create(rule=self.issue_alert_rule, owner_id=self.user.id)
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.issue_alert_rule.id,
+ **data,
+ )
+ assert not RuleSnooze.objects.filter(
+ rule=self.issue_alert_rule.id, user_id=self.user.id
+ ).exists()
+ assert response.status_code == 204
+
+ @with_feature("organizations:mute-alerts")
+ def test_cant_delete_issue_alert_rule_mute_everyone(self):
+ """Test that a user can't unsnooze a rule that's snoozed for everyone if they do not belong to the team the owns the rule"""
+ other_team = self.create_team()
+ other_issue_alert_rule = Rule.objects.create(
+ label="test rule", project=self.project, owner=other_team.actor
+ )
+ RuleSnooze.objects.create(rule=other_issue_alert_rule)
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_issue_alert_rule.id,
+ **data,
+ )
+ assert RuleSnooze.objects.filter(rule=other_issue_alert_rule.id).exists()
+ assert response.status_code == 401
+
+
+@region_silo_test
+class PostMetricRuleSnoozeTest(BaseRuleSnoozeTest):
+ endpoint = "sentry-api-0-metric-rule-snooze"
+ method = "post"
+
+ @with_feature("organizations:mute-alerts")
def test_mute_metric_alert_user_forever(self):
"""Test that a user can mute a metric alert rule for themselves forever"""
- data = {"target": "me", "alert_rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -223,13 +353,16 @@ def test_mute_metric_alert_user_forever(self):
assert response.data["alertRuleId"] == self.metric_alert_rule.id
assert response.data["until"] == "forever"
+ @with_feature("organizations:mute-alerts")
def test_mute_metric_alert_user_until(self):
"""Test that a user can mute a metric alert rule for themselves a period of time"""
- data = {"target": "me", "alert_rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -239,13 +372,16 @@ def test_mute_metric_alert_user_until(self):
assert response.data["alertRuleId"] == self.metric_alert_rule.id
assert response.data["until"] == self.until
+ @with_feature("organizations:mute-alerts")
def test_mute_metric_alert_everyone_forever(self):
"""Test that a metric alert rule can be muted for everyone forever"""
- data = {"target": "everyone", "alert_rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -261,13 +397,16 @@ def test_mute_metric_alert_everyone_forever(self):
target_object=self.metric_alert_rule.id,
)
+ @with_feature("organizations:mute-alerts")
def test_mute_metric_alert_everyone_until(self):
"""Test that a metric alert rule can be muted for everyone for a period of time"""
- data = {"target": "everyone", "alert_rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "everyone", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
assert response.status_code == 201
assert len(response.data) == 6
@@ -283,71 +422,87 @@ def test_mute_metric_alert_everyone_until(self):
target_object=self.metric_alert_rule.id,
)
+ @with_feature("organizations:mute-alerts")
def test_mute_metric_alert_user_then_everyone(self):
"""Test that a user can mute a metric alert for themselves and then the same alert can be muted for everyone"""
- data = {"target": "me", "alert_rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
alert_rule=self.metric_alert_rule.id, user_id=self.user.id, until=self.until
).exists()
assert response.status_code == 201
everyone_until = datetime.now(pytz.UTC) + timedelta(days=1)
- data = {"target": "everyone", "alert_rule": True, "until": everyone_until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "everyone", "until": everyone_until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
alert_rule=self.metric_alert_rule.id, user_id=None, until=everyone_until
).exists()
assert response.status_code == 201
+ @with_feature("organizations:mute-alerts")
def test_mute_metric_alert_everyone_then_user(self):
"""Test that a metric alert can be muted for everyone and then a user can mute the same alert for themselves"""
everyone_until = datetime.now(pytz.UTC) + timedelta(days=1)
- data = {"target": "everyone", "alert_rule": True, "until": everyone_until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "everyone", "until": everyone_until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
alert_rule=self.metric_alert_rule.id, user_id=None, until=everyone_until
).exists()
assert response.status_code == 201
- data = {"target": "me", "alert_rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(
alert_rule=self.metric_alert_rule.id, user_id=self.user.id, until=self.until
).exists()
assert response.status_code == 201
+ @with_feature("organizations:mute-alerts")
def test_edit_metric_alert_mute(self):
"""Test that we throw an error if a metric alert rule has already been muted by a user"""
- data = {"target": "me", "alert_rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
assert response.status_code == 201
- data = {"target": "me", "alert_rule": True, "until": self.until}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
+ data = {"target": "me", "until": self.until}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
assert len(RuleSnooze.objects.all()) == 1
assert response.status_code == 410
assert "RuleSnooze already exists for this rule and scope." in response.data["detail"]
+ @with_feature("organizations:mute-alerts")
def test_user_cant_snooze_metric_alert_for_everyone(self):
"""Test that if a user doesn't belong to the team that can edit a metric alert rule, we throw an error when they try to mute it for everyone"""
other_team = self.create_team()
@@ -356,15 +511,18 @@ def test_user_cant_snooze_metric_alert_for_everyone(self):
projects=[self.project],
owner=ActorTuple.from_actor_identifier(f"team:{other_team.id}"),
)
- data = {"target": "everyone", "alertRule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, other_metric_alert_rule.id, **data
- )
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_metric_alert_rule.id,
+ **data,
+ )
assert not RuleSnooze.objects.filter(alert_rule=other_metric_alert_rule).exists()
assert response.status_code == 401
assert "Requesting user cannot mute this rule" in response.data["detail"]
+ @with_feature("organizations:mute-alerts")
def test_user_can_snooze_metric_alert_for_self(self):
"""Test that if a user doesn't belong to the team that can edit a metric alert rule, they are able to mute it for just themselves."""
other_team = self.create_team()
@@ -373,63 +531,97 @@ def test_user_can_snooze_metric_alert_for_self(self):
projects=[self.project],
owner=ActorTuple.from_actor_identifier(f"team:{other_team.id}"),
)
- data = {"target": "me", "alertRule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, other_metric_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(alert_rule=other_metric_alert_rule).exists()
assert response.status_code == 201
+ @with_feature("organizations:mute-alerts")
def test_user_can_mute_unassigned_metric_alert(self):
"""Test that if a metric alert rule's owner is unassigned, the user can mute it."""
other_metric_alert_rule = self.create_alert_rule(
organization=self.project.organization, projects=[self.project], owner=None
)
- data = {"target": "me", "alertRule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, other_metric_alert_rule.id, **data
- )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_metric_alert_rule.id,
+ **data,
+ )
assert RuleSnooze.objects.filter(alert_rule=other_metric_alert_rule.id).exists()
assert response.status_code == 201
- def test_no_issue_alert(self):
- """Test that we throw an error when an issue alert rule doesn't exist"""
- data = {"target": "me", "rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(self.organization.slug, self.project.slug, 777, **data)
- assert not RuleSnooze.objects.filter(alert_rule=self.issue_alert_rule.id).exists()
- assert response.status_code == 400
- assert "Rule does not exist" in response.data
-
+ @with_feature("organizations:mute-alerts")
def test_no_metric_alert(self):
"""Test that we throw an error when a metric alert rule doesn't exist"""
- data = {"target": "me", "alert_rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(self.organization.slug, self.project.slug, 777, **data)
+ data = {"target": "me"}
+ response = self.get_response(self.organization.slug, self.project.slug, 777, **data)
assert not RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
assert response.status_code == 400
assert "Rule does not exist" in response.data
- def test_invalid_data_issue_alert(self):
- """Test that we throw an error when passed invalid data"""
- data = {"target": "me", "rule": self.issue_alert_rule.id}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
- assert not RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
- assert response.status_code == 400
- assert "Must be a valid boolean" in response.data["rule"][0]
-
- def test_rule_and_alert_rule(self):
- """Test that we throw an error if both rule and alert rule are passed"""
- data = {"target": "me", "rule": True, "alert_rule": True}
- with self.feature({"organizations:mute-alerts": True}):
- response = self.get_response(
- self.organization.slug, self.project.slug, self.metric_alert_rule.id, **data
- )
- assert not RuleSnooze.objects.filter(alert_rule=self.metric_alert_rule.id).exists()
- assert response.status_code == 400
- assert "Pass either rule or alert rule, not both." in response.data
+
+@region_silo_test
+class DeleteMetricRuleSnoozeTest(BaseRuleSnoozeTest):
+ endpoint = "sentry-api-0-metric-rule-snooze"
+ method = "delete"
+
+ @with_feature("organizations:mute-alerts")
+ def test_delete_metric_alert_rule_mute_myself(self):
+ """Test that a user can unsnooze a metric alert rule they've snoozed for just themselves"""
+ RuleSnooze.objects.create(
+ user_id=self.user.id, alert_rule=self.metric_alert_rule, owner_id=self.user.id
+ )
+ data = {"target": "me"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
+ assert not RuleSnooze.objects.filter(
+ alert_rule=self.metric_alert_rule.id, user_id=self.user.id
+ ).exists()
+ assert response.status_code == 204
+
+ @with_feature("organizations:mute-alerts")
+ def test_delete_metric_alert_rule_mute_everyone(self):
+ """Test that a user can unsnooze a metric rule they've snoozed for everyone"""
+ RuleSnooze.objects.create(alert_rule=self.metric_alert_rule, owner_id=self.user.id)
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ self.metric_alert_rule.id,
+ **data,
+ )
+ assert not RuleSnooze.objects.filter(
+ alert_rule=self.metric_alert_rule.id, user_id=self.user.id
+ ).exists()
+ assert response.status_code == 204
+
+ @with_feature("organizations:mute-alerts")
+ def test_cant_delete_metric_alert_rule_mute_everyone(self):
+ """Test that a user can't unsnooze a metric rule that's snoozed for everyone if they do not belong to the team the owns the rule"""
+ other_team = self.create_team()
+ other_metric_alert_rule = self.create_alert_rule(
+ organization=self.project.organization,
+ projects=[self.project],
+ owner=ActorTuple.from_actor_identifier(f"team:{other_team.id}"),
+ )
+ RuleSnooze.objects.create(alert_rule=other_metric_alert_rule)
+ data = {"target": "everyone"}
+ response = self.get_response(
+ self.organization.slug,
+ self.project.slug,
+ other_metric_alert_rule.id,
+ **data,
+ )
+ assert RuleSnooze.objects.filter(alert_rule=other_metric_alert_rule.id).exists()
+ assert response.status_code == 401
|
57cfd864e4f276d58fe8f7111654d78307328858
|
2023-11-06 22:17:18
|
Colton Allen
|
feat(replays): Handle non-201 replay analysis service response types (#59201)
| false
|
Handle non-201 replay analysis service response types (#59201)
|
feat
|
diff --git a/src/sentry/replays/endpoints/project_replay_accessibility_issues.py b/src/sentry/replays/endpoints/project_replay_accessibility_issues.py
index 5641201ce242c3..679dbc1397a7a3 100644
--- a/src/sentry/replays/endpoints/project_replay_accessibility_issues.py
+++ b/src/sentry/replays/endpoints/project_replay_accessibility_issues.py
@@ -86,10 +86,18 @@ def get_result(self, limit, cursor=None):
def request_accessibility_issues(filenames: list[str]) -> Any:
try:
- return requests.post(
+ response = requests.post(
f"{options.get('replay.analyzer_service_url')}/api/0/analyze/accessibility",
json={"data": {"filenames": filenames}},
- ).json()
+ )
+
+ content = response.content
+ status_code = response.status_code
+
+ if status_code == 201:
+ return response.json()
+ else:
+ raise ValueError(f"An error occurred: {content.decode('utf-8')}")
except Exception:
logger.exception("replay accessibility analysis failed")
raise ParseError("Could not analyze accessibility issues at this time.")
|
18fbd935115b475c6f3bd95d0aab95cf8bc28608
|
2023-10-06 21:57:39
|
Tony Xiao
|
chore(statistical-detectors): Append experimental to function regress… (#57677)
| false
|
Append experimental to function regress… (#57677)
|
chore
|
diff --git a/src/sentry/issues/grouptype.py b/src/sentry/issues/grouptype.py
index 609e57759a5af2..0ba984ce65017a 100644
--- a/src/sentry/issues/grouptype.py
+++ b/src/sentry/issues/grouptype.py
@@ -413,7 +413,7 @@ class ProfileFrameDropType(GroupType):
class ProfileFunctionRegressionExperimentalType(GroupType):
type_id = 2010
slug = "profile_function_regression_exp"
- description = "Function Duration Regression"
+ description = "Function Duration Regression (Experimental)"
category = GroupCategory.PERFORMANCE.value
|
7223eccfb92581037b02d411b43d6eb885de5317
|
2023-10-18 20:49:18
|
Dominik Buszowiecki
|
feat(browser-starfish): show resource size stats (#58283)
| false
|
show resource size stats (#58283)
|
feat
|
diff --git a/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx b/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx
index 9bf35455b14312..3e3e54267f80fe 100644
--- a/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx
+++ b/static/app/views/performance/browser/resources/resourceSummaryPage/index.tsx
@@ -2,6 +2,7 @@ import styled from '@emotion/styled';
import Breadcrumbs from 'sentry/components/breadcrumbs';
import FeatureBadge from 'sentry/components/featureBadge';
+import FileSize from 'sentry/components/fileSize';
import * as Layout from 'sentry/components/layouts/thirds';
import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
@@ -24,7 +25,14 @@ import {DataTitles, getThroughputTitle} from 'sentry/views/starfish/views/spans/
import {Block, BlockContainer} from 'sentry/views/starfish/views/spanSummaryPage/block';
import {SampleList} from 'sentry/views/starfish/views/spanSummaryPage/sampleList';
-const {SPAN_SELF_TIME, SPAN_OP, SPAN_DESCRIPTION} = SpanMetricsField;
+const {
+ SPAN_SELF_TIME,
+ SPAN_OP,
+ SPAN_DESCRIPTION,
+ HTTP_DECODED_RESPONSE_BODY_LENGTH,
+ HTTP_RESPONSE_CONTENT_LENGTH,
+ HTTP_RESPONSE_TRANSFER_SIZE,
+} = SpanMetricsField;
function ResourceSummary() {
const organization = useOrganization();
@@ -34,6 +42,9 @@ function ResourceSummary() {
} = useLocation();
const {data: spanMetrics} = useSpanMetrics(groupId, {}, [
`avg(${SPAN_SELF_TIME})`,
+ `avg(${HTTP_RESPONSE_CONTENT_LENGTH})`,
+ `avg(${HTTP_DECODED_RESPONSE_BODY_LENGTH})`,
+ `avg(${HTTP_RESPONSE_TRANSFER_SIZE})`,
'spm()',
SPAN_OP,
SPAN_DESCRIPTION,
@@ -82,6 +93,17 @@ function ResourceSummary() {
</PageFilterBar>
</PaddedContainer>
<BlockContainer>
+ <Block title={t('Avg encoded size')}>
+ <FileSize bytes={spanMetrics?.[`avg(${HTTP_RESPONSE_CONTENT_LENGTH})`]} />
+ </Block>
+ <Block title={t('Avg decoded size')}>
+ <FileSize
+ bytes={spanMetrics?.[`avg(${HTTP_DECODED_RESPONSE_BODY_LENGTH})`]}
+ />
+ </Block>
+ <Block title={t('Avg transfer size')}>
+ <FileSize bytes={spanMetrics?.[`avg(${HTTP_RESPONSE_TRANSFER_SIZE})`]} />
+ </Block>
<Block title={DataTitles.avg}>
<DurationCell
milliseconds={spanMetrics?.[`avg(${SpanMetricsField.SPAN_SELF_TIME})`]}
diff --git a/static/app/views/starfish/types.tsx b/static/app/views/starfish/types.tsx
index 2ba96dc0581ff8..2d592886847f86 100644
--- a/static/app/views/starfish/types.tsx
+++ b/static/app/views/starfish/types.tsx
@@ -28,9 +28,16 @@ export enum SpanMetricsField {
PROJECT_ID = 'project.id',
RESOURCE_RENDER_BLOCKING_STATUS = 'resource.render_blocking_status',
HTTP_RESPONSE_CONTENT_LENGTH = 'http.response_content_length',
+ HTTP_DECODED_RESPONSE_BODY_LENGTH = 'http.decoded_response_body_length',
+ HTTP_RESPONSE_TRANSFER_SIZE = 'http.response_transfer_size',
}
-export type SpanNumberFields = 'span.self_time' | 'span.duration';
+export type SpanNumberFields =
+ | SpanMetricsField.SPAN_SELF_TIME
+ | SpanMetricsField.SPAN_DURATION
+ | SpanMetricsField.HTTP_DECODED_RESPONSE_BODY_LENGTH
+ | SpanMetricsField.HTTP_RESPONSE_CONTENT_LENGTH
+ | SpanMetricsField.HTTP_RESPONSE_TRANSFER_SIZE;
export type SpanStringFields =
| 'span.op'
|
b9aa8aeff8995a645709677089884655198138ce
|
2017-10-12 05:13:17
|
Billy Vong
|
ref(settings): Decouple org settings views from org home container (#6280)
| false
|
Decouple org settings views from org home container (#6280)
|
ref
|
diff --git a/package.json b/package.json
index ff6e0752100f51..fac909eadf3794 100644
--- a/package.json
+++ b/package.json
@@ -95,6 +95,7 @@
],
"moduleNameMapper": {
"\\.(css|less)$": "<rootDir>/tests/js/helpers/importStyleMock.js",
+ "jquery": "<rootDir>/src/sentry/static/sentry/__mocks__/jquery.jsx",
"integration-docs-platforms": "<rootDir>/tests/fixtures/_platforms.json"
},
"modulePaths": [
diff --git a/src/sentry/static/sentry/app/__mocks__/jquery.jsx b/src/sentry/static/sentry/app/__mocks__/jquery.jsx
new file mode 100644
index 00000000000000..4f559a63157bda
--- /dev/null
+++ b/src/sentry/static/sentry/app/__mocks__/jquery.jsx
@@ -0,0 +1,7 @@
+let jq = {
+ tooltip: () => jq,
+ select2: () => jq,
+ on: () => jq
+};
+
+export default () => jq;
diff --git a/src/sentry/static/sentry/app/routes.jsx b/src/sentry/static/sentry/app/routes.jsx
index 2a33f0c44062e4..d4eb8c9b07b9f5 100644
--- a/src/sentry/static/sentry/app/routes.jsx
+++ b/src/sentry/static/sentry/app/routes.jsx
@@ -1,16 +1,8 @@
-import React from 'react';
import {Redirect, Route, IndexRoute, IndexRedirect} from 'react-router';
-
-import HookStore from './stores/hookStore';
+import React from 'react';
import AccountAuthorizations from './views/accountAuthorizations';
-
import AccountLayout from './views/accountLayout';
-import ApiApplications from './views/apiApplications';
-import ApiApplicationDetails from './views/apiApplicationDetails';
-import ApiLayout from './views/apiLayout';
-import ApiNewToken from './views/apiNewToken';
-import ApiTokens from './views/apiTokens';
import AdminBuffer from './views/adminBuffer';
import AdminLayout from './views/adminLayout';
import AdminOrganizations from './views/adminOrganizations';
@@ -19,20 +11,32 @@ import AdminProjects from './views/adminProjects';
import AdminQueue from './views/adminQueue';
import AdminSettings from './views/adminSettings';
import AdminUsers from './views/adminUsers';
+import AllTeamsList from './views/organizationTeams/allTeamsList';
+import ApiApplicationDetails from './views/apiApplicationDetails';
+import ApiApplications from './views/apiApplications';
+import ApiLayout from './views/apiLayout';
+import ApiNewToken from './views/apiNewToken';
+import ApiTokens from './views/apiTokens';
import App from './views/app';
+import CreateProject from './views/onboarding/createProject';
import GroupActivity from './views/groupActivity';
import GroupDetails from './views/groupDetails';
import GroupEventDetails from './views/groupEventDetails';
import GroupEvents from './views/groupEvents';
-import GroupTags from './views/groupTags';
+import GroupMergedView from './views/groupMerged/groupMergedView';
+import GroupSimilarView from './views/groupSimilar/groupSimilarView';
import GroupTagValues from './views/groupTagValues';
+import GroupTags from './views/groupTags';
import GroupUserReports from './views/groupUserReports';
-import GroupSimilarView from './views/groupSimilar/groupSimilarView';
-import GroupMergedView from './views/groupMerged/groupMergedView';
+import HookStore from './stores/hookStore';
import MyIssuesAssignedToMe from './views/myIssues/assignedToMe';
import MyIssuesBookmarked from './views/myIssues/bookmarked';
import MyIssuesViewed from './views/myIssues/viewed';
+import NewProject from './views/projectInstall/newProject';
+import OnboardingConfigure from './views/onboarding/configure/index';
+import OnboardingWizard from './views/onboarding/index';
import OrganizationAuditLog from './views/organizationAuditLog';
+import OrganizationContext from './views/organizationContext';
import OrganizationApiKeysView
from './views/settings/organization/apiKeys/organizationApiKeysView';
import OrganizationApiKeyDetailsView
@@ -40,43 +44,36 @@ import OrganizationApiKeyDetailsView
import OrganizationCreate from './views/organizationCreate';
import OrganizationDashboard from './views/organizationDashboard';
import OrganizationDetails from './views/organizationDetails';
-import OrganizationContext from './views/organizationContext';
+import OrganizationHomeContainer from './components/organizations/homeContainer';
import OrganizationIntegrations from './views/organizationIntegrations';
import OrganizationRateLimits from './views/organizationRateLimits';
import OrganizationRepositories from './views/organizationRepositories';
import OrganizationSettings from './views/organizationSettings';
import OrganizationStats from './views/organizationStats';
import OrganizationTeams from './views/organizationTeams';
-import OnboardingWizard from './views/onboarding/index';
-import CreateProject from './views/onboarding/createProject';
-
-import OnboardingConfigure from './views/onboarding/configure/index';
-
-import AllTeamsList from './views/organizationTeams/allTeamsList';
-import ProjectAlertSettings from './views/projectAlertSettings';
import ProjectAlertRules from './views/projectAlertRules';
-import ProjectReleaseTracking from './views/projectReleaseTracking';
+import ProjectAlertSettings from './views/projectAlertSettings';
import ProjectChooser from './views/projectChooser';
import ProjectCspSettings from './views/projectCspSettings';
import ProjectDashboard from './views/projectDashboard';
import ProjectDataForwarding from './views/projectDataForwarding';
+import ProjectDebugSymbols from './views/projectDebugSymbols';
import ProjectDetails from './views/projectDetails';
+import ProjectDocsContext from './views/projectInstall/docsContext';
import ProjectEvents from './views/projectEvents';
import ProjectFilters from './views/projectFilters';
-import NewProject from './views/projectInstall/newProject';
import ProjectGettingStarted from './views/projectInstall/gettingStarted';
-import ProjectDocsContext from './views/projectInstall/docsContext';
import ProjectInstallOverview from './views/projectInstall/overview';
import ProjectInstallPlatform from './views/projectInstall/platform';
-import ProjectReleases from './views/projectReleases';
-import ProjectSavedSearches from './views/projectSavedSearches';
-import ProjectDebugSymbols from './views/projectDebugSymbols';
-import ProjectKeys from './views/projectKeys';
import ProjectKeyDetails from './views/projectKeyDetails';
+import ProjectKeys from './views/projectKeys';
import ProjectProcessingIssues from './views/projectProcessingIssues';
+import ProjectReleaseTracking from './views/projectReleaseTracking';
+import ProjectReleases from './views/projectReleases';
+import ProjectSavedSearches from './views/projectSavedSearches';
import ProjectSettings from './views/projectSettings';
-import ProjectUserReports from './views/projectUserReports';
import ProjectUserReportSettings from './views/projectUserReportSettings';
+import ProjectUserReports from './views/projectUserReports';
import ReleaseAllEvents from './views/releaseAllEvents';
import ReleaseArtifacts from './views/releaseArtifacts';
import ReleaseCommits from './views/releases/releaseCommits';
@@ -84,15 +81,13 @@ import ReleaseDetails from './views/releaseDetails';
import ReleaseNewEvents from './views/releaseNewEvents';
import ReleaseOverview from './views/releases/releaseOverview';
import RouteNotFound from './views/routeNotFound';
+import SetCallsignsAction from './views/requiredAdminActions/setCallsigns';
import SharedGroupDetails from './views/sharedGroupDetails';
import Stream from './views/stream';
import TeamCreate from './views/teamCreate';
import TeamDetails from './views/teamDetails';
import TeamMembers from './views/teamMembers';
import TeamSettings from './views/teamSettings';
-
-import SetCallsignsAction from './views/requiredAdminActions/setCallsigns';
-
import errorHandler from './utils/errorHandler';
function appendTrailingSlash(nextState, replaceState) {
@@ -102,6 +97,36 @@ function appendTrailingSlash(nextState, replaceState) {
}
}
+const orgSettingsRoutes = [
+ <Route
+ key="api-keys"
+ path="api-keys/"
+ component={errorHandler(OrganizationApiKeysView)}
+ />,
+ <Route
+ key="api-keys-detail"
+ path="api-keys/:apiKey/"
+ component={errorHandler(OrganizationApiKeyDetailsView)}
+ />,
+ <Route
+ key="audit-log"
+ path="audit-log/"
+ component={errorHandler(OrganizationAuditLog)}
+ />,
+ <Route
+ key="integrations"
+ path="integrations/"
+ component={errorHandler(OrganizationIntegrations)}
+ />,
+ <Route
+ key="rate-limits"
+ path="rate-limits/"
+ component={errorHandler(OrganizationRateLimits)}
+ />,
+ <Route key="repos" path="repos/" component={errorHandler(OrganizationRepositories)} />,
+ <Route key="settings" path="settings/" component={errorHandler(OrganizationSettings)} />
+];
+
function routes() {
let hooksRoutes = [];
HookStore.get('routes').forEach(cb => {
@@ -164,30 +189,11 @@ function routes() {
<Route path="/:orgId/" component={errorHandler(OrganizationDetails)}>
<IndexRoute component={errorHandler(OrganizationDashboard)} />
- <Route
- path="/organizations/:orgId/api-keys/:apiKey/"
- component={errorHandler(OrganizationApiKeyDetailsView)}
- />
- <Route
- path="/organizations/:orgId/api-keys/"
- component={errorHandler(OrganizationApiKeysView)}
- />
- <Route
- path="/organizations/:orgId/audit-log/"
- component={errorHandler(OrganizationAuditLog)}
- />
- <Route
- path="/organizations/:orgId/repos/"
- component={errorHandler(OrganizationRepositories)}
- />
- <Route
- path="/organizations/:orgId/integrations/"
- component={errorHandler(OrganizationIntegrations)}
- />
- <Route
- path="/organizations/:orgId/settings/"
- component={errorHandler(OrganizationSettings)}
- />
+
+ <Route path="/organizations/:orgId/" component={OrganizationHomeContainer}>
+ {orgSettingsRoutes}
+ </Route>
+
<Route
path="/organizations/:orgId/teams/"
component={errorHandler(OrganizationTeams)}
@@ -231,10 +237,6 @@ function routes() {
path="/organizations/:orgId/projects/choose/"
component={errorHandler(ProjectChooser)}
/>
- <Route
- path="/organizations/:orgId/rate-limits/"
- component={errorHandler(OrganizationRateLimits)}
- />
<Route
path="/organizations/:orgId/stats/"
component={errorHandler(OrganizationStats)}
diff --git a/src/sentry/static/sentry/app/views/organizationAuditLog.jsx b/src/sentry/static/sentry/app/views/organizationAuditLog.jsx
index c6c547f58994a5..b07d8b4f54daed 100644
--- a/src/sentry/static/sentry/app/views/organizationAuditLog.jsx
+++ b/src/sentry/static/sentry/app/views/organizationAuditLog.jsx
@@ -7,7 +7,6 @@ import DateTime from '../components/dateTime';
import Avatar from '../components/avatar';
import LoadingIndicator from '../components/loadingIndicator';
import LoadingError from '../components/loadingError';
-import OrganizationHomeContainer from '../components/organizations/homeContainer';
import OrganizationState from '../mixins/organizationState';
import Pagination from '../components/pagination';
import SelectInput from '../components/selectInput';
@@ -148,7 +147,7 @@ const OrganizationAuditLog = React.createClass({
return (
<DocumentTitle title={this.getTitle()}>
- <OrganizationHomeContainer>
+ <div>
<h3>{t('Audit Log')}</h3>
<div className="pull-right">
@@ -195,7 +194,7 @@ const OrganizationAuditLog = React.createClass({
</div>
{this.state.pageLinks &&
<Pagination pageLinks={this.state.pageLinks} {...this.props} />}
- </OrganizationHomeContainer>
+ </div>
</DocumentTitle>
);
}
diff --git a/src/sentry/static/sentry/app/views/organizationIntegrations.jsx b/src/sentry/static/sentry/app/views/organizationIntegrations.jsx
index ab96d2e0854cf2..0de95cacb89325 100644
--- a/src/sentry/static/sentry/app/views/organizationIntegrations.jsx
+++ b/src/sentry/static/sentry/app/views/organizationIntegrations.jsx
@@ -7,7 +7,6 @@ import Confirm from '../components/confirm';
import DropdownLink from '../components/dropdownLink';
import IndicatorStore from '../stores/indicatorStore';
import MenuItem from '../components/menuItem';
-import OrganizationHomeContainer from '../components/organizations/homeContainer';
export default class OrganizationIntegrations extends AsyncView {
componentDidMount() {
@@ -133,7 +132,7 @@ export default class OrganizationIntegrations extends AsyncView {
};
return (
- <OrganizationHomeContainer className="ref-organization-integrations">
+ <div className="ref-organization-integrations">
<div className="pull-right">
<DropdownLink
anchorRight
@@ -208,7 +207,7 @@ export default class OrganizationIntegrations extends AsyncView {
</a>
</p>
</div>}
- </OrganizationHomeContainer>
+ </div>
);
}
}
diff --git a/src/sentry/static/sentry/app/views/organizationRateLimits/index.jsx b/src/sentry/static/sentry/app/views/organizationRateLimits/index.jsx
index 897693ee406beb..86037e82d84dc7 100644
--- a/src/sentry/static/sentry/app/views/organizationRateLimits/index.jsx
+++ b/src/sentry/static/sentry/app/views/organizationRateLimits/index.jsx
@@ -3,7 +3,6 @@ import React from 'react';
import ApiMixin from '../../mixins/apiMixin';
import IndicatorStore from '../../stores/indicatorStore';
-import OrganizationHomeContainer from '../../components/organizations/homeContainer';
import OrganizationState from '../../mixins/organizationState';
import {RangeField} from '../../components/forms';
import {t} from '../../locale';
@@ -200,16 +199,14 @@ const OrganizationRateLimits = React.createClass({
let org = this.context.organization;
return (
- <OrganizationHomeContainer>
- <div className="box">
- <div className="box-header">
- <h3>{t('Rate Limits')}</h3>
- </div>
- <div className="box-content with-padding">
- <RateLimitEditor organization={org} />
- </div>
+ <div className="box">
+ <div className="box-header">
+ <h3>{t('Rate Limits')}</h3>
</div>
- </OrganizationHomeContainer>
+ <div className="box-content with-padding">
+ <RateLimitEditor organization={org} />
+ </div>
+ </div>
);
}
});
diff --git a/src/sentry/static/sentry/app/views/organizationSettings.jsx b/src/sentry/static/sentry/app/views/organizationSettings.jsx
index 340049ecc5ed25..9fe7f5eec712ee 100644
--- a/src/sentry/static/sentry/app/views/organizationSettings.jsx
+++ b/src/sentry/static/sentry/app/views/organizationSettings.jsx
@@ -11,7 +11,6 @@ import {
} from '../components/forms';
import IndicatorStore from '../stores/indicatorStore';
import LoadingIndicator from '../components/loadingIndicator';
-import OrganizationHomeContainer from '../components/organizations/homeContainer';
import OrganizationStore from '../stores/organizationStore';
import {t} from '../locale';
import {extractMultilineFields} from '../utils';
@@ -356,7 +355,7 @@ const OrganizationSettings = React.createClass({
let access = data && new Set(data.access);
return (
- <OrganizationHomeContainer>
+ <div>
{this.state.loading && <LoadingIndicator />}
{!this.state.loading &&
@@ -396,7 +395,7 @@ const OrganizationSettings = React.createClass({
</div>
</div>}
</div>}
- </OrganizationHomeContainer>
+ </div>
);
}
});
diff --git a/src/sentry/static/sentry/app/views/organizationSettingsView.jsx b/src/sentry/static/sentry/app/views/organizationSettingsView.jsx
index 303a903168f5ba..ac552c5cc101d2 100644
--- a/src/sentry/static/sentry/app/views/organizationSettingsView.jsx
+++ b/src/sentry/static/sentry/app/views/organizationSettingsView.jsx
@@ -1,16 +1,13 @@
import DocumentTitle from 'react-document-title';
import React from 'react';
-import OrganizationHomeContainer from '../components/organizations/homeContainer';
import AsyncView from './asyncView';
class OrganizationSettingsView extends AsyncView {
render() {
return (
<DocumentTitle title={this.getTitle()}>
- <OrganizationHomeContainer {...this.props}>
- {this.renderComponent()}
- </OrganizationHomeContainer>
+ {this.renderComponent()}
</DocumentTitle>
);
}
diff --git a/tests/js/setup.js b/tests/js/setup.js
index 53d2b08ae22e19..9cf5ce095c63d3 100644
--- a/tests/js/setup.js
+++ b/tests/js/setup.js
@@ -5,6 +5,9 @@ import ConfigStore from 'app/stores/configStore';
jest.mock('app/translations');
jest.mock('app/api');
+// We generally use actual jQuery, and jest mocks takes precedence over node_modules
+jest.unmock('jquery');
+
window.$ = window.jQuery = jQuery;
window.sinon = sinon;
diff --git a/tests/js/spec/views/__snapshots__/organizationApiKeyDetailsView.spec.jsx.snap b/tests/js/spec/views/__snapshots__/organizationApiKeyDetailsView.spec.jsx.snap
index 0701afa57c776c..fdc45eeee6eabe 100644
--- a/tests/js/spec/views/__snapshots__/organizationApiKeyDetailsView.spec.jsx.snap
+++ b/tests/js/spec/views/__snapshots__/organizationApiKeyDetailsView.spec.jsx.snap
@@ -12,994 +12,479 @@ exports[`OrganizationApiKeyDetailsView renders 1`] = `
<DocumentTitle
title="Organization Name Edit API Key"
>
- <HomeContainer
- params={
- Object {
- "apiKey": 1,
- "orgId": "org-slug",
- }
- }
- >
+ <div>
<div
- className=" organization-home"
+ className="page-header"
>
- <div
- className="sub-header flex flex-container flex-vertically-centered"
+ <h3>
+ Edit Api Key
+ </h3>
+ </div>
+ <ApiForm
+ apiEndpoint="/organizations/org-slug/api-keys/1/"
+ apiMethod="PUT"
+ cancelLabel="Cancel"
+ className="form-stacked"
+ footerClass="form-actions align-right"
+ initialData={
+ Object {
+ "allowed_origins": "",
+ "id": 1,
+ "key": "aa624bcc12024702a202cd90be5feda0",
+ "label": "Default",
+ "scope_list": Array [
+ "project:read",
+ "event:read",
+ "team:read",
+ "member:read",
+ ],
+ "status": 0,
+ }
+ }
+ onCancel={[Function]}
+ onSubmitError={[Function]}
+ onSubmitSuccess={[Function]}
+ requireChanges={false}
+ submitDisabled={false}
+ submitLabel="Save Changes"
+ >
+ <form
+ className="form-stacked"
+ onSubmit={[Function]}
>
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
- >
- <div
- className="project-select"
- >
- <h3>
- <Link
- className="home-crumb"
- to="/org-slug/"
- >
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
- </Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
- >
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
- </div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
+ <SplitLayout
+ splitWidth={15}
>
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
+ <SpreadLayout
+ center={true}
+ className="split-layout"
+ responsive={false}
>
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
+ <div
+ className="spread-layout split-layout center"
>
- <a
- className="button button-primary"
+ <TextField
+ className="split-layout-child"
disabled={false}
- onClick={[Function]}
- role="button"
+ hideErrorMessage={false}
+ label="Label"
+ name="label"
+ required={false}
style={
Object {
- "marginRight": 5,
+ "marginRight": 15,
}
}
>
- <FlowLayout
- truncate={false}
+ <div
+ className="split-layout-child control-group"
+ style={
+ Object {
+ "marginRight": 15,
+ }
+ }
>
<div
- className="flow-layout"
+ className="controls"
>
- <span
- className="button-label"
+ <label
+ className="control-label"
+ htmlFor="id-label"
>
- New Project
- </span>
+ Label
+ </label>
+ <input
+ className="form-control"
+ disabled={false}
+ id="id-label"
+ onChange={[Function]}
+ required={false}
+ type="text"
+ value="Default"
+ />
</div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
+ </div>
+ </TextField>
+ <TextField
+ className="split-layout-child"
+ disabled={true}
+ hideErrorMessage={false}
+ label="API Key"
+ name="key"
+ required={false}
+ style={
+ Object {
+ "marginRight": undefined,
+ }
+ }
>
- <FlowLayout
- truncate={false}
+ <div
+ className="split-layout-child control-group"
+ style={
+ Object {
+ "marginRight": undefined,
+ }
+ }
>
<div
- className="flow-layout"
+ className="controls"
>
- <span
- className="button-label"
+ <label
+ className="control-label"
+ htmlFor="id-key"
>
- New Team
- </span>
+ API Key
+ </label>
+ <input
+ className="form-control"
+ disabled={true}
+ id="id-key"
+ onChange={[Function]}
+ required={false}
+ type="text"
+ value="aa624bcc12024702a202cd90be5feda0"
+ />
</div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
- <div
- className="container"
- >
- <div
- className="content row"
+ </div>
+ </TextField>
+ </div>
+ </SpreadLayout>
+ </SplitLayout>
+ <MultipleCheckboxField
+ choices={
+ Array [
+ Array [
+ "project:read",
+ "project:read",
+ ],
+ Array [
+ "project:write",
+ "project:write",
+ ],
+ Array [
+ "project:admin",
+ "project:admin",
+ ],
+ Array [
+ "project:releases",
+ "project:releases",
+ ],
+ Array [
+ "team:read",
+ "team:read",
+ ],
+ Array [
+ "team:write",
+ "team:write",
+ ],
+ Array [
+ "team:admin",
+ "team:admin",
+ ],
+ Array [
+ "event:read",
+ "event:read",
+ ],
+ Array [
+ "event:admin",
+ "event:admin",
+ ],
+ Array [
+ "org:read",
+ "org:read",
+ ],
+ Array [
+ "org:write",
+ "org:write",
+ ],
+ Array [
+ "org:admin",
+ "org:admin",
+ ],
+ Array [
+ "member:read",
+ "member:read",
+ ],
+ Array [
+ "member:admin",
+ "member:admin",
+ ],
+ ]
+ }
+ className="api-key-details"
+ disabled={false}
+ hideErrorMessage={false}
+ label="Scopes"
+ name="scope_list"
+ required={true}
>
<div
- className="col-md-2 org-sidebar"
+ className="api-key-details control-group"
>
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
+ <div
+ className="required"
+ >
+ <div
+ className="controls"
+ >
+ <label
+ className="control-label"
+ style={
+ Object {
+ "borderBottom": "1px solid #f1eff3",
+ "display": "block",
+ "marginBottom": 10,
+ }
+ }
>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
+ Scopes
+ </label>
</div>
- </HomeSidebar>
+ </div>
+ <div
+ className="control-list"
+ >
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={true}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="project:read"
+ />
+ project:read
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="project:write"
+ />
+ project:write
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="project:admin"
+ />
+ project:admin
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="project:releases"
+ />
+ project:releases
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={true}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="team:read"
+ />
+ team:read
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="team:write"
+ />
+ team:write
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="team:admin"
+ />
+ team:admin
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={true}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="event:read"
+ />
+ event:read
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="event:admin"
+ />
+ event:admin
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="org:read"
+ />
+ org:read
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="org:write"
+ />
+ org:write
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="org:admin"
+ />
+ org:admin
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={true}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="member:read"
+ />
+ member:read
+ </label>
+ <label
+ className="checkbox"
+ >
+ <input
+ checked={false}
+ disabled={false}
+ onChange={[Function]}
+ type="checkbox"
+ value="member:admin"
+ />
+ member:admin
+ </label>
+ </div>
</div>
+ </MultipleCheckboxField>
+ <TextareaField
+ disabled={false}
+ help="Separate multiple entries with a newline"
+ hideErrorMessage={false}
+ label="Allowed Domains"
+ name="allowed_origins"
+ placeholder="e.g. example.com or https://example.com"
+ required={false}
+ >
<div
- className="col-md-10"
+ className="control-group"
>
- <div>
- <div
- className="page-header"
+ <div
+ className="controls"
+ >
+ <label
+ className="control-label"
+ htmlFor="id-allowed_origins"
>
- <h3>
- Edit Api Key
- </h3>
- </div>
- <ApiForm
- apiEndpoint="/organizations/org-slug/api-keys/1/"
- apiMethod="PUT"
- cancelLabel="Cancel"
- className="form-stacked"
- footerClass="form-actions align-right"
- initialData={
- Object {
- "allowed_origins": "",
- "id": 1,
- "key": "aa624bcc12024702a202cd90be5feda0",
- "label": "Default",
- "scope_list": Array [
- "project:read",
- "event:read",
- "team:read",
- "member:read",
- ],
- "status": 0,
- }
- }
- onCancel={[Function]}
- onSubmitError={[Function]}
- onSubmitSuccess={[Function]}
- requireChanges={false}
- submitDisabled={false}
- submitLabel="Save Changes"
+ Allowed Domains
+ </label>
+ <textarea
+ className="form-control"
+ disabled={false}
+ id="id-allowed_origins"
+ onChange={[Function]}
+ placeholder="e.g. example.com or https://example.com"
+ required={false}
+ value=""
+ />
+ <p
+ className="help-block"
>
- <form
- className="form-stacked"
- onSubmit={[Function]}
- >
- <SplitLayout
- splitWidth={15}
- >
- <SpreadLayout
- center={true}
- className="split-layout"
- responsive={false}
- >
- <div
- className="spread-layout split-layout center"
- >
- <TextField
- className="split-layout-child"
- disabled={false}
- hideErrorMessage={false}
- label="Label"
- name="label"
- required={false}
- style={
- Object {
- "marginRight": 15,
- }
- }
- >
- <div
- className="split-layout-child control-group"
- style={
- Object {
- "marginRight": 15,
- }
- }
- >
- <div
- className="controls"
- >
- <label
- className="control-label"
- htmlFor="id-label"
- >
- Label
- </label>
- <input
- className="form-control"
- disabled={false}
- id="id-label"
- onChange={[Function]}
- required={false}
- type="text"
- value="Default"
- />
- </div>
- </div>
- </TextField>
- <TextField
- className="split-layout-child"
- disabled={true}
- hideErrorMessage={false}
- label="API Key"
- name="key"
- required={false}
- style={
- Object {
- "marginRight": undefined,
- }
- }
- >
- <div
- className="split-layout-child control-group"
- style={
- Object {
- "marginRight": undefined,
- }
- }
- >
- <div
- className="controls"
- >
- <label
- className="control-label"
- htmlFor="id-key"
- >
- API Key
- </label>
- <input
- className="form-control"
- disabled={true}
- id="id-key"
- onChange={[Function]}
- required={false}
- type="text"
- value="aa624bcc12024702a202cd90be5feda0"
- />
- </div>
- </div>
- </TextField>
- </div>
- </SpreadLayout>
- </SplitLayout>
- <MultipleCheckboxField
- choices={
- Array [
- Array [
- "project:read",
- "project:read",
- ],
- Array [
- "project:write",
- "project:write",
- ],
- Array [
- "project:admin",
- "project:admin",
- ],
- Array [
- "project:releases",
- "project:releases",
- ],
- Array [
- "team:read",
- "team:read",
- ],
- Array [
- "team:write",
- "team:write",
- ],
- Array [
- "team:admin",
- "team:admin",
- ],
- Array [
- "event:read",
- "event:read",
- ],
- Array [
- "event:admin",
- "event:admin",
- ],
- Array [
- "org:read",
- "org:read",
- ],
- Array [
- "org:write",
- "org:write",
- ],
- Array [
- "org:admin",
- "org:admin",
- ],
- Array [
- "member:read",
- "member:read",
- ],
- Array [
- "member:admin",
- "member:admin",
- ],
- ]
- }
- className="api-key-details"
- disabled={false}
- hideErrorMessage={false}
- label="Scopes"
- name="scope_list"
- required={true}
- >
- <div
- className="api-key-details control-group"
- >
- <div
- className="required"
- >
- <div
- className="controls"
- >
- <label
- className="control-label"
- style={
- Object {
- "borderBottom": "1px solid #f1eff3",
- "display": "block",
- "marginBottom": 10,
- }
- }
- >
- Scopes
- </label>
- </div>
- </div>
- <div
- className="control-list"
- >
- <label
- className="checkbox"
- >
- <input
- checked={true}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="project:read"
- />
- project:read
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="project:write"
- />
- project:write
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="project:admin"
- />
- project:admin
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="project:releases"
- />
- project:releases
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={true}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="team:read"
- />
- team:read
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="team:write"
- />
- team:write
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="team:admin"
- />
- team:admin
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={true}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="event:read"
- />
- event:read
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="event:admin"
- />
- event:admin
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="org:read"
- />
- org:read
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="org:write"
- />
- org:write
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="org:admin"
- />
- org:admin
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={true}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="member:read"
- />
- member:read
- </label>
- <label
- className="checkbox"
- >
- <input
- checked={false}
- disabled={false}
- onChange={[Function]}
- type="checkbox"
- value="member:admin"
- />
- member:admin
- </label>
- </div>
- </div>
- </MultipleCheckboxField>
- <TextareaField
- disabled={false}
- help="Separate multiple entries with a newline"
- hideErrorMessage={false}
- label="Allowed Domains"
- name="allowed_origins"
- placeholder="e.g. example.com or https://example.com"
- required={false}
- >
- <div
- className="control-group"
- >
- <div
- className="controls"
- >
- <label
- className="control-label"
- htmlFor="id-allowed_origins"
- >
- Allowed Domains
- </label>
- <textarea
- className="form-control"
- disabled={false}
- id="id-allowed_origins"
- onChange={[Function]}
- placeholder="e.g. example.com or https://example.com"
- required={false}
- value=""
- />
- <p
- className="help-block"
- >
- Separate multiple entries with a newline
- </p>
- </div>
- </div>
- </TextareaField>
- <div
- className="form-actions align-right"
- style={
- Object {
- "marginTop": 25,
- }
- }
- >
- <button
- className="btn btn-primary"
- disabled={false}
- type="submit"
- >
- Save Changes
- </button>
- <button
- className="btn btn-default"
- disabled={false}
- onClick={[Function]}
- style={
- Object {
- "marginLeft": 5,
- }
- }
- type="button"
- >
- Cancel
- </button>
- </div>
- </form>
- </ApiForm>
+ Separate multiple entries with a newline
+ </p>
</div>
</div>
+ </TextareaField>
+ <div
+ className="form-actions align-right"
+ style={
+ Object {
+ "marginTop": 25,
+ }
+ }
+ >
+ <button
+ className="btn btn-primary"
+ disabled={false}
+ type="submit"
+ >
+ Save Changes
+ </button>
+ <button
+ className="btn btn-default"
+ disabled={false}
+ onClick={[Function]}
+ style={
+ Object {
+ "marginLeft": 5,
+ }
+ }
+ type="button"
+ >
+ Cancel
+ </button>
</div>
- </div>
- </div>
- </HomeContainer>
+ </form>
+ </ApiForm>
+ </div>
</DocumentTitle>
</OrganizationApiKeyDetailsView>
`;
diff --git a/tests/js/spec/views/__snapshots__/organizationApiKeysView.spec.jsx.snap b/tests/js/spec/views/__snapshots__/organizationApiKeysView.spec.jsx.snap
index fe13cd0335cf43..d234d1bc491dee 100644
--- a/tests/js/spec/views/__snapshots__/organizationApiKeysView.spec.jsx.snap
+++ b/tests/js/spec/views/__snapshots__/organizationApiKeysView.spec.jsx.snap
@@ -11,767 +11,253 @@ exports[`OrganizationApiKeysView renders 1`] = `
<DocumentTitle
title="Organization Name API Keys"
>
- <HomeContainer
- params={
- Object {
- "orgId": "org-slug",
- }
- }
- >
- <div
- className=" organization-home"
+ <div>
+ <SpreadLayout
+ center={true}
+ className="page-header"
+ responsive={false}
>
<div
- className="sub-header flex flex-container flex-vertically-centered"
+ className="spread-layout page-header center"
>
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
+ <h3>
+ Api Keys
+ </h3>
+ <Button
+ disabled={false}
+ onClick={[Function]}
+ priority="primary"
+ type="button"
+ >
+ <button
+ className="button button-primary"
+ disabled={false}
+ onClick={[Function]}
+ role="button"
+ type="button"
>
- <div
- className="project-select"
+ <FlowLayout
+ truncate={false}
>
- <h3>
+ <div
+ className="flow-layout"
+ >
+ <span
+ className="button-label"
+ >
+ New API Key
+ </span>
+ </div>
+ </FlowLayout>
+ </button>
+ </Button>
+ </div>
+ </SpreadLayout>
+ <p>
+ API keys grant access to the
+
+ <a
+ href="https://docs.sentry.io/hosted/api/"
+ rel="nofollow"
+ target="_blank"
+ >
+ developer web API
+ </a>
+ . If you're looking to configure a Sentry client, you'll need a client key which is available in your project settings.
+ </p>
+ <div
+ className="alert alert-block alert-info"
+ >
+ psst. Until Sentry supports OAuth, you might want to switch to using
+
+ <Link
+ to="/api/"
+ >
+ <Link
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to="/api/"
+ >
+ <a
+ onClick={[Function]}
+ style={Object {}}
+ >
+ Auth Tokens
+ </a>
+ </Link>
+ </Link>
+
+ instead.
+ </div>
+ <table
+ className="table api-key-list"
+ >
+ <colgroup>
+ <col
+ style={
+ Object {
+ "width": "40%",
+ }
+ }
+ />
+ <col
+ style={
+ Object {
+ "width": "40%",
+ }
+ }
+ />
+ <col
+ style={
+ Object {
+ "width": "20%",
+ }
+ }
+ />
+ </colgroup>
+ <tbody>
+ <tr>
+ <td>
+ <h5>
+ <Link
+ to="/organizations/org-slug/api-keys/1"
+ >
<Link
- className="home-crumb"
- to="/org-slug/"
+ onlyActiveOnIndex={false}
+ style={Object {}}
+ to="/organizations/org-slug/api-keys/1"
>
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
+ <a
+ onClick={[Function]}
style={Object {}}
- to="/org-slug/"
>
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
+ Default
+ </a>
</Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
- >
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
+ </Link>
+ </h5>
+ </td>
+ <td>
+ <div
+ className="form-control disabled auto-select"
+ >
+ aa624bcc12024702a202cd90be5feda0
</div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
- >
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
+ </td>
+ <td
+ className="align-right"
>
<Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
+ className="btn btn-default btn-sm"
style={
Object {
- "marginRight": 5,
+ "marginRight": 4,
}
}
- to="/organizations/org-slug/projects/new/"
+ to="/organizations/org-slug/api-keys/1"
>
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
+ <Link
+ className="btn btn-default btn-sm"
+ onlyActiveOnIndex={false}
style={
Object {
- "marginRight": 5,
+ "marginRight": 4,
}
}
+ to="/organizations/org-slug/api-keys/1"
>
- <FlowLayout
- truncate={false}
+ <a
+ className="btn btn-default btn-sm"
+ onClick={[Function]}
+ style={
+ Object {
+ "marginRight": 4,
+ }
+ }
>
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Project
- </span>
- </div>
- </FlowLayout>
- </a>
+ Edit Key
+ </a>
+ </Link>
</Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
+ <LinkWithConfirmation
+ className="btn btn-default btn-sm"
+ message="Are you sure you want to remove this API key?"
+ onConfirm={[Function]}
+ title="Remove API Key?"
>
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
+ <Confirm
+ cancelText="Cancel"
+ confirmText="Confirm"
+ message="Are you sure you want to remove this API key?"
+ onConfirm={[Function]}
+ priority="primary"
>
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Team
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
- <div
- className="container"
- >
- <div
- className="content row"
- >
- <div
- className="col-md-2 org-sidebar"
- >
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- </div>
- </HomeSidebar>
- </div>
- <div
- className="col-md-10"
- >
- <div>
- <SpreadLayout
- center={true}
- className="page-header"
- responsive={false}
- >
- <div
- className="spread-layout page-header center"
- >
- <h3>
- Api Keys
- </h3>
- <Button
- disabled={false}
+ <span>
+ <a
+ className="btn btn-default btn-sm"
onClick={[Function]}
- priority="primary"
- type="button"
- >
- <button
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- type="button"
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New API Key
- </span>
- </div>
- </FlowLayout>
- </button>
- </Button>
- </div>
- </SpreadLayout>
- <p>
- API keys grant access to the
-
- <a
- href="https://docs.sentry.io/hosted/api/"
- rel="nofollow"
- target="_blank"
- >
- developer web API
- </a>
- . If you're looking to configure a Sentry client, you'll need a client key which is available in your project settings.
- </p>
- <div
- className="alert alert-block alert-info"
- >
- psst. Until Sentry supports OAuth, you might want to switch to using
-
- <Link
- to="/api/"
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/api/"
+ title="Remove API Key?"
>
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Auth Tokens
- </a>
- </Link>
- </Link>
-
- instead.
- </div>
- <table
- className="table api-key-list"
- >
- <colgroup>
- <col
- style={
- Object {
- "width": "40%",
- }
- }
- />
- <col
- style={
- Object {
- "width": "40%",
- }
- }
- />
- <col
- style={
- Object {
- "width": "20%",
+ <span
+ className="icon-trash"
+ />
+ </a>
+ <Modal
+ animation={false}
+ autoFocus={true}
+ backdrop={true}
+ bsClass="modal"
+ dialogComponentClass={[Function]}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
}
}
- />
- </colgroup>
- <tbody>
- <tr>
- <td>
- <h5>
- <Link
- to="/organizations/org-slug/api-keys/1"
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/api-keys/1"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Default
- </a>
- </Link>
- </Link>
- </h5>
- </td>
- <td>
- <div
- className="form-control disabled auto-select"
- >
- aa624bcc12024702a202cd90be5feda0
- </div>
- </td>
- <td
- className="align-right"
- >
- <Link
- className="btn btn-default btn-sm"
- style={
- Object {
- "marginRight": 4,
- }
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ >
+ <Modal
+ autoFocus={true}
+ backdrop={true}
+ backdropClassName="modal-backdrop"
+ backdropTransitionTimeout={150}
+ containerClassName="modal-open"
+ dialogTransitionTimeout={300}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
}
- to="/organizations/org-slug/api-keys/1"
- >
- <Link
- className="btn btn-default btn-sm"
- onlyActiveOnIndex={false}
- style={
- Object {
- "marginRight": 4,
- }
- }
- to="/organizations/org-slug/api-keys/1"
- >
- <a
- className="btn btn-default btn-sm"
- onClick={[Function]}
- style={
- Object {
- "marginRight": 4,
- }
- }
- >
- Edit Key
- </a>
- </Link>
- </Link>
- <LinkWithConfirmation
- className="btn btn-default btn-sm"
- message="Are you sure you want to remove this API key?"
- onConfirm={[Function]}
- title="Remove API Key?"
- >
- <Confirm
- cancelText="Cancel"
- confirmText="Confirm"
- message="Are you sure you want to remove this API key?"
- onConfirm={[Function]}
- priority="primary"
- >
- <span>
- <a
- className="btn btn-default btn-sm"
- onClick={[Function]}
- title="Remove API Key?"
- >
- <span
- className="icon-trash"
- />
- </a>
- <Modal
- animation={false}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- >
- <Modal
- autoFocus={true}
- backdrop={true}
- backdropClassName="modal-backdrop"
- backdropTransitionTimeout={150}
- containerClassName="modal-open"
- dialogTransitionTimeout={300}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onEntering={[Function]}
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- />
- </Modal>
- </span>
- </Confirm>
- </LinkWithConfirmation>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
- </HomeContainer>
+ }
+ onEntering={[Function]}
+ onExited={[Function]}
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ />
+ </Modal>
+ </span>
+ </Confirm>
+ </LinkWithConfirmation>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
</DocumentTitle>
</OrganizationApiKeysView>
`;
diff --git a/tests/js/spec/views/__snapshots__/organizationIntegrations.spec.jsx.snap b/tests/js/spec/views/__snapshots__/organizationIntegrations.spec.jsx.snap
index 6845690d8918ee..d14ed794bef9e7 100644
--- a/tests/js/spec/views/__snapshots__/organizationIntegrations.spec.jsx.snap
+++ b/tests/js/spec/views/__snapshots__/organizationIntegrations.spec.jsx.snap
@@ -11,589 +11,83 @@ exports[`OrganizationIntegrations render() with a provider renders 1`] = `
<DocumentTitle
title="Integrations"
>
- <HomeContainer
+ <div
className="ref-organization-integrations"
>
<div
- className="ref-organization-integrations organization-home"
+ className="pull-right"
>
- <div
- className="sub-header flex flex-container flex-vertically-centered"
+ <DropdownLink
+ anchorRight={true}
+ caret={true}
+ className="btn btn-primary btn-sm"
+ disabled={false}
+ title="Add Integration"
>
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
- >
- <div
- className="project-select"
- >
- <h3>
- <Link
- className="home-crumb"
- to="/org-slug/"
- >
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
- </Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
- >
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
- </div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
+ <span
+ className="pull-right anchor-right dropdown"
>
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
+ <a
+ className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
+ data-toggle="dropdown"
>
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Project
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
+ Add Integration
+ <i
+ className="icon-arrow-down"
+ />
+ </a>
+ <ul
+ className="dropdown-menu"
>
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
+ <MenuItem
+ noAnchor={true}
>
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
+ <li
+ className=""
+ href={null}
+ role="presentation"
+ title={null}
>
- <FlowLayout
- truncate={false}
+ <a
+ onClick={[Function]}
>
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Team
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
+ GitHub
+ </a>
+ </li>
+ </MenuItem>
+ </ul>
+ </span>
+ </DropdownLink>
+ </div>
+ <h3
+ className="m-b-2"
+ >
+ Integrations
+ </h3>
+ <div
+ className="well blankslate align-center p-x-2 p-y-1"
+ >
<div
- className="container"
+ className="icon icon-lg icon-git-commit"
+ />
+ <h3>
+ Sentry is better with friends
+ </h3>
+ <p>
+ Integrations allow you to pull in things like repository data or sync with an external issue tracker.
+ </p>
+ <p
+ className="m-b-1"
>
- <div
- className="content row"
+ <a
+ className="btn btn-default"
+ href="https://docs.sentry.io/learn/integrations/"
>
- <div
- className="col-md-2 org-sidebar"
- >
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- </div>
- </HomeSidebar>
- </div>
- <div
- className="col-md-10"
- >
- <div
- className="pull-right"
- >
- <DropdownLink
- anchorRight={true}
- caret={true}
- className="btn btn-primary btn-sm"
- disabled={false}
- title="Add Integration"
- >
- <span
- className="pull-right anchor-right dropdown"
- >
- <a
- className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
- data-toggle="dropdown"
- >
- Add Integration
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- noAnchor={true}
- >
- <li
- className=""
- href={null}
- role="presentation"
- title={null}
- >
- <a
- onClick={[Function]}
- >
- GitHub
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </div>
- <h3
- className="m-b-2"
- >
- Integrations
- </h3>
- <div
- className="well blankslate align-center p-x-2 p-y-1"
- >
- <div
- className="icon icon-lg icon-git-commit"
- />
- <h3>
- Sentry is better with friends
- </h3>
- <p>
- Integrations allow you to pull in things like repository data or sync with an external issue tracker.
- </p>
- <p
- className="m-b-1"
- >
- <a
- className="btn btn-default"
- href="https://docs.sentry.io/learn/integrations/"
- >
- Learn more
- </a>
- </p>
- </div>
- </div>
- </div>
- </div>
+ Learn more
+ </a>
+ </p>
</div>
- </HomeContainer>
+ </div>
</DocumentTitle>
</OrganizationIntegrations>
`;
@@ -609,680 +103,174 @@ exports[`OrganizationIntegrations render() with a provider renders with a reposi
<DocumentTitle
title="Integrations"
>
- <HomeContainer
+ <div
className="ref-organization-integrations"
>
<div
- className="ref-organization-integrations organization-home"
+ className="pull-right"
>
- <div
- className="sub-header flex flex-container flex-vertically-centered"
+ <DropdownLink
+ anchorRight={true}
+ caret={true}
+ className="btn btn-primary btn-sm"
+ disabled={false}
+ title="Add Integration"
>
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
+ <span
+ className="pull-right anchor-right dropdown"
+ >
+ <a
+ className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ Add Integration
+ <i
+ className="icon-arrow-down"
+ />
+ </a>
+ <ul
+ className="dropdown-menu"
>
- <div
- className="project-select"
+ <MenuItem
+ noAnchor={true}
>
- <h3>
- <Link
- className="home-crumb"
- to="/org-slug/"
- >
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
- </Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
+ <li
+ className=""
+ href={null}
+ role="presentation"
+ title={null}
+ >
+ <a
+ onClick={[Function]}
>
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
- </div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
- >
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
+ GitHub
+ </a>
+ </li>
+ </MenuItem>
+ </ul>
+ </span>
+ </DropdownLink>
+ </div>
+ <h3
+ className="m-b-2"
+ >
+ Integrations
+ </h3>
+ <div
+ className="panel panel-default"
+ >
+ <table
+ className="table"
+ >
+ <tbody>
+ <tr>
+ <td
style={
Object {
- "marginRight": 5,
+ "paddingRight": 0,
+ "width": 24,
}
}
- to="/organizations/org-slug/projects/new/"
>
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
+ <span
+ className="icon icon-integration icon-github"
style={
Object {
- "marginRight": 5,
+ "display": "inline-block",
+ "height": 24,
+ "width": 24,
}
}
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Project
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
+ />
+ </td>
+ <td>
+ <strong>
+ repo-name
+ </strong>
+ —
+ <small>
+ GitHub
+ </small>
+ </td>
+ <td
+ style={
+ Object {
+ "width": 60,
+ }
+ }
>
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
+ <Confirm
+ cancelText="Cancel"
+ confirmText="Confirm"
+ message="Are you sure you want to remove this integration?"
+ onConfirm={[Function]}
+ priority="primary"
>
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
+ <span>
+ <button
+ className="btn btn-default btn-xs"
+ onClick={[Function]}
>
<span
- className="button-label"
- >
- New Team
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
- <div
- className="container"
- >
- <div
- className="content row"
- >
- <div
- className="col-md-2 org-sidebar"
- >
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- </div>
- </HomeSidebar>
- </div>
- <div
- className="col-md-10"
- >
- <div
- className="pull-right"
- >
- <DropdownLink
- anchorRight={true}
- caret={true}
- className="btn btn-primary btn-sm"
- disabled={false}
- title="Add Integration"
- >
- <span
- className="pull-right anchor-right dropdown"
- >
- <a
- className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
- data-toggle="dropdown"
- >
- Add Integration
- <i
- className="icon-arrow-down"
+ className="icon icon-trash"
/>
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- noAnchor={true}
- >
- <li
- className=""
- href={null}
- role="presentation"
- title={null}
- >
- <a
- onClick={[Function]}
- >
- GitHub
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </div>
- <h3
- className="m-b-2"
- >
- Integrations
- </h3>
- <div
- className="panel panel-default"
- >
- <table
- className="table"
- >
- <tbody>
- <tr>
- <td
- style={
- Object {
- "paddingRight": 0,
- "width": 24,
- }
+ </button>
+ <Modal
+ animation={false}
+ autoFocus={true}
+ backdrop={true}
+ bsClass="modal"
+ dialogComponentClass={[Function]}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
}
- >
- <span
- className="icon icon-integration icon-github"
- style={
- Object {
- "display": "inline-block",
- "height": 24,
- "width": 24,
- }
- }
- />
- </td>
- <td>
- <strong>
- repo-name
- </strong>
- —
- <small>
- GitHub
- </small>
- </td>
- <td
- style={
- Object {
- "width": 60,
+ }
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ >
+ <Modal
+ autoFocus={true}
+ backdrop={true}
+ backdropClassName="modal-backdrop"
+ backdropTransitionTimeout={150}
+ containerClassName="modal-open"
+ dialogTransitionTimeout={300}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
}
}
- >
- <Confirm
- cancelText="Cancel"
- confirmText="Confirm"
- message="Are you sure you want to remove this integration?"
- onConfirm={[Function]}
- priority="primary"
- >
- <span>
- <button
- className="btn btn-default btn-xs"
- onClick={[Function]}
- >
- <span
- className="icon icon-trash"
- />
- </button>
- <Modal
- animation={false}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- >
- <Modal
- autoFocus={true}
- backdrop={true}
- backdropClassName="modal-backdrop"
- backdropTransitionTimeout={150}
- containerClassName="modal-open"
- dialogTransitionTimeout={300}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onEntering={[Function]}
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- />
- </Modal>
- </span>
- </Confirm>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
+ onEntering={[Function]}
+ onExited={[Function]}
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ />
+ </Modal>
+ </span>
+ </Confirm>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
- </HomeContainer>
+ </div>
</DocumentTitle>
</OrganizationIntegrations>
`;
@@ -1291,7 +279,7 @@ exports[`OrganizationIntegrations render() without any providers is loading when
<DocumentTitle
title="Integrations"
>
- <HomeContainer
+ <div
className="ref-organization-integrations"
>
<div
@@ -1333,7 +321,7 @@ exports[`OrganizationIntegrations render() without any providers is loading when
</a>
</p>
</div>
- </HomeContainer>
+ </div>
</DocumentTitle>
`;
@@ -1348,572 +336,66 @@ exports[`OrganizationIntegrations render() without any providers renders 1`] = `
<DocumentTitle
title="Integrations"
>
- <HomeContainer
+ <div
className="ref-organization-integrations"
>
<div
- className="ref-organization-integrations organization-home"
+ className="pull-right"
>
- <div
- className="sub-header flex flex-container flex-vertically-centered"
+ <DropdownLink
+ anchorRight={true}
+ caret={true}
+ className="btn btn-primary btn-sm"
+ disabled={false}
+ title="Add Integration"
>
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
- >
- <div
- className="project-select"
- >
- <h3>
- <Link
- className="home-crumb"
- to="/org-slug/"
- >
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
- </Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
- >
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
- </div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
+ <span
+ className="pull-right anchor-right dropdown"
>
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Project
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
+ <a
+ className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
+ data-toggle="dropdown"
>
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Team
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
+ Add Integration
+ <i
+ className="icon-arrow-down"
+ />
+ </a>
+ <ul
+ className="dropdown-menu"
+ />
+ </span>
+ </DropdownLink>
+ </div>
+ <h3
+ className="m-b-2"
+ >
+ Integrations
+ </h3>
+ <div
+ className="well blankslate align-center p-x-2 p-y-1"
+ >
<div
- className="container"
+ className="icon icon-lg icon-git-commit"
+ />
+ <h3>
+ Sentry is better with friends
+ </h3>
+ <p>
+ Integrations allow you to pull in things like repository data or sync with an external issue tracker.
+ </p>
+ <p
+ className="m-b-1"
>
- <div
- className="content row"
+ <a
+ className="btn btn-default"
+ href="https://docs.sentry.io/learn/integrations/"
>
- <div
- className="col-md-2 org-sidebar"
- >
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- </div>
- </HomeSidebar>
- </div>
- <div
- className="col-md-10"
- >
- <div
- className="pull-right"
- >
- <DropdownLink
- anchorRight={true}
- caret={true}
- className="btn btn-primary btn-sm"
- disabled={false}
- title="Add Integration"
- >
- <span
- className="pull-right anchor-right dropdown"
- >
- <a
- className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
- data-toggle="dropdown"
- >
- Add Integration
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- />
- </span>
- </DropdownLink>
- </div>
- <h3
- className="m-b-2"
- >
- Integrations
- </h3>
- <div
- className="well blankslate align-center p-x-2 p-y-1"
- >
- <div
- className="icon icon-lg icon-git-commit"
- />
- <h3>
- Sentry is better with friends
- </h3>
- <p>
- Integrations allow you to pull in things like repository data or sync with an external issue tracker.
- </p>
- <p
- className="m-b-1"
- >
- <a
- className="btn btn-default"
- href="https://docs.sentry.io/learn/integrations/"
- >
- Learn more
- </a>
- </p>
- </div>
- </div>
- </div>
- </div>
+ Learn more
+ </a>
+ </p>
</div>
- </HomeContainer>
+ </div>
</DocumentTitle>
</OrganizationIntegrations>
`;
diff --git a/tests/js/spec/views/__snapshots__/organizationRepositories.spec.jsx.snap b/tests/js/spec/views/__snapshots__/organizationRepositories.spec.jsx.snap
index 30a8d1f29a0b1e..31c4aa2e80f680 100644
--- a/tests/js/spec/views/__snapshots__/organizationRepositories.spec.jsx.snap
+++ b/tests/js/spec/views/__snapshots__/organizationRepositories.spec.jsx.snap
@@ -11,664 +11,150 @@ exports[`OrganizationRepositories render() with a provider renders 1`] = `
<DocumentTitle
title="Repositories"
>
- <HomeContainer
- params={
- Object {
- "orgId": "org-slug",
- }
- }
- >
+ <div>
<div
- className=" organization-home"
+ className="pull-right"
>
- <div
- className="sub-header flex flex-container flex-vertically-centered"
+ <DropdownLink
+ anchorRight={true}
+ caret={true}
+ className="btn btn-primary btn-sm"
+ disabled={false}
+ title="Add Repository"
>
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
- >
- <div
- className="project-select"
- >
- <h3>
- <Link
- className="home-crumb"
- to="/org-slug/"
- >
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
- </Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
- >
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
- </div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
+ <span
+ className="pull-right anchor-right dropdown"
>
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
+ <a
+ className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
+ data-toggle="dropdown"
>
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Project
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
+ Add Repository
+ <i
+ className="icon-arrow-down"
+ />
+ </a>
+ <ul
+ className="dropdown-menu"
>
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
+ <MenuItem
+ noAnchor={true}
>
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
+ <li
+ className=""
+ href={null}
+ role="presentation"
+ title={null}
>
- <FlowLayout
- truncate={false}
+ <AddRepositoryLink
+ onSuccess={[Function]}
+ orgId="org-slug"
+ provider={
+ Object {
+ "config": Array [
+ Object {
+ "help": "Enter your repository name, including the owner.",
+ "label": "Repository Name",
+ "name": "name",
+ "placeholder": "e.g. getsentry/sentry",
+ "required": true,
+ "type": "text",
+ },
+ ],
+ "id": "github",
+ "name": "GitHub",
+ }
+ }
>
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Team
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
+ <a
+ onClick={[Function]}
+ >
+ GitHub
+ <Modal
+ animation={false}
+ autoFocus={true}
+ backdrop={true}
+ bsClass="modal"
+ dialogComponentClass={[Function]}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
+ }
+ }
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ >
+ <Modal
+ autoFocus={true}
+ backdrop={true}
+ backdropClassName="modal-backdrop"
+ backdropTransitionTimeout={150}
+ containerClassName="modal-open"
+ dialogTransitionTimeout={300}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
+ }
+ }
+ onEntering={[Function]}
+ onExited={[Function]}
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ />
+ </Modal>
+ </a>
+ </AddRepositoryLink>
+ </li>
+ </MenuItem>
+ </ul>
+ </span>
+ </DropdownLink>
+ </div>
+ <h3
+ className="m-b-2"
+ >
+ Repositories
+ </h3>
+ <div
+ className="well blankslate align-center p-x-2 p-y-1"
+ >
<div
- className="container"
+ className="icon icon-lg icon-git-commit"
+ />
+ <h3>
+ Sentry is better with commit data
+ </h3>
+ <p>
+ Adding one or more repositories will enable enhanced releases and the ability to resolve Sentry Issues via git message.
+ </p>
+ <p
+ className="m-b-1"
>
- <div
- className="content row"
+ <a
+ className="btn btn-default"
+ href="https://docs.sentry.io/learn/releases/"
>
- <div
- className="col-md-2 org-sidebar"
- >
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- </div>
- </HomeSidebar>
- </div>
- <div
- className="col-md-10"
- >
- <div>
- <div
- className="pull-right"
- >
- <DropdownLink
- anchorRight={true}
- caret={true}
- className="btn btn-primary btn-sm"
- disabled={false}
- title="Add Repository"
- >
- <span
- className="pull-right anchor-right dropdown"
- >
- <a
- className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
- data-toggle="dropdown"
- >
- Add Repository
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- noAnchor={true}
- >
- <li
- className=""
- href={null}
- role="presentation"
- title={null}
- >
- <AddRepositoryLink
- onSuccess={[Function]}
- orgId="org-slug"
- provider={
- Object {
- "config": Array [
- Object {
- "help": "Enter your repository name, including the owner.",
- "label": "Repository Name",
- "name": "name",
- "placeholder": "e.g. getsentry/sentry",
- "required": true,
- "type": "text",
- },
- ],
- "id": "github",
- "name": "GitHub",
- }
- }
- >
- <a
- onClick={[Function]}
- >
- GitHub
- <Modal
- animation={false}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- >
- <Modal
- autoFocus={true}
- backdrop={true}
- backdropClassName="modal-backdrop"
- backdropTransitionTimeout={150}
- containerClassName="modal-open"
- dialogTransitionTimeout={300}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onEntering={[Function]}
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- />
- </Modal>
- </a>
- </AddRepositoryLink>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </div>
- <h3
- className="m-b-2"
- >
- Repositories
- </h3>
- <div
- className="well blankslate align-center p-x-2 p-y-1"
- >
- <div
- className="icon icon-lg icon-git-commit"
- />
- <h3>
- Sentry is better with commit data
- </h3>
- <p>
- Adding one or more repositories will enable enhanced releases and the ability to resolve Sentry Issues via git message.
- </p>
- <p
- className="m-b-1"
- >
- <a
- className="btn btn-default"
- href="https://docs.sentry.io/learn/releases/"
- >
- Learn more
- </a>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
+ Learn more
+ </a>
+ </p>
</div>
- </HomeContainer>
+ </div>
</DocumentTitle>
</OrganizationRepositories>
`;
@@ -684,787 +170,273 @@ exports[`OrganizationRepositories render() with a provider renders with a reposi
<DocumentTitle
title="Repositories"
>
- <HomeContainer
- params={
- Object {
- "orgId": "org-slug",
- }
- }
- >
+ <div>
<div
- className=" organization-home"
+ className="pull-right"
>
- <div
- className="sub-header flex flex-container flex-vertically-centered"
+ <DropdownLink
+ anchorRight={true}
+ caret={true}
+ className="btn btn-primary btn-sm"
+ disabled={false}
+ title="Add Repository"
>
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
+ <span
+ className="pull-right anchor-right dropdown"
+ >
+ <a
+ className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ Add Repository
+ <i
+ className="icon-arrow-down"
+ />
+ </a>
+ <ul
+ className="dropdown-menu"
>
- <div
- className="project-select"
+ <MenuItem
+ noAnchor={true}
>
- <h3>
- <Link
- className="home-crumb"
- to="/org-slug/"
- >
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
- </Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
+ <li
+ className=""
+ href={null}
+ role="presentation"
+ title={null}
+ >
+ <AddRepositoryLink
+ onSuccess={[Function]}
+ orgId="org-slug"
+ provider={
+ Object {
+ "config": Array [
+ Object {
+ "help": "Enter your repository name, including the owner.",
+ "label": "Repository Name",
+ "name": "name",
+ "placeholder": "e.g. getsentry/sentry",
+ "required": true,
+ "type": "text",
+ },
+ ],
+ "id": "github",
+ "name": "GitHub",
+ }
+ }
>
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
+ <a
+ onClick={[Function]}
+ >
+ GitHub
+ <Modal
+ animation={false}
+ autoFocus={true}
+ backdrop={true}
+ bsClass="modal"
+ dialogComponentClass={[Function]}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
+ }
+ }
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ >
+ <Modal
+ autoFocus={true}
+ backdrop={true}
+ backdropClassName="modal-backdrop"
+ backdropTransitionTimeout={150}
+ containerClassName="modal-open"
+ dialogTransitionTimeout={300}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
+ }
+ }
+ onEntering={[Function]}
+ onExited={[Function]}
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
/>
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
- </div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
- >
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
+ </Modal>
+ </a>
+ </AddRepositoryLink>
+ </li>
+ </MenuItem>
+ </ul>
+ </span>
+ </DropdownLink>
+ </div>
+ <h3
+ className="m-b-2"
+ >
+ Repositories
+ </h3>
+ <div
+ className="m-b-2"
+ >
+ <p>
+ Connecting a repository allows Sentry to capture commit data via webhooks. This enables features like suggested assignees and resolving issues via commit message. Once you've connected a repository, you can associate commits with releases via the API.
+
+ <span>
+ <span>
+ See our
+ </span>
+ <a
+ href="https://docs.sentry.io/learn/releases/"
>
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
+ <span>
+ documentation
+ </span>
+ </a>
+ <span>
+ for more details.
+ </span>
+ </span>
+ </p>
+ </div>
+ <div
+ className="panel panel-default"
+ >
+ <table
+ className="table"
+ >
+ <tbody>
+ <tr>
+ <td>
+ <strong>
+ repo-name
+ </strong>
+ <br />
+ <small />
+ <small>
+
+ —
+ <a
+ href="https://github.com/example/repo-name"
+ >
+ https://github.com/example/repo-name
+ </a>
+ </small>
+ </td>
+ <td
style={
Object {
- "marginRight": 5,
+ "width": 60,
}
}
- to="/organizations/org-slug/projects/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Project
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
>
- <a
- className="button button-primary"
+ <Confirm
+ cancelText="Cancel"
+ confirmText="Confirm"
disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Team
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
- <div
- className="container"
- >
- <div
- className="content row"
- >
- <div
- className="col-md-2 org-sidebar"
- >
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- </div>
- </HomeSidebar>
- </div>
- <div
- className="col-md-10"
- >
- <div>
- <div
- className="pull-right"
+ message="Are you sure you want to remove this repository?"
+ onConfirm={[Function]}
+ priority="primary"
>
- <DropdownLink
- anchorRight={true}
- caret={true}
- className="btn btn-primary btn-sm"
- disabled={false}
- title="Add Repository"
- >
- <span
- className="pull-right anchor-right dropdown"
- >
- <a
- className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
- data-toggle="dropdown"
- >
- Add Repository
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
+ <span>
+ <Button
+ disabled={false}
+ onClick={[Function]}
+ size="xsmall"
+ >
+ <button
+ className="button button-default button-xs"
+ disabled={false}
+ onClick={[Function]}
+ role="button"
>
- <MenuItem
- noAnchor={true}
+ <FlowLayout
+ truncate={false}
>
- <li
- className=""
- href={null}
- role="presentation"
- title={null}
+ <div
+ className="flow-layout"
>
- <AddRepositoryLink
- onSuccess={[Function]}
- orgId="org-slug"
- provider={
- Object {
- "config": Array [
- Object {
- "help": "Enter your repository name, including the owner.",
- "label": "Repository Name",
- "name": "name",
- "placeholder": "e.g. getsentry/sentry",
- "required": true,
- "type": "text",
- },
- ],
- "id": "github",
- "name": "GitHub",
- }
- }
- >
- <a
- onClick={[Function]}
- >
- GitHub
- <Modal
- animation={false}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- >
- <Modal
- autoFocus={true}
- backdrop={true}
- backdropClassName="modal-backdrop"
- backdropTransitionTimeout={150}
- containerClassName="modal-open"
- dialogTransitionTimeout={300}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onEntering={[Function]}
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- />
- </Modal>
- </a>
- </AddRepositoryLink>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </div>
- <h3
- className="m-b-2"
- >
- Repositories
- </h3>
- <div
- className="m-b-2"
- >
- <p>
- Connecting a repository allows Sentry to capture commit data via webhooks. This enables features like suggested assignees and resolving issues via commit message. Once you've connected a repository, you can associate commits with releases via the API.
-
- <span>
- <span>
- See our
- </span>
- <a
- href="https://docs.sentry.io/learn/releases/"
- >
- <span>
- documentation
- </span>
- </a>
- <span>
- for more details.
- </span>
- </span>
- </p>
- </div>
- <div
- className="panel panel-default"
- >
- <table
- className="table"
- >
- <tbody>
- <tr>
- <td>
- <strong>
- repo-name
- </strong>
- <br />
- <small />
- <small>
-
- —
- <a
- href="https://github.com/example/repo-name"
+ <span
+ className="button-label"
>
- https://github.com/example/repo-name
- </a>
- </small>
- </td>
- <td
- style={
- Object {
- "width": 60,
- }
- }
- >
- <Confirm
- cancelText="Cancel"
- confirmText="Confirm"
- disabled={false}
- message="Are you sure you want to remove this repository?"
- onConfirm={[Function]}
- priority="primary"
- >
- <span>
- <Button
- disabled={false}
- onClick={[Function]}
- size="xsmall"
- >
- <button
- className="button button-default button-xs"
- disabled={false}
- onClick={[Function]}
- role="button"
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- <span
- className="icon icon-trash"
- />
- </span>
- </div>
- </FlowLayout>
- </button>
- </Button>
- <Modal
- animation={false}
- autoFocus={true}
- backdrop={true}
- bsClass="modal"
- dialogComponentClass={[Function]}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- >
- <Modal
- autoFocus={true}
- backdrop={true}
- backdropClassName="modal-backdrop"
- backdropTransitionTimeout={150}
- containerClassName="modal-open"
- dialogTransitionTimeout={300}
- enforceFocus={true}
- keyboard={true}
- manager={
- ModalManager {
- "containers": Array [],
- "data": Array [],
- "handleContainerOverflow": true,
- "hideSiblingNodes": true,
- "modals": Array [],
- }
- }
- onEntering={[Function]}
- onExited={[Function]}
- onHide={[Function]}
- renderBackdrop={[Function]}
- restoreFocus={true}
- show={false}
- />
- </Modal>
+ <span
+ className="icon icon-trash"
+ />
</span>
- </Confirm>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- </div>
+ </div>
+ </FlowLayout>
+ </button>
+ </Button>
+ <Modal
+ animation={false}
+ autoFocus={true}
+ backdrop={true}
+ bsClass="modal"
+ dialogComponentClass={[Function]}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
+ }
+ }
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ >
+ <Modal
+ autoFocus={true}
+ backdrop={true}
+ backdropClassName="modal-backdrop"
+ backdropTransitionTimeout={150}
+ containerClassName="modal-open"
+ dialogTransitionTimeout={300}
+ enforceFocus={true}
+ keyboard={true}
+ manager={
+ ModalManager {
+ "containers": Array [],
+ "data": Array [],
+ "handleContainerOverflow": true,
+ "hideSiblingNodes": true,
+ "modals": Array [],
+ }
+ }
+ onEntering={[Function]}
+ onExited={[Function]}
+ onHide={[Function]}
+ renderBackdrop={[Function]}
+ restoreFocus={true}
+ show={false}
+ />
+ </Modal>
+ </span>
+ </Confirm>
+ </td>
+ </tr>
+ </tbody>
+ </table>
</div>
- </HomeContainer>
+ </div>
</DocumentTitle>
</OrganizationRepositories>
`;
@@ -1473,12 +445,60 @@ exports[`OrganizationRepositories render() without any providers is loading when
<DocumentTitle
title="Repositories"
>
- <HomeContainer
- params={
- Object {
- "orgId": "org-slug",
- }
+ <div>
+ <div
+ className="pull-right"
+ >
+ <DropdownLink
+ anchorRight={true}
+ caret={true}
+ className="btn btn-primary btn-sm"
+ disabled={false}
+ title="Add Repository"
+ />
+ </div>
+ <h3
+ className="m-b-2"
+ >
+ Repositories
+ </h3>
+ <div
+ className="well blankslate align-center p-x-2 p-y-1"
+ >
+ <div
+ className="icon icon-lg icon-git-commit"
+ />
+ <h3>
+ Sentry is better with commit data
+ </h3>
+ <p>
+ Adding one or more repositories will enable enhanced releases and the ability to resolve Sentry Issues via git message.
+ </p>
+ <p
+ className="m-b-1"
+ >
+ <a
+ className="btn btn-default"
+ href="https://docs.sentry.io/learn/releases/"
+ >
+ Learn more
+ </a>
+ </p>
+ </div>
+ </div>
+</DocumentTitle>
+`;
+
+exports[`OrganizationRepositories render() without any providers renders 1`] = `
+<OrganizationRepositories
+ params={
+ Object {
+ "orgId": "org-slug",
}
+ }
+>
+ <DocumentTitle
+ title="Repositories"
>
<div>
<div
@@ -1490,7 +510,24 @@ exports[`OrganizationRepositories render() without any providers is loading when
className="btn btn-primary btn-sm"
disabled={false}
title="Add Repository"
- />
+ >
+ <span
+ className="pull-right anchor-right dropdown"
+ >
+ <a
+ className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
+ data-toggle="dropdown"
+ >
+ Add Repository
+ <i
+ className="icon-arrow-down"
+ />
+ </a>
+ <ul
+ className="dropdown-menu"
+ />
+ </span>
+ </DropdownLink>
</div>
<h3
className="m-b-2"
@@ -1521,593 +558,6 @@ exports[`OrganizationRepositories render() without any providers is loading when
</p>
</div>
</div>
- </HomeContainer>
-</DocumentTitle>
-`;
-
-exports[`OrganizationRepositories render() without any providers renders 1`] = `
-<OrganizationRepositories
- params={
- Object {
- "orgId": "org-slug",
- }
- }
->
- <DocumentTitle
- title="Repositories"
- >
- <HomeContainer
- params={
- Object {
- "orgId": "org-slug",
- }
- }
- >
- <div
- className=" organization-home"
- >
- <div
- className="sub-header flex flex-container flex-vertically-centered"
- >
- <div>
- <ProjectSelector
- organization={
- Object {
- "access": Array [
- "org:read",
- "org:write",
- "org:admin",
- "project:read",
- "project:write",
- "project:admin",
- "team:read",
- "team:write",
- "team:admin",
- ],
- "features": Array [],
- "id": "3",
- "name": "Organization Name",
- "onboardingTasks": Array [],
- "slug": "org-slug",
- "teams": Array [],
- }
- }
- projectId={null}
- >
- <div
- className="project-select"
- >
- <h3>
- <Link
- className="home-crumb"
- to="/org-slug/"
- >
- <Link
- className="home-crumb"
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- className="home-crumb"
- onClick={[Function]}
- style={Object {}}
- >
- <span
- className="icon-home"
- />
- </a>
- </Link>
- </Link>
- Select a project
- <DropdownLink
- anchorRight={false}
- caret={true}
- disabled={false}
- onClose={[Function]}
- onOpen={[Function]}
- title=""
- topLevelClasses="project-dropdown is-empty"
- >
- <span
- className="project-dropdown is-empty dropdown"
- >
- <a
- className="dropdown-toggle"
- data-toggle="dropdown"
- >
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- >
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <div
- className="empty-message"
- >
- You have no projects.
- </div>
- </li>
- </MenuItem>
- <MenuItem
- divider={true}
- >
- <li
- className="divider"
- href={null}
- role="presentation"
- title={null}
- />
- </MenuItem>
- <MenuItem
- className="empty-projects-item"
- noAnchor={true}
- >
- <li
- className="empty-projects-item"
- href={null}
- role="presentation"
- title={null}
- >
- <a
- className="btn btn-primary btn-block"
- href="/organizations/org-slug/projects/new/"
- >
- Create project
- </a>
- </li>
- </MenuItem>
- </ul>
- </span>
- </DropdownLink>
- </h3>
- </div>
- </ProjectSelector>
- </div>
- <div
- className="align-right hidden-xs"
- >
- <Button
- disabled={false}
- priority="primary"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- to="/organizations/org-slug/projects/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={
- Object {
- "marginRight": 5,
- }
- }
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Project
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- <Button
- disabled={false}
- priority="primary"
- to="/organizations/org-slug/teams/new/"
- >
- <Link
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- onlyActiveOnIndex={false}
- role="button"
- style={Object {}}
- to="/organizations/org-slug/teams/new/"
- >
- <a
- className="button button-primary"
- disabled={false}
- onClick={[Function]}
- role="button"
- style={Object {}}
- >
- <FlowLayout
- truncate={false}
- >
- <div
- className="flow-layout"
- >
- <span
- className="button-label"
- >
- New Team
- </span>
- </div>
- </FlowLayout>
- </a>
- </Link>
- </Button>
- </div>
- </div>
- <div
- className="container"
- >
- <div
- className="content row"
- >
- <div
- className="col-md-2 org-sidebar"
- >
- <HomeSidebar>
- <div>
- <h6
- className="nav-header"
- >
- Organization
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/org-slug/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/org-slug/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Dashboard
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- isActive={[Function]}
- to="/organizations/org-slug/teams/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/teams/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Projects & Teams
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/stats/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/stats/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Stats
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Issues
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/assigned/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/assigned/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Assigned to Me
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/bookmarks/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Bookmarks
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/issues/history/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/issues/history/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- History
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- <div>
- <h6
- className="nav-header with-divider"
- >
- Manage
- </h6>
- <ul
- className="nav nav-stacked"
- >
- <li>
- <a
- href="/organizations/org-slug/members/"
- >
- Members
-
- </a>
- </li>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/audit-log/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/audit-log/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Audit Log
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/rate-limits/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/rate-limits/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Rate Limits
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/repos/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/repos/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Repositories
- </a>
- </Link>
- </li>
- </ListLink>
- <ListLink
- activeClassName="active"
- index={false}
- to="/organizations/org-slug/settings/"
- >
- <li
- className=""
- >
- <Link
- onlyActiveOnIndex={false}
- style={Object {}}
- to="/organizations/org-slug/settings/"
- >
- <a
- onClick={[Function]}
- style={Object {}}
- >
- Settings
- </a>
- </Link>
- </li>
- </ListLink>
- </ul>
- </div>
- </div>
- </HomeSidebar>
- </div>
- <div
- className="col-md-10"
- >
- <div>
- <div
- className="pull-right"
- >
- <DropdownLink
- anchorRight={true}
- caret={true}
- className="btn btn-primary btn-sm"
- disabled={false}
- title="Add Repository"
- >
- <span
- className="pull-right anchor-right dropdown"
- >
- <a
- className="btn btn-primary btn-sm dropdown-menu-right dropdown-toggle"
- data-toggle="dropdown"
- >
- Add Repository
- <i
- className="icon-arrow-down"
- />
- </a>
- <ul
- className="dropdown-menu"
- />
- </span>
- </DropdownLink>
- </div>
- <h3
- className="m-b-2"
- >
- Repositories
- </h3>
- <div
- className="well blankslate align-center p-x-2 p-y-1"
- >
- <div
- className="icon icon-lg icon-git-commit"
- />
- <h3>
- Sentry is better with commit data
- </h3>
- <p>
- Adding one or more repositories will enable enhanced releases and the ability to resolve Sentry Issues via git message.
- </p>
- <p
- className="m-b-1"
- >
- <a
- className="btn btn-default"
- href="https://docs.sentry.io/learn/releases/"
- >
- Learn more
- </a>
- </p>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </HomeContainer>
</DocumentTitle>
</OrganizationRepositories>
`;
diff --git a/tests/js/spec/views/organizationApiKeyDetailsView.spec.jsx b/tests/js/spec/views/organizationApiKeyDetailsView.spec.jsx
index 75a982b175dbac..093c866a0bfd09 100644
--- a/tests/js/spec/views/organizationApiKeyDetailsView.spec.jsx
+++ b/tests/js/spec/views/organizationApiKeyDetailsView.spec.jsx
@@ -5,6 +5,8 @@ import {Client} from 'app/api';
import OrganizationApiKeyDetailsView
from 'app/views/settings/organization/apiKeys/organizationApiKeyDetailsView';
+jest.mock('jquery');
+
const childContextTypes = {
organization: React.PropTypes.object,
router: React.PropTypes.object,
|
f021d4e09343b293385707a458a8b7e5b9f6c801
|
2019-01-12 21:10:34
|
Armin Ronacher
|
feat: Silently ignore CFI errors as far as users are concerned (#11496)
| false
|
Silently ignore CFI errors as far as users are concerned (#11496)
|
feat
|
diff --git a/src/sentry/models/debugfile.py b/src/sentry/models/debugfile.py
index 8d4ac32a55a862..58f272e3e4cf3d 100644
--- a/src/sentry/models/debugfile.py
+++ b/src/sentry/models/debugfile.py
@@ -636,8 +636,17 @@ def _generate_caches_impl(self, dif, filepath):
return error
_, _, error = self._update_cachefile(dif, filepath, ProjectCfiCacheFile)
+
+ # CFI generation will never fail to the user. We instead log it here
+ # for reference only. This is because we have currently limited trust
+ # in our CFI generation and even without CFI information we can
+ # continue processing stacktraces.
if error is not None:
- return error
+ logger.warning('dsymfile.cfi-generation-failed', extra=dict(
+ error=error,
+ debug_id=dif.debug_id
+ ))
+ return None
return None
|
14e2ac473935957ec9223ce46b42c71f607a2b55
|
2024-10-04 01:14:29
|
Andrew Liu
|
chore(feedback): remove user-feedback-ingest rollout flag (#78097)
| false
|
remove user-feedback-ingest rollout flag (#78097)
|
chore
|
diff --git a/src/sentry/features/temporary.py b/src/sentry/features/temporary.py
index c3f0e6f7d211f3..06e16837f9504c 100644
--- a/src/sentry/features/temporary.py
+++ b/src/sentry/features/temporary.py
@@ -510,8 +510,6 @@ def register_temporary_features(manager: FeatureManager):
# Enables uptime related settings for projects and orgs
manager.add('organizations:uptime-settings', OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
manager.add("organizations:use-metrics-layer", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
- # Enable User Feedback v2 ingest
- manager.add("organizations:user-feedback-ingest", OrganizationFeature, FeatureHandlerStrategy.INTERNAL, api_expose=False)
# Use ReplayClipPreview inside the User Feedback Details panel
manager.add("organizations:user-feedback-replay-clip", OrganizationFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)
# Enable User Feedback spam auto filtering feature ingest
diff --git a/src/sentry/feedback/usecases/create_feedback.py b/src/sentry/feedback/usecases/create_feedback.py
index 57c9aae5e4a033..e379ba3c0dfcd4 100644
--- a/src/sentry/feedback/usecases/create_feedback.py
+++ b/src/sentry/feedback/usecases/create_feedback.py
@@ -8,7 +8,7 @@
import jsonschema
-from sentry import features
+from sentry import features, options
from sentry.constants import DataCategory
from sentry.eventstore.models import Event, GroupEvent
from sentry.feedback.usecases.spam_detection import is_spam
@@ -353,6 +353,9 @@ def shim_to_feedback(
User feedbacks are an event type, so we try and grab as much from the
legacy user report and event to create the new feedback.
"""
+ if is_in_feedback_denylist(project.organization):
+ return
+
try:
feedback_event: dict[str, Any] = {
"contexts": {
@@ -399,3 +402,7 @@ def auto_ignore_spam_feedbacks(project, issue_fingerprint):
new_substatus=GroupSubStatus.FOREVER,
),
)
+
+
+def is_in_feedback_denylist(organization):
+ return organization.slug in options.get("feedback.organizations.slug-denylist")
diff --git a/src/sentry/ingest/consumer/processors.py b/src/sentry/ingest/consumer/processors.py
index 3f067f0d8dbfb2..1247a95f75ad53 100644
--- a/src/sentry/ingest/consumer/processors.py
+++ b/src/sentry/ingest/consumer/processors.py
@@ -13,7 +13,7 @@
from sentry.attachments import CachedAttachment, attachment_cache
from sentry.event_manager import save_attachment
from sentry.eventstore.processing import event_processing_store
-from sentry.feedback.usecases.create_feedback import FeedbackCreationSource
+from sentry.feedback.usecases.create_feedback import FeedbackCreationSource, is_in_feedback_denylist
from sentry.ingest.userreport import Conflict, save_userreport
from sentry.killswitches import killswitch_matches_context
from sentry.models.project import Project
@@ -193,7 +193,7 @@ def process_event(
except Exception:
pass
elif data.get("type") == "feedback":
- if features.has("organizations:user-feedback-ingest", project.organization, actor=None):
+ if not is_in_feedback_denylist(project.organization):
save_event_feedback.delay(
cache_key=None, # no need to cache as volume is low
data=data,
@@ -201,6 +201,8 @@ def process_event(
event_id=event_id,
project_id=project_id,
)
+ else:
+ metrics.incr("feedback.ingest.filtered", tags={"reason": "org.denylist"})
else:
# Preprocess this event, which spawns either process_event or
# save_event. Pass data explicitly to avoid fetching it again from the
diff --git a/src/sentry/ingest/userreport.py b/src/sentry/ingest/userreport.py
index 71b777fc04c853..904f66418b89d3 100644
--- a/src/sentry/ingest/userreport.py
+++ b/src/sentry/ingest/userreport.py
@@ -6,10 +6,11 @@
from django.db import IntegrityError, router
from django.utils import timezone
-from sentry import eventstore, features, options
+from sentry import eventstore, options
from sentry.eventstore.models import Event, GroupEvent
from sentry.feedback.usecases.create_feedback import (
UNREAL_FEEDBACK_UNATTENDED_MESSAGE,
+ is_in_feedback_denylist,
shim_to_feedback,
)
from sentry.models.userreport import UserReport
@@ -32,7 +33,8 @@ def save_userreport(
start_time=None,
):
with metrics.timer("sentry.ingest.userreport.save_userreport"):
- if is_org_in_denylist(project.organization):
+ if is_in_feedback_denylist(project.organization):
+ metrics.incr("user_report.create_user_report.filtered", tags={"reason": "org.denylist"})
return
if should_filter_user_report(report["comments"]):
return
@@ -97,24 +99,19 @@ def save_userreport(
user_feedback_received.send(project=project, sender=save_userreport)
- has_feedback_ingest = features.has(
- "organizations:user-feedback-ingest", project.organization, actor=None
- )
logger.info(
"ingest.user_report",
extra={
"project_id": project.id,
"event_id": report["event_id"],
"has_event": bool(event),
- "has_feedback_ingest": has_feedback_ingest,
},
)
metrics.incr(
"user_report.create_user_report.saved",
- tags={"has_event": bool(event), "has_feedback_ingest": has_feedback_ingest},
+ tags={"has_event": bool(event)},
)
-
- if has_feedback_ingest and event:
+ if event:
logger.info(
"ingest.user_report.shim_to_feedback",
extra={"project_id": project.id, "event_id": report["event_id"]},
@@ -150,10 +147,3 @@ def should_filter_user_report(comments: str):
return True
return False
-
-
-def is_org_in_denylist(organization):
- if organization.slug in options.get("feedback.organizations.slug-denylist"):
- metrics.incr("user_report.create_user_report.filtered", tags={"reason": "org.denylist"})
- return True
- return False
diff --git a/src/sentry/tasks/update_user_reports.py b/src/sentry/tasks/update_user_reports.py
index fbdcaca4de187e..0075f46dd8e02e 100644
--- a/src/sentry/tasks/update_user_reports.py
+++ b/src/sentry/tasks/update_user_reports.py
@@ -5,8 +5,12 @@
import sentry_sdk
from django.utils import timezone
-from sentry import eventstore, features, quotas
-from sentry.feedback.usecases.create_feedback import FeedbackCreationSource, shim_to_feedback
+from sentry import eventstore, quotas
+from sentry.feedback.usecases.create_feedback import (
+ FeedbackCreationSource,
+ is_in_feedback_denylist,
+ shim_to_feedback,
+)
from sentry.models.project import Project
from sentry.models.userreport import UserReport
from sentry.silo.base import SiloMode
@@ -86,9 +90,7 @@ def update_user_reports(**kwargs: Any) -> None:
for event in events:
report = report_by_event.get(event.event_id)
if report:
- if features.has(
- "organizations:user-feedback-ingest", project.organization, actor=None
- ):
+ if not is_in_feedback_denylist(project.organization):
logger.info(
"update_user_reports.shim_to_feedback",
extra={"report_id": report.id, "event_id": event.event_id},
diff --git a/src/sentry/web/frontend/error_page_embed.py b/src/sentry/web/frontend/error_page_embed.py
index fdfc803460ce42..68c608e88303be 100644
--- a/src/sentry/web/frontend/error_page_embed.py
+++ b/src/sentry/web/frontend/error_page_embed.py
@@ -11,7 +11,7 @@
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import View
-from sentry import eventstore, features
+from sentry import eventstore
from sentry.feedback.usecases.create_feedback import FeedbackCreationSource, shim_to_feedback
from sentry.models.options.project_option import ProjectOption
from sentry.models.project import Project
@@ -194,12 +194,7 @@ def dispatch(self, request: HttpRequest) -> HttpResponse:
)
project = Project.objects.get(id=report.project_id)
- if (
- features.has(
- "organizations:user-feedback-ingest", project.organization, actor=request.user
- )
- and event is not None
- ):
+ if event is not None:
shim_to_feedback(
{
"name": report.name,
diff --git a/tests/sentry/api/endpoints/test_project_user_reports.py b/tests/sentry/api/endpoints/test_project_user_reports.py
index 982866e6218f81..a057863df6e9e8 100644
--- a/tests/sentry/api/endpoints/test_project_user_reports.py
+++ b/tests/sentry/api/endpoints/test_project_user_reports.py
@@ -432,16 +432,15 @@ def test_simple_shim_to_feedback(self, mock_produce_occurrence_to_kafka):
url = _make_url(self.project)
- with self.feature("organizations:user-feedback-ingest"):
- response = self.client.post(
- url,
- data={
- "event_id": event_with_replay.event_id,
- "email": "[email protected]",
- "name": "Foo Bar",
- "comments": "It broke!",
- },
- )
+ response = self.client.post(
+ url,
+ data={
+ "event_id": event_with_replay.event_id,
+ "email": "[email protected]",
+ "name": "Foo Bar",
+ "comments": "It broke!",
+ },
+ )
assert response.status_code == 200, response.content
@@ -480,16 +479,15 @@ def test_simple_shim_to_feedback_no_event_should_not_call(
url = _make_url(self.project)
event_id = uuid4().hex
- with self.feature("organizations:user-feedback-ingest"):
- response = self.client.post(
- url,
- data={
- "event_id": event_id,
- "email": "[email protected]",
- "name": "Foo Bar",
- "comments": "It broke!",
- },
- )
+ response = self.client.post(
+ url,
+ data={
+ "event_id": event_id,
+ "email": "[email protected]",
+ "name": "Foo Bar",
+ "comments": "It broke!",
+ },
+ )
assert response.status_code == 200, response.content
diff --git a/tests/sentry/feedback/usecases/test_create_feedback.py b/tests/sentry/feedback/usecases/test_create_feedback.py
index 69496b24ff69a0..7dd67ab96eb867 100644
--- a/tests/sentry/feedback/usecases/test_create_feedback.py
+++ b/tests/sentry/feedback/usecases/test_create_feedback.py
@@ -14,6 +14,7 @@
FeedbackCreationSource,
create_feedback_issue,
fix_for_issue_platform,
+ is_in_feedback_denylist,
shim_to_feedback,
validate_issue_platform_event_schema,
)
@@ -814,3 +815,17 @@ def test_shim_to_feedback_missing_fields(default_project, monkeypatch):
report_dict, event, default_project, FeedbackCreationSource.USER_REPORT_ENVELOPE # type: ignore[arg-type]
)
assert mock_create_feedback_issue.call_count == 0
+
+
+@django_db_all
+def test_denylist(set_sentry_option, default_project):
+ with set_sentry_option(
+ "feedback.organizations.slug-denylist", [default_project.organization.slug]
+ ):
+ assert is_in_feedback_denylist(default_project.organization) is True
+
+
+@django_db_all
+def test_denylist_not_in_list(set_sentry_option, default_project):
+ with set_sentry_option("feedback.organizations.slug-denylist", ["not-in-list"]):
+ assert is_in_feedback_denylist(default_project.organization) is False
diff --git a/tests/sentry/ingest/test_userreport.py b/tests/sentry/ingest/test_userreport.py
index 4b9bef8e370bc8..faa483743cd8ca 100644
--- a/tests/sentry/ingest/test_userreport.py
+++ b/tests/sentry/ingest/test_userreport.py
@@ -1,5 +1,5 @@
from sentry.feedback.usecases.create_feedback import UNREAL_FEEDBACK_UNATTENDED_MESSAGE
-from sentry.ingest.userreport import is_org_in_denylist, save_userreport, should_filter_user_report
+from sentry.ingest.userreport import save_userreport, should_filter_user_report
from sentry.models.userreport import UserReport
from sentry.testutils.pytest.fixtures import django_db_all
@@ -22,24 +22,10 @@ def test_empty_message(set_sentry_option):
assert should_filter_user_report("") is True
-@django_db_all
-def test_org_denylist(set_sentry_option, default_project):
- with set_sentry_option(
- "feedback.organizations.slug-denylist", [default_project.organization.slug]
- ):
- assert is_org_in_denylist(default_project.organization) is True
-
-
-@django_db_all
-def test_org_denylist_not_in_list(set_sentry_option, default_project):
- with set_sentry_option("feedback.organizations.slug-denylist", ["not-in-list"]):
- assert is_org_in_denylist(default_project.organization) is False
-
-
@django_db_all
def test_save_user_report_returns_instance(set_sentry_option, default_project, monkeypatch):
# Mocking dependencies and setting up test data
- monkeypatch.setattr("sentry.ingest.userreport.is_org_in_denylist", lambda org: False)
+ monkeypatch.setattr("sentry.ingest.userreport.is_in_feedback_denylist", lambda org: False)
monkeypatch.setattr("sentry.ingest.userreport.should_filter_user_report", lambda message: False)
monkeypatch.setattr(
"sentry.ingest.userreport.UserReport.objects.create", lambda **kwargs: UserReport()
@@ -66,7 +52,7 @@ def test_save_user_report_returns_instance(set_sentry_option, default_project, m
@django_db_all
def test_save_user_report_denylist(set_sentry_option, default_project, monkeypatch):
- monkeypatch.setattr("sentry.ingest.userreport.is_org_in_denylist", lambda org: True)
+ monkeypatch.setattr("sentry.ingest.userreport.is_in_feedback_denylist", lambda org: True)
report = {
"event_id": "123456",
"name": "Test User",
diff --git a/tests/sentry/tasks/test_update_user_reports.py b/tests/sentry/tasks/test_update_user_reports.py
index 9e2b07b55f3fc9..1bed0fa40fa172 100644
--- a/tests/sentry/tasks/test_update_user_reports.py
+++ b/tests/sentry/tasks/test_update_user_reports.py
@@ -140,7 +140,7 @@ def test_simple_calls_feedback_shim_if_ff_enabled(self, mock_produce_occurrence_
email="[email protected]",
name="Foo Bar",
)
- with self.feature("organizations:user-feedback-ingest"), self.tasks():
+ with self.tasks():
update_user_reports(max_events=2)
report1 = UserReport.objects.get(project_id=project.id, event_id=event1.event_id)
diff --git a/tests/sentry/web/frontend/test_error_page_embed.py b/tests/sentry/web/frontend/test_error_page_embed.py
index 444d289d088270..fe3e462e2c67d3 100644
--- a/tests/sentry/web/frontend/test_error_page_embed.py
+++ b/tests/sentry/web/frontend/test_error_page_embed.py
@@ -238,39 +238,37 @@ def test_environment_gets_user_report(self):
@mock.patch("sentry.feedback.usecases.create_feedback.produce_occurrence_to_kafka")
def test_calls_feedback_shim_if_ff_enabled(self, mock_produce_occurrence_to_kafka):
self.make_event(environment=self.environment.name, event_id=self.event_id)
- with self.feature({"organizations:user-feedback-ingest": True}):
- self.client.post(
- self.path,
- {
- "name": "Jane Bloggs",
- "email": "[email protected]",
- "comments": "This is an example!",
- },
- HTTP_REFERER="http://example.com",
- HTTP_ACCEPT="application/json",
- )
- assert len(mock_produce_occurrence_to_kafka.mock_calls) == 1
- mock_event_data = mock_produce_occurrence_to_kafka.call_args_list[0][1]["event_data"]
- assert mock_event_data["contexts"]["feedback"]["contact_email"] == "[email protected]"
- assert mock_event_data["contexts"]["feedback"]["message"] == "This is an example!"
- assert mock_event_data["contexts"]["feedback"]["name"] == "Jane Bloggs"
- assert mock_event_data["platform"] == "other"
- assert mock_event_data["contexts"]["feedback"]["associated_event_id"] == self.event_id
- assert mock_event_data["level"] == "error"
+ self.client.post(
+ self.path,
+ {
+ "name": "Jane Bloggs",
+ "email": "[email protected]",
+ "comments": "This is an example!",
+ },
+ HTTP_REFERER="http://example.com",
+ HTTP_ACCEPT="application/json",
+ )
+ assert len(mock_produce_occurrence_to_kafka.mock_calls) == 1
+ mock_event_data = mock_produce_occurrence_to_kafka.call_args_list[0][1]["event_data"]
+ assert mock_event_data["contexts"]["feedback"]["contact_email"] == "[email protected]"
+ assert mock_event_data["contexts"]["feedback"]["message"] == "This is an example!"
+ assert mock_event_data["contexts"]["feedback"]["name"] == "Jane Bloggs"
+ assert mock_event_data["platform"] == "other"
+ assert mock_event_data["contexts"]["feedback"]["associated_event_id"] == self.event_id
+ assert mock_event_data["level"] == "error"
@mock.patch("sentry.feedback.usecases.create_feedback.produce_occurrence_to_kafka")
def test_does_not_call_feedback_shim_no_event_if_ff_enabled(
self, mock_produce_occurrence_to_kafka
):
- with self.feature({"organizations:user-feedback-ingest": True}):
- self.client.post(
- self.path,
- {
- "name": "Jane Bloggs",
- "email": "[email protected]",
- "comments": "This is an example!",
- },
- HTTP_REFERER="http://example.com",
- HTTP_ACCEPT="application/json",
- )
- assert len(mock_produce_occurrence_to_kafka.mock_calls) == 0
+ self.client.post(
+ self.path,
+ {
+ "name": "Jane Bloggs",
+ "email": "[email protected]",
+ "comments": "This is an example!",
+ },
+ HTTP_REFERER="http://example.com",
+ HTTP_ACCEPT="application/json",
+ )
+ assert len(mock_produce_occurrence_to_kafka.mock_calls) == 0
|
c3dd90af179ca002555d66ac5e68b67e86674f91
|
2021-10-12 02:21:09
|
NisanthanNanthakumar
|
feat(alert-rule): Render Alert Rule UI Component in Metric Alerts (#29103)
| false
|
Render Alert Rule UI Component in Metric Alerts (#29103)
|
feat
|
diff --git a/src/sentry/incidents/endpoints/organization_alert_rule_available_action_index.py b/src/sentry/incidents/endpoints/organization_alert_rule_available_action_index.py
index 19960e90b2aab6..b46d3100cfb560 100644
--- a/src/sentry/incidents/endpoints/organization_alert_rule_available_action_index.py
+++ b/src/sentry/incidents/endpoints/organization_alert_rule_available_action_index.py
@@ -47,6 +47,7 @@ def build_action_response(
elif sentry_app_installation:
action_response["sentryAppName"] = sentry_app_installation.sentry_app.name
action_response["sentryAppId"] = sentry_app_installation.sentry_app_id
+ action_response["sentryAppInstallationUuid"] = sentry_app_installation.uuid
action_response["status"] = SentryAppStatus.as_str(
sentry_app_installation.sentry_app.status
)
diff --git a/static/app/views/alerts/incidentRules/triggers/actionsPanel/index.tsx b/static/app/views/alerts/incidentRules/triggers/actionsPanel/index.tsx
index 5cafa9dd821d70..9151d84fbd503b 100644
--- a/static/app/views/alerts/incidentRules/triggers/actionsPanel/index.tsx
+++ b/static/app/views/alerts/incidentRules/triggers/actionsPanel/index.tsx
@@ -3,12 +3,13 @@ import styled from '@emotion/styled';
import * as Sentry from '@sentry/react';
import {addErrorMessage} from 'app/actionCreators/indicator';
+import {openModal} from 'app/actionCreators/modal';
import Button from 'app/components/button';
import SelectControl from 'app/components/forms/selectControl';
import ListItem from 'app/components/list/listItem';
import LoadingIndicator from 'app/components/loadingIndicator';
import {PanelItem} from 'app/components/panels';
-import {IconAdd} from 'app/icons';
+import {IconAdd, IconSettings} from 'app/icons';
import {t} from 'app/locale';
import space from 'app/styles/space';
import {Organization, Project, SelectValue} from 'app/types';
@@ -27,6 +28,7 @@ import {
TargetLabel,
Trigger,
} from 'app/views/alerts/incidentRules/types';
+import SentryAppRuleModal from 'app/views/alerts/issueRuleEditor/sentryAppRuleModal';
type Props = {
availableActions: MetricActionTemplate[] | null;
@@ -211,6 +213,30 @@ class ActionsPanel extends PureComponent<Props> {
onChange(triggerIndex, triggers, replaceAtArrayIndex(actions, index, newAction));
};
+ /**
+ * Update the Trigger's Action fields from the SentryAppRuleModal together
+ * only after the user clicks "Save Changes".
+ * @param formData Form data
+ */
+ updateParentFromSentryAppRule = (
+ triggerIndex: number,
+ actionIndex: number,
+ formData: {[key: string]: string}
+ ): void => {
+ const {triggers, onChange} = this.props;
+ const {actions} = triggers[triggerIndex];
+ const newAction = {
+ ...actions[actionIndex],
+ ...formData,
+ };
+
+ onChange(
+ triggerIndex,
+ triggers,
+ replaceAtArrayIndex(actions, actionIndex, newAction)
+ );
+ };
+
render() {
const {
availableActions,
@@ -314,6 +340,39 @@ class ActionsPanel extends PureComponent<Props> {
actionIdx
)}
/>
+ ) : availableAction &&
+ availableAction.type === 'sentry_app' &&
+ availableAction.settings ? (
+ <Button
+ icon={<IconSettings />}
+ type="button"
+ onClick={() => {
+ openModal(
+ deps => (
+ <SentryAppRuleModal
+ {...deps}
+ // Using ! for keys that will exist for sentryapps
+ sentryAppInstallationUuid={
+ availableAction.sentryAppInstallationUuid!
+ }
+ config={availableAction.settings!}
+ appName={availableAction.sentryAppName!}
+ onSubmitSuccess={this.updateParentFromSentryAppRule.bind(
+ this,
+ triggerIndex,
+ actionIdx
+ )}
+ resetValues={
+ triggers[triggerIndex].actions[actionIdx] || {}
+ }
+ />
+ ),
+ {allowClickClose: false}
+ );
+ }}
+ >
+ {t('Settings')}
+ </Button>
) : null}
<ActionTargetSelector
action={action}
diff --git a/static/app/views/alerts/incidentRules/types.tsx b/static/app/views/alerts/incidentRules/types.tsx
index 0d8e3f7f68c170..0c2b2dabe5f4e6 100644
--- a/static/app/views/alerts/incidentRules/types.tsx
+++ b/static/app/views/alerts/incidentRules/types.tsx
@@ -1,4 +1,5 @@
import {t} from 'app/locale';
+import {SchemaFormConfig} from 'app/views/organizationIntegrations/sentryAppExternalForm';
export enum AlertRuleThresholdType {
ABOVE,
@@ -185,6 +186,7 @@ export type MetricActionTemplate = {
*/
sentryAppId?: number;
+ sentryAppInstallationUuid?: string;
/**
* For some available actions, we pass in the list of available targets.
*/
@@ -194,6 +196,11 @@ export type MetricActionTemplate = {
* If this is a `sentry_app` action, this is the Sentry App's status.
*/
status?: 'unpublished' | 'published' | 'internal';
+
+ /**
+ * Sentry App Alert Rule UI Component settings
+ */
+ settings?: SchemaFormConfig;
};
/**
|
3d6983ecd9f416bf85d9c6c68a5203798c8a0bcb
|
2022-02-16 01:13:12
|
Vu Luong
|
fix(ui): Remove icons from dropdown menus (#31832)
| false
|
Remove icons from dropdown menus (#31832)
|
fix
|
diff --git a/static/app/views/alerts/rules/row.tsx b/static/app/views/alerts/rules/row.tsx
index 2d24f31ad6dc24..25c1c3ab78f81a 100644
--- a/static/app/views/alerts/rules/row.tsx
+++ b/static/app/views/alerts/rules/row.tsx
@@ -7,12 +7,13 @@ import ActorAvatar from 'sentry/components/avatar/actorAvatar';
import {openConfirmModal} from 'sentry/components/confirm';
import DateTime from 'sentry/components/dateTime';
import DropdownMenuControlV2 from 'sentry/components/dropdownMenuControlV2';
+import {MenuItemProps} from 'sentry/components/dropdownMenuItemV2';
import ErrorBoundary from 'sentry/components/errorBoundary';
import IdBadge from 'sentry/components/idBadge';
import Link from 'sentry/components/links/link';
import TimeSince from 'sentry/components/timeSince';
import Tooltip from 'sentry/components/tooltip';
-import {IconArrow, IconDelete, IconEdit, IconEllipsis} from 'sentry/icons';
+import {IconArrow, IconEllipsis} from 'sentry/icons';
import {t, tct} from 'sentry/locale';
import overflowEllipsis from 'sentry/styles/overflowEllipsis';
import space from 'sentry/styles/space';
@@ -158,17 +159,16 @@ function RuleListRow({
[IncidentStatus.OPENED]: t('Resolved'),
};
- const actions = [
+ const actions: MenuItemProps[] = [
{
key: 'edit',
label: t('Edit'),
- leadingItems: <IconEdit />,
to: editLink,
},
{
key: 'delete',
label: t('Delete'),
- leadingItems: <IconDelete />,
+ priority: 'danger',
onAction: () => {
openConfirmModal({
onConfirm: () => onDelete(slug, rule),
diff --git a/static/app/views/dashboardsV2/manage/dashboardList.tsx b/static/app/views/dashboardsV2/manage/dashboardList.tsx
index 5eae1c52a118ff..33685c3b7def5e 100644
--- a/static/app/views/dashboardsV2/manage/dashboardList.tsx
+++ b/static/app/views/dashboardsV2/manage/dashboardList.tsx
@@ -17,7 +17,7 @@ import {MenuItemProps} from 'sentry/components/dropdownMenuItemV2';
import EmptyStateWarning from 'sentry/components/emptyStateWarning';
import Pagination from 'sentry/components/pagination';
import TimeSince from 'sentry/components/timeSince';
-import {IconCopy, IconDelete, IconEllipsis} from 'sentry/icons';
+import {IconEllipsis} from 'sentry/icons';
import {t, tn} from 'sentry/locale';
import space from 'sentry/styles/space';
import {Organization} from 'sentry/types';
@@ -88,13 +88,11 @@ function DashboardList({
{
key: 'dashboard-duplicate',
label: t('Duplicate'),
- leadingItems: <IconCopy />,
onAction: () => handleDuplicate(dashboard),
},
{
key: 'dashboard-delete',
label: t('Delete'),
- leadingItems: <IconDelete />,
priority: 'danger',
onAction: () => {
openConfirmModal({
diff --git a/static/app/views/dashboardsV2/widgetCard/widgetCardContextMenu.tsx b/static/app/views/dashboardsV2/widgetCard/widgetCardContextMenu.tsx
index 59bd846243e42a..48f33809d42561 100644
--- a/static/app/views/dashboardsV2/widgetCard/widgetCardContextMenu.tsx
+++ b/static/app/views/dashboardsV2/widgetCard/widgetCardContextMenu.tsx
@@ -6,14 +6,7 @@ import {parseArithmetic} from 'sentry/components/arithmeticInput/parser';
import {openConfirmModal} from 'sentry/components/confirm';
import DropdownMenuControlV2 from 'sentry/components/dropdownMenuControlV2';
import {MenuItemProps} from 'sentry/components/dropdownMenuItemV2';
-import {
- IconCopy,
- IconDelete,
- IconEdit,
- IconEllipsis,
- IconIssues,
- IconTelescope,
-} from 'sentry/icons';
+import {IconEllipsis} from 'sentry/icons';
import {t} from 'sentry/locale';
import space from 'sentry/styles/space';
import {Organization, PageFilters} from 'sentry/types';
@@ -141,7 +134,6 @@ function WidgetCardContextMenu({
menuOptions.push({
key: 'open-in-discover',
label: t('Open in Discover'),
- leadingItems: <IconTelescope />,
to: widget.queries.length === 1 ? discoverPath : undefined,
onAction: () => {
if (widget.queries.length === 1) {
@@ -177,7 +169,6 @@ function WidgetCardContextMenu({
menuOptions.push({
key: 'open-in-issues',
label: t('Open in Issues'),
- leadingItems: <IconIssues />,
to: issuesLocation,
});
}
@@ -186,7 +177,6 @@ function WidgetCardContextMenu({
menuOptions.push({
key: 'duplicate-widget',
label: t('Duplicate Widget'),
- leadingItems: <IconCopy />,
onAction: () => onDuplicate?.(),
});
widgetLimitReached && disabledKeys.push('duplicate-widget');
@@ -194,14 +184,12 @@ function WidgetCardContextMenu({
menuOptions.push({
key: 'edit-widget',
label: t('Edit Widget'),
- leadingItems: <IconEdit />,
onAction: () => onEdit?.(),
});
menuOptions.push({
key: 'delete-widget',
label: t('Delete Widget'),
- leadingItems: <IconDelete />,
priority: 'danger',
onAction: () => {
openConfirmModal({
diff --git a/static/app/views/eventsV2/queryList.tsx b/static/app/views/eventsV2/queryList.tsx
index 103f917780efa3..46a1241bade48b 100644
--- a/static/app/views/eventsV2/queryList.tsx
+++ b/static/app/views/eventsV2/queryList.tsx
@@ -14,7 +14,7 @@ import {MenuItemProps} from 'sentry/components/dropdownMenuItemV2';
import EmptyStateWarning from 'sentry/components/emptyStateWarning';
import Pagination from 'sentry/components/pagination';
import TimeSince from 'sentry/components/timeSince';
-import {IconCopy, IconDelete, IconEllipsis, IconGraph} from 'sentry/icons';
+import {IconEllipsis} from 'sentry/icons';
import {t} from 'sentry/locale';
import space from 'sentry/styles/space';
import {Organization, SavedQuery} from 'sentry/types';
@@ -211,7 +211,6 @@ class QueryList extends React.Component<Props> {
{
key: 'add-to-dashboard',
label: t('Add to Dashboard'),
- leadingItems: <IconGraph />,
onAction: () => this.handleAddQueryToDashboard(eventView),
},
];
@@ -279,7 +278,6 @@ class QueryList extends React.Component<Props> {
{
key: 'add-to-dashboard',
label: t('Add to Dashboard'),
- leadingItems: <IconGraph />,
onAction: () => this.handleAddQueryToDashboard(eventView, savedQuery),
},
]
@@ -287,14 +285,12 @@ class QueryList extends React.Component<Props> {
{
key: 'duplicate',
label: t('Duplicate Query'),
- leadingItems: <IconCopy />,
onAction: () =>
this.handleDuplicateQuery(eventView, decodeList(savedQuery.yAxis)),
},
{
key: 'delete',
label: t('Delete Query'),
- leadingItems: <IconDelete />,
priority: 'danger',
onAction: () => this.handleDeleteQuery(eventView),
},
|
b5aad1448bf1d75d1ba8db140b67813ec8b87669
|
2024-10-11 04:42:18
|
Scott Cooper
|
fix(issues): Rename trace section (#78982)
| false
|
Rename trace section (#78982)
|
fix
|
diff --git a/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx b/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx
index a7259c966137e6..74a73fe54df4f4 100644
--- a/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx
+++ b/static/app/components/events/interfaces/performance/eventTraceView.spec.tsx
@@ -100,7 +100,7 @@ describe('EventTraceView', () => {
render(<EventTraceView group={group} event={event} organization={organization} />);
- expect(await screen.findByText('Trace Connections')).toBeInTheDocument();
+ expect(await screen.findByText('Trace')).toBeInTheDocument();
expect(await screen.findByText('transaction')).toBeInTheDocument();
});
@@ -126,7 +126,7 @@ describe('EventTraceView', () => {
render(<EventTraceView group={group} event={event} organization={organization} />);
- expect(await screen.findByText('Trace Connections')).toBeInTheDocument();
+ expect(await screen.findByText('Trace')).toBeInTheDocument();
expect(
await screen.findByRole('link', {name: 'View Full Trace'})
).toBeInTheDocument();
diff --git a/static/app/components/events/interfaces/performance/eventTraceView.tsx b/static/app/components/events/interfaces/performance/eventTraceView.tsx
index c26611eb74890a..4162a65d4b2827 100644
--- a/static/app/components/events/interfaces/performance/eventTraceView.tsx
+++ b/static/app/components/events/interfaces/performance/eventTraceView.tsx
@@ -154,7 +154,7 @@ export function EventTraceView({group, event, organization}: EventTraceViewProps
return (
<ErrorBoundary mini>
- <InterimSection type={SectionKey.TRACE} title={t('Trace Connections')}>
+ <InterimSection type={SectionKey.TRACE} title={t('Trace')}>
<TraceContentWrapper>
<div>
<TraceDataSection event={event} />
diff --git a/static/app/views/issueDetails/streamline/eventNavigation.tsx b/static/app/views/issueDetails/streamline/eventNavigation.tsx
index 0efb2c98027f6f..ec251e30ccf2f9 100644
--- a/static/app/views/issueDetails/streamline/eventNavigation.tsx
+++ b/static/app/views/issueDetails/streamline/eventNavigation.tsx
@@ -79,7 +79,7 @@ const EventNavOrder = [
const sectionLabels = {
[SectionKey.HIGHLIGHTS]: t('Event Highlights'),
[SectionKey.STACKTRACE]: t('Stack Trace'),
- [SectionKey.TRACE]: t('Trace Connections'),
+ [SectionKey.TRACE]: t('Trace'),
[SectionKey.EXCEPTION]: t('Stack Trace'),
[SectionKey.BREADCRUMBS]: t('Breadcrumbs'),
[SectionKey.TAGS]: t('Tags'),
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.