This incorporates a change from `sentry-ruby` to add the `db.` prefix to
recorded ActiveRecord traces. This enables the "Slow DB ops" dashboard in
Sentry.
flag=none
test plan:
- verify SQL traces are recorded like normal
- verify they populate into the "Slow DB ops" dashboard in Sentry
Change-Id: I530a20324913036fa9560b4df2b4845f87e91573
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287982
Reviewed-by: Andrea Cirulli <andrea.cirulli@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
This change causes `db.redis.command` spans to be recorded by Sentry when
APM is enabled. It also makes slight improvements to the Sentry
initializer.
flag=none
closes DE-1055
test plan:
- verify that Sentry and Canvas initialize OK, and both errors and APM
transactions are recorded OK
- verify that controllers which interface with Redis record spans in
their APM transactions
- verify that Redis commands are not recorded as breadcrumbs (we did not
enable this feature)
Change-Id: I7955b3ad5d6b59e6fd96c801881671814064d622
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/285255
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
There was already a Setting to control the frontend error sample rate,
so this change adds one to control the backend sample rate, as well, and
removes the unnecessary `sentry_disabled` Setting.
flag=none
closes DE-1034
test plan:
- verify that the backend error sample rate defaults to `1.0` when unset
- verify that setting it to `0.0` results in no backend errors being
collected
- verify that changing the setting takes effect without server restart
when a SIGHUP is sent (test by calling `Canvas::Reloader.reload!`)
Change-Id: Ib8905ef4d18da7e1d2647ed9122218f56499670e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/284796
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Ogata <aogata@instructure.com>
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Otherwise, methods like `Sentry.set_tags` will be delegated to
`NilClass`, and will fail when called. We wrap the initialization in a
rescue block so we don't break the app if this default init fails.
flag=none
closes DE-1016
test plan:
- remove `sentry.yml`
- verify app starts correctly, calls to `Sentry.set_tags` don't raise
- verify that with `sentry.yml` present and `sentry_disabled` setting
false, Sentry captures errors
Change-Id: I93c6e65f8aa08d1e52c0a05b8ffd23fc7f3ef4fa
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/283868
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
This commit adds Sentry support to the frontend, so that exceptions on
the browser side will be reported to Sentry. It requires that
`frontend_dsn` be defined in `config/sentry.yml` and that the
`sentry_disabled` Setting be `false` or unset.
Future commits may add support for frontend APM, Fullstory linking, and
source map uploading.
Settings included in this commit:
- `sentry_frontend_errors_sample_rate`, which controls the sample rate of
error collection (defaults to 0.0, meaning no errors are collected)
flag=none
closes DE-967
test plan:
- confirm that there are no issues when `frontend_dsn` is not set
- confirm that setting `frontend_dsn` results in frontend exceptions
being caught
- check unhandled exceptions
- check exceptions caught by Canvas's React `ErrorBoundary`
- confirm that Sentry is not enabled on the frontend if the
`sentry_disabled` setting is `true`
- confirm that user context is associated with frontend exceptions
reported to Sentry
- confirm that adjusting `sentry_frontend_errors_sample_rate` correctly
adjusts the quantity of errors delivered to Sentry, and that leaving it
unset or set to 0.0 results in no errors being sent
Change-Id: I47af7006a7f12b54dcb3f0121331af6ca2509124
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282879
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Because APM collects performance monitoring data about each request or
job execution, this results in a large amount of additional data being
sent to Sentry. For this reason, APM is off by default, and the rate of
sampling is configurable in a setting.
Settings related to this change:
- `sentry_backend_traces_sample_rate`: the APM sample rate, with a
default value of 0.0 (max value 1.0, although this isn't recommended)
refs DE-922
flag=none
test plan:
- ensure you have Sentry running at sentry.docker and have a DSN
configured in `config/sentry.rb`
- confirm that, by default:
- no traces appear in the "Performance" section
- change the `sentry_backend_traces_sample_rate` setting to `1.0`
- restart rails and job servers
- confirm that:
- traces now appear in the "Performance" section for both controller
and job executions
- for jobs, traces and contain context from the job under the
"INST-JOBS"section
- remove `config/sentry.yml` and restart rails and jobs servers
- confirm that the app/jobs start fine and there are no issues
Change-Id: I876d9e3c9fb55c8dca374f29987775803e6aabaf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/282306
QA-Review: Isaac Moore <isaac.moore@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ben Rinaca <brinaca@instructure.com>