appsignal 3.2.2 → 3.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: 2b85a454d1a7609add364698fe5407bfe438db4d4f15966ec5cb0ada9e015e11
4
- data.tar.gz: 24fcedd7b116b6a017e247c1e049b1ad575d789372894504aaa80270b6cabfd0
3
+ metadata.gz: 65532373cf64e4540c1ecb07fb76f248f07c869b0d7a265c0257d58ac1ada1e3
4
+ data.tar.gz: 0e28bada60eaf3ffbaa776e5c14cf2ed204af935d1e6183a5efe00f5cc4dcea5
5
5
  SHA512:
6
- metadata.gz: 5fd91fd5250d78ab967151497a5a22dd017070af9a31cfb87de396755b88ae02eb12fc1844dd6cbe63a934c4896b98ce86c4770b0523a6b8ea76bfdb3a152e31
7
- data.tar.gz: ceeac6a2e2b545b64e6f820b1acc34e0d9465500f2abf7d050c004120c3845bead373bbfcf777f725d488ec589e57791f059879e64b5f8e6af35581d96b06811
6
+ metadata.gz: 6c470d0b070d7aea2986971c1d357b450cb25b9daccc43e5acc2ac84c0b591557b5d0551fa7d11184f3d08330f88ffd5988766ce2d04b388ce74a7fa1d113b28
7
+ data.tar.gz: e7be539740c14370c8b8b1ba48ae882599260b2d012bd2258821112a2c7901a266d1cf18159aa7bd175dcecb672f2772018016ffa062da5947e350de76241942
data/.rubocop_todo.yml CHANGED
@@ -88,6 +88,7 @@ Style/Alias:
88
88
  Style/ClassAndModuleChildren:
89
89
  Exclude:
90
90
  - 'lib/appsignal/integrations/padrino.rb'
91
+ - 'lib/appsignal/integrations/hanami.rb'
91
92
 
92
93
  # Offense count: 1
93
94
  Style/DoubleNegation:
@@ -1368,6 +1368,24 @@ blocks:
1368
1368
  value: latest
1369
1369
  commands:
1370
1370
  - "./support/bundler_wrapper exec rake test"
1371
+ - name: Ruby 3.0.4 for hanami
1372
+ env_vars:
1373
+ - *2
1374
+ - *3
1375
+ - *4
1376
+ - *5
1377
+ - name: RUBY_VERSION
1378
+ value: 3.0.4
1379
+ - name: GEMSET
1380
+ value: hanami
1381
+ - name: BUNDLE_GEMFILE
1382
+ value: gemfiles/hanami.gemfile
1383
+ - name: _RUBYGEMS_VERSION
1384
+ value: latest
1385
+ - name: _BUNDLER_VERSION
1386
+ value: latest
1387
+ commands:
1388
+ - "./support/bundler_wrapper exec rake test"
1371
1389
  - name: Ruby 3.0.4 for http5
1372
1390
  env_vars:
1373
1391
  - *2
@@ -1707,6 +1725,24 @@ blocks:
1707
1725
  value: latest
1708
1726
  commands:
1709
1727
  - "./support/bundler_wrapper exec rake test"
1728
+ - name: Ruby 3.1.2 for hanami
1729
+ env_vars:
1730
+ - *2
1731
+ - *3
1732
+ - *4
1733
+ - *5
1734
+ - name: RUBY_VERSION
1735
+ value: 3.1.2
1736
+ - name: GEMSET
1737
+ value: hanami
1738
+ - name: BUNDLE_GEMFILE
1739
+ value: gemfiles/hanami.gemfile
1740
+ - name: _RUBYGEMS_VERSION
1741
+ value: latest
1742
+ - name: _BUNDLER_VERSION
1743
+ value: latest
1744
+ commands:
1745
+ - "./support/bundler_wrapper exec rake test"
1710
1746
  - name: Ruby 3.1.2 for http5
1711
1747
  env_vars:
1712
1748
  - *2
@@ -1923,7 +1959,7 @@ blocks:
1923
1959
  value: latest
1924
1960
  commands:
1925
1961
  - "./support/bundler_wrapper exec rake test"
1926
- - name: Ruby 3.2.0-preview3
1962
+ - name: Ruby 3.2.0-rc1
1927
1963
  dependencies:
1928
1964
  - Validation
1929
1965
  task:
@@ -1939,14 +1975,14 @@ blocks:
1939
1975
  - "./support/bundler_wrapper exec rake extension:install"
1940
1976
  epilogue: *1
1941
1977
  jobs:
1942
- - name: Ruby 3.2.0-preview3 for no_dependencies
1978
+ - name: Ruby 3.2.0-rc1 for no_dependencies
1943
1979
  env_vars:
1944
1980
  - *2
1945
1981
  - *3
1946
1982
  - *4
1947
1983
  - *5
1948
1984
  - name: RUBY_VERSION
1949
- value: 3.2.0-preview3
1985
+ value: 3.2.0-rc1
1950
1986
  - name: GEMSET
1951
1987
  value: no_dependencies
1952
1988
  - name: BUNDLE_GEMFILE
@@ -1958,12 +1994,15 @@ blocks:
1958
1994
  - &6
1959
1995
  name: _LIBYAML
1960
1996
  value: '1'
1997
+ - &7
1998
+ name: RUBY_CFLAGS
1999
+ value: "-std=gnu99"
1961
2000
  commands:
1962
2001
  - "./support/bundler_wrapper exec rake test"
1963
2002
  - "./support/bundler_wrapper exec rake test:failure"
1964
- - name: Ruby 3.2.0-preview3 - Gems
2003
+ - name: Ruby 3.2.0-rc1 - Gems
1965
2004
  dependencies:
1966
- - Ruby 3.2.0-preview3
2005
+ - Ruby 3.2.0-rc1
1967
2006
  task:
1968
2007
  prologue:
1969
2008
  commands:
@@ -1977,14 +2016,14 @@ blocks:
1977
2016
  - "./support/bundler_wrapper exec rake extension:install"
1978
2017
  epilogue: *1
1979
2018
  jobs:
1980
- - name: Ruby 3.2.0-preview3 for capistrano2
2019
+ - name: Ruby 3.2.0-rc1 for capistrano2
1981
2020
  env_vars:
1982
2021
  - *2
1983
2022
  - *3
1984
2023
  - *4
1985
2024
  - *5
1986
2025
  - name: RUBY_VERSION
1987
- value: 3.2.0-preview3
2026
+ value: 3.2.0-rc1
1988
2027
  - name: GEMSET
1989
2028
  value: capistrano2
1990
2029
  - name: BUNDLE_GEMFILE
@@ -1994,16 +2033,17 @@ blocks:
1994
2033
  - name: _BUNDLER_VERSION
1995
2034
  value: latest
1996
2035
  - *6
2036
+ - *7
1997
2037
  commands:
1998
2038
  - "./support/bundler_wrapper exec rake test"
1999
- - name: Ruby 3.2.0-preview3 for capistrano3
2039
+ - name: Ruby 3.2.0-rc1 for capistrano3
2000
2040
  env_vars:
2001
2041
  - *2
2002
2042
  - *3
2003
2043
  - *4
2004
2044
  - *5
2005
2045
  - name: RUBY_VERSION
2006
- value: 3.2.0-preview3
2046
+ value: 3.2.0-rc1
2007
2047
  - name: GEMSET
2008
2048
  value: capistrano3
2009
2049
  - name: BUNDLE_GEMFILE
@@ -2013,16 +2053,17 @@ blocks:
2013
2053
  - name: _BUNDLER_VERSION
2014
2054
  value: latest
2015
2055
  - *6
2056
+ - *7
2016
2057
  commands:
2017
2058
  - "./support/bundler_wrapper exec rake test"
2018
- - name: Ruby 3.2.0-preview3 for grape
2059
+ - name: Ruby 3.2.0-rc1 for grape
2019
2060
  env_vars:
2020
2061
  - *2
2021
2062
  - *3
2022
2063
  - *4
2023
2064
  - *5
2024
2065
  - name: RUBY_VERSION
2025
- value: 3.2.0-preview3
2066
+ value: 3.2.0-rc1
2026
2067
  - name: GEMSET
2027
2068
  value: grape
2028
2069
  - name: BUNDLE_GEMFILE
@@ -2032,16 +2073,37 @@ blocks:
2032
2073
  - name: _BUNDLER_VERSION
2033
2074
  value: latest
2034
2075
  - *6
2076
+ - *7
2077
+ commands:
2078
+ - "./support/bundler_wrapper exec rake test"
2079
+ - name: Ruby 3.2.0-rc1 for hanami
2080
+ env_vars:
2081
+ - *2
2082
+ - *3
2083
+ - *4
2084
+ - *5
2085
+ - name: RUBY_VERSION
2086
+ value: 3.2.0-rc1
2087
+ - name: GEMSET
2088
+ value: hanami
2089
+ - name: BUNDLE_GEMFILE
2090
+ value: gemfiles/hanami.gemfile
2091
+ - name: _RUBYGEMS_VERSION
2092
+ value: latest
2093
+ - name: _BUNDLER_VERSION
2094
+ value: latest
2095
+ - *6
2096
+ - *7
2035
2097
  commands:
2036
2098
  - "./support/bundler_wrapper exec rake test"
2037
- - name: Ruby 3.2.0-preview3 for http5
2099
+ - name: Ruby 3.2.0-rc1 for http5
2038
2100
  env_vars:
2039
2101
  - *2
2040
2102
  - *3
2041
2103
  - *4
2042
2104
  - *5
2043
2105
  - name: RUBY_VERSION
2044
- value: 3.2.0-preview3
2106
+ value: 3.2.0-rc1
2045
2107
  - name: GEMSET
2046
2108
  value: http5
2047
2109
  - name: BUNDLE_GEMFILE
@@ -2051,16 +2113,17 @@ blocks:
2051
2113
  - name: _BUNDLER_VERSION
2052
2114
  value: latest
2053
2115
  - *6
2116
+ - *7
2054
2117
  commands:
2055
2118
  - "./support/bundler_wrapper exec rake test"
2056
- - name: Ruby 3.2.0-preview3 for padrino
2119
+ - name: Ruby 3.2.0-rc1 for padrino
2057
2120
  env_vars:
2058
2121
  - *2
2059
2122
  - *3
2060
2123
  - *4
2061
2124
  - *5
2062
2125
  - name: RUBY_VERSION
2063
- value: 3.2.0-preview3
2126
+ value: 3.2.0-rc1
2064
2127
  - name: GEMSET
2065
2128
  value: padrino
2066
2129
  - name: BUNDLE_GEMFILE
@@ -2070,16 +2133,17 @@ blocks:
2070
2133
  - name: _BUNDLER_VERSION
2071
2134
  value: latest
2072
2135
  - *6
2136
+ - *7
2073
2137
  commands:
2074
2138
  - "./support/bundler_wrapper exec rake test"
2075
- - name: Ruby 3.2.0-preview3 for psych-3
2139
+ - name: Ruby 3.2.0-rc1 for psych-3
2076
2140
  env_vars:
2077
2141
  - *2
2078
2142
  - *3
2079
2143
  - *4
2080
2144
  - *5
2081
2145
  - name: RUBY_VERSION
2082
- value: 3.2.0-preview3
2146
+ value: 3.2.0-rc1
2083
2147
  - name: GEMSET
2084
2148
  value: psych-3
2085
2149
  - name: BUNDLE_GEMFILE
@@ -2089,16 +2153,17 @@ blocks:
2089
2153
  - name: _BUNDLER_VERSION
2090
2154
  value: latest
2091
2155
  - *6
2156
+ - *7
2092
2157
  commands:
2093
2158
  - "./support/bundler_wrapper exec rake test"
2094
- - name: Ruby 3.2.0-preview3 for psych-4
2159
+ - name: Ruby 3.2.0-rc1 for psych-4
2095
2160
  env_vars:
2096
2161
  - *2
2097
2162
  - *3
2098
2163
  - *4
2099
2164
  - *5
2100
2165
  - name: RUBY_VERSION
2101
- value: 3.2.0-preview3
2166
+ value: 3.2.0-rc1
2102
2167
  - name: GEMSET
2103
2168
  value: psych-4
2104
2169
  - name: BUNDLE_GEMFILE
@@ -2108,16 +2173,17 @@ blocks:
2108
2173
  - name: _BUNDLER_VERSION
2109
2174
  value: latest
2110
2175
  - *6
2176
+ - *7
2111
2177
  commands:
2112
2178
  - "./support/bundler_wrapper exec rake test"
2113
- - name: Ruby 3.2.0-preview3 for que
2179
+ - name: Ruby 3.2.0-rc1 for que
2114
2180
  env_vars:
2115
2181
  - *2
2116
2182
  - *3
2117
2183
  - *4
2118
2184
  - *5
2119
2185
  - name: RUBY_VERSION
2120
- value: 3.2.0-preview3
2186
+ value: 3.2.0-rc1
2121
2187
  - name: GEMSET
2122
2188
  value: que
2123
2189
  - name: BUNDLE_GEMFILE
@@ -2127,16 +2193,17 @@ blocks:
2127
2193
  - name: _BUNDLER_VERSION
2128
2194
  value: latest
2129
2195
  - *6
2196
+ - *7
2130
2197
  commands:
2131
2198
  - "./support/bundler_wrapper exec rake test"
2132
- - name: Ruby 3.2.0-preview3 for que_beta
2199
+ - name: Ruby 3.2.0-rc1 for que_beta
2133
2200
  env_vars:
2134
2201
  - *2
2135
2202
  - *3
2136
2203
  - *4
2137
2204
  - *5
2138
2205
  - name: RUBY_VERSION
2139
- value: 3.2.0-preview3
2206
+ value: 3.2.0-rc1
2140
2207
  - name: GEMSET
2141
2208
  value: que_beta
2142
2209
  - name: BUNDLE_GEMFILE
@@ -2146,16 +2213,17 @@ blocks:
2146
2213
  - name: _BUNDLER_VERSION
2147
2214
  value: latest
2148
2215
  - *6
2216
+ - *7
2149
2217
  commands:
2150
2218
  - "./support/bundler_wrapper exec rake test"
2151
- - name: Ruby 3.2.0-preview3 for rails-6.1
2219
+ - name: Ruby 3.2.0-rc1 for rails-6.1
2152
2220
  env_vars:
2153
2221
  - *2
2154
2222
  - *3
2155
2223
  - *4
2156
2224
  - *5
2157
2225
  - name: RUBY_VERSION
2158
- value: 3.2.0-preview3
2226
+ value: 3.2.0-rc1
2159
2227
  - name: GEMSET
2160
2228
  value: rails-6.1
2161
2229
  - name: BUNDLE_GEMFILE
@@ -2165,16 +2233,17 @@ blocks:
2165
2233
  - name: _BUNDLER_VERSION
2166
2234
  value: latest
2167
2235
  - *6
2236
+ - *7
2168
2237
  commands:
2169
2238
  - "./support/bundler_wrapper exec rake test"
2170
- - name: Ruby 3.2.0-preview3 for rails-7.0
2239
+ - name: Ruby 3.2.0-rc1 for rails-7.0
2171
2240
  env_vars:
2172
2241
  - *2
2173
2242
  - *3
2174
2243
  - *4
2175
2244
  - *5
2176
2245
  - name: RUBY_VERSION
2177
- value: 3.2.0-preview3
2246
+ value: 3.2.0-rc1
2178
2247
  - name: GEMSET
2179
2248
  value: rails-7.0
2180
2249
  - name: BUNDLE_GEMFILE
@@ -2184,16 +2253,17 @@ blocks:
2184
2253
  - name: _BUNDLER_VERSION
2185
2254
  value: latest
2186
2255
  - *6
2256
+ - *7
2187
2257
  commands:
2188
2258
  - "./support/bundler_wrapper exec rake test"
2189
- - name: Ruby 3.2.0-preview3 for resque-2
2259
+ - name: Ruby 3.2.0-rc1 for resque-2
2190
2260
  env_vars:
2191
2261
  - *2
2192
2262
  - *3
2193
2263
  - *4
2194
2264
  - *5
2195
2265
  - name: RUBY_VERSION
2196
- value: 3.2.0-preview3
2266
+ value: 3.2.0-rc1
2197
2267
  - name: GEMSET
2198
2268
  value: resque-2
2199
2269
  - name: BUNDLE_GEMFILE
@@ -2203,16 +2273,17 @@ blocks:
2203
2273
  - name: _BUNDLER_VERSION
2204
2274
  value: latest
2205
2275
  - *6
2276
+ - *7
2206
2277
  commands:
2207
2278
  - "./support/bundler_wrapper exec rake test"
2208
- - name: Ruby 3.2.0-preview3 for sequel
2279
+ - name: Ruby 3.2.0-rc1 for sequel
2209
2280
  env_vars:
2210
2281
  - *2
2211
2282
  - *3
2212
2283
  - *4
2213
2284
  - *5
2214
2285
  - name: RUBY_VERSION
2215
- value: 3.2.0-preview3
2286
+ value: 3.2.0-rc1
2216
2287
  - name: GEMSET
2217
2288
  value: sequel
2218
2289
  - name: BUNDLE_GEMFILE
@@ -2222,16 +2293,17 @@ blocks:
2222
2293
  - name: _BUNDLER_VERSION
2223
2294
  value: latest
2224
2295
  - *6
2296
+ - *7
2225
2297
  commands:
2226
2298
  - "./support/bundler_wrapper exec rake test"
2227
- - name: Ruby 3.2.0-preview3 for sinatra
2299
+ - name: Ruby 3.2.0-rc1 for sinatra
2228
2300
  env_vars:
2229
2301
  - *2
2230
2302
  - *3
2231
2303
  - *4
2232
2304
  - *5
2233
2305
  - name: RUBY_VERSION
2234
- value: 3.2.0-preview3
2306
+ value: 3.2.0-rc1
2235
2307
  - name: GEMSET
2236
2308
  value: sinatra
2237
2309
  - name: BUNDLE_GEMFILE
@@ -2241,16 +2313,17 @@ blocks:
2241
2313
  - name: _BUNDLER_VERSION
2242
2314
  value: latest
2243
2315
  - *6
2316
+ - *7
2244
2317
  commands:
2245
2318
  - "./support/bundler_wrapper exec rake test"
2246
- - name: Ruby 3.2.0-preview3 for webmachine
2319
+ - name: Ruby 3.2.0-rc1 for webmachine
2247
2320
  env_vars:
2248
2321
  - *2
2249
2322
  - *3
2250
2323
  - *4
2251
2324
  - *5
2252
2325
  - name: RUBY_VERSION
2253
- value: 3.2.0-preview3
2326
+ value: 3.2.0-rc1
2254
2327
  - name: GEMSET
2255
2328
  value: webmachine
2256
2329
  - name: BUNDLE_GEMFILE
@@ -2260,6 +2333,7 @@ blocks:
2260
2333
  - name: _BUNDLER_VERSION
2261
2334
  value: latest
2262
2335
  - *6
2336
+ - *7
2263
2337
  commands:
2264
2338
  - "./support/bundler_wrapper exec rake test"
2265
2339
  - name: Ruby jruby-9.3.9.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # AppSignal for Ruby gem Changelog
2
2
 
3
+ ## 3.3.0
4
+
5
+ ### Added
6
+
7
+ - [e4314b5b](https://github.com/appsignal/appsignal-ruby/commit/e4314b5b2d3fdf7865555535b2324094ec620349) minor - Hanami 2 is now supported. Requests will now appear as performance measurements.
8
+
3
9
  ## 3.2.2
4
10
 
5
11
  ### Changed
data/README.md CHANGED
@@ -232,6 +232,7 @@ configurations you need to run the spec suite with a specific Gemfile.
232
232
  BUNDLE_GEMFILE=gemfiles/capistrano2.gemfile bundle exec rspec
233
233
  BUNDLE_GEMFILE=gemfiles/capistrano3.gemfile bundle exec rspec
234
234
  BUNDLE_GEMFILE=gemfiles/grape.gemfile bundle exec rspec
235
+ BUNDLE_GEMFILE=gemfiles/hanami.gemfile bundle exec rspec
235
236
  BUNDLE_GEMFILE=gemfiles/http5.gemfile bundle exec rspec
236
237
  BUNDLE_GEMFILE=gemfiles/no_dependencies.gemfile bundle exec rspec
237
238
  BUNDLE_GEMFILE=gemfiles/padrino.gemfile bundle exec rspec
data/build_matrix.yml CHANGED
@@ -205,10 +205,12 @@ matrix:
205
205
  - ruby: "2.7.7"
206
206
  - ruby: "3.0.4"
207
207
  - ruby: "3.1.2"
208
- - ruby: "3.2.0-preview3"
208
+ - ruby: "3.2.0-rc1"
209
209
  env_vars:
210
210
  - name: "_LIBYAML"
211
211
  value: "1"
212
+ - name: "RUBY_CFLAGS"
213
+ value: "-std=gnu99"
212
214
  - ruby: "jruby-9.3.9.0"
213
215
  gems: "minimal"
214
216
  - ruby: "jruby-9.4.0.0"
@@ -218,6 +220,12 @@ matrix:
218
220
  - gem: "capistrano2"
219
221
  - gem: "capistrano3"
220
222
  - gem: "grape"
223
+ - gem: "hanami"
224
+ only:
225
+ ruby:
226
+ - "3.0.4"
227
+ - "3.1.2"
228
+ - "3.2.0-rc1"
221
229
  - gem: "http5"
222
230
  - gem: "padrino"
223
231
  - gem: "psych-3"
@@ -225,13 +233,13 @@ matrix:
225
233
  ruby:
226
234
  - "3.0.4"
227
235
  - "3.1.2"
228
- - "3.2.0-preview3"
236
+ - "3.2.0-rc1"
229
237
  - gem: "psych-4"
230
238
  only:
231
239
  ruby:
232
240
  - "3.0.4"
233
241
  - "3.1.2"
234
- - "3.2.0-preview3"
242
+ - "3.2.0-rc1"
235
243
  - gem: "que"
236
244
  - gem: "que_beta"
237
245
  - gem: "rails-3.2"
@@ -304,7 +312,7 @@ matrix:
304
312
  - "2.7.7"
305
313
  - "3.0.4"
306
314
  - "3.1.2"
307
- - "3.2.0-preview3"
315
+ - "3.2.0-rc1"
308
316
  - "jruby-9.4.0.0"
309
317
  - gem: "rails-7.0"
310
318
  only:
@@ -312,7 +320,7 @@ matrix:
312
320
  - "2.7.7"
313
321
  - "3.0.4"
314
322
  - "3.1.2"
315
- - "3.2.0-preview3"
323
+ - "3.2.0-rc1"
316
324
  - "jruby-9.4.0.0"
317
325
  - gem: "resque-1"
318
326
  bundler: "1.17.3"
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem "hanami", "~> 2.0.0"
4
+ gem "hanami-router", "~> 2.0.0"
5
+ gem "hanami-controller", "~> 2.0.0"
6
+
7
+ gemspec :path => '../'
@@ -61,6 +61,8 @@ module Appsignal
61
61
  install_for_padrino(config)
62
62
  elsif installed_frameworks.include?(:grape)
63
63
  install_for_grape(config)
64
+ elsif installed_frameworks.include?(:hanami)
65
+ install_for_hanami(config)
64
66
  elsif installed_frameworks.include?(:sinatra)
65
67
  install_for_sinatra(config)
66
68
  else
@@ -162,6 +164,24 @@ module Appsignal
162
164
  done_notice
163
165
  end
164
166
 
167
+ def install_for_hanami(config)
168
+ puts "Installing for Hanami"
169
+ config[:name] = required_input(" Enter application name: ")
170
+ puts
171
+ configure(config, %w[development production staging], true)
172
+
173
+ puts "Finish Hanami installation"
174
+ puts " Hanami requires some manual configuration."
175
+ puts " After installing the gem, add the following line to config.ru:"
176
+ puts
177
+ puts " require 'appsignal/integrations/hanami'"
178
+ puts
179
+ puts " You can find more information in the documentation:"
180
+ puts " http://docs.appsignal.com/ruby/integrations/hanami.html"
181
+ press_any_key
182
+ done_notice
183
+ end
184
+
165
185
  def install_for_capistrano
166
186
  capfile = File.join(Dir.pwd, "Capfile")
167
187
  return unless File.exist?(capfile)
@@ -256,6 +276,7 @@ module Appsignal
256
276
  out << :sinatra if framework_available? "sinatra"
257
277
  out << :padrino if framework_available? "padrino"
258
278
  out << :grape if framework_available? "grape"
279
+ out << :hanami if framework_available? "hanami"
259
280
  end
260
281
  end
261
282
 
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "appsignal"
4
+
5
+ module Appsignal
6
+ module Integrations
7
+ module HanamiPlugin
8
+ def self.init
9
+ Appsignal.logger.debug("Loading Hanami integration")
10
+
11
+ hanami_app_config = ::Hanami.app.config
12
+ Appsignal.config = Appsignal::Config.new(
13
+ hanami_app_config.root || Dir.pwd,
14
+ hanami_app_config.env
15
+ )
16
+
17
+ Appsignal.start_logger
18
+ Appsignal.start
19
+
20
+ ::Hanami::Action.send(:prepend, Appsignal::Integrations::HanamiIntegration) if Appsignal.active?
21
+ end
22
+ end
23
+ end
24
+ end
25
+
26
+ module Appsignal::Integrations::HanamiIntegration
27
+ def call(env)
28
+ params = ::Hanami::Action::BaseParams.new(env)
29
+ request = ::Hanami::Action::Request.new(
30
+ :env => env,
31
+ :params => params,
32
+ :sessions_enabled => true
33
+ )
34
+
35
+ transaction = Appsignal::Transaction.create(
36
+ SecureRandom.uuid,
37
+ Appsignal::Transaction::HTTP_REQUEST,
38
+ request
39
+ )
40
+
41
+ begin
42
+ Appsignal.instrument("process_action.hanami") do
43
+ super.tap do |response|
44
+ transaction.set_metadata("status", response.status.to_s)
45
+ end
46
+ end
47
+ rescue Exception => error # rubocop:disable Lint/RescueException
48
+ transaction.set_error(error)
49
+ transaction.set_metadata("status", "500")
50
+ raise error
51
+ ensure
52
+ transaction.params = request.params.to_h
53
+ transaction.set_action_if_nil(self.class.name)
54
+ transaction.set_metadata("path", request.path)
55
+ transaction.set_metadata("method", request.request_method)
56
+ transaction.set_http_or_background_queue_start
57
+ Appsignal::Transaction.complete_current!
58
+ end
59
+ end
60
+ end
61
+
62
+ Appsignal::Integrations::HanamiPlugin.init
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Appsignal
4
- VERSION = "3.2.2".freeze
4
+ VERSION = "3.3.0".freeze
5
5
  end
@@ -660,7 +660,73 @@ describe Appsignal::CLI::Install do
660
660
  end
661
661
  end
662
662
 
663
- if !rails_present? && !sinatra_present? && !padrino_present? && !grape_present?
663
+ if hanami2_present?
664
+ context "with hanami" do
665
+ it_behaves_like "push_api_key validation"
666
+ it_behaves_like "requires an application name"
667
+
668
+ describe "hanami specific tests" do
669
+ let(:installation_instructions) do
670
+ [
671
+ "Installing for Hanami",
672
+ "Hanami requires some manual configuration.",
673
+ "http://docs.appsignal.com/ruby/integrations/hanami.html"
674
+ ]
675
+ end
676
+ let(:app_name) { "Test app" }
677
+ before { enter_app_name app_name }
678
+
679
+ describe "configuration with environment variables" do
680
+ before { choose_environment_config }
681
+
682
+ it_behaves_like "windows installation"
683
+ it_behaves_like "capistrano install"
684
+ it_behaves_like "demo data"
685
+
686
+ it "prints environment variables" do
687
+ run
688
+
689
+ expect(output).to include_env_push_api_key(push_api_key)
690
+ expect(output).to include_env_app_name(app_name)
691
+ end
692
+
693
+ it "completes the installation" do
694
+ run
695
+
696
+ expect(output).to include(*installation_instructions)
697
+ expect(output).to include_complete_install
698
+ end
699
+ end
700
+
701
+ describe "configure with a configuration file" do
702
+ before { choose_config_file }
703
+
704
+ it_behaves_like "windows installation"
705
+ it_behaves_like "capistrano install"
706
+ it_behaves_like "demo data"
707
+
708
+ it "writes configuration to file" do
709
+ run
710
+ expect(output).to include_file_config
711
+ expect(config_file).to configure_app_name(app_name)
712
+ expect(config_file).to configure_push_api_key(push_api_key)
713
+ expect(config_file).to configure_environment("development")
714
+ expect(config_file).to configure_environment("staging")
715
+ expect(config_file).to configure_environment("production")
716
+ end
717
+
718
+ it "completes the installation" do
719
+ run
720
+
721
+ expect(output).to include(*installation_instructions)
722
+ expect(output).to include_complete_install
723
+ end
724
+ end
725
+ end
726
+ end
727
+ end
728
+
729
+ if !rails_present? && !sinatra_present? && !padrino_present? && !grape_present? && !hanami2_present?
664
730
  context "with unknown framework" do
665
731
  let(:push_api_key) { "my_key" }
666
732
 
@@ -0,0 +1,116 @@
1
+ # frozen_string_literal: true
2
+
3
+ if DependencyHelper.hanami2_present?
4
+ describe "Hanami integration" do
5
+ require "appsignal/integrations/hanami"
6
+
7
+ before do
8
+ allow(Appsignal).to receive(:active?).and_return(true)
9
+ allow(Appsignal).to receive(:start).and_return(true)
10
+ allow(Appsignal).to receive(:start_logger).and_return(true)
11
+ end
12
+
13
+ describe Appsignal::Integrations::HanamiPlugin do
14
+ it "starts AppSignal on init" do
15
+ expect(Appsignal).to receive(:start)
16
+ end
17
+
18
+ it "starts the logger on init" do
19
+ expect(Appsignal).to receive(:start_logger)
20
+ end
21
+
22
+ it "prepends the integration to Hanami" do
23
+ expect(::Hanami::Action).to receive(:send).with(:prepend, Appsignal::Integrations::HanamiIntegration)
24
+ end
25
+
26
+ context "when not active" do
27
+ before { allow(Appsignal).to receive(:active?).and_return(false) }
28
+
29
+ it "does not prepend the integration" do
30
+ expect(::Hanami::Action).to_not receive(:send).with(:prepend, Appsignal::Integrations::HanamiIntegration)
31
+ end
32
+ end
33
+
34
+ context "when APPSIGNAL_APP_ENV ENV var is provided" do
35
+ it "uses this as the environment" do
36
+ ENV["APPSIGNAL_APP_ENV"] = "custom"
37
+
38
+ # Reset the plugin to pull down the latest data
39
+ Appsignal::Integrations::HanamiPlugin.init
40
+
41
+ expect(Appsignal.config.env).to eq("custom")
42
+ end
43
+ end
44
+
45
+ context "when APPSIGNAL_APP_ENV ENV var is not provided" do
46
+ it "uses the Hanami environment" do
47
+ # Reset the plugin to pull down the latest data
48
+ Appsignal::Integrations::HanamiPlugin.init
49
+
50
+ expect(Appsignal.config.env).to eq("test")
51
+ end
52
+ end
53
+
54
+ after { Appsignal::Integrations::HanamiPlugin.init }
55
+ end
56
+
57
+ describe "Hanami Actions" do
58
+ let(:env) do
59
+ Rack::MockRequest.env_for(
60
+ "/books",
61
+ "router.params" => router_params,
62
+ :method => "GET"
63
+ )
64
+ end
65
+
66
+ let(:router_params) { { :foo => "bar", :baz => "qux" } }
67
+
68
+ describe "#call", :error => false do
69
+ it "sets params" do
70
+ expect_any_instance_of(Appsignal::Transaction).to receive(:params=).with(router_params)
71
+ end
72
+
73
+ it "sets the action name" do
74
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_action_if_nil).with("HanamiApp::Actions::Books::Index")
75
+ end
76
+
77
+ it "sets the metadata" do
78
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_metadata).with("status", "200")
79
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_metadata).with("path", "/books")
80
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_metadata).with("method", "GET")
81
+ end
82
+
83
+ it "sets the queue start" do
84
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_http_or_background_queue_start)
85
+ end
86
+
87
+ context "with error", :error => true do
88
+ let(:error) { HanamiApp::ExampleError }
89
+
90
+ it "records the exception" do
91
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_error).with(error)
92
+ end
93
+
94
+ it "sets the status to 500" do
95
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_metadata).with("status", "500")
96
+ expect_any_instance_of(Appsignal::Transaction).to receive(:set_metadata).twice
97
+ end
98
+ end
99
+
100
+ after(:error => false) do
101
+ Appsignal::Integrations::HanamiPlugin.init
102
+
103
+ action = HanamiApp::Actions::Books::Index.new
104
+ action.call(env)
105
+ end
106
+
107
+ after(:error => true) do
108
+ Appsignal::Integrations::HanamiPlugin.init
109
+
110
+ action = HanamiApp::Actions::Books::Error.new
111
+ expect { action.call(env) }.to raise_error(error)
112
+ end
113
+ end
114
+ end
115
+ end
116
+ end
data/spec/spec_helper.rb CHANGED
@@ -29,6 +29,11 @@ if DependencyHelper.rails_present?
29
29
  require f
30
30
  end
31
31
  end
32
+ if DependencyHelper.hanami2_present?
33
+ Dir[File.join(DirectoryHelper.support_dir, "hanami", "*.rb")].each do |f|
34
+ require f
35
+ end
36
+ end
32
37
  require "pry" if DependencyHelper.dependency_present?("pry")
33
38
  require "appsignal"
34
39
  # Include patches of AppSignal modules and classes to make test helpers
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "hanami"
4
+ require "hanami/action"
5
+
6
+ module HanamiApp
7
+ class App < Hanami::App
8
+ end
9
+
10
+ class Routes < Hanami::Routes
11
+ get "/books", :to => "books.index"
12
+ end
13
+
14
+ module Actions
15
+ module Books
16
+ class Index < Hanami::Action
17
+ def handle(_request, response)
18
+ response.body = "YOU REQUESTED BOOKS!"
19
+ end
20
+ end
21
+
22
+ class Error < Hanami::Action
23
+ def handle(_request, _response)
24
+ raise ExampleError
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ class ExampleError < StandardError; end
31
+ end
@@ -9,6 +9,10 @@ module DependencyHelper
9
9
  ruby_version.segments.take(2) == [2, 0]
10
10
  end
11
11
 
12
+ def ruby_3_0_or_newer?
13
+ ruby_version >= Gem::Version.new("3.0.0")
14
+ end
15
+
12
16
  def ruby_3_1_or_newer?
13
17
  ruby_version >= Gem::Version.new("3.1.0")
14
18
  end
@@ -115,6 +119,14 @@ module DependencyHelper
115
119
  dependency_present? "que"
116
120
  end
117
121
 
122
+ def hanami_present?
123
+ dependency_present? "hanami"
124
+ end
125
+
126
+ def hanami2_present?
127
+ ruby_3_0_or_newer? && hanami_present? && Gem.loaded_specs["hanami"].version >= Gem::Version.new("2.0")
128
+ end
129
+
118
130
  def dependency_present?(dependency_file)
119
131
  Gem.loaded_specs.key? dependency_file
120
132
  end
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: 3.2.2
4
+ version: 3.3.0
5
5
  platform: ruby
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: 2022-12-13 00:00:00.000000000 Z
13
+ date: 2022-12-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rack
@@ -161,6 +161,7 @@ files:
161
161
  - gemfiles/capistrano2.gemfile
162
162
  - gemfiles/capistrano3.gemfile
163
163
  - gemfiles/grape.gemfile
164
+ - gemfiles/hanami.gemfile
164
165
  - gemfiles/http5.gemfile
165
166
  - gemfiles/no_dependencies.gemfile
166
167
  - gemfiles/padrino.gemfile
@@ -240,6 +241,7 @@ files:
240
241
  - lib/appsignal/integrations/delayed_job_plugin.rb
241
242
  - lib/appsignal/integrations/excon.rb
242
243
  - lib/appsignal/integrations/grape.rb
244
+ - lib/appsignal/integrations/hanami.rb
243
245
  - lib/appsignal/integrations/http.rb
244
246
  - lib/appsignal/integrations/mongo_ruby_driver.rb
245
247
  - lib/appsignal/integrations/net_http.rb
@@ -339,6 +341,7 @@ files:
339
341
  - spec/lib/appsignal/hooks_spec.rb
340
342
  - spec/lib/appsignal/integrations/data_mapper_spec.rb
341
343
  - spec/lib/appsignal/integrations/grape_spec.rb
344
+ - spec/lib/appsignal/integrations/hanami_spec.rb
342
345
  - spec/lib/appsignal/integrations/http_spec.rb
343
346
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
344
347
  - spec/lib/appsignal/integrations/object_spec.rb
@@ -378,6 +381,7 @@ files:
378
381
  - spec/support/fixtures/projects/valid/config/environments/test.rb
379
382
  - spec/support/fixtures/projects/valid/log/.gitkeep
380
383
  - spec/support/fixtures/uploaded_file.txt
384
+ - spec/support/hanami/hanami_app.rb
381
385
  - spec/support/helpers/action_mailer_helpers.rb
382
386
  - spec/support/helpers/activejob_helpers.rb
383
387
  - spec/support/helpers/api_request_helper.rb
@@ -418,7 +422,7 @@ metadata:
418
422
  documentation_uri: https://docs.appsignal.com/ruby/
419
423
  homepage_uri: https://docs.appsignal.com/ruby/
420
424
  source_code_uri: https://github.com/appsignal/appsignal-ruby
421
- post_install_message:
425
+ post_install_message:
422
426
  rdoc_options: []
423
427
  require_paths:
424
428
  - lib
@@ -434,8 +438,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
434
438
  - !ruby/object:Gem::Version
435
439
  version: '0'
436
440
  requirements: []
437
- rubygems_version: 3.3.26
438
- signing_key:
441
+ rubygems_version: 3.1.4
442
+ signing_key:
439
443
  specification_version: 4
440
444
  summary: Logs performance and exception data from your app to appsignal.com
441
445
  test_files:
@@ -494,6 +498,7 @@ test_files:
494
498
  - spec/lib/appsignal/hooks_spec.rb
495
499
  - spec/lib/appsignal/integrations/data_mapper_spec.rb
496
500
  - spec/lib/appsignal/integrations/grape_spec.rb
501
+ - spec/lib/appsignal/integrations/hanami_spec.rb
497
502
  - spec/lib/appsignal/integrations/http_spec.rb
498
503
  - spec/lib/appsignal/integrations/mongo_ruby_driver_spec.rb
499
504
  - spec/lib/appsignal/integrations/object_spec.rb
@@ -533,6 +538,7 @@ test_files:
533
538
  - spec/support/fixtures/projects/valid/config/environments/test.rb
534
539
  - spec/support/fixtures/projects/valid/log/.gitkeep
535
540
  - spec/support/fixtures/uploaded_file.txt
541
+ - spec/support/hanami/hanami_app.rb
536
542
  - spec/support/helpers/action_mailer_helpers.rb
537
543
  - spec/support/helpers/activejob_helpers.rb
538
544
  - spec/support/helpers/api_request_helper.rb