-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add an easy cron integration #757
Comments
We made the process of reporting check-ins simpler in https://github.com/getsentry/sentry-php/releases/tag/3.21.0 See #719 for more context on this. |
It doesn't help for the environment thing, in my case it always log in production when I'm in environment "dev" |
How does your |
parameters:
env(SENTRY_ENV): undefined
env(SENTRY_DSN):
env(VERSION): undefined
env(SENTRY_TRACE_SAMPLE_RATE): '0.1'
sentry:
dsn: '%env(SENTRY_DSN)%'
options:
environment: '%env(SENTRY_ENV)%'
traces_sample_rate: '%env(float:SENTRY_TRACE_SAMPLE_RATE)%'
integrations:
- 'Sentry\Integration\IgnoreErrorsIntegration' The SENTRY_ENV is set to "prod", "staging", "preprod" or "dev" depending of the environment. When I ran my test with SENTRY_ENV set to "dev", production was the environment reported in Sentry cron. |
I'm unable to reproduce the issue you're seeing. \Sentry\captureCheckIn(
slug: 'my-cron-job',
status: \Sentry\CheckInStatus::ok(),
); Maybe check the version you have installed for our underlying PHP SDK (sentry/sentry). You can update the underlying SDK by running |
Alright, I had to update my sdk and use the captureCheckIn and it's working great now. Thank you :) I still hope that there will be a trait or some kind of helper for Commands. Here's my code for future reference : private function initSentry(): ?string
{
return captureCheckIn(
slug: 'cancel-unpaid-order',
status: CheckInStatus::inProgress()
);
}
private function notifySentryForSuccess(string $checkInId): void
{
captureCheckIn(
slug: 'cancel-unpaid-order',
status: CheckInStatus::ok(),
checkInId: $checkInId,
);
}
private function notifySentryForError(string $checkInId): void
{
captureCheckIn(
slug: 'cancel-unpaid-order',
status: CheckInStatus::error(),
checkInId: $checkInId,
);
}
``` |
Problem Statement
Everywhere you use the CRON feature, you have to specify which environment and release you use. The initialized sentry SDK is not reused
Solution Brainstorm
Add the capacity to reuse configured SDK maybe with an helper ?
The text was updated successfully, but these errors were encountered: