Module: ElasticAPM::Spies::S3Spy::Ext Private
- Defined in:
- lib/elastic_apm/spies/s3.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .prepended(mod) ⇒ Object private
Class Method Details
.prepended(mod) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/elastic_apm/spies/s3.rb', line 81 def self.prepended(mod) # Alias all available operations mod.api.operation_names.each do |operation_name| define_method(operation_name) do |params = {}, = {}, &block| bucket_name = ElasticAPM::Spies::S3Spy.bucket_name(params) region = ElasticAPM::Spies::S3Spy.accesspoint_region(params) || config.region resource = "#{SUBTYPE}/#{bucket_name || 'unknown-bucket'}" context = ElasticAPM::Span::Context.new( db: { instance: config.region, type: SUBTYPE }, destination: { address: config.endpoint.host, port: config.endpoint.port, service: { name: SUBTYPE, type: TYPE, resource: resource }, cloud: { region: region } } ) ElasticAPM.with_span( ElasticAPM::Spies::S3Spy.span_name(operation_name, bucket_name), TYPE, subtype: SUBTYPE, action: ElasticAPM::Spies::S3Spy.formatted_op_name(operation_name), context: context ) do ElasticAPM::Spies::S3Spy.without_net_http do super(params, , &block) end end end end end |