Sha256: fbbe3a2ec64c07d05f05325d73b02098aaae916dfc5d8a2871673edc39609ae4

Contents?: true

Size: 966 Bytes

Versions: 19

Compression:

Stored size: 966 Bytes

Contents

# frozen_string_literal: true

require 'deimos/tracing/provider'

module Deimos
  module Tracing
    # Tracing wrapper class for Datadog.
    class Datadog < Tracing::Provider
      # @param config [Hash]
      def initialize(config)
        raise 'Tracing config must specify service_name' if config[:service_name].nil?

        @service = config[:service_name]
      end

      # :nodoc:
      def start(span_name, options={})
        span = ::Datadog.tracer.trace(span_name)
        span.service = @service
        span.resource = options[:resource]
        span
      end

      # :nodoc:
      def finish(span)
        span.finish
      end

      # :nodoc:
      def active_span
        ::Datadog.tracer.active_span
      end

      # :nodoc:
      def set_error(span, exception)
        span.set_error(exception)
      end

      # :nodoc:
      def set_tag(tag, value, span=nil)
        (span || active_span).set_tag(tag, value)
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
deimos-ruby-1.20.0 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.7 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.6 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.5 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.4 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.3 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.2 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.1 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.1.pre.beta1 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.0 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.beta2 lib/deimos/tracing/datadog.rb
deimos-ruby-1.19.beta1 lib/deimos/tracing/datadog.rb
deimos-ruby-1.18.2 lib/deimos/tracing/datadog.rb
deimos-ruby-1.18.1 lib/deimos/tracing/datadog.rb
deimos-ruby-1.18.0 lib/deimos/tracing/datadog.rb
deimos-ruby-1.17.1 lib/deimos/tracing/datadog.rb
deimos-ruby-1.17.0 lib/deimos/tracing/datadog.rb
deimos-ruby-1.16.5 lib/deimos/tracing/datadog.rb
deimos-ruby-1.16.4 lib/deimos/tracing/datadog.rb