module Dogapi

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Unless explicitly stated otherwise all files in this repository are licensed under the BSD-3-Clause License. This product includes software developed at Datadog (www.datadoghq.com/). Copyright 2011-Present Datadog, Inc.

Constants

USER_AGENT
VERSION

Public Class Methods

find_datadog_host() click to toggle source
    # File lib/dogapi/common.rb
208 def Dogapi.find_datadog_host
209   # allow env-based overriding, useful for tests
210   ENV['DATADOG_HOST'] || 'https://api.datadoghq.com'
211 end
find_localhost() click to toggle source
    # File lib/dogapi/common.rb
216 def Dogapi.find_localhost
217   return @@hostname if @@hostname
218   out, status = Open3.capture2('hostname', '-f', err: File::NULL)
219   unless status.exitstatus.zero?
220     begin
221       out = Addrinfo.getaddrinfo(Socket.gethostname, nil, nil, nil, nil, Socket::AI_CANONNAME).first.canonname
222     rescue SocketError
223       out, status = Open3.capture2('hostname', err: File::NULL)
224       raise SystemCallError, 'Both `hostname` and `hostname -f` failed.' unless status.exitstatus.zero?
225     end
226   end
227   @@hostname = out.strip
228 end
find_proxy() click to toggle source
    # File lib/dogapi/common.rb
230 def Dogapi.find_proxy
231   ENV['DD_PROXY_HTTPS'] || ENV['dd_proxy_https'] ||
232     ENV['DD_PROXY_HTTP'] || ENV['dd_proxy_http'] ||
233     ENV['HTTPS_PROXY'] || ENV['https_proxy'] || ENV['HTTP_PROXY'] || ENV['http_proxy']
234 end
symbolized_access(hash) click to toggle source

Very simplified hash with indifferent access - access to string or symbol keys via symbols. E.g.: my_hash = { 'foo' => 1 } Dogapi.symbolized_access(my_hash) my_hash # => 1

    # File lib/dogapi/common.rb
250 def Dogapi.symbolized_access(hash)
251   hash.default_proc = proc { |h, k| h.key?(k.to_s) ? h[k.to_s] : nil }
252   hash
253 end
validate_tags(tags) click to toggle source
    # File lib/dogapi/common.rb
236 def Dogapi.validate_tags(tags)
237   unless tags.is_a? Array
238     raise ArgumentError, "The tags parameter needs to be an array of string. Current value: #{tags}"
239   end
240   tags.each do |tag|
241     raise ArgumentError, "Each tag needs to be a string. Current value: #{tag}" unless tag.is_a? String
242   end
243 end