Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(crons): Add Laravel upsert quickstart platform guide #56060

Merged
merged 1 commit into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
} from './platformPickerPanel';
import {
CeleryBeatAutoDiscovery,
LaravelUpsertPlatformGuide,
PHPUpsertPlatformGuide,
QuickStartProps,
} from './quickStartEntries';
Expand All @@ -46,7 +47,7 @@ const platformGuides: Record<SupportedPlatform, PlatformGuide[]> = {
],
'php-laravel': [
{
Guide: () => null,
Guide: LaravelUpsertPlatformGuide,
title: 'Upsert',
},
],
Expand Down
50 changes: 50 additions & 0 deletions static/app/views/monitors/components/quickStartEntries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,53 @@ $checkInId = \Sentry\captureCheckIn(
</Fragment>
);
}

export function LaravelUpsertPlatformGuide() {
const basicConfigCode = `protected function schedule(Schedule $schedule)
{
$schedule->command('emails:send')
->everyHour()
->sentryMonitor(); // add this line
}`;

const advancedConfigCode = `protected function schedule(Schedule $schedule)
{
$schedule->command('emails:send')
->everyHour()
->sentryMonitor(
// Specify the slug of the job monitor in case of duplicate commands or if the monitor was created in the UI
monitorSlug: null,
// Check-in margin in minutes
checkInMargin: 5,
// Max runtime in minutes
maxRuntime: 15,
// In case you want to configure the job monitor exclusively in the UI, you can turn off sending the monitor config with the check-in.
// Passing a monitor-slug is required in this case.
updateMonitorConfig: false,
)
}`;

return (
<Fragment>
<div>
{tct('Use the [additionalDocs: Laravel SDK] to monitor your scheduled task.', {
additionalDocs: (
<ExternalLink href="https://docs.sentry.io/platforms/php/guides/laravel/crons/#job-monitoring" />
),
})}
</div>
<div>
{t(
'To set up, add the "sentryMonitor()" macro to your scheduled tasks defined in your "app/Console/Kernel.php" file:'
)}
</div>
<CodeSnippet language="php">{basicConfigCode}</CodeSnippet>
<div>
{t(
'By default, the Laravel SDK will infer various parameters of your scheduled task. For greater control, we expose some optional parameters on the sentryMonitor() macro.'
)}
</div>
<CodeSnippet language="php">{advancedConfigCode}</CodeSnippet>
</Fragment>
);
}
Loading