appsignal 2.11.1-java → 2.11.2-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +197 -0
- data/CHANGELOG.md +6 -0
- data/README.md +9 -0
- data/build_matrix.yml +13 -0
- data/ext/base.rb +12 -9
- data/gemfiles/no_dependencies.gemfile +7 -0
- data/gemfiles/resque-2.gemfile +0 -1
- data/gemfiles/webmachine.gemfile +1 -0
- data/lib/appsignal/cli/diagnose/utils.rb +8 -11
- data/lib/appsignal/cli/install.rb +5 -8
- data/lib/appsignal/helpers/instrumentation.rb +32 -0
- data/lib/appsignal/transaction.rb +30 -2
- data/lib/appsignal/version.rb +1 -1
- data/spec/lib/appsignal/hooks/resque_spec.rb +10 -2
- data/spec/lib/appsignal/hooks/sidekiq_spec.rb +4 -2
- data/spec/lib/appsignal/transaction_spec.rb +55 -0
- data/spec/lib/appsignal_spec.rb +30 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d3b1274a059f49554109997af44b40585057950b4b8f4d2ab52dd87cc6690ba2
|
|
4
|
+
data.tar.gz: 42f76f14cf36b7309ade272924f9137e763f0ca56446189d97ea83b8f95a12f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 23832e2898160147ca20e4881232111628d40864a255642c07f8eea69d3ff89cf6ce8f75cdb63e4c04946f52e383f2ba27eb56ddf812b6c510df567f77c99e5f
|
|
7
|
+
data.tar.gz: cdbc11ff5c3e7e3b756a8e3ad4dcb1483d7e6772346e652b042e7b3e08e00130d39c2160ea7ef5e47c44f1c8818a678d0393828bf9730f456bab401393754ad0
|
data/.semaphore/semaphore.yml
CHANGED
|
@@ -31,6 +31,7 @@ global_job_config:
|
|
|
31
31
|
prologue:
|
|
32
32
|
commands:
|
|
33
33
|
- checkout
|
|
34
|
+
- git -C /home/semaphore/.rbenv/plugins/ruby-build pull
|
|
34
35
|
- sem-version ruby $RUBY_VERSION
|
|
35
36
|
- "./support/check_versions"
|
|
36
37
|
- cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE)
|
|
@@ -992,6 +993,202 @@ blocks:
|
|
|
992
993
|
commands:
|
|
993
994
|
- "./support/bundler_wrapper exec rake test"
|
|
994
995
|
- "./support/bundler_wrapper exec rake test:failure"
|
|
996
|
+
- name: Ruby 3.0.0
|
|
997
|
+
dependencies:
|
|
998
|
+
- Validation
|
|
999
|
+
task:
|
|
1000
|
+
prologue:
|
|
1001
|
+
commands:
|
|
1002
|
+
- "./support/bundler_wrapper exec rake extension:install"
|
|
1003
|
+
jobs:
|
|
1004
|
+
- name: Ruby 3.0.0 for no_dependencies
|
|
1005
|
+
env_vars:
|
|
1006
|
+
- name: RUBY_VERSION
|
|
1007
|
+
value: 3.0.0
|
|
1008
|
+
- name: GEMSET
|
|
1009
|
+
value: no_dependencies
|
|
1010
|
+
- name: BUNDLE_GEMFILE
|
|
1011
|
+
value: gemfiles/no_dependencies.gemfile
|
|
1012
|
+
- name: _RUBYGEMS_VERSION
|
|
1013
|
+
value: latest
|
|
1014
|
+
- name: _BUNDLER_VERSION
|
|
1015
|
+
value: latest
|
|
1016
|
+
commands:
|
|
1017
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1018
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1019
|
+
- name: Ruby 3.0.0 - Gems
|
|
1020
|
+
dependencies:
|
|
1021
|
+
- Ruby 3.0.0
|
|
1022
|
+
task:
|
|
1023
|
+
prologue:
|
|
1024
|
+
commands:
|
|
1025
|
+
- "./support/bundler_wrapper exec rake extension:install"
|
|
1026
|
+
jobs:
|
|
1027
|
+
- name: Ruby 3.0.0 for capistrano2
|
|
1028
|
+
env_vars:
|
|
1029
|
+
- name: RUBY_VERSION
|
|
1030
|
+
value: 3.0.0
|
|
1031
|
+
- name: GEMSET
|
|
1032
|
+
value: capistrano2
|
|
1033
|
+
- name: BUNDLE_GEMFILE
|
|
1034
|
+
value: gemfiles/capistrano2.gemfile
|
|
1035
|
+
- name: _RUBYGEMS_VERSION
|
|
1036
|
+
value: latest
|
|
1037
|
+
- name: _BUNDLER_VERSION
|
|
1038
|
+
value: latest
|
|
1039
|
+
commands:
|
|
1040
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1041
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1042
|
+
- name: Ruby 3.0.0 for capistrano3
|
|
1043
|
+
env_vars:
|
|
1044
|
+
- name: RUBY_VERSION
|
|
1045
|
+
value: 3.0.0
|
|
1046
|
+
- name: GEMSET
|
|
1047
|
+
value: capistrano3
|
|
1048
|
+
- name: BUNDLE_GEMFILE
|
|
1049
|
+
value: gemfiles/capistrano3.gemfile
|
|
1050
|
+
- name: _RUBYGEMS_VERSION
|
|
1051
|
+
value: latest
|
|
1052
|
+
- name: _BUNDLER_VERSION
|
|
1053
|
+
value: latest
|
|
1054
|
+
commands:
|
|
1055
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1056
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1057
|
+
- name: Ruby 3.0.0 for grape
|
|
1058
|
+
env_vars:
|
|
1059
|
+
- name: RUBY_VERSION
|
|
1060
|
+
value: 3.0.0
|
|
1061
|
+
- name: GEMSET
|
|
1062
|
+
value: grape
|
|
1063
|
+
- name: BUNDLE_GEMFILE
|
|
1064
|
+
value: gemfiles/grape.gemfile
|
|
1065
|
+
- name: _RUBYGEMS_VERSION
|
|
1066
|
+
value: latest
|
|
1067
|
+
- name: _BUNDLER_VERSION
|
|
1068
|
+
value: latest
|
|
1069
|
+
commands:
|
|
1070
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1071
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1072
|
+
- name: Ruby 3.0.0 for padrino
|
|
1073
|
+
env_vars:
|
|
1074
|
+
- name: RUBY_VERSION
|
|
1075
|
+
value: 3.0.0
|
|
1076
|
+
- name: GEMSET
|
|
1077
|
+
value: padrino
|
|
1078
|
+
- name: BUNDLE_GEMFILE
|
|
1079
|
+
value: gemfiles/padrino.gemfile
|
|
1080
|
+
- name: _RUBYGEMS_VERSION
|
|
1081
|
+
value: latest
|
|
1082
|
+
- name: _BUNDLER_VERSION
|
|
1083
|
+
value: latest
|
|
1084
|
+
commands:
|
|
1085
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1086
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1087
|
+
- name: Ruby 3.0.0 for que
|
|
1088
|
+
env_vars:
|
|
1089
|
+
- name: RUBY_VERSION
|
|
1090
|
+
value: 3.0.0
|
|
1091
|
+
- name: GEMSET
|
|
1092
|
+
value: que
|
|
1093
|
+
- name: BUNDLE_GEMFILE
|
|
1094
|
+
value: gemfiles/que.gemfile
|
|
1095
|
+
- name: _RUBYGEMS_VERSION
|
|
1096
|
+
value: latest
|
|
1097
|
+
- name: _BUNDLER_VERSION
|
|
1098
|
+
value: latest
|
|
1099
|
+
commands:
|
|
1100
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1101
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1102
|
+
- name: Ruby 3.0.0 for que_beta
|
|
1103
|
+
env_vars:
|
|
1104
|
+
- name: RUBY_VERSION
|
|
1105
|
+
value: 3.0.0
|
|
1106
|
+
- name: GEMSET
|
|
1107
|
+
value: que_beta
|
|
1108
|
+
- name: BUNDLE_GEMFILE
|
|
1109
|
+
value: gemfiles/que_beta.gemfile
|
|
1110
|
+
- name: _RUBYGEMS_VERSION
|
|
1111
|
+
value: latest
|
|
1112
|
+
- name: _BUNDLER_VERSION
|
|
1113
|
+
value: latest
|
|
1114
|
+
commands:
|
|
1115
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1116
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1117
|
+
- name: Ruby 3.0.0 for rails-6.0
|
|
1118
|
+
env_vars:
|
|
1119
|
+
- name: RUBY_VERSION
|
|
1120
|
+
value: 3.0.0
|
|
1121
|
+
- name: GEMSET
|
|
1122
|
+
value: rails-6.0
|
|
1123
|
+
- name: BUNDLE_GEMFILE
|
|
1124
|
+
value: gemfiles/rails-6.0.gemfile
|
|
1125
|
+
- name: _RUBYGEMS_VERSION
|
|
1126
|
+
value: latest
|
|
1127
|
+
- name: _BUNDLER_VERSION
|
|
1128
|
+
value: latest
|
|
1129
|
+
commands:
|
|
1130
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1131
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1132
|
+
- name: Ruby 3.0.0 for resque-2
|
|
1133
|
+
env_vars:
|
|
1134
|
+
- name: RUBY_VERSION
|
|
1135
|
+
value: 3.0.0
|
|
1136
|
+
- name: GEMSET
|
|
1137
|
+
value: resque-2
|
|
1138
|
+
- name: BUNDLE_GEMFILE
|
|
1139
|
+
value: gemfiles/resque-2.gemfile
|
|
1140
|
+
- name: _RUBYGEMS_VERSION
|
|
1141
|
+
value: latest
|
|
1142
|
+
- name: _BUNDLER_VERSION
|
|
1143
|
+
value: latest
|
|
1144
|
+
commands:
|
|
1145
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1146
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1147
|
+
- name: Ruby 3.0.0 for sequel
|
|
1148
|
+
env_vars:
|
|
1149
|
+
- name: RUBY_VERSION
|
|
1150
|
+
value: 3.0.0
|
|
1151
|
+
- name: GEMSET
|
|
1152
|
+
value: sequel
|
|
1153
|
+
- name: BUNDLE_GEMFILE
|
|
1154
|
+
value: gemfiles/sequel.gemfile
|
|
1155
|
+
- name: _RUBYGEMS_VERSION
|
|
1156
|
+
value: latest
|
|
1157
|
+
- name: _BUNDLER_VERSION
|
|
1158
|
+
value: latest
|
|
1159
|
+
commands:
|
|
1160
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1161
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1162
|
+
- name: Ruby 3.0.0 for sinatra
|
|
1163
|
+
env_vars:
|
|
1164
|
+
- name: RUBY_VERSION
|
|
1165
|
+
value: 3.0.0
|
|
1166
|
+
- name: GEMSET
|
|
1167
|
+
value: sinatra
|
|
1168
|
+
- name: BUNDLE_GEMFILE
|
|
1169
|
+
value: gemfiles/sinatra.gemfile
|
|
1170
|
+
- name: _RUBYGEMS_VERSION
|
|
1171
|
+
value: latest
|
|
1172
|
+
- name: _BUNDLER_VERSION
|
|
1173
|
+
value: latest
|
|
1174
|
+
commands:
|
|
1175
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1176
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
1177
|
+
- name: Ruby 3.0.0 for webmachine
|
|
1178
|
+
env_vars:
|
|
1179
|
+
- name: RUBY_VERSION
|
|
1180
|
+
value: 3.0.0
|
|
1181
|
+
- name: GEMSET
|
|
1182
|
+
value: webmachine
|
|
1183
|
+
- name: BUNDLE_GEMFILE
|
|
1184
|
+
value: gemfiles/webmachine.gemfile
|
|
1185
|
+
- name: _RUBYGEMS_VERSION
|
|
1186
|
+
value: latest
|
|
1187
|
+
- name: _BUNDLER_VERSION
|
|
1188
|
+
value: latest
|
|
1189
|
+
commands:
|
|
1190
|
+
- "./support/bundler_wrapper exec rake test"
|
|
1191
|
+
- "./support/bundler_wrapper exec rake test:failure"
|
|
995
1192
|
- name: Ruby jruby-9.1.17.0
|
|
996
1193
|
dependencies:
|
|
997
1194
|
- Validation
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
# 2.11.2
|
|
4
|
+
- Support Ruby 3.0. PR #681
|
|
5
|
+
- Support breadcrumbs. PR #666
|
|
6
|
+
- Log Ruby errors on extension download. PR #679
|
|
7
|
+
- Fix Ruby 1.9 build. PR #680
|
|
8
|
+
|
|
3
9
|
# 2.11.1
|
|
4
10
|
- Support AS notifications instrumenters that use `start` and `finish`.
|
|
5
11
|
- Updated agent with better logging and an IO stats fix.
|
data/README.md
CHANGED
|
@@ -157,6 +157,15 @@ as most Linux distributions, FreeBSD, macOS, excluding Microsoft Windows.
|
|
|
157
157
|
For more detailed information please visit our [Supported
|
|
158
158
|
systems][supported-systems] page.
|
|
159
159
|
|
|
160
|
+
## Releases
|
|
161
|
+
|
|
162
|
+
Following the process below to release a new version of the Ruby gem.
|
|
163
|
+
|
|
164
|
+
1. Run: `rake publish`
|
|
165
|
+
1. Update the Ruby gem version number when prompted.
|
|
166
|
+
1. Update the `CHANGELOG` file with the changes since the last release.
|
|
167
|
+
1. Confirm with your two-factor authentication token for Rubygems.org, _twice_.
|
|
168
|
+
|
|
160
169
|
## Development
|
|
161
170
|
|
|
162
171
|
### Installation
|
data/build_matrix.yml
CHANGED
|
@@ -32,6 +32,7 @@ semaphore: # Default `.semaphore/semaphore.yml` contents
|
|
|
32
32
|
prologue:
|
|
33
33
|
commands:
|
|
34
34
|
- checkout
|
|
35
|
+
- git -C /home/semaphore/.rbenv/plugins/ruby-build pull
|
|
35
36
|
- sem-version ruby $RUBY_VERSION
|
|
36
37
|
- ./support/check_versions
|
|
37
38
|
- cache restore $_BUNDLER_CACHE-bundler-$RUBY_VERSION-$GEMSET-$(checksum $BUNDLE_GEMFILE)
|
|
@@ -116,6 +117,7 @@ matrix:
|
|
|
116
117
|
gems: "minimal"
|
|
117
118
|
- ruby: "2.6.5"
|
|
118
119
|
- ruby: "2.7.1"
|
|
120
|
+
- ruby: "3.0.0"
|
|
119
121
|
- ruby: "jruby-9.1.17.0"
|
|
120
122
|
gems: "minimal"
|
|
121
123
|
gems:
|
|
@@ -138,24 +140,29 @@ matrix:
|
|
|
138
140
|
ruby:
|
|
139
141
|
- "2.6.5"
|
|
140
142
|
- "2.7.1"
|
|
143
|
+
- "3.0.0"
|
|
141
144
|
- gem: "rails-4.2"
|
|
142
145
|
bundler: "1.17.3"
|
|
143
146
|
exclude:
|
|
144
147
|
ruby:
|
|
145
148
|
- "2.6.5"
|
|
146
149
|
- "2.7.1"
|
|
150
|
+
- "3.0.0"
|
|
147
151
|
- gem: "rails-5.0"
|
|
148
152
|
exclude:
|
|
149
153
|
ruby:
|
|
150
154
|
- "2.0.0-p648"
|
|
155
|
+
- "3.0.0"
|
|
151
156
|
- gem: "rails-5.1"
|
|
152
157
|
exclude:
|
|
153
158
|
ruby:
|
|
154
159
|
- "2.0.0-p648"
|
|
160
|
+
- "3.0.0"
|
|
155
161
|
- gem: "rails-5.2"
|
|
156
162
|
exclude:
|
|
157
163
|
ruby:
|
|
158
164
|
- "2.0.0-p648"
|
|
165
|
+
- "3.0.0"
|
|
159
166
|
- gem: "rails-6.0"
|
|
160
167
|
exclude:
|
|
161
168
|
ruby:
|
|
@@ -167,11 +174,17 @@ matrix:
|
|
|
167
174
|
- "jruby-9.1.17.0"
|
|
168
175
|
- gem: "resque-1"
|
|
169
176
|
bundler: "1.17.3"
|
|
177
|
+
exclude:
|
|
178
|
+
ruby:
|
|
179
|
+
- "3.0.0"
|
|
170
180
|
- gem: "resque-2"
|
|
171
181
|
exclude:
|
|
172
182
|
ruby:
|
|
173
183
|
- "2.0.0-p648"
|
|
174
184
|
- gem: "sequel"
|
|
175
185
|
- gem: "sequel-435"
|
|
186
|
+
exclude:
|
|
187
|
+
ruby:
|
|
188
|
+
- "3.0.0"
|
|
176
189
|
- gem: "sinatra"
|
|
177
190
|
- gem: "webmachine"
|
data/ext/base.rb
CHANGED
|
@@ -119,30 +119,33 @@ def download_archive(type)
|
|
|
119
119
|
|
|
120
120
|
version = AGENT_CONFIG["version"]
|
|
121
121
|
filename = ARCH_CONFIG[type]["filename"]
|
|
122
|
-
|
|
122
|
+
download_errors = []
|
|
123
123
|
|
|
124
124
|
AGENT_CONFIG["mirrors"].each do |mirror|
|
|
125
125
|
download_url = [mirror, version, filename].join("/")
|
|
126
|
-
attempted_mirror_urls << download_url
|
|
127
126
|
report["download"]["download_url"] = download_url
|
|
128
127
|
|
|
129
128
|
begin
|
|
130
|
-
|
|
129
|
+
args = [
|
|
131
130
|
download_url,
|
|
132
131
|
:ssl_ca_cert => CA_CERT_PATH,
|
|
133
132
|
:proxy => http_proxy
|
|
134
|
-
|
|
135
|
-
|
|
133
|
+
]
|
|
134
|
+
if URI.respond_to?(:open) # rubocop:disable Style/GuardClause
|
|
135
|
+
return URI.open(*args)
|
|
136
|
+
else
|
|
137
|
+
return open(*args)
|
|
138
|
+
end
|
|
139
|
+
rescue => error
|
|
140
|
+
download_errors << "- URL: #{download_url}\n Error: #{error.class}: #{error.message}"
|
|
136
141
|
next
|
|
137
142
|
end
|
|
138
143
|
end
|
|
139
144
|
|
|
140
|
-
attempted_mirror_urls_mapped = attempted_mirror_urls.map { |mirror| "- #{mirror}" }
|
|
141
145
|
abort_installation(
|
|
142
146
|
"Could not download archive from any of our mirrors. " \
|
|
143
|
-
"
|
|
144
|
-
"#{
|
|
145
|
-
"Please make sure your network allows access to any of these mirrors."
|
|
147
|
+
"Please make sure your network allows access to any of these mirrors.\n" \
|
|
148
|
+
"Attempted to download the archive from the following urls:\n#{download_errors.join("\n")}"
|
|
146
149
|
)
|
|
147
150
|
end
|
|
148
151
|
|
|
@@ -2,4 +2,11 @@ source 'https://rubygems.org'
|
|
|
2
2
|
|
|
3
3
|
gem 'rack', '~> 1.6'
|
|
4
4
|
|
|
5
|
+
ruby_version = Gem::Version.new(RUBY_VERSION)
|
|
6
|
+
if ruby_version < Gem::Version.new("2.0.0")
|
|
7
|
+
# Newer versions of this gem have rexml as a dependency which doesn't work on
|
|
8
|
+
# Ruby 1.9
|
|
9
|
+
gem "crack", "0.4.4"
|
|
10
|
+
end
|
|
11
|
+
|
|
5
12
|
gemspec :path => '../'
|
data/gemfiles/resque-2.gemfile
CHANGED
data/gemfiles/webmachine.gemfile
CHANGED
|
@@ -34,20 +34,17 @@ module Appsignal
|
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
def self.parse_yaml(contents)
|
|
37
|
-
arguments = [contents]
|
|
38
37
|
if YAML.respond_to? :safe_load
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
[Time]
|
|
46
|
-
end
|
|
38
|
+
if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.6.0")
|
|
39
|
+
# Use keyword params for Ruby 2.6 and up
|
|
40
|
+
YAML.safe_load(contents, :permitted_classes => [Time])
|
|
41
|
+
else
|
|
42
|
+
YAML.safe_load(contents, [Time])
|
|
43
|
+
end
|
|
47
44
|
else
|
|
48
|
-
|
|
45
|
+
# Support for Ruby versions without YAML.safe_load
|
|
46
|
+
YAML.load(contents) # rubocop:disable Security/YAMLLoad
|
|
49
47
|
end
|
|
50
|
-
YAML.send(method, *arguments)
|
|
51
48
|
end
|
|
52
49
|
end
|
|
53
50
|
end
|
|
@@ -278,14 +278,11 @@ module Appsignal
|
|
|
278
278
|
"../../../resources/appsignal.yml.erb"
|
|
279
279
|
)
|
|
280
280
|
file_contents = File.read(filename)
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
arguments << "-"
|
|
287
|
-
end
|
|
288
|
-
template = ERB.new(*arguments)
|
|
281
|
+
template = if ruby_2_6_or_up?
|
|
282
|
+
ERB.new(file_contents, :trim_mode => "-")
|
|
283
|
+
else
|
|
284
|
+
ERB.new(file_contents, nil, "-")
|
|
285
|
+
end
|
|
289
286
|
config = template.result(OpenStruct.new(data).instance_eval { binding })
|
|
290
287
|
|
|
291
288
|
FileUtils.mkdir_p(File.join(Dir.pwd, "config"))
|
|
@@ -380,6 +380,38 @@ module Appsignal
|
|
|
380
380
|
end
|
|
381
381
|
alias :tag_job :tag_request
|
|
382
382
|
|
|
383
|
+
# Add breadcrumbs to the transaction.
|
|
384
|
+
#
|
|
385
|
+
# Breadcrumbs can be used to trace what path a user has taken
|
|
386
|
+
# before encounterin an error.
|
|
387
|
+
#
|
|
388
|
+
# Only the last 20 added breadcrumbs will be saved.
|
|
389
|
+
#
|
|
390
|
+
# @example
|
|
391
|
+
# Appsignal.add_breadcrumb("Navigation", "http://blablabla.com", "", { :response => 200 }, Time.now.utc)
|
|
392
|
+
# Appsignal.add_breadcrumb("Network", "[GET] http://blablabla.com", "", { :response => 500 })
|
|
393
|
+
# Appsignal.add_breadcrumb("UI", "closed modal(change_password)", "User closed modal without actions")
|
|
394
|
+
#
|
|
395
|
+
# @param category [String] category of breadcrumb
|
|
396
|
+
# e.g. "UI", "Network", "Navigation", "Console".
|
|
397
|
+
# @param action [String] name of breadcrumb
|
|
398
|
+
# e.g "The user clicked a button", "HTTP 500 from http://blablabla.com"
|
|
399
|
+
# @option message [String] optional message in string format
|
|
400
|
+
# @option metadata [Hash<String,String>] key/value metadata in <string, string> format
|
|
401
|
+
# @option time [Time] time of breadcrumb, should respond to `.to_i` defaults to `Time.now.utc`
|
|
402
|
+
# @return [void]
|
|
403
|
+
#
|
|
404
|
+
# @see Transaction#add_breadcrumb
|
|
405
|
+
# @see http://docs.appsignal.com/ruby/instrumentation/breadcrumbs.html
|
|
406
|
+
# Breadcrumb reference
|
|
407
|
+
# @since 2.12.0
|
|
408
|
+
def add_breadcrumb(category, action, message = "", metadata = {}, time = Time.now.utc)
|
|
409
|
+
return unless active?
|
|
410
|
+
transaction = Appsignal::Transaction.current
|
|
411
|
+
return false unless transaction
|
|
412
|
+
transaction.add_breadcrumb(category, action, message, metadata, time)
|
|
413
|
+
end
|
|
414
|
+
|
|
383
415
|
# Instrument helper for AppSignal.
|
|
384
416
|
#
|
|
385
417
|
# For more help, read our custom instrumentation guide, listed under "See
|
|
@@ -11,6 +11,7 @@ module Appsignal
|
|
|
11
11
|
BLANK = "".freeze
|
|
12
12
|
ALLOWED_TAG_KEY_TYPES = [Symbol, String].freeze
|
|
13
13
|
ALLOWED_TAG_VALUE_TYPES = [Symbol, String, Integer].freeze
|
|
14
|
+
BREADCRUMB_LIMIT = 20
|
|
14
15
|
|
|
15
16
|
class << self
|
|
16
17
|
def create(id, namespace, request, options = {})
|
|
@@ -58,7 +59,7 @@ module Appsignal
|
|
|
58
59
|
end
|
|
59
60
|
end
|
|
60
61
|
|
|
61
|
-
attr_reader :ext, :transaction_id, :action, :namespace, :request, :paused, :tags, :options, :discarded
|
|
62
|
+
attr_reader :ext, :transaction_id, :action, :namespace, :request, :paused, :tags, :options, :discarded, :breadcrumbs
|
|
62
63
|
|
|
63
64
|
# @!attribute params
|
|
64
65
|
# Attribute for parameters of the transaction.
|
|
@@ -80,6 +81,7 @@ module Appsignal
|
|
|
80
81
|
@paused = false
|
|
81
82
|
@discarded = false
|
|
82
83
|
@tags = {}
|
|
84
|
+
@breadcrumbs = []
|
|
83
85
|
@store = Hash.new({})
|
|
84
86
|
@options = options
|
|
85
87
|
@options[:params_method] ||= :params
|
|
@@ -156,6 +158,31 @@ module Appsignal
|
|
|
156
158
|
@tags.merge!(given_tags)
|
|
157
159
|
end
|
|
158
160
|
|
|
161
|
+
# Add breadcrumbs to the transaction.
|
|
162
|
+
#
|
|
163
|
+
# @param category [String] category of breadcrumb
|
|
164
|
+
# e.g. "UI", "Network", "Navigation", "Console".
|
|
165
|
+
# @param action [String] name of breadcrumb
|
|
166
|
+
# e.g "The user clicked a button", "HTTP 500 from http://blablabla.com"
|
|
167
|
+
# @option message [String] optional message in string format
|
|
168
|
+
# @option metadata [Hash<String,String>] key/value metadata in <string, string> format
|
|
169
|
+
# @option time [Time] time of breadcrumb, should respond to `.to_i` defaults to `Time.now.utc`
|
|
170
|
+
# @return [void]
|
|
171
|
+
#
|
|
172
|
+
# @see Appsignal.add_breadcrumb
|
|
173
|
+
# @see http://docs.appsignal.com/ruby/instrumentation/breadcrumbs.html
|
|
174
|
+
# Breadcrumb reference
|
|
175
|
+
def add_breadcrumb(category, action, message = "", metadata = {}, time = Time.now.utc)
|
|
176
|
+
@breadcrumbs.push(
|
|
177
|
+
:time => time.to_i,
|
|
178
|
+
:category => category,
|
|
179
|
+
:action => action,
|
|
180
|
+
:message => message,
|
|
181
|
+
:metadata => metadata
|
|
182
|
+
)
|
|
183
|
+
@breadcrumbs = @breadcrumbs.last(BREADCRUMB_LIMIT)
|
|
184
|
+
end
|
|
185
|
+
|
|
159
186
|
# Set an action name for the transaction.
|
|
160
187
|
#
|
|
161
188
|
# An action name is used to identify the location of a certain sample;
|
|
@@ -287,7 +314,8 @@ module Appsignal
|
|
|
287
314
|
:environment => sanitized_environment,
|
|
288
315
|
:session_data => sanitized_session_data,
|
|
289
316
|
:metadata => metadata,
|
|
290
|
-
:tags => sanitized_tags
|
|
317
|
+
:tags => sanitized_tags,
|
|
318
|
+
:breadcrumbs => breadcrumbs
|
|
291
319
|
}.each do |key, data|
|
|
292
320
|
set_sample_data(key, data)
|
|
293
321
|
end
|
data/lib/appsignal/version.rb
CHANGED
|
@@ -60,7 +60,10 @@ describe Appsignal::Hooks::ResqueHook do
|
|
|
60
60
|
"error" => nil,
|
|
61
61
|
"namespace" => namespace,
|
|
62
62
|
"metadata" => {},
|
|
63
|
-
"sample_data" => {
|
|
63
|
+
"sample_data" => {
|
|
64
|
+
"breadcrumbs" => [],
|
|
65
|
+
"tags" => { "queue" => queue }
|
|
66
|
+
}
|
|
64
67
|
)
|
|
65
68
|
expect(transaction_hash["events"].map { |e| e["name"] })
|
|
66
69
|
.to eql(["perform.resque"])
|
|
@@ -84,7 +87,10 @@ describe Appsignal::Hooks::ResqueHook do
|
|
|
84
87
|
},
|
|
85
88
|
"namespace" => namespace,
|
|
86
89
|
"metadata" => {},
|
|
87
|
-
"sample_data" => {
|
|
90
|
+
"sample_data" => {
|
|
91
|
+
"breadcrumbs" => [],
|
|
92
|
+
"tags" => { "queue" => queue }
|
|
93
|
+
}
|
|
88
94
|
)
|
|
89
95
|
end
|
|
90
96
|
end
|
|
@@ -118,6 +124,7 @@ describe Appsignal::Hooks::ResqueHook do
|
|
|
118
124
|
"metadata" => {},
|
|
119
125
|
"sample_data" => {
|
|
120
126
|
"tags" => { "queue" => queue },
|
|
127
|
+
"breadcrumbs" => [],
|
|
121
128
|
"params" => [
|
|
122
129
|
"foo",
|
|
123
130
|
{
|
|
@@ -174,6 +181,7 @@ describe Appsignal::Hooks::ResqueHook do
|
|
|
174
181
|
"namespace" => namespace,
|
|
175
182
|
"metadata" => {},
|
|
176
183
|
"sample_data" => {
|
|
184
|
+
"breadcrumbs" => [],
|
|
177
185
|
"tags" => { "queue" => queue }
|
|
178
186
|
# Params will be set by the ActiveJob integration
|
|
179
187
|
}
|
|
@@ -262,7 +262,8 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
|
|
|
262
262
|
"sample_data" => {
|
|
263
263
|
"environment" => {},
|
|
264
264
|
"params" => expected_args,
|
|
265
|
-
"tags" => {}
|
|
265
|
+
"tags" => {},
|
|
266
|
+
"breadcrumbs" => []
|
|
266
267
|
}
|
|
267
268
|
)
|
|
268
269
|
expect_transaction_to_have_sidekiq_event(transaction_hash)
|
|
@@ -290,7 +291,8 @@ describe Appsignal::Hooks::SidekiqPlugin, :with_yaml_parse_error => false do
|
|
|
290
291
|
"sample_data" => {
|
|
291
292
|
"environment" => {},
|
|
292
293
|
"params" => expected_args,
|
|
293
|
-
"tags" => {}
|
|
294
|
+
"tags" => {},
|
|
295
|
+
"breadcrumbs" => []
|
|
294
296
|
}
|
|
295
297
|
)
|
|
296
298
|
# TODO: Not available in transaction.to_h yet.
|
|
@@ -356,6 +356,57 @@ describe Appsignal::Transaction do
|
|
|
356
356
|
end
|
|
357
357
|
end
|
|
358
358
|
|
|
359
|
+
describe "#add_breadcrumb" do
|
|
360
|
+
context "when over the limit" do
|
|
361
|
+
before do
|
|
362
|
+
22.times do |i|
|
|
363
|
+
transaction.add_breadcrumb(
|
|
364
|
+
"network",
|
|
365
|
+
"GET http://localhost",
|
|
366
|
+
"User made external network request",
|
|
367
|
+
{ :code => i + 1 },
|
|
368
|
+
Time.parse("10-10-2010 10:00:00 UTC")
|
|
369
|
+
)
|
|
370
|
+
end
|
|
371
|
+
transaction.sample_data
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
it "stores last <LIMIT> breadcrumbs on the transaction" do
|
|
375
|
+
expect(transaction.to_h["sample_data"]["breadcrumbs"].length).to eql(20)
|
|
376
|
+
expect(transaction.to_h["sample_data"]["breadcrumbs"][0]).to eq(
|
|
377
|
+
"action" => "GET http://localhost",
|
|
378
|
+
"category" => "network",
|
|
379
|
+
"message" => "User made external network request",
|
|
380
|
+
"metadata" => { "code" => 3 },
|
|
381
|
+
"time" => 1286704800 # rubocop:disable Style/NumericLiterals
|
|
382
|
+
)
|
|
383
|
+
expect(transaction.to_h["sample_data"]["breadcrumbs"][19]).to eq(
|
|
384
|
+
"action" => "GET http://localhost",
|
|
385
|
+
"category" => "network",
|
|
386
|
+
"message" => "User made external network request",
|
|
387
|
+
"metadata" => { "code" => 22 },
|
|
388
|
+
"time" => 1286704800 # rubocop:disable Style/NumericLiterals
|
|
389
|
+
)
|
|
390
|
+
end
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
context "with defaults" do
|
|
394
|
+
it "stores breadcrumb with defaults on transaction" do
|
|
395
|
+
timeframe_start = Time.now.utc.to_i
|
|
396
|
+
transaction.add_breadcrumb("user_action", "clicked HOME")
|
|
397
|
+
transaction.sample_data
|
|
398
|
+
timeframe_end = Time.now.utc.to_i
|
|
399
|
+
|
|
400
|
+
breadcrumb = transaction.to_h["sample_data"]["breadcrumbs"][0]
|
|
401
|
+
expect(breadcrumb["category"]).to eq("user_action")
|
|
402
|
+
expect(breadcrumb["action"]).to eq("clicked HOME")
|
|
403
|
+
expect(breadcrumb["message"]).to eq("")
|
|
404
|
+
expect(breadcrumb["time"]).to be_between(timeframe_start, timeframe_end)
|
|
405
|
+
expect(breadcrumb["metadata"]).to eq({})
|
|
406
|
+
end
|
|
407
|
+
end
|
|
408
|
+
end
|
|
409
|
+
|
|
359
410
|
describe "#set_action" do
|
|
360
411
|
context "when the action is set" do
|
|
361
412
|
it "updates the action name on the transaction" do
|
|
@@ -649,6 +700,10 @@ describe Appsignal::Transaction do
|
|
|
649
700
|
"tags",
|
|
650
701
|
Appsignal::Utils::Data.generate({})
|
|
651
702
|
).once
|
|
703
|
+
expect(transaction.ext).to receive(:set_sample_data).with(
|
|
704
|
+
"breadcrumbs",
|
|
705
|
+
Appsignal::Utils::Data.generate([])
|
|
706
|
+
).once
|
|
652
707
|
|
|
653
708
|
transaction.sample_data
|
|
654
709
|
end
|
data/spec/lib/appsignal_spec.rb
CHANGED
|
@@ -491,6 +491,36 @@ describe Appsignal do
|
|
|
491
491
|
end
|
|
492
492
|
end
|
|
493
493
|
|
|
494
|
+
describe ".add_breadcrumb" do
|
|
495
|
+
before { allow(Appsignal::Transaction).to receive(:current).and_return(transaction) }
|
|
496
|
+
|
|
497
|
+
context "with transaction" do
|
|
498
|
+
let(:transaction) { double }
|
|
499
|
+
it "should call add_breadcrumb on transaction" do
|
|
500
|
+
expect(transaction).to receive(:add_breadcrumb)
|
|
501
|
+
.with("Network", "http", "User made network request", { :response => 200 }, fixed_time)
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
after do
|
|
505
|
+
Appsignal.add_breadcrumb(
|
|
506
|
+
"Network",
|
|
507
|
+
"http",
|
|
508
|
+
"User made network request",
|
|
509
|
+
{ :response => 200 },
|
|
510
|
+
fixed_time
|
|
511
|
+
)
|
|
512
|
+
end
|
|
513
|
+
end
|
|
514
|
+
|
|
515
|
+
context "without transaction" do
|
|
516
|
+
let(:transaction) { nil }
|
|
517
|
+
|
|
518
|
+
it "should not call add_breadcrumb on transaction" do
|
|
519
|
+
expect(Appsignal.add_breadcrumb("Network", "http")).to be_falsy
|
|
520
|
+
end
|
|
521
|
+
end
|
|
522
|
+
end
|
|
523
|
+
|
|
494
524
|
describe "custom stats" do
|
|
495
525
|
let(:tags) { { :foo => "bar" } }
|
|
496
526
|
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: appsignal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.11.
|
|
4
|
+
version: 2.11.2
|
|
5
5
|
platform: java
|
|
6
6
|
authors:
|
|
7
7
|
- Robert Beekman
|
|
8
8
|
- Thijs Cadier
|
|
9
9
|
- Tom de Bruijn
|
|
10
|
-
autorequire:
|
|
10
|
+
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date:
|
|
13
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rack
|
|
@@ -413,7 +413,7 @@ metadata:
|
|
|
413
413
|
documentation_uri: https://docs.appsignal.com/ruby/
|
|
414
414
|
homepage_uri: https://docs.appsignal.com/ruby/
|
|
415
415
|
source_code_uri: https://github.com/appsignal/appsignal-ruby
|
|
416
|
-
post_install_message:
|
|
416
|
+
post_install_message:
|
|
417
417
|
rdoc_options: []
|
|
418
418
|
require_paths:
|
|
419
419
|
- lib
|
|
@@ -429,8 +429,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
429
429
|
- !ruby/object:Gem::Version
|
|
430
430
|
version: '0'
|
|
431
431
|
requirements: []
|
|
432
|
-
rubygems_version: 3.1.
|
|
433
|
-
signing_key:
|
|
432
|
+
rubygems_version: 3.1.4
|
|
433
|
+
signing_key:
|
|
434
434
|
specification_version: 4
|
|
435
435
|
summary: Logs performance and exception data from your app to appsignal.com
|
|
436
436
|
test_files:
|