aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/test/cases/logging_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Adding enque time tracking and loggingCory Gwin @gwincr112019-02-131-0/+2
| | | | | | | | | | | | | | | Motivation: - Currently we have 2 seperate monkey patches in place for tracking enqueded time for 2 seperate workers. It seems that activejob could be a source of truth for how long an item has been enqued so that we can easily use it for consistent monitoring across workers/apps to ensure that jobs are running at an acceptable speed. Changes: - Add an enqueded at attribute and serilization tooling. - Add a method to get how long a job has been enqueded for. - Add a logging item to show how long a job was enqued prior to the perform method firing.
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-211-5/+3
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* Improve `enqueue_retry.active_job` messagebogdanvlviv2018-09-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since #33751 was added `enqueue_retry.active_job` instrumentation to the `retry_on` method, then #33897 moved the instrumentation to `retry_job` method in order to ensure that this method publish `enqueue_retry.active_job` notification too. See related discussion https://github.com/rails/rails/pull/33751#discussion_r214140008 Since `enqueue_retry.active_job` moved to `retry_job`, there is no guarantee that payload of `enqueue_retry.active_job` would have `:error`. See test `LoggingTest#test_enqueue_retry_logging_on_retry_job` as example of that case. Related to https://github.com/rails/rails/pull/33897#discussion_r219707024 I think we can improve notification of `enqueue_retry.active_job`: - If there is no `event.payload[:error]`, then publish like "Retrying RescueJob in 3 seconds." only. - If `event.payload[:wait]` is `nil`, then publish "Retrying RescueJob in 0 seconds." instead of "Retrying RescueJob in nil seconds." - If there is `event.payload[:error]`, then publish "Retrying RescueJob in 3 seconds, due to a DefaultsError.". - Change the type of the message from `error` to `info.` Also, this commit removes part of messages - "The original exception was #{ex.cause.inspect}." of `enqueue_retry.active_job`, `retry_stopped.active_job`, and `discard.active_job` since I haven't found it useful. Please let me know whether you agree with that?
* `retry_job` should publish `enqueue_retry.active_job` notificationbogdanvlviv2018-09-161-0/+5
| | | | | | | | | | Also this commit removes `:wait` from payload of `retry_stopped.active_job`. Related to https://github.com/rails/rails/pull/33751#discussion_r214140008 Follow up #33751 /cc @kaspth, @rafaelfranca
* Add missing `perform_enqueued_jobs` to error logging testyuuji.yaginuma2018-09-091-1/+1
| | | | Without `perform_enqueued_jobs`, job are not executed and assertion is not done.
* Move ActiveJob retry and discard logging into log subscriberSteve S2018-08-301-27/+72
|
* Wrap ActiveJob::Enqueue in evented ActiveSupport::Notificationzvkemp2018-07-171-3/+20
|
* [Active Job] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
|
* Use frozen-string-literal in ActiveJobKir Shatrov2017-07-091-0/+1
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Add missing requireyuuji.yaginuma2017-04-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Without this, unit test fails. ``` bundle exec ruby -w -Ilib:lib:test test/cases/logging_test.rb Using inline Run options: --seed 41246 # Running: SE......S.... Finished in 0.052938s, 245.5696 runs/s, 831.1585 assertions/s. 1) Error: LoggingTest#test_job_error_logging: NameError: uninitialized constant LoggingTest::RescueJob test/cases/logging_test.rb:130:in `rescue in test_job_error_logging' test/cases/logging_test.rb:129:in `test_job_error_logging' 13 runs, 44 assertions, 0 failures, 1 errors, 2 skips You have skipped tests. Run with --verbose for details. ```
* Add error logging to Active JobSteven Bull2017-03-271-0/+7
| | | | | | | | | | | | | | | | | | | | Active Job logging instrumentation is changed to log errors (with backtrace) when a job raises an exception in #perform. This improves debugging during development and test with the default configuration. Prior to Rails 5, the default development configuration ran jobs with InlineAdapter, which would raise exceptions to the caller and be shown in the development log. In Rails 5, the default adapter was changed to AsyncAdapter, which would silently swallow exceptions and log a "Performed SomeJob from Async..." info message. This could be confusing to a developer, as it would seem that the job was performed successfully. This patch removes the "Performed..." info message from the log and adds an error-level "Error performing SomeJob..." log message which includes the exception backtrace for jobs that raise an exception within the #perform method. It provides this behavior for all adapters.
* Include JobID in all ActiveJob info logsBolek Kurowski2017-02-221-6/+6
| | | | | | | | | | Currently we provide the Job ID in logs only related to enqueuing a job. This adds the job id to the remaining ActiveJob logs when: - a job started performing - a job ended performing Providing the job id in those logs will ease searching logs by job id.
* applies new string literal convention in activejob/testXavier Noria2016-08-061-7/+7
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Fix jobs overriding AJ::Base#loggerJean Boussier2016-06-171-1/+6
|
* Properly log nested parameters to Active JobMarek Pieczyk2015-09-081-0/+8
| | | | Refactor arguments logging method for Active Job
* Fix naming collisionTamir Duberstein2015-03-111-1/+1
|
* Include missing requireDavid Heinemeier Hansson2014-12-051-0/+1
|
* Only filter GIDable objects; remove cosmetic changesAri Pollak2014-12-011-10/+10
|
* Hide potentially sensitive ActiveJob params from logsAri Pollak2014-11-281-10/+18
| | | | * Show GlobalID instead of full object .inspect output
* - Remove duplication in AJ logging test for setting logger.Vipul A M2014-10-201-1/+1
| | | | - Remove un-needed require in AJ rescue test.
* Active Job refactoringCristian Bica2014-09-031-16/+25
|
* [ActiveJob] Fix tests for sucker_punchAbdelkader Boudih2014-08-171-1/+1
|
* Moved AR testing from using global variable to thread variableCristian Bica2014-08-161-1/+1
|
* Fixed failing tests; Load active_job in railtie; Renamed generator to jobCristian Bica2014-08-121-0/+1
|
* Remove activejob integration testsAbdelkader Boudih2014-08-121-0/+1
|
* Add 'activejob/' from commit '14f74a8331f94150dfee653224de8fc837797709'Abdelkader Boudih2014-08-121-0/+94
git-subtree-dir: activejob git-subtree-mainline: b45b99894a60eda434abec94d133a1cfd8de2dda git-subtree-split: 14f74a8331f94150dfee653224de8fc837797709