appsignal 3.3.5 → 3.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.semaphore/semaphore.yml +113 -113
- data/CHANGELOG.md +19 -0
- data/build_matrix.yml +19 -19
- data/ext/agent.rb +27 -27
- data/ext/appsignal_extension.c +4 -2
- data/lib/appsignal/cli/demo.rb +2 -2
- data/lib/appsignal/cli/diagnose.rb +1 -1
- data/lib/appsignal/cli/install.rb +5 -5
- data/lib/appsignal/helpers/instrumentation.rb +9 -9
- data/lib/appsignal/logger.rb +12 -1
- data/lib/appsignal/marker.rb +1 -1
- data/lib/appsignal/transaction.rb +2 -2
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +2 -2
- data/resources/appsignal.yml.erb +1 -1
- data/spec/lib/appsignal/cli/diagnose_spec.rb +33 -0
- data/spec/lib/appsignal/cli/install_spec.rb +4 -4
- data/spec/lib/appsignal/logger_spec.rb +22 -13
- data/spec/support/fixtures/projects/valid/config/appsignal.yml +6 -0
- metadata +3 -3
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,24 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 3.3.7
|
4
|
+
|
5
|
+
### Changed
|
6
|
+
|
7
|
+
- [8e67159e](https://github.com/appsignal/appsignal-ruby/commit/8e67159e2a57d3b697a07fadd8eb0e0234db9124) patch - Configure AppSignal with the RACK_ENV or RAILS_ENV environment variable in diagnose CLI, if present. Makes it easier to run the diagnose CLI in production, without having to always specify the environment with the `--environment` CLI option.
|
8
|
+
|
9
|
+
### Fixed
|
10
|
+
|
11
|
+
- [a815b298](https://github.com/appsignal/appsignal-ruby/commit/a815b29826a84f430384e7e735f79c8c312f1abf) patch - Remove trailing comments in SQL queries, ensuring queries are grouped consistently.
|
12
|
+
- [a815b298](https://github.com/appsignal/appsignal-ruby/commit/a815b29826a84f430384e7e735f79c8c312f1abf) patch - Fix an issue where events longer than forty-eight minutes would be shown as having a zero-second duration.
|
13
|
+
|
14
|
+
## 3.3.6
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- [962d069c](https://github.com/appsignal/appsignal-ruby/commit/962d069ce46fd7bf404a2ce28343e1f650ce3b37) patch - Bump agent to 8d042e2.
|
19
|
+
|
20
|
+
- Support multiple log formats.
|
21
|
+
|
3
22
|
## 3.3.5
|
4
23
|
|
5
24
|
### Changed
|
data/build_matrix.yml
CHANGED
@@ -199,9 +199,9 @@ matrix:
|
|
199
199
|
gems: "minimal"
|
200
200
|
- ruby: "2.6.9"
|
201
201
|
- ruby: "2.7.7"
|
202
|
-
- ruby: "3.0.
|
203
|
-
- ruby: "3.1.
|
204
|
-
- ruby: "3.2.
|
202
|
+
- ruby: "3.0.5"
|
203
|
+
- ruby: "3.1.3"
|
204
|
+
- ruby: "3.2.1"
|
205
205
|
- ruby: "jruby-9.3.9.0"
|
206
206
|
gems: "minimal"
|
207
207
|
- ruby: "jruby-9.4.0.0"
|
@@ -214,23 +214,23 @@ matrix:
|
|
214
214
|
- gem: "hanami"
|
215
215
|
only:
|
216
216
|
ruby:
|
217
|
-
- "3.0.
|
218
|
-
- "3.1.
|
219
|
-
- "3.2.
|
217
|
+
- "3.0.5"
|
218
|
+
- "3.1.3"
|
219
|
+
- "3.2.1"
|
220
220
|
- gem: "http5"
|
221
221
|
- gem: "padrino"
|
222
222
|
- gem: "psych-3"
|
223
223
|
only:
|
224
224
|
ruby:
|
225
|
-
- "3.0.
|
226
|
-
- "3.1.
|
227
|
-
- "3.2.
|
225
|
+
- "3.0.5"
|
226
|
+
- "3.1.3"
|
227
|
+
- "3.2.1"
|
228
228
|
- gem: "psych-4"
|
229
229
|
only:
|
230
230
|
ruby:
|
231
|
-
- "3.0.
|
232
|
-
- "3.1.
|
233
|
-
- "3.2.
|
231
|
+
- "3.0.5"
|
232
|
+
- "3.1.3"
|
233
|
+
- "3.2.1"
|
234
234
|
- gem: "que"
|
235
235
|
- gem: "que_beta"
|
236
236
|
- gem: "rails-3.2"
|
@@ -293,7 +293,7 @@ matrix:
|
|
293
293
|
- "2.5.8"
|
294
294
|
- "2.6.9"
|
295
295
|
- "2.7.7"
|
296
|
-
- "3.0.
|
296
|
+
- "3.0.5"
|
297
297
|
- "jruby-9.4.0.0"
|
298
298
|
- gem: "rails-6.1"
|
299
299
|
only:
|
@@ -301,17 +301,17 @@ matrix:
|
|
301
301
|
- "2.5.8"
|
302
302
|
- "2.6.9"
|
303
303
|
- "2.7.7"
|
304
|
-
- "3.0.
|
305
|
-
- "3.1.
|
306
|
-
- "3.2.
|
304
|
+
- "3.0.5"
|
305
|
+
- "3.1.3"
|
306
|
+
- "3.2.1"
|
307
307
|
- "jruby-9.4.0.0"
|
308
308
|
- gem: "rails-7.0"
|
309
309
|
only:
|
310
310
|
ruby:
|
311
311
|
- "2.7.7"
|
312
|
-
- "3.0.
|
313
|
-
- "3.1.
|
314
|
-
- "3.2.
|
312
|
+
- "3.0.5"
|
313
|
+
- "3.1.3"
|
314
|
+
- "3.2.1"
|
315
315
|
- "jruby-9.4.0.0"
|
316
316
|
- gem: "resque-1"
|
317
317
|
bundler: "1.17.3"
|
data/ext/agent.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# Modifications to this file will be overwritten with the next agent release.
|
5
5
|
|
6
6
|
APPSIGNAL_AGENT_CONFIG = {
|
7
|
-
"version" => "
|
7
|
+
"version" => "dee4fcb",
|
8
8
|
"mirrors" => [
|
9
9
|
"https://appsignal-agent-releases.global.ssl.fastly.net",
|
10
10
|
"https://d135dj0rjqvssy.cloudfront.net"
|
@@ -12,131 +12,131 @@ APPSIGNAL_AGENT_CONFIG = {
|
|
12
12
|
"triples" => {
|
13
13
|
"x86_64-darwin" => {
|
14
14
|
"static" => {
|
15
|
-
"checksum" => "
|
15
|
+
"checksum" => "d45bfc2eb38138c317b501c3156459b8dbbb15a59910f1e2ec3d2d02e461a147",
|
16
16
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
17
17
|
},
|
18
18
|
"dynamic" => {
|
19
|
-
"checksum" => "
|
19
|
+
"checksum" => "a126901650046ae1c40affd386ab5dfcda5cb89f9bd05cf0a3087faff1d2d77d",
|
20
20
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
21
21
|
}
|
22
22
|
},
|
23
23
|
"universal-darwin" => {
|
24
24
|
"static" => {
|
25
|
-
"checksum" => "
|
25
|
+
"checksum" => "d45bfc2eb38138c317b501c3156459b8dbbb15a59910f1e2ec3d2d02e461a147",
|
26
26
|
"filename" => "appsignal-x86_64-darwin-all-static.tar.gz"
|
27
27
|
},
|
28
28
|
"dynamic" => {
|
29
|
-
"checksum" => "
|
29
|
+
"checksum" => "a126901650046ae1c40affd386ab5dfcda5cb89f9bd05cf0a3087faff1d2d77d",
|
30
30
|
"filename" => "appsignal-x86_64-darwin-all-dynamic.tar.gz"
|
31
31
|
}
|
32
32
|
},
|
33
33
|
"aarch64-darwin" => {
|
34
34
|
"static" => {
|
35
|
-
"checksum" => "
|
35
|
+
"checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
|
36
36
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
37
37
|
},
|
38
38
|
"dynamic" => {
|
39
|
-
"checksum" => "
|
39
|
+
"checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
|
40
40
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
41
41
|
}
|
42
42
|
},
|
43
43
|
"arm64-darwin" => {
|
44
44
|
"static" => {
|
45
|
-
"checksum" => "
|
45
|
+
"checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
|
46
46
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
47
47
|
},
|
48
48
|
"dynamic" => {
|
49
|
-
"checksum" => "
|
49
|
+
"checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
|
50
50
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
51
51
|
}
|
52
52
|
},
|
53
53
|
"arm-darwin" => {
|
54
54
|
"static" => {
|
55
|
-
"checksum" => "
|
55
|
+
"checksum" => "1cd875e74ba18c2bc81533437a9eebdf08f624e0201427c13326c2be00f22907",
|
56
56
|
"filename" => "appsignal-aarch64-darwin-all-static.tar.gz"
|
57
57
|
},
|
58
58
|
"dynamic" => {
|
59
|
-
"checksum" => "
|
59
|
+
"checksum" => "d2243146bf4e5839a4cf4430870b7b87d6553e1da4dc631c9fb396bba094cea4",
|
60
60
|
"filename" => "appsignal-aarch64-darwin-all-dynamic.tar.gz"
|
61
61
|
}
|
62
62
|
},
|
63
63
|
"aarch64-linux" => {
|
64
64
|
"static" => {
|
65
|
-
"checksum" => "
|
65
|
+
"checksum" => "72fbfaa1c6ed72defea9eca59679372f53ddeab845a9b2f75d9d165e4983d69e",
|
66
66
|
"filename" => "appsignal-aarch64-linux-all-static.tar.gz"
|
67
67
|
},
|
68
68
|
"dynamic" => {
|
69
|
-
"checksum" => "
|
69
|
+
"checksum" => "bf31b4836c84ceaa87a52aa85f296d40e32cfd784a8aa5b19ec5ca3a4aa5c8eb",
|
70
70
|
"filename" => "appsignal-aarch64-linux-all-dynamic.tar.gz"
|
71
71
|
}
|
72
72
|
},
|
73
73
|
"i686-linux" => {
|
74
74
|
"static" => {
|
75
|
-
"checksum" => "
|
75
|
+
"checksum" => "c504a7233512c9285274a7ba0142ab91cf4637c6f5f57c58c6890137ba0f82de",
|
76
76
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
77
77
|
},
|
78
78
|
"dynamic" => {
|
79
|
-
"checksum" => "
|
79
|
+
"checksum" => "19091f50e98afed547b73bc220770bdafce737e152ab9345dabe03e284219cc1",
|
80
80
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
81
81
|
}
|
82
82
|
},
|
83
83
|
"x86-linux" => {
|
84
84
|
"static" => {
|
85
|
-
"checksum" => "
|
85
|
+
"checksum" => "c504a7233512c9285274a7ba0142ab91cf4637c6f5f57c58c6890137ba0f82de",
|
86
86
|
"filename" => "appsignal-i686-linux-all-static.tar.gz"
|
87
87
|
},
|
88
88
|
"dynamic" => {
|
89
|
-
"checksum" => "
|
89
|
+
"checksum" => "19091f50e98afed547b73bc220770bdafce737e152ab9345dabe03e284219cc1",
|
90
90
|
"filename" => "appsignal-i686-linux-all-dynamic.tar.gz"
|
91
91
|
}
|
92
92
|
},
|
93
93
|
"x86_64-linux" => {
|
94
94
|
"static" => {
|
95
|
-
"checksum" => "
|
95
|
+
"checksum" => "f9e68dbbee7d38b255c5b9bc0cb75226764f79cd51421e4e00a9e7454b0c6ccb",
|
96
96
|
"filename" => "appsignal-x86_64-linux-all-static.tar.gz"
|
97
97
|
},
|
98
98
|
"dynamic" => {
|
99
|
-
"checksum" => "
|
99
|
+
"checksum" => "58e3192c87903a2abce6540b893c9d25a69f43e37fd2367df45c2c22c26068ba",
|
100
100
|
"filename" => "appsignal-x86_64-linux-all-dynamic.tar.gz"
|
101
101
|
}
|
102
102
|
},
|
103
103
|
"x86_64-linux-musl" => {
|
104
104
|
"static" => {
|
105
|
-
"checksum" => "
|
105
|
+
"checksum" => "8fa1d110d2544502509cc66ba8ec6685010d8c6d8373f4f14ebe721d4be157e0",
|
106
106
|
"filename" => "appsignal-x86_64-linux-musl-all-static.tar.gz"
|
107
107
|
},
|
108
108
|
"dynamic" => {
|
109
|
-
"checksum" => "
|
109
|
+
"checksum" => "fc46dd29864165968d96bb78fde1c8970903488d80d97056e630636c736cf86f",
|
110
110
|
"filename" => "appsignal-x86_64-linux-musl-all-dynamic.tar.gz"
|
111
111
|
}
|
112
112
|
},
|
113
113
|
"aarch64-linux-musl" => {
|
114
114
|
"static" => {
|
115
|
-
"checksum" => "
|
115
|
+
"checksum" => "a43895183baf017879332885a904208773befc14b9bd628efae6d1513052b782",
|
116
116
|
"filename" => "appsignal-aarch64-linux-musl-all-static.tar.gz"
|
117
117
|
},
|
118
118
|
"dynamic" => {
|
119
|
-
"checksum" => "
|
119
|
+
"checksum" => "7e96b29348be655066cf162ae5c15248bba7d7177663e35e60a6c5ad243937d0",
|
120
120
|
"filename" => "appsignal-aarch64-linux-musl-all-dynamic.tar.gz"
|
121
121
|
}
|
122
122
|
},
|
123
123
|
"x86_64-freebsd" => {
|
124
124
|
"static" => {
|
125
|
-
"checksum" => "
|
125
|
+
"checksum" => "1b992f770bdbced09f7b5f18d7aa721710218d4a76a131adc7affe44d68684f0",
|
126
126
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
127
127
|
},
|
128
128
|
"dynamic" => {
|
129
|
-
"checksum" => "
|
129
|
+
"checksum" => "300b718986c10ff65f237e1d74086e9cc0f7079d7b531e3b6f9a64752f1aa6ee",
|
130
130
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
131
131
|
}
|
132
132
|
},
|
133
133
|
"amd64-freebsd" => {
|
134
134
|
"static" => {
|
135
|
-
"checksum" => "
|
135
|
+
"checksum" => "1b992f770bdbced09f7b5f18d7aa721710218d4a76a131adc7affe44d68684f0",
|
136
136
|
"filename" => "appsignal-x86_64-freebsd-all-static.tar.gz"
|
137
137
|
},
|
138
138
|
"dynamic" => {
|
139
|
-
"checksum" => "
|
139
|
+
"checksum" => "300b718986c10ff65f237e1d74086e9cc0f7079d7b531e3b6f9a64752f1aa6ee",
|
140
140
|
"filename" => "appsignal-x86_64-freebsd-all-dynamic.tar.gz"
|
141
141
|
}
|
142
142
|
}
|
data/ext/appsignal_extension.c
CHANGED
@@ -720,11 +720,12 @@ static VALUE close_span(VALUE self) {
|
|
720
720
|
return Qnil;
|
721
721
|
}
|
722
722
|
|
723
|
-
static VALUE a_log(VALUE self, VALUE group, VALUE severity, VALUE message, VALUE attributes) {
|
723
|
+
static VALUE a_log(VALUE self, VALUE group, VALUE severity, VALUE format, VALUE message, VALUE attributes) {
|
724
724
|
appsignal_data_t* attributes_data;
|
725
725
|
|
726
726
|
Check_Type(group, T_STRING);
|
727
727
|
Check_Type(severity, T_FIXNUM);
|
728
|
+
Check_Type(format, T_FIXNUM);
|
728
729
|
Check_Type(message, T_STRING);
|
729
730
|
Check_Type(attributes, RUBY_T_DATA);
|
730
731
|
|
@@ -733,6 +734,7 @@ static VALUE a_log(VALUE self, VALUE group, VALUE severity, VALUE message, VALUE
|
|
733
734
|
appsignal_log(
|
734
735
|
make_appsignal_string(group),
|
735
736
|
FIX2INT(severity),
|
737
|
+
FIX2INT(format),
|
736
738
|
make_appsignal_string(message),
|
737
739
|
attributes_data
|
738
740
|
);
|
@@ -859,7 +861,7 @@ void Init_appsignal_extension(void) {
|
|
859
861
|
// Diagnostics
|
860
862
|
rb_define_singleton_method(Extension, "diagnose", diagnose, 0);
|
861
863
|
// Logging
|
862
|
-
rb_define_singleton_method(Extension, "log", a_log,
|
864
|
+
rb_define_singleton_method(Extension, "log", a_log, 5);
|
863
865
|
|
864
866
|
// Server state
|
865
867
|
rb_define_singleton_method(Extension, "get_server_state", get_server_state, 1);
|
data/lib/appsignal/cli/demo.rb
CHANGED
@@ -35,9 +35,9 @@ module Appsignal
|
|
35
35
|
# @since 2.0.0
|
36
36
|
# @see Appsignal::Demo
|
37
37
|
# @see Appsignal::CLI::Install
|
38
|
-
# @see
|
38
|
+
# @see https://docs.appsignal.com/ruby/command-line/demo.html
|
39
39
|
# AppSignal demo documentation
|
40
|
-
# @see
|
40
|
+
# @see https://docs.appsignal.com/support/debugging.html
|
41
41
|
# Debugging AppSignal guide
|
42
42
|
# @api private
|
43
43
|
class Demo
|
@@ -196,7 +196,7 @@ module Appsignal
|
|
196
196
|
|
197
197
|
Appsignal.config = Appsignal::Config.new(
|
198
198
|
current_path,
|
199
|
-
options
|
199
|
+
options.fetch(:environment, ENV.fetch("RACK_ENV", ENV.fetch("RAILS_ENV", nil))),
|
200
200
|
initial_config
|
201
201
|
)
|
202
202
|
Appsignal.config.write_to_environment
|
@@ -126,7 +126,7 @@ module Appsignal
|
|
126
126
|
puts " require 'appsignal/integrations/sinatra'"
|
127
127
|
puts
|
128
128
|
puts " You can find more information in the documentation:"
|
129
|
-
puts "
|
129
|
+
puts " https://docs.appsignal.com/ruby/integrations/sinatra.html"
|
130
130
|
press_any_key
|
131
131
|
done_notice
|
132
132
|
end
|
@@ -144,7 +144,7 @@ module Appsignal
|
|
144
144
|
puts " require 'appsignal/integrations/padrino"
|
145
145
|
puts
|
146
146
|
puts " You can find more information in the documentation:"
|
147
|
-
puts "
|
147
|
+
puts " https://docs.appsignal.com/ruby/integrations/padrino.html"
|
148
148
|
press_any_key
|
149
149
|
done_notice
|
150
150
|
end
|
@@ -159,7 +159,7 @@ module Appsignal
|
|
159
159
|
|
160
160
|
puts "Manual Grape configuration needed"
|
161
161
|
puts " See the installation instructions at:"
|
162
|
-
puts "
|
162
|
+
puts " https://docs.appsignal.com/ruby/integrations/grape.html"
|
163
163
|
press_any_key
|
164
164
|
done_notice
|
165
165
|
end
|
@@ -177,7 +177,7 @@ module Appsignal
|
|
177
177
|
puts " require 'appsignal/integrations/hanami'"
|
178
178
|
puts
|
179
179
|
puts " You can find more information in the documentation:"
|
180
|
-
puts "
|
180
|
+
puts " https://docs.appsignal.com/ruby/integrations/hanami.html"
|
181
181
|
press_any_key
|
182
182
|
done_notice
|
183
183
|
end
|
@@ -234,7 +234,7 @@ module Appsignal
|
|
234
234
|
end
|
235
235
|
puts
|
236
236
|
puts " See the documentation for more configuration options:"
|
237
|
-
puts "
|
237
|
+
puts " https://docs.appsignal.com/gem-settings/configuration.html"
|
238
238
|
press_any_key
|
239
239
|
break
|
240
240
|
end
|
@@ -197,9 +197,9 @@ module Appsignal
|
|
197
197
|
# used to send the error.
|
198
198
|
# @return [void]
|
199
199
|
#
|
200
|
-
# @see
|
200
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/exception-handling.html
|
201
201
|
# Exception handling guide
|
202
|
-
# @see
|
202
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/tagging.html
|
203
203
|
# Tagging guide
|
204
204
|
# @since 0.6.0
|
205
205
|
def send_error(
|
@@ -296,7 +296,7 @@ module Appsignal
|
|
296
296
|
# @return [void]
|
297
297
|
#
|
298
298
|
# @see Transaction#set_error
|
299
|
-
# @see
|
299
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/exception-handling.html
|
300
300
|
# Exception handling guide
|
301
301
|
# @since 0.6.6
|
302
302
|
def set_error(exception, tags = nil, namespace = nil)
|
@@ -435,7 +435,7 @@ module Appsignal
|
|
435
435
|
# @return [void]
|
436
436
|
#
|
437
437
|
# @see Transaction.set_tags
|
438
|
-
# @see
|
438
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/tagging.html
|
439
439
|
# Tagging guide
|
440
440
|
def tag_request(tags = {})
|
441
441
|
return unless active?
|
@@ -468,7 +468,7 @@ module Appsignal
|
|
468
468
|
# @return [void]
|
469
469
|
#
|
470
470
|
# @see Transaction#add_breadcrumb
|
471
|
-
# @see
|
471
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/breadcrumbs.html
|
472
472
|
# Breadcrumb reference
|
473
473
|
# @since 2.12.0
|
474
474
|
def add_breadcrumb(category, action, message = "", metadata = {}, time = Time.now.utc)
|
@@ -513,9 +513,9 @@ module Appsignal
|
|
513
513
|
#
|
514
514
|
# @see Appsignal::Transaction#instrument
|
515
515
|
# @see .instrument_sql
|
516
|
-
# @see
|
516
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/instrumentation.html
|
517
517
|
# AppSignal custom instrumentation guide
|
518
|
-
# @see
|
518
|
+
# @see https://docs.appsignal.com/api/event-names.html
|
519
519
|
# AppSignal event naming guide
|
520
520
|
# @since 1.3.0
|
521
521
|
def instrument(
|
@@ -557,9 +557,9 @@ module Appsignal
|
|
557
557
|
# @return [Object] Returns the block's return value.
|
558
558
|
#
|
559
559
|
# @see .instrument
|
560
|
-
# @see
|
560
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/instrumentation.html
|
561
561
|
# AppSignal custom instrumentation guide
|
562
|
-
# @see
|
562
|
+
# @see https://docs.appsignal.com/api/event-names.html
|
563
563
|
# AppSignal event naming guide
|
564
564
|
# @since 2.0.0
|
565
565
|
def instrument_sql(name, title = nil, body = nil, &block)
|
data/lib/appsignal/logger.rb
CHANGED
@@ -6,15 +6,20 @@ require "set"
|
|
6
6
|
module Appsignal
|
7
7
|
# Logger that flushes logs to the AppSignal logging service
|
8
8
|
class Logger < ::Logger # rubocop:disable Metrics/ClassLength
|
9
|
+
PLAINTEXT = 0
|
10
|
+
LOGFMT = 1
|
11
|
+
JSON = 2
|
12
|
+
|
9
13
|
# Create a new logger instance
|
10
14
|
#
|
11
15
|
# @param group Name of the group for this logger.
|
12
16
|
# @param level Log level to filter with
|
13
17
|
# @return [void]
|
14
|
-
def initialize(group, level
|
18
|
+
def initialize(group, level: INFO, format: PLAINTEXT)
|
15
19
|
raise TypeError, "group must be a string" unless group.is_a? String
|
16
20
|
@group = group
|
17
21
|
@level = level
|
22
|
+
@format = format
|
18
23
|
end
|
19
24
|
|
20
25
|
# We support the various methods in the Ruby
|
@@ -51,6 +56,7 @@ module Appsignal
|
|
51
56
|
Appsignal::Extension.log(
|
52
57
|
group,
|
53
58
|
severity_number,
|
59
|
+
@format,
|
54
60
|
message,
|
55
61
|
Appsignal::Utils::Data.generate({})
|
56
62
|
)
|
@@ -69,6 +75,7 @@ module Appsignal
|
|
69
75
|
Appsignal::Extension.log(
|
70
76
|
@group,
|
71
77
|
2,
|
78
|
+
@format,
|
72
79
|
message,
|
73
80
|
Appsignal::Utils::Data.generate(attributes)
|
74
81
|
)
|
@@ -86,6 +93,7 @@ module Appsignal
|
|
86
93
|
Appsignal::Extension.log(
|
87
94
|
@group,
|
88
95
|
3,
|
96
|
+
@format,
|
89
97
|
message,
|
90
98
|
Appsignal::Utils::Data.generate(attributes)
|
91
99
|
)
|
@@ -103,6 +111,7 @@ module Appsignal
|
|
103
111
|
Appsignal::Extension.log(
|
104
112
|
@group,
|
105
113
|
5,
|
114
|
+
@format,
|
106
115
|
message,
|
107
116
|
Appsignal::Utils::Data.generate(attributes)
|
108
117
|
)
|
@@ -120,6 +129,7 @@ module Appsignal
|
|
120
129
|
Appsignal::Extension.log(
|
121
130
|
@group,
|
122
131
|
6,
|
132
|
+
@format,
|
123
133
|
message,
|
124
134
|
Appsignal::Utils::Data.generate(attributes)
|
125
135
|
)
|
@@ -137,6 +147,7 @@ module Appsignal
|
|
137
147
|
Appsignal::Extension.log(
|
138
148
|
@group,
|
139
149
|
7,
|
150
|
+
@format,
|
140
151
|
message,
|
141
152
|
Appsignal::Utils::Data.generate(attributes)
|
142
153
|
)
|
data/lib/appsignal/marker.rb
CHANGED
@@ -18,7 +18,7 @@ module Appsignal
|
|
18
18
|
# Set config does not override data set in {#marker_data}.
|
19
19
|
#
|
20
20
|
# @see Appsignal::CLI::NotifyOfDeploy
|
21
|
-
# @see
|
21
|
+
# @see https://docs.appsignal.com/appsignal/terminology.html#markers
|
22
22
|
# Terminology: Deploy marker
|
23
23
|
# @api private
|
24
24
|
class Marker
|
@@ -159,7 +159,7 @@ module Appsignal
|
|
159
159
|
# @return [void]
|
160
160
|
#
|
161
161
|
# @see Appsignal.tag_request
|
162
|
-
# @see
|
162
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/tagging.html
|
163
163
|
# Tagging guide
|
164
164
|
def set_tags(given_tags = {})
|
165
165
|
@tags.merge!(given_tags)
|
@@ -177,7 +177,7 @@ module Appsignal
|
|
177
177
|
# @return [void]
|
178
178
|
#
|
179
179
|
# @see Appsignal.add_breadcrumb
|
180
|
-
# @see
|
180
|
+
# @see https://docs.appsignal.com/ruby/instrumentation/breadcrumbs.html
|
181
181
|
# Breadcrumb reference
|
182
182
|
def add_breadcrumb(category, action, message = "", metadata = {}, time = Time.now.utc)
|
183
183
|
@breadcrumbs.push(
|
data/lib/appsignal/version.rb
CHANGED
data/lib/appsignal.rb
CHANGED
@@ -74,8 +74,8 @@ module Appsignal
|
|
74
74
|
# This is not required for the automatic integrations AppSignal offers, but
|
75
75
|
# this is required for all non-automatic integrations and pure Ruby
|
76
76
|
# applications. For more information, see our [integrations
|
77
|
-
# list](
|
78
|
-
# AppSignal](
|
77
|
+
# list](https://docs.appsignal.com/ruby/integrations/) and our [Integrating
|
78
|
+
# AppSignal](https://docs.appsignal.com/ruby/instrumentation/integrating-appsignal.html)
|
79
79
|
# guide.
|
80
80
|
#
|
81
81
|
# To start the logger see {.start_logger}.
|
data/resources/appsignal.yml.erb
CHANGED
@@ -26,7 +26,7 @@ default: &defaults
|
|
26
26
|
# - SystemExit
|
27
27
|
# - SystemStackError
|
28
28
|
|
29
|
-
# See
|
29
|
+
# See https://docs.appsignal.com/ruby/configuration/options.html for
|
30
30
|
# all configuration options.
|
31
31
|
|
32
32
|
# Configuration per environment, leave out an environment or set active
|
@@ -802,6 +802,39 @@ describe Appsignal::CLI::Diagnose, :api_stub => true, :send_report => :yes_cli_i
|
|
802
802
|
end
|
803
803
|
end
|
804
804
|
|
805
|
+
context "when the source is the RACK_ENV env variable", :send_report => :no_cli_option do
|
806
|
+
let(:config) { project_fixture_config("rack_env") }
|
807
|
+
let(:options) { {} }
|
808
|
+
before do
|
809
|
+
ENV["RACK_ENV"] = "rack_env"
|
810
|
+
run
|
811
|
+
end
|
812
|
+
after { ENV.delete("RACK_ENV") }
|
813
|
+
|
814
|
+
it "outputs the RACK_ENV variable value" do
|
815
|
+
expect(output).to include(
|
816
|
+
%(environment: "rack_env" (Loaded from: initial)\n)
|
817
|
+
)
|
818
|
+
end
|
819
|
+
end
|
820
|
+
|
821
|
+
context "when the source is the RAILS_ENV env variable", :send_report => :no_cli_option do
|
822
|
+
let(:config) { project_fixture_config("rails_env") }
|
823
|
+
let(:options) { {} }
|
824
|
+
before do
|
825
|
+
ENV.delete("RACK_ENV")
|
826
|
+
ENV["RAILS_ENV"] = "rails_env"
|
827
|
+
run
|
828
|
+
end
|
829
|
+
after { ENV.delete("RAILS_ENV") }
|
830
|
+
|
831
|
+
it "outputs the RAILS_ENV variable value" do
|
832
|
+
expect(output).to include(
|
833
|
+
%(environment: "rails_env" (Loaded from: initial)\n)
|
834
|
+
)
|
835
|
+
end
|
836
|
+
end
|
837
|
+
|
805
838
|
context "when the source is multiple sources" do
|
806
839
|
let(:options) { { :environment => "development" } }
|
807
840
|
before do
|
@@ -469,7 +469,7 @@ describe Appsignal::CLI::Install do
|
|
469
469
|
"Installing for Sinatra",
|
470
470
|
"Sinatra requires some manual configuration.",
|
471
471
|
"require 'appsignal/integrations/sinatra'",
|
472
|
-
"
|
472
|
+
"https://docs.appsignal.com/ruby/integrations/sinatra.html"
|
473
473
|
]
|
474
474
|
end
|
475
475
|
let(:app_name) { "Test app" }
|
@@ -536,7 +536,7 @@ describe Appsignal::CLI::Install do
|
|
536
536
|
[
|
537
537
|
"Installing for Padrino",
|
538
538
|
"Padrino requires some manual configuration.",
|
539
|
-
"
|
539
|
+
"https://docs.appsignal.com/ruby/integrations/padrino.html"
|
540
540
|
]
|
541
541
|
end
|
542
542
|
let(:app_name) { "Test app" }
|
@@ -603,7 +603,7 @@ describe Appsignal::CLI::Install do
|
|
603
603
|
[
|
604
604
|
"Installing for Grape",
|
605
605
|
"Manual Grape configuration needed",
|
606
|
-
"
|
606
|
+
"https://docs.appsignal.com/ruby/integrations/grape.html"
|
607
607
|
]
|
608
608
|
end
|
609
609
|
let(:app_name) { "Test app" }
|
@@ -670,7 +670,7 @@ describe Appsignal::CLI::Install do
|
|
670
670
|
[
|
671
671
|
"Installing for Hanami",
|
672
672
|
"Hanami requires some manual configuration.",
|
673
|
-
"
|
673
|
+
"https://docs.appsignal.com/ruby/integrations/hanami.html"
|
674
674
|
]
|
675
675
|
end
|
676
676
|
let(:app_name) { "Test app" }
|