Skip to content

Commit

Permalink
Allow controlling Otel log level in different environments (#295)
Browse files Browse the repository at this point in the history
This is mainly to help us suppress the verbose output on enabling
different instrumentations on startup in test environments, but
also could be generally useful. More on the PR to enable it:
open-telemetry/opentelemetry-ruby#831

Also updates encrypted config.yml for test runs on CI with 
new test configuration keys to lower Otel log level in test
  • Loading branch information
hartsick authored Oct 6, 2022
1 parent c3f298b commit c013731
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
Binary file modified config/config.yml.enc
Binary file not shown.
2 changes: 2 additions & 0 deletions config/config.yml.example
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ development: &default
otel_service_name: # "pender"
otel_resource_attributes:
# developer.name: <DEVELOPER_NAME>
otel_log_level: info

test:
<<: *default
Expand All @@ -137,6 +138,7 @@ test:
storage_medias_asset_path: 'http://localhost:9000/check-test/medias'
otel_exporter_otlp_endpoint:
otel_exporter_otlp_headers:
otel_log_level: error
airbrake_host:

production:
Expand Down
4 changes: 4 additions & 0 deletions config/initializers/open_telemetry.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require 'pender_open_telemetry_config'
require 'pender_open_telemetry_test_config'

# Lines immediately below set any environment config that should
# be applied to all environments
ENV['OTEL_LOG_LEVEL'] = PenderConfig.get('otel_log_level')

unless Rails.env.test?
Pender::OpenTelemetryConfig.new(
PenderConfig.get('otel_exporter_otlp_endpoint'),
Expand Down

0 comments on commit c013731

Please sign in to comment.