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

Defined in:
lib/datadog/tracing/contrib/presto/instrumentation.rb

Overview

Instance methods for Presto::Client

Instance Method Summary collapse

Instance Method Details

#kill(query_id) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/datadog/tracing/contrib/presto/instrumentation.rb', line 54

def kill(query_id)
  Tracing.trace(
    Ext::SPAN_KILL,
    service: datadog_configuration[:service_name]
  ) do |span|
    begin
      decorate!(span, Ext::TAG_OPERATION_KILL)
      span.resource = Ext::SPAN_KILL
      span.span_type = Tracing::Metadata::Ext::AppTypes::TYPE_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



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/datadog/tracing/contrib/presto/instrumentation.rb', line 36

def query(query, &blk)
  Tracing.trace(
    Ext::SPAN_QUERY,
    service: datadog_configuration[:service_name]
  ) do |span|
    begin
      decorate!(span, Ext::TAG_OPERATION_QUERY)
      span.resource = query
      span.span_type = Tracing::Metadata::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



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

def run(query)
  Tracing.trace(
    Ext::SPAN_QUERY,
    service: datadog_configuration[:service_name]
  ) do |span|
    begin
      decorate!(span, Ext::TAG_OPERATION_QUERY)
      span.resource = query
      span.span_type = Tracing::Metadata::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