From 835e8d91d43cea39317d6d4a999d44fc6d067d53 Mon Sep 17 00:00:00 2001 From: Jack Rothrock Date: Fri, 23 Aug 2024 15:51:06 -0600 Subject: [PATCH 1/2] Fix Scout layer capturing for background jobs --- lib/scout_apm/logging/loggers/formatter.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/scout_apm/logging/loggers/formatter.rb b/lib/scout_apm/logging/loggers/formatter.rb index 3a3b092..6f315da 100644 --- a/lib/scout_apm/logging/loggers/formatter.rb +++ b/lib/scout_apm/logging/loggers/formatter.rb @@ -46,12 +46,18 @@ def scout_layer # rubocop:disable Metrics/AbcSize name, action = layer.name.split('/') - return {} unless name && action + return {} unless name updated_name = name.split('_').map(&:capitalize).join derived_key = "#{layer.type.downcase}_entrypoint".to_sym - derived_value_of_scout_name = "#{updated_name}#{layer.type.capitalize}##{action}" + + # For background jobs, we won't have an action. + derived_value_of_scout_name = if action + "#{updated_name}#{layer.type.capitalize}##{action}" + else + name + end { derived_key => derived_value_of_scout_name } end From f425d8dd654dfc09fac9f591b06553b69ee20e06 Mon Sep 17 00:00:00 2001 From: Jack Rothrock Date: Fri, 23 Aug 2024 15:57:36 -0600 Subject: [PATCH 2/2] Bump version to 0.0.11 --- CHANGELOG.md | 3 +++ lib/scout_apm/logging/version.rb | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc34809..eb7259b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## 0.0.11 +* Fix Scout layer capturing in log attributes for background jobs. + ## 0.0.10 * Remove capitalization from action name in the formatter, to match that of the standard format. diff --git a/lib/scout_apm/logging/version.rb b/lib/scout_apm/logging/version.rb index a31f7bc..a602abc 100644 --- a/lib/scout_apm/logging/version.rb +++ b/lib/scout_apm/logging/version.rb @@ -2,6 +2,6 @@ module ScoutApm module Logging - VERSION = '0.0.10' + VERSION = '0.0.11' end end