appsignal 3.4.8 → 3.4.9

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: 54fdd8b2a084c44b982733d9092c8261a92ef41b8aa1da2f720ab5fd2a121d0c
4
- data.tar.gz: 620c8506a36a6a54a7cdf3666134df9c1eeabc755801cd575121f3f72886ae93
3
+ metadata.gz: e1b6fb8c98cfa14b4d288e85f6c2d34926d4088770d92bb5cbc0e0d408890b90
4
+ data.tar.gz: 1dd9ac89d972087f32e3ffad6c0b6f2d60a15a749d2b90dd0ebd50b3fdb1ac13
5
5
  SHA512:
6
- metadata.gz: 268a3f028f4dce2f02e7351a8202c233062f69900f2506e4baa408d1f07bfc9b51315cdc35c7b746baf5a657ad7c893999c8ed9d9246f9ec6f9c4f597dee55c8
7
- data.tar.gz: 4cc40d1f68a9b58b8c70d2b8d4563eba367ca4d1d1f12c6175edd96ea5c52227fa2e9300dda893542037d189752690edba1eeca901bd6e874fedcb10c67913d5
6
+ metadata.gz: ac524c7c3a9e89436836527daa1c0d857bfdbd3179458d564a7ce33957dedca02457d24c3253c35548ed307541efc8351b952e66618e29b8ffb3ec012d8ba68f
7
+ data.tar.gz: c198818a139d0d0f9a05e7408fe14c7c387c7658025dc22f6dd565d1d16d5b58cc09390f8b5fb80b481060149691b2fa6fe04da8bcf329e1381c0ec9097cbfee
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.4.9
4
+
5
+ ### Added
6
+
7
+ - [d048c778](https://github.com/appsignal/appsignal-ruby/commit/d048c778e2718110609ba03f4d755953828bf4c5) patch - Allow passing custom data using the `appsignal` context via the Rails error reporter:
8
+
9
+ ```ruby
10
+ custom_data = { :hash => { :one => 1, :two => 2 }, :array => [1, 2] }
11
+ Rails.error.handle(:context => { :appsignal => { :custom_data => custom_data } }) do
12
+ raise "Test"
13
+ end
14
+ ```
15
+
3
16
  ## 3.4.8
4
17
 
5
18
  ### Added
@@ -55,9 +55,10 @@ module Appsignal
55
55
  return unless handled
56
56
 
57
57
  Appsignal.send_error(error) do |transaction|
58
- namespace, action_name, tags = context_for(context.dup)
58
+ namespace, action_name, tags, custom_data = context_for(context.dup)
59
59
  transaction.set_namespace(namespace) if namespace
60
60
  transaction.set_action(action_name) if action_name
61
+ transaction.set_sample_data("custom_data", custom_data) if custom_data
61
62
 
62
63
  tags[:severity] = severity
63
64
  tags[:source] = source.to_s if source
@@ -69,6 +70,7 @@ module Appsignal
69
70
 
70
71
  def context_for(context)
71
72
  tags = {}
73
+ custom_data = nil
72
74
 
73
75
  appsignal_context = context.delete(:appsignal)
74
76
  # Fetch the namespace and action name based on the Rails execution
@@ -102,10 +104,13 @@ module Appsignal
102
104
 
103
105
  context_action_name = appsignal_context[:action]
104
106
  action_name = context_action_name if context_action_name
107
+
108
+ context_custom_data = appsignal_context[:custom_data]
109
+ custom_data = context_custom_data if context_custom_data
105
110
  end
106
111
  tags.merge!(context)
107
112
 
108
- [namespace, action_name, tags]
113
+ [namespace, action_name, tags, custom_data]
109
114
  end
110
115
  end
111
116
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.4.8"
4
+ VERSION = "3.4.9"
5
5
  end
@@ -196,6 +196,33 @@ if DependencyHelper.rails_present?
196
196
  end
197
197
  end
198
198
 
199
+ it "sends tags stored in :appsignal -> :custom_data as custom data" do
200
+ current_transaction = http_request_transaction
201
+
202
+ with_current_transaction current_transaction do
203
+ given_context = {
204
+ :appsignal => {
205
+ :custom_data => {
206
+ :array => [1, 2],
207
+ :hash => { :one => 1, :two => 2 }
208
+ }
209
+ }
210
+ }
211
+ Rails.error.handle(:context => given_context) { raise ExampleStandardError }
212
+
213
+ transaction = last_transaction
214
+ transaction_hash = transaction.to_h
215
+ expect(transaction_hash).to include(
216
+ "sample_data" => hash_including(
217
+ "custom_data" => {
218
+ "array" => [1, 2],
219
+ "hash" => { "one" => 1, "two" => 2 }
220
+ }
221
+ )
222
+ )
223
+ end
224
+ end
225
+
199
226
  it "overwrites duplicated namespace and action with custom from context" do
200
227
  current_transaction = http_request_transaction
201
228
  current_transaction.set_namespace "custom"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appsignal
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.8
4
+ version: 3.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Beekman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-07-21 00:00:00.000000000 Z
13
+ date: 2023-07-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack