Module: ILove::Tracing

Defined in:
lib/ilove/tracing.rb,
lib/ilove/tracing/sql.rb,
lib/ilove/tracing/twirp.rb,
lib/ilove/tracing/client.rb,
lib/ilove/tracing/version.rb,
lib/ilove/tracing/request_id.rb,
lib/ilove/tracing/incoming_requests.rb,
lib/ilove/tracing/outgoing_requests.rb,
lib/ilove/tracing/faraday_middleware.rb

Defined Under Namespace

Modules: Client, FaradayMiddleware, IncomingRequests, OutgoingRequests, RequestId, Sql, Twirp Classes: Configuration, Error

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.configurationObject



86
87
88
# File 'lib/ilove/tracing.rb', line 86

def self.configuration
  @cfg
end

.configure {|@cfg| ... } ⇒ Object

Yields:

  • (@cfg)


90
91
92
93
94
# File 'lib/ilove/tracing.rb', line 90

def self.configure(&_block)
  @cfg = Configuration.new
  yield @cfg
  setup @cfg
end

.setup(cfg) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/ilove/tracing.rb', line 96

def self.setup(cfg)
  return unless cfg.enabled?

  require_relative 'tracing/client'

  ILove::Tracing::Client.setup cfg

  if cfg.trace_incoming_requests?
    require_relative 'tracing/incoming_requests'

    ILove::Tracing::IncomingRequests.setup cfg
  end

  if cfg.trace_outgoing_requests?
    require_relative 'tracing/outgoing_requests'

    ILove::Tracing::OutgoingRequests.setup cfg
  end

  if cfg.trace_twirp_requests?
    require_relative 'tracing/twirp'

    ILove::Tracing::Twirp.setup cfg
  end

  if cfg.trace_sql?
    require_relative 'tracing/sql'

    ILove::Tracing::Sql.setup cfg
  end

  if cfg.pass_request_id?
    require_relative 'tracing/request_id'

    ILove::Tracing::RequestId.setup cfg
  end

  if cfg.pass_request_id? || cfg.trace_outgoing_requests?
    ILove::Tracing::FaradayMiddleware.setup cfg
  end
end