Module: Aws::Xray

Defined in:
lib/aws/xray.rb,
lib/aws/xray/rack.rb,
lib/aws/xray/cause.rb,
lib/aws/xray/error.rb,
lib/aws/xray/rails.rb,
lib/aws/xray/trace.rb,
lib/aws/xray/client.rb,
lib/aws/xray/errors.rb,
lib/aws/xray/worker.rb,
lib/aws/xray/context.rb,
lib/aws/xray/faraday.rb,
lib/aws/xray/request.rb,
lib/aws/xray/segment.rb,
lib/aws/xray/sockets.rb,
lib/aws/xray/version.rb,
lib/aws/xray/response.rb,
lib/aws/xray/subsegment.rb,
lib/aws/xray/hooks/rsolr.rb,
lib/aws/xray/configuration.rb,
lib/aws/xray/header_parser.rb,
lib/aws/xray/error_handlers.rb,
lib/aws/xray/hooks/net_http.rb,
lib/aws/xray/version_detector.rb,
lib/aws/xray/annotation_normalizer.rb

Defined Under Namespace

Modules: AnnotationNormalizer, HeaderParser, Hooks Classes: BaseError, CanNotSendAllByteError, Cause, Client, Configuration, Context, DefaultErrorHandler, Error, ErrorHandlerWithSentry, Faraday, IoSocket, MissingNameError, NotSetError, NullSocket, QueueIsFullError, Rack, Railtie, Request, Response, Segment, SegmentDidNotStartError, Subsegment, TestSocket, Trace, VersionDetector, Worker

Constant Summary collapse

TRACE_HEADER =
'X-Amzn-Trace-Id'.freeze
VERSION =
'0.30.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject (readonly)

Returns the value of attribute config.



21
22
23
# File 'lib/aws/xray.rb', line 21

def config
  @config
end

Class Method Details

.overwrite(name:, &block) ⇒ Object

Overwrite under lying tracing name at once. If current context does not set to current thread, do nothing.

Parameters:

  • name (String)


38
39
40
41
42
43
44
# File 'lib/aws/xray.rb', line 38

def self.overwrite(name:, &block)
  if Context.started?
    Context.current.overwrite(name: name, &block)
  else
    block.call
  end
end

.trace(name: nil) ⇒ Object

Parameters:

  • name (String) (defaults to: nil)

    a logical name of this tracing context.



26
27
28
29
30
31
32
33
# File 'lib/aws/xray.rb', line 26

def self.trace(name: nil)
  name = name || config.name || raise(MissingNameError)
  Context.with_new_context(name, Trace.generate) do
    Context.current.base_trace do |seg|
      yield seg
    end
  end
end