Sha256: b724c64013ef95153bee3835aff865835830d253a4847f56c9a327be350aa76e

Contents?: true

Size: 780 Bytes

Versions: 13

Compression:

Stored size: 780 Bytes

Contents

module Datadog
  # Contains behavior for managing correlations with tracing
  # e.g. Retrieve a correlation to the current trace for logging, etc.
  module Correlation
    # Struct representing correlation
    Identifier = Struct.new(:trace_id, :span_id) do
      def initialize(*args)
        super
        self.trace_id = trace_id || 0
        self.span_id = span_id || 0
      end

      def to_s
        "dd.trace_id=#{trace_id} dd.span_id=#{span_id}"
      end
    end.freeze

    NULL_IDENTIFIER = Identifier.new.freeze

    module_function

    # Produces a CorrelationIdentifier from the Context provided
    def identifier_from_context(context)
      return NULL_IDENTIFIER if context.nil?
      Identifier.new(context.trace_id, context.span_id).freeze
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ls-trace-0.1.2 lib/ddtrace/correlation.rb
ddtrace-0.33.1 lib/ddtrace/correlation.rb
ddtrace-0.33.0 lib/ddtrace/correlation.rb
ddtrace-0.32.0 lib/ddtrace/correlation.rb
ddtrace-0.31.1 lib/ddtrace/correlation.rb
ddtrace-0.31.0 lib/ddtrace/correlation.rb
ddtrace-0.30.1 lib/ddtrace/correlation.rb
ddtrace-0.30.0 lib/ddtrace/correlation.rb
ddtrace-0.29.1 lib/ddtrace/correlation.rb
ls-trace-0.1.1 lib/ddtrace/correlation.rb
ddtrace-0.29.0 lib/ddtrace/correlation.rb
ddtrace-0.28.0 lib/ddtrace/correlation.rb
ddtrace-0.27.0 lib/ddtrace/correlation.rb