Class: DatadogProxy::DatadogClient

Inherits:
Object
  • Object
show all
Defined in:
lib/datadog_proxy/datadog_client.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Constructor Details

#initialize(api_key, app_key) ⇒ DatadogClient



8
9
10
11
# File 'lib/datadog_proxy/datadog_client.rb', line 8

def initialize(api_key, app_key)
  @client = Dogapi::Client.new(api_key, app_key)
  @graph_snapshot_url_cache = {}
end

Instance Method Details

#graph_snapshot_url(options) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/datadog_proxy/datadog_client.rb', line 13

def graph_snapshot_url(options)
  # TODO: cap cache size or use external storage like memcached
  @graph_snapshot_url_cache[options.hash] ||= _graph_snapshot_url(options)

  # Append time to avoid the graph is cached.
  "#{@graph_snapshot_url_cache[options.hash]}?#{Time.now.to_i}"
end