Sha256: e9e4ba6ca12750916d805007933f97f4a7f78a6bf860d1bc4a8e8112506f7ada
Contents?: true
Size: 969 Bytes
Versions: 2
Compression:
Stored size: 969 Bytes
Contents
require 'aws-xray-sdk/facets/rack' require 'aws-xray-sdk/facets/rails/ex_middleware' module GovukXRay def self.initialize(app) app.middleware.insert 0, XRay::Rack::Middleware app.middleware.use XRay::Rails::ExceptionMiddleware end def self.start # if aws-sdk is loaded, we want to instrument that too patch = Gem.loaded_specs.has_key?('aws-sdk-core') ? %I[aws_sdk net_http] : %I[net_http] # if there isn't a name set, attempting to record a segment will # throw an error govuk_app_name = ENV['GOVUK_APP_NAME'] name = govuk_app_name.blank? ? 'xray' : govuk_app_name XRay.recorder.configure( name: name, patch: patch, context_missing: 'LOG_ERROR', sampling_rules: { version: 1, default: { 'fixed_target': ENV.fetch('XRAY_SAMPLE_TARGET', 0).to_i, 'rate': ENV.fetch('XRAY_SAMPLE_RATE', 0.01).to_f, }, rules: [], }, ) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
govuk_app_config-1.9.3 | lib/govuk_app_config/govuk_xray.rb |
govuk_app_config-1.9.2 | lib/govuk_app_config/govuk_xray.rb |