import styled from '@emotion/styled'; import {CodeSnippet} from 'sentry/components/codeSnippet'; import ExternalLink from 'sentry/components/links/externalLink'; import Link from 'sentry/components/links/link'; import List from 'sentry/components/list'; import ListItem from 'sentry/components/list/listItem'; import {Panel, PanelBody, PanelHeader} from 'sentry/components/panels'; import {t, tct} from 'sentry/locale'; import space from 'sentry/styles/space'; import useOrganization from 'sentry/utils/useOrganization'; import {Monitor} from './types'; type Props = { monitor: Monitor; }; const MonitorOnboarding = ({monitor}: Props) => { const checkInUrl = `https://sentry.io/api/0/monitors/${monitor.id}/checkins/`; const checkInDetailsUrl = `${checkInUrl}{checkInId}/`; const organization = useOrganization(); return ( {t('How to instrument monitors')} {tct( 'To report the start of a job execution using [linkDocs:DSN authentication], use the following request (your DSN can be found [linkProjectDSN:here])', { linkDocs: ( ), linkProjectDSN: ( ), } )} {`curl -X POST \\\n'${checkInUrl}' \\\n--header 'Authorization: DSN {DSN}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"status": "in_progress"}'`} {t( 'The above request will then return a check-in id which you can use to modify the check-in upon job completion' )} {t('For reflecting successful execution with optional duration in ms')} {`curl -X PUT \\\n'${checkInDetailsUrl}' \\\n--header 'Authorization: DSN {DSN}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"status": "ok", "duration": 3000}'`} {t('For reflecting failed execution with optional duration in ms')} {`curl -X PUT \\\n'${checkInDetailsUrl}' \\\n--header 'Authorization: DSN {DSN}' \\\n--header 'Content-Type: application/json' \\\n--data-raw '{"status": "error", "duration": 3000}'`} ); }; const OnboardingText = styled('p')` font-size: ${p => p.theme.fontSizeLarge}; `; const StyledListItem = styled(ListItem)` margin-bottom: ${space(2)}; `; export default MonitorOnboarding;