Skip to content

Commit

Permalink
Don't init OpenTelemetry when in rails console.
Browse files Browse the repository at this point in the history
This fixes a bunch of annoying warnings on startup, avoids generating
traces from interactive use by default, and probably reduces the chance
of OOM when execing `rails console` inside a serving app container.
  • Loading branch information
sengi committed Jul 11, 2023
1 parent 4fb9681 commit 9e45bef
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 9.0.2

* GovukAppConfig no longer automatically initialises OpenTelemetry when running in `rails console`.

# 9.0.1

* Rename the "error" field in Rails logs from logstasher to "message" as error is supposed to be an object.
Expand All @@ -12,11 +16,11 @@

# 8.1.1

* Fix prometheus_exporter to method patching compatible with open telemetry.
* Fix prometheus_exporter to method patching compatible with OpenTelemetry.

# 8.1.0

* Add ability to enable Open Telemetry instrumentation for Rails applications.
* Add ability to enable OpenTelemetry instrumentation for Rails applications.

# 8.0.2

Expand Down
4 changes: 3 additions & 1 deletion lib/govuk_app_config/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ class Railtie < Rails::Railtie
end

initializer "govuk_app_config.configure_open_telemetry" do |app|
GovukOpenTelemetry.configure(app.class.module_parent_name.underscore)
unless Rails.const_defined?('Console') do
GovukOpenTelemetry.configure(app.class.module_parent_name.underscore)
end
end

config.before_initialize do
Expand Down
2 changes: 1 addition & 1 deletion lib/govuk_app_config/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module GovukAppConfig
VERSION = "9.0.1".freeze
VERSION = "9.0.2".freeze
end

0 comments on commit 9e45bef

Please sign in to comment.