Class: Dogapi::MetricService

Inherits:
Service
  • Object
show all
Defined in:
lib/dogapi/metric.rb

Overview

DEPRECATED: Going forward, use the V1 services. This legacy service will be removed in an upcoming release.

Constant Summary collapse

API_VERSION =
'1.0.0'

Instance Method Summary collapse

Methods inherited from Service

#connect, #initialize, #request

Constructor Details

This class inherits a constructor from Dogapi::Service

Instance Method Details

#submit(api_key, scope, metric, points) ⇒ Object

DEPRECATED: Going forward, use the V1 services. This legacy service will be removed in an upcoming release.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/dogapi/metric.rb', line 20

def submit(api_key, scope, metric, points)
  warn '[DEPRECATION] Dogapi::MetricService.submit() has been deprecated in favor of the newer V1 services'
  series = [{
    :host    =>  scope.host,
    :device  =>  scope.device,
    :metric  =>  metric,
    :points  =>  points.map { |p| [p[0].to_i, p[1]] }
  }]

  params = {
    :api_key      =>  api_key,
    :api_version  =>  API_VERSION,
    :series       =>  series.to_json
  }

  request Net::HTTP::Post, '/series/submit', params
end