appsignal 4.5.6 → 4.5.7
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/CHANGELOG.md +21 -0
- data/lib/appsignal/internal_errors.rb +19 -0
- data/lib/appsignal/version.rb +1 -1
- data/lib/appsignal.rb +41 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb6b257bdb500ffff85f0aaf2c4a63c85ef1d454df501973b99c3871869564fd
|
4
|
+
data.tar.gz: 9f62ae7ee6fd67935b079ece3d8c5ef827396b654b675754bcaa9a323ca8141e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a58b34251fd0eef84bf5cfb0f275f4e974d3e48eccdfb10426acda5ec6ba39c6f33377b3f77bdfb7c0772f2bdc510ce0a2f5e829649c67b203f105ae1360c41
|
7
|
+
data.tar.gz: d96563953abcb4614df3325b486ba23b6e25458d1649661a977e45ea06e24bec7bfa79f21295ed901d466313b3d8753f1d91d3585f20c166388b6006cef000cf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
# AppSignal for Ruby gem Changelog
|
2
2
|
|
3
|
+
## 4.5.7
|
4
|
+
|
5
|
+
_Published on 2025-03-20._
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Add the `Appsignal.config_error` and `Appsignal.config_error?` methods. This method contains any error that may have occurred while loading the `config/appsignal.rb` file. If it is `nil` no error occurred or `Appsignal.start` hasn't been called yet. The `Appsignal.config_error?` method is an alias for syntax sugar. (patch [0f3a7372](https://github.com/appsignal/appsignal-ruby/commit/0f3a73729306d96b630339ccf6e218318d1e2870))
|
10
|
+
- Add the `check_if_started!` method. This method will raise an error if the AppSignal Ruby gem failed to start.
|
11
|
+
|
12
|
+
Call this method in your CI or on app boot if you wish to verify that AppSignal has started when your application does, and want the application to fail to start if AppSignal hasn't started.
|
13
|
+
|
14
|
+
For example, in this Rails initializer:
|
15
|
+
|
16
|
+
```
|
17
|
+
# config/initializers/appsignal.rb
|
18
|
+
|
19
|
+
Appsignal.check_if_started!
|
20
|
+
```
|
21
|
+
|
22
|
+
(patch [b41c9c99](https://github.com/appsignal/appsignal-ruby/commit/b41c9c991bdbcd64b7a04e9832b15ddacda7ae20))
|
23
|
+
|
3
24
|
## 4.5.6
|
4
25
|
|
5
26
|
_Published on 2025-03-20._
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Appsignal
|
4
|
+
# @api private
|
5
|
+
class InternalError < StandardError; end
|
6
|
+
|
7
|
+
# @api private
|
8
|
+
class NotStartedError < InternalError
|
9
|
+
MESSAGE = <<~MESSAGE
|
10
|
+
The AppSignal Ruby gem was not started!
|
11
|
+
|
12
|
+
This error was raised by calling `Appsignal.check_if_started!`
|
13
|
+
MESSAGE
|
14
|
+
|
15
|
+
def message
|
16
|
+
MESSAGE
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/appsignal/version.rb
CHANGED
data/lib/appsignal.rb
CHANGED
@@ -62,6 +62,19 @@ module Appsignal
|
|
62
62
|
# @see start
|
63
63
|
attr_writer :internal_logger
|
64
64
|
|
65
|
+
# Returns the error that was encountered while loading the `appsignal.rb`
|
66
|
+
# config file.
|
67
|
+
#
|
68
|
+
# It does not include any error that occurred while loading the
|
69
|
+
# `appsignal.yml` file.
|
70
|
+
#
|
71
|
+
# If the value is `nil`, no error was encountered or AppSignal wasn't
|
72
|
+
# started yet.
|
73
|
+
#
|
74
|
+
# @return [NilClass/Exception]
|
75
|
+
attr_reader :config_error
|
76
|
+
alias config_error? config_error
|
77
|
+
|
65
78
|
# @api private
|
66
79
|
def testing?
|
67
80
|
false
|
@@ -483,6 +496,31 @@ module Appsignal
|
|
483
496
|
defined?(@dsl_config_file_loaded) ? true : false
|
484
497
|
end
|
485
498
|
|
499
|
+
# Check if the AppSignal Ruby gem has started successfully.
|
500
|
+
#
|
501
|
+
# If it has not (yet) started or encountered an error in the
|
502
|
+
# `config/appsignal.rb` config file during start up that prevented it from
|
503
|
+
# starting, it will raise a {Appsignal::NotStartedError}.
|
504
|
+
#
|
505
|
+
# If there an error raised from the config file, it will include it as the
|
506
|
+
# error cause of the raised error.
|
507
|
+
#
|
508
|
+
# @raise [Appsignal::NotStartedError]
|
509
|
+
# @return [void]
|
510
|
+
def check_if_started!
|
511
|
+
return if started?
|
512
|
+
|
513
|
+
begin
|
514
|
+
raise config_error if config_error?
|
515
|
+
rescue
|
516
|
+
# Raise the NotStartedError and make the config error the error cause
|
517
|
+
raise NotStartedError, config_error
|
518
|
+
end
|
519
|
+
|
520
|
+
# Raise the NotStartedError as normal
|
521
|
+
raise NotStartedError
|
522
|
+
end
|
523
|
+
|
486
524
|
private
|
487
525
|
|
488
526
|
def params_match_loaded_config?(env_param, root_path_param)
|
@@ -508,7 +546,7 @@ module Appsignal
|
|
508
546
|
@dsl_config_file_loaded = true
|
509
547
|
require path
|
510
548
|
rescue => error
|
511
|
-
@
|
549
|
+
@config_error = error
|
512
550
|
message = "Not starting AppSignal because an error occurred while " \
|
513
551
|
"loading the AppSignal config file.\n" \
|
514
552
|
"File: #{path.inspect}\n" \
|
@@ -527,7 +565,7 @@ module Appsignal
|
|
527
565
|
end
|
528
566
|
|
529
567
|
# Disable on config file error
|
530
|
-
config[:active] = false if defined?(@
|
568
|
+
config[:active] = false if defined?(@config_error)
|
531
569
|
|
532
570
|
ENV.delete("_APPSIGNAL_CONFIG_FILE_CONTEXT")
|
533
571
|
ENV.delete("_APPSIGNAL_CONFIG_FILE_ENV")
|
@@ -569,6 +607,7 @@ module Appsignal
|
|
569
607
|
end
|
570
608
|
end
|
571
609
|
|
610
|
+
require "appsignal/internal_errors"
|
572
611
|
require "appsignal/loaders"
|
573
612
|
require "appsignal/sample_data"
|
574
613
|
require "appsignal/environment"
|
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: 4.5.
|
4
|
+
version: 4.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Beekman
|
@@ -248,6 +248,7 @@ files:
|
|
248
248
|
- lib/appsignal/integrations/sidekiq.rb
|
249
249
|
- lib/appsignal/integrations/unicorn.rb
|
250
250
|
- lib/appsignal/integrations/webmachine.rb
|
251
|
+
- lib/appsignal/internal_errors.rb
|
251
252
|
- lib/appsignal/loaders.rb
|
252
253
|
- lib/appsignal/loaders/grape.rb
|
253
254
|
- lib/appsignal/loaders/hanami.rb
|