|
1 | 1 | import {useEffect} from 'react'; |
2 | 2 | import styled from '@emotion/styled'; |
| 3 | +import * as Sentry from '@sentry/react'; |
3 | 4 | import moment from 'moment-timezone'; |
4 | 5 |
|
5 | 6 | import {addErrorMessage, addSuccessMessage} from 'sentry/actionCreators/indicator'; |
@@ -216,9 +217,12 @@ function InvestigationRuleCreationInternal(props: PropsInternal) { |
216 | 217 | if (isBreakingRequestError) { |
217 | 218 | const msg = t('Unable to fetch investigation rule'); |
218 | 219 | handleXhrErrorResponse(msg, error); |
219 | | - addErrorMessage(msg); |
| 220 | + Sentry.withScope(scope => { |
| 221 | + scope.setExtra('query', query); |
| 222 | + Sentry.captureException(error); |
| 223 | + }); |
220 | 224 | } |
221 | | - }, [isBreakingRequestError, error]); |
| 225 | + }, [isBreakingRequestError, error, query]); |
222 | 226 |
|
223 | 227 | if (isLoading || isBreakingRequestError) { |
224 | 228 | return null; |
@@ -256,30 +260,32 @@ function InvestigationRuleCreationInternal(props: PropsInternal) { |
256 | 260 | <Tooltip |
257 | 261 | isHoverable |
258 | 262 | title={ |
259 | | - isTransactionQueryMissing |
260 | | - ? tct( |
261 | | - 'If you filter by [code:event.type:transaction] we can adjust your sampling priorities, increasing the odds of getting matching events. [link:Learn more.]', |
262 | | - { |
263 | | - code: <code />, |
264 | | - link: ( |
265 | | - <ExternalLink href="https://docs.sentry.io/product/performance/retention-priorities/#investigation-mode" /> |
266 | | - ), |
267 | | - } |
268 | | - ) |
269 | | - : tct( |
270 | | - 'We can find more events that match your search query by adjusting your sampling priorities for an hour, increasing the odds of getting matching events. [link:Learn more.]', |
271 | | - { |
272 | | - link: ( |
273 | | - <ExternalLink href="https://docs.sentry.io/product/performance/retention-priorities/#investigation-mode" /> |
274 | | - ), |
275 | | - } |
276 | | - ) |
| 263 | + isBreakingRequestError |
| 264 | + ? t('Search query unsupported.') |
| 265 | + : isTransactionQueryMissing |
| 266 | + ? tct( |
| 267 | + 'If you filter by [code:event.type:transaction] we can adjust your sampling priorities, increasing the odds of getting matching events. [link:Learn more.]', |
| 268 | + { |
| 269 | + code: <code />, |
| 270 | + link: ( |
| 271 | + <ExternalLink href="https://docs.sentry.io/product/performance/retention-priorities/#investigation-mode" /> |
| 272 | + ), |
| 273 | + } |
| 274 | + ) |
| 275 | + : tct( |
| 276 | + 'We can find more events that match your search query by adjusting your sampling priorities for an hour, increasing the odds of getting matching events. [link:Learn more.]', |
| 277 | + { |
| 278 | + link: ( |
| 279 | + <ExternalLink href="https://docs.sentry.io/product/performance/retention-priorities/#investigation-mode" /> |
| 280 | + ), |
| 281 | + } |
| 282 | + ) |
277 | 283 | } |
278 | 284 | > |
279 | 285 | <Button |
280 | 286 | {...props.buttonProps} |
281 | 287 | priority={isLikelyMoreNeeded ? 'primary' : 'default'} |
282 | | - disabled={isTransactionQueryMissing} |
| 288 | + disabled={isTransactionQueryMissing || isBreakingRequestError} |
283 | 289 | onClick={() => createInvestigationRule({organization, projects, query})} |
284 | 290 | icon={<IconStack />} |
285 | 291 | > |
|
0 commit comments