opentelemetry-instrumentation-action_mailer 0.1.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c3ef9c8a18527a671299d41be95a48d7f833336f9aa8287d1997cd1ffeb2731
4
- data.tar.gz: ea5c33c527501de18ccc1d60664d160caffa778da961bfbf0be1a6aebd9014f6
3
+ metadata.gz: 4527d53916f5a801016ad1fc3ba838f295999d842beb8cd34f55ef19aa3c8fd6
4
+ data.tar.gz: 107e82bd30819e1d7c4806ddbd18389e3239c81fd29254c44ed80ba429eeb9d8
5
5
  SHA512:
6
- metadata.gz: 649c4d315736660cf0f79d1fa68496f93f1056be6c7c0c51a3f8968d05145935bbb40b3b95d9142da51add1e79d1291c428f1860f53d53828d77182a46990898
7
- data.tar.gz: 68da2cd0d4ae9e9003d483f87e3d9629d8a4222cd98f89047c07d72ec2d62dad70c75915d359a6d1f0568310d149d2e439a3b5d1d031055f25a64a5614fce331
6
+ metadata.gz: f5aaa610dd35ac258f2637e45f200f3d918bc780b954678a86c693b9f496f887dbe9bfe48ab922fb6c6f6330e81909e892c23aaffaba3077ed2e6f2be81c61e1
7
+ data.tar.gz: f1896f1e118f7050d4cbe92aec92d1f2ea467d4b2b7bb54943b8b40311e19247974f986808371e2569db9b8900742ea96d91a710af301fa57e31f29742363a11
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History: opentelemetry-instrumentation-action_mailer
2
2
 
3
+ ### v0.3.0 / 2024-12-19
4
+
5
+ * ADDED: Upgrade ActiveSupport Instrumentation 0.7.0
6
+
7
+ ### v0.2.0 / 2024-10-22
8
+
9
+ * ADDED: Subscribe to process.action_mailer notifications
10
+
3
11
  ### v0.1.0 / 2024-05-13
4
12
 
5
13
  Initial release.
data/README.md CHANGED
@@ -21,7 +21,7 @@ To use the instrumentation, call `use` with the name of the instrumentation:
21
21
 
22
22
  ```ruby
23
23
  OpenTelemetry::SDK.configure do |c|
24
- # Use only the ActionMailer instrumentation
24
+ # Use only the ActionMailer instrumentation
25
25
  c.use 'OpenTelemetry::Instrumentation::ActionMailer'
26
26
  # Use the ActionMailer instrumentation along with the rest of the Rails-related instrumentation
27
27
  c.use 'OpenTelemetry::Instrumentation::Rails'
@@ -44,12 +44,13 @@ See the table below for details of what [Rails Framework Hook Events](https://gu
44
44
 
45
45
  | Event Name | Creates Span? | Notes |
46
46
  | - | - | - |
47
- | `deliver.action_mailer` | :white_check_mark: | Creates an span with kind `internal` and email content and status|
48
- | `process.action_mailer` | :x: | Lack of useful info so ignored |
47
+ | `deliver.action_mailer` | :white_check_mark: | Creates a span with kind `internal` and email content and status |
48
+ | `process.action_mailer` | :white_check_mark: | Creates a span with kind `internal` that will include email rendering spans |
49
49
 
50
50
  ### Options
51
51
 
52
52
  ActionMailer instrumentation doesn't expose email addresses by default, but if email addresses are needed, simply use `:email_address` option:
53
+
53
54
  ```ruby
54
55
  OpenTelemetry::SDK.configure do |c|
55
56
  c.use 'OpenTelemetry::Instrumentation::ActionMailer', { email_address: :include }
@@ -57,6 +58,7 @@ end
57
58
  ```
58
59
 
59
60
  If only want to hide certain attributes from the notifications payload for email address:
61
+
60
62
  ```ruby
61
63
  OpenTelemetry::SDK.configure do |c|
62
64
  c.use 'OpenTelemetry::Instrumentation::ActionMailer', { email_address: :include, disallowed_notification_payload_keys: ['email.to.address'] }
@@ -65,9 +67,9 @@ end
65
67
 
66
68
  ## Semantic Conventions
67
69
 
68
- Internal spans are named using the name of the `ActiveSupport` event that was provided (e.g. `action_mailer deliver`).
70
+ Internal spans are named using the name of the `ActiveSupport` event that was provided (e.g. `deliver.action_mailer`).
69
71
 
70
- The following attributes from the notification payload for the `deliver.action_mailer` event are attached to `action_mailer deliver` spans:
72
+ ### Attributes attached to the `deliver.action_mailer` event payload
71
73
 
72
74
  | Attribute Name | Type | Notes |
73
75
  | - | - | - |
@@ -77,17 +79,25 @@ The following attributes from the notification payload for the `deliver.action_m
77
79
  | `email.to.address` | Array | Receiver for mail (omit by default, include when `email_address` set to `:include`) |
78
80
  | `email.from.address` | Array | Sender for mail (omit by default, include when `email_address` set to `:include`) |
79
81
  | `email.cc.address` | Array | mail CC (omit by default, include when `email_address` set to `:include`) |
80
- | `email.bcc.address` | Array | mail BCC (omit by default, include when `email_address` set to `:include`) |
82
+ | `email.bcc.address` | Array | mail BCC (omit by default, include when `email_address` set to `:include`) |
83
+
84
+ ### Attributes attached to the `process.action_mailer` event payload
85
+
86
+ | Attribute Name | Type | Notes |
87
+ | - | - | - |
88
+ | `mailer` | String | Mailer class that is used to render the mail |
89
+ | `action` | String | Method from the mailer class called to render the mail |
90
+ | `args` | Array | Arguments passed to the method to render the email |
91
+
81
92
  ## Examples
82
93
 
83
94
  Example usage can be seen in the `./example/trace_request_demonstration.ru` file [here](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/action_mailer/example/trace_request_demonstration.ru)
84
95
 
85
-
86
96
  ## How can I get involved?
87
97
 
88
98
  The `opentelemetry-instrumentation-action_mailer` gem source is [on GitHub][repo-github], along with related gems including `opentelemetry-api` and `opentelemetry-sdk`.
89
99
 
90
- The OpenTelemetry Ruby gems are maintained by the OpenTelemetry-Ruby special interest group (SIG). You can get involved by joining us in [GitHub Discussions][discussions-url] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
100
+ The OpenTelemetry Ruby gems are maintained by the OpenTelemetry Ruby special interest group (SIG). You can get involved by joining us on our [GitHub Discussions][discussions-url], [Slack Channel][slack-channel] or attending our weekly meeting. See the [meeting calendar][community-meetings] for dates and times. For more information on this and other language SIGs, see the OpenTelemetry [community page][ruby-sig].
91
101
 
92
102
  ## License
93
103
 
@@ -99,4 +109,5 @@ The `opentelemetry-instrumentation-action_mailer` gem is distributed under the A
99
109
  [license-github]: https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/LICENSE
100
110
  [ruby-sig]: https://github.com/open-telemetry/community#ruby-sig
101
111
  [community-meetings]: https://github.com/open-telemetry/community#community-meetings
112
+ [slack-channel]: https://cloud-native.slack.com/archives/C01NWKKMKMY
102
113
  [discussions-url]: https://github.com/open-telemetry/opentelemetry-ruby/discussions
@@ -7,7 +7,53 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActionMailer
10
- # The Instrumentation class contains logic to detect and install the ActionMailer instrumentation
10
+ # The {OpenTelemetry::Instrumentation::ActionMailer::Instrumentation} class contains logic to detect and install the ActionMailer instrumentation
11
+ #
12
+ # Installation and configuration of this instrumentation is done within the
13
+ # {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry/SDK#configure-instance_method OpenTelemetry::SDK#configure}
14
+ # block, calling {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry%2FSDK%2FConfigurator:use use()}
15
+ # or {https://www.rubydoc.info/gems/opentelemetry-sdk/OpenTelemetry%2FSDK%2FConfigurator:use_all use_all()}.
16
+ #
17
+ # ## Configuration keys and options
18
+ #
19
+ # ### `:disallowed_notification_payload_keys`
20
+ #
21
+ # Specifies an array of keys that should be excluded from the `deliver.action_mailer` notification payload as span attributes.
22
+ #
23
+ # ### `:disallowed_process_payload_keys`
24
+ #
25
+ # Specifies an array of keys that should be excluded from the `process.action_mailer` notification payload as span attributes.
26
+ #
27
+ # ### `:notification_payload_transform`
28
+ #
29
+ # - `proc` **default** `nil`
30
+ #
31
+ # Specifies custom proc used to extract span attributes form the `deliver.action_mailer` notification payload. Use this to rename keys, extract nested values, or perform any other custom logic.
32
+ #
33
+ # ### `:process_payload_transform`
34
+ #
35
+ # - `proc` **default** `nil`
36
+ #
37
+ # Specifies custom proc used to extract span attributes form the `process.action_mailer` notification payload. Use this to rename keys, extract nested values, or perform any other custom logic.
38
+ #
39
+ # ### `:email_address`
40
+ #
41
+ # - `symbol` **default** `:omit`
42
+ #
43
+ # Specifies whether to include email addresses in the notification payload. Valid values are `:omit` and `:include`.
44
+ #
45
+ # @example An explicit default configuration
46
+ # OpenTelemetry::SDK.configure do |c|
47
+ # c.use_all({
48
+ # 'OpenTelemetry::Instrumentation::ActionMailer' => {
49
+ # disallowed_notification_payload_keys: [],
50
+ # disallowed_process_payload_keys: [],
51
+ # notification_payload_transform: nil,
52
+ # process_payload_transform: nil,
53
+ # email_address: :omit,
54
+ # },
55
+ # })
56
+ # end
11
57
  class Instrumentation < OpenTelemetry::Instrumentation::Base
12
58
  MINIMUM_VERSION = Gem::Version.new('6.1.0')
13
59
  EMAIL_ATTRIBUTE = %w[email.to.address email.from.address email.cc.address email.bcc.address].freeze
@@ -27,7 +73,9 @@ module OpenTelemetry
27
73
  end
28
74
 
29
75
  option :disallowed_notification_payload_keys, default: [], validate: :array
76
+ option :disallowed_process_payload_keys, default: [], validate: :array
30
77
  option :notification_payload_transform, default: nil, validate: :callable
78
+ option :process_payload_transform, default: nil, validate: :callable
31
79
  option :email_address, default: :omit, validate: %I[omit include]
32
80
 
33
81
  private
@@ -7,24 +7,39 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActionMailer
10
- SUBSCRIPTIONS = %w[
11
- deliver.action_mailer
12
- ].freeze
10
+ DELIVER_SUBSCRIPTION = 'deliver.action_mailer'
11
+ PROCESS_SUBSCRIPTION = 'process.action_mailer'
13
12
 
14
13
  # This Railtie sets up subscriptions to relevant ActionMailer notifications
15
14
  class Railtie < ::Rails::Railtie
16
15
  config.after_initialize do
17
16
  ::OpenTelemetry::Instrumentation::ActiveSupport::Instrumentation.instance.install({})
17
+ subscribe_to_deliver
18
+ subscribe_to_process
19
+ end
18
20
 
19
- SUBSCRIPTIONS.each do |subscription_name|
20
- config = ActionMailer::Instrumentation.instance.config
21
+ class << self
22
+ def subscribe_to_deliver
21
23
  ::OpenTelemetry::Instrumentation::ActiveSupport.subscribe(
22
24
  ActionMailer::Instrumentation.instance.tracer,
23
- subscription_name,
25
+ DELIVER_SUBSCRIPTION,
24
26
  config[:notification_payload_transform],
25
27
  config[:disallowed_notification_payload_keys]
26
28
  )
27
29
  end
30
+
31
+ def subscribe_to_process
32
+ ::OpenTelemetry::Instrumentation::ActiveSupport.subscribe(
33
+ ActionMailer::Instrumentation.instance.tracer,
34
+ PROCESS_SUBSCRIPTION,
35
+ config[:process_payload_transform],
36
+ config[:disallowed_process_payload_keys]
37
+ )
38
+ end
39
+
40
+ def config
41
+ ActionMailer::Instrumentation.instance.config
42
+ end
28
43
  end
29
44
  end
30
45
  end
@@ -7,7 +7,7 @@
7
7
  module OpenTelemetry
8
8
  module Instrumentation
9
9
  module ActionMailer
10
- VERSION = '0.1.0'
10
+ VERSION = '0.3.0'
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opentelemetry-instrumentation-action_mailer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OpenTelemetry Authors
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-13 00:00:00.000000000 Z
11
+ date: 2024-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opentelemetry-api
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.1'
33
+ version: '0.7'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.1'
40
+ version: '0.7'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: opentelemetry-instrumentation-base
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -142,28 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 1.60.1
145
+ version: 1.69.1
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 1.60.1
152
+ version: 1.69.1
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: rubocop-performance
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '1.20'
159
+ version: 1.23.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '1.20'
166
+ version: 1.23.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: simplecov
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '3.19'
187
+ version: 3.24.0
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '3.19'
194
+ version: 3.24.0
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: yard
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -227,11 +227,11 @@ homepage: https://github.com/open-telemetry/opentelemetry-ruby-contrib
227
227
  licenses:
228
228
  - Apache-2.0
229
229
  metadata:
230
- changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_mailer/0.1.0/file/CHANGELOG.md
230
+ changelog_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_mailer/0.3.0/file/CHANGELOG.md
231
231
  source_code_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/tree/main/instrumentation/action_mailer
232
232
  bug_tracker_uri: https://github.com/open-telemetry/opentelemetry-ruby-contrib/issues
233
- documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_mailer/0.1.0
234
- post_install_message:
233
+ documentation_uri: https://rubydoc.info/gems/opentelemetry-instrumentation-action_mailer/0.3.0
234
+ post_install_message:
235
235
  rdoc_options: []
236
236
  require_paths:
237
237
  - lib
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  version: '0'
248
248
  requirements: []
249
249
  rubygems_version: 3.2.33
250
- signing_key:
250
+ signing_key:
251
251
  specification_version: 4
252
252
  summary: ActionMailer instrumentation for the OpenTelemetry framework
253
253
  test_files: []