Class: Dogapi::V1::UsageService

Inherits:
APIService show all
Defined in:
lib/dogapi/v1/usage.rb

Constant Summary collapse

API_VERSION =
'v1'

Instance Attribute Summary

Attributes inherited from APIService

#api_key, #application_key

Instance Method Summary collapse

Methods inherited from APIService

#connect, #handle_redirect, #handle_response, #initialize, #prepare_params, #prepare_request, #request, #should_set_api_and_app_keys_in_params?, #suppress_error_if_silent

Constructor Details

This class inherits a constructor from Dogapi::APIService

Instance Method Details

#get_custom_metrics_usage(start_hr, end_hr = nil) ⇒ Object

Retrieve hourly custom metrics usage information

:start_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, for usage beginning at this hour :end_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, default start_hr+1d, for usage ending BEFORE this hour



44
45
46
47
48
49
50
51
52
# File 'lib/dogapi/v1/usage.rb', line 44

def get_custom_metrics_usage(start_hr, end_hr = nil)
  params = {
    start_hr: start_hr
  }

  params['end_hr'] = end_hr if end_hr

  request(Net::HTTP::Get, "/api/#{API_VERSION}/usage/timeseries", params, nil, false)
end

#get_fargate_usage(start_hr, end_hr = nil) ⇒ Object

Retrieve hourly fargate usage information

:start_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, for usage beginning at this hour :end_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, default start_hr+1d, for usage ending BEFORE this hour



86
87
88
89
90
91
92
93
94
# File 'lib/dogapi/v1/usage.rb', line 86

def get_fargate_usage(start_hr, end_hr = nil)
  params = {
    start_hr: start_hr
  }

  params['end_hr'] = end_hr if end_hr

  request(Net::HTTP::Get, "/api/#{API_VERSION}/usage/fargate", params, nil, false)
end

#get_hosts_usage(start_hr, end_hr = nil) ⇒ Object

Retrieve hourly host usage information

:start_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, for usage beginning at this hour :end_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, default start_hr+1d, for usage ending BEFORE this hour



16
17
18
19
20
21
22
23
24
# File 'lib/dogapi/v1/usage.rb', line 16

def get_hosts_usage(start_hr, end_hr = nil)
  params = {
    start_hr: start_hr
  }

  params['end_hr'] = end_hr if end_hr

  request(Net::HTTP::Get, "/api/#{API_VERSION}/usage/hosts", params, nil, false)
end

#get_logs_usage(start_hr, end_hr = nil) ⇒ Object

Retrieve hourly logs usage information

:start_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, for usage beginning at this hour :end_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, default start_hr+1d, for usage ending BEFORE this hour



30
31
32
33
34
35
36
37
38
# File 'lib/dogapi/v1/usage.rb', line 30

def get_logs_usage(start_hr, end_hr = nil)
  params = {
    start_hr: start_hr
  }

  params['end_hr'] = end_hr if end_hr

  request(Net::HTTP::Get, "/api/#{API_VERSION}/usage/logs", params, nil, false)
end

#get_synthetics_usage(start_hr, end_hr = nil) ⇒ Object

Retrieve hourly synthetics usage information

:start_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, for usage beginning at this hour :end_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, default start_hr+1d, for usage ending BEFORE this hour



72
73
74
75
76
77
78
79
80
# File 'lib/dogapi/v1/usage.rb', line 72

def get_synthetics_usage(start_hr, end_hr = nil)
  params = {
    start_hr: start_hr
  }

  params['end_hr'] = end_hr if end_hr

  request(Net::HTTP::Get, "/api/#{API_VERSION}/usage/synthetics", params, nil, false)
end

#get_traces_usage(start_hr, end_hr = nil) ⇒ Object

Retrieve hourly trace search usage information

:start_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, for usage beginning at this hour :end_hr => String: Datetime ISO-8601 UTC YYYY-MM-DDThh, default start_hr+1d, for usage ending BEFORE this hour



58
59
60
61
62
63
64
65
66
# File 'lib/dogapi/v1/usage.rb', line 58

def get_traces_usage(start_hr, end_hr = nil)
  params = {
    start_hr: start_hr
  }

  params['end_hr'] = end_hr if end_hr

  request(Net::HTTP::Get, "/api/#{API_VERSION}/usage/traces", params, nil, false)
end