Class: ScoutApm::Serializers::SlowJobsSerializerToJson
- Inherits:
-
Object
- Object
- ScoutApm::Serializers::SlowJobsSerializerToJson
- Defined in:
- lib/scout_apm/serializers/slow_jobs_serializer_to_json.rb
Instance Attribute Summary collapse
-
#jobs ⇒ Object
readonly
Returns the value of attribute jobs.
Instance Method Summary collapse
-
#as_json ⇒ Object
An array of job records.
-
#initialize(jobs) ⇒ SlowJobsSerializerToJson
constructor
Jobs is a series of slow job records.
Constructor Details
#initialize(jobs) ⇒ SlowJobsSerializerToJson
Jobs is a series of slow job records
7 8 9 |
# File 'lib/scout_apm/serializers/slow_jobs_serializer_to_json.rb', line 7 def initialize(jobs) @jobs = jobs end |
Instance Attribute Details
#jobs ⇒ Object (readonly)
Returns the value of attribute jobs.
4 5 6 |
# File 'lib/scout_apm/serializers/slow_jobs_serializer_to_json.rb', line 4 def jobs @jobs end |
Instance Method Details
#as_json ⇒ Object
An array of job records
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/scout_apm/serializers/slow_jobs_serializer_to_json.rb', line 12 def as_json jobs.map do |job| { "queue" => job.queue_name, "name" => job.job_name, "time" => job.time, "total_time" => job.total_time, "exclusive_time" => job.exclusive_time, "metrics" => MetricsToJsonSerializer.new(job.metrics).as_json, # New style of metrics "context" => job.context.to_hash, "score" => job.score, } end end |