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



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

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.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



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

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.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



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

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.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