Module: Datadog::Contrib::Presto::Instrumentation::Client::InstanceMethods

Defined in:
lib/ddtrace/contrib/presto/instrumentation.rb

Overview

Instance methods for Presto::Client

Instance Method Summary collapse

Instance Method Details

#kill(query_id) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/ddtrace/contrib/presto/instrumentation.rb', line 50

def kill(query_id)
  tracer.trace(Ext::SPAN_KILL, span_options) do |span|
    begin
      decorate!(span)
      span.resource = Ext::SPAN_KILL
      span.span_type = Datadog::Ext::AppTypes::DB
      # ^ not an SQL type span, since there's no SQL query
      span.set_tag(Ext::TAG_QUERY_ID, query_id)
    rescue StandardError => e
      Datadog.logger.debug("error preparing span for presto: #{e}")
    end

    super(query_id)
  end
end

#query(query, &blk) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/ddtrace/contrib/presto/instrumentation.rb', line 35

def query(query, &blk)
  tracer.trace(Ext::SPAN_QUERY, span_options) do |span|
    begin
      decorate!(span)
      span.resource = query
      span.span_type = Datadog::Ext::SQL::TYPE
      span.set_tag(Ext::TAG_QUERY_ASYNC, !blk.nil?)
    rescue StandardError => e
      Datadog.logger.debug("error preparing span for presto: #{e}")
    end

    super(query, &blk)
  end
end

#run(query) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ddtrace/contrib/presto/instrumentation.rb', line 20

def run(query)
  tracer.trace(Ext::SPAN_QUERY, span_options) do |span|
    begin
      decorate!(span)
      span.resource = query
      span.span_type = Datadog::Ext::SQL::TYPE
      span.set_tag(Ext::TAG_QUERY_ASYNC, false)
    rescue StandardError => e
      Datadog.logger.debug("error preparing span for presto: #{e}")
    end

    super(query)
  end
end