<commit_before>require 'concurrent'
require 'lightstep/span_context'

module LightStep
  # Span represents an OpenTracer Span
  #
  # See http://www.opentracing.io for more information.
  class Span
    # Part of the OpenTracing API
    attr_writer :operation_name

    # Internal use only
    # @private
    attr_reader :start_micros, :end_micros, :tags, :operation_name, :context

    # To keep backwards compatibility
    alias_method :span_context, :context

    # Creates a new {Span}
    #
    # @param tracer [Tracer] the tracer that created this span
    # @param operation_name [String] the operation name of this span. If it's
    #        not a String it will be encoded with to_s.
    # @param child_of [SpanContext] the parent SpanContext (per child_of)
    # @param references [Array<SpanContext>] An array of SpanContexts
    #   that identify what Spans this Span follows from causally. Presently
    #   only one reference is supported, and cannot be provided in addition to
    #   a child_of.
    # @param start_micros [Numeric] start time of the span in microseconds
    # @param tags [Hash] initial key:value tags (per set_tag) for the Span
    # @param max_log_records [Numeric] maximum allowable number of log records
    #        for the Span
    # @return [Span] a started Span
    def initialize(
      tracer:,
      operation_name:,
      child_of: nil,
      references: [],
      start_micros:,
      tags: nil,
      max_log_records:
    )

      @tags = Concurrent::Hash.new
      @tags.update(tags.each do |tag| tag.map do |k, v| { k => v.to_s } end end) unless tags.nil?
      @log_records = Concurrent::Array.new
      @dropped_logs = Concurrent::AtomicFixnum.new
      @max_log_records = max_log_records

      @tracer = tracer
      self.operation_name = operation_name.to_s
      self.start_micros = start_micros

      ref = child_of ? child_of : references
      ref = ref[0] if (Array === ref)
      ref = ref.context if (Span === ref)<commit_msg>fix coercion of values to strings<commit_after>require 'concurrent'
require 'lightstep/span_context'

module LightStep
  # Span represents an OpenTracer Span
  #
  # See http://www.opentracing.io for more information.
  class Span
    # Part of the OpenTracing API
    attr_writer :operation_name

    # Internal use only
    # @private
    attr_reader :start_micros, :end_micros, :tags, :operation_name, :context

    # To keep backwards compatibility
    alias_method :span_context, :context

    # Creates a new {Span}
    #
    # @param tracer [Tracer] the tracer that created this span
    # @param operation_name [String] the operation name of this span. If it's
    #        not a String it will be encoded with to_s.
    # @param child_of [SpanContext] the parent SpanContext (per child_of)
    # @param references [Array<SpanContext>] An array of SpanContexts
    #   that identify what Spans this Span follows from causally. Presently
    #   only one reference is supported, and cannot be provided in addition to
    #   a child_of.
    # @param start_micros [Numeric] start time of the span in microseconds
    # @param tags [Hash] initial key:value tags (per set_tag) for the Span
    # @param max_log_records [Numeric] maximum allowable number of log records
    #        for the Span
    # @return [Span] a started Span
    def initialize(
      tracer:,
      operation_name:,
      child_of: nil,
      references: [],
      start_micros:,
      tags: nil,
      max_log_records:
    )

      @tags = Concurrent::Hash.new
      @tags.update(tags.each do |k, v| tags[k] = v.to_s end) unless tags.nil?
      @log_records = Concurrent::Array.new
      @dropped_logs = Concurrent::AtomicFixnum.new
      @max_log_records = max_log_records

      @tracer = tracer
      self.operation_name = operation_name.to_s
      self.start_micros = start_micros

      ref = child_of ? child_of : references
      ref = ref[0] if (Array === ref)
      ref = ref.context if (Span === ref)
{'fraction_non_alphanumeric': 0.08249496981891348, 'fraction_numerical': 0.0005030181086519115, 'mean_word_length': 2.941526263627354, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '880982', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1209, 'n_words': 410}