Class: DdPostGauge::Client
- Inherits:
-
Object
- Object
- DdPostGauge::Client
- Defined in:
- lib/dd_post_gauge/client.rb
Instance Method Summary collapse
- #call(metric_name, value, timestamp: nil, resource_name: nil, type_name: nil) ⇒ void
-
#initialize(api_key: nil, site: nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_key: nil, site: nil) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 |
# File 'lib/dd_post_gauge/client.rb', line 10 def initialize(api_key: nil, site: nil) Dotenv.load @api_key = api_key || ENV.fetch("DATADOG_API_KEY", nil) @site = site || ENV.fetch("DATADOG_SITE", "datadoghq.com") configure end |
Instance Method Details
#call(metric_name, value, timestamp: nil, resource_name: nil, type_name: nil) ⇒ void
This method returns an undefined value.
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/dd_post_gauge/client.rb', line 23 def call(metric_name, value, timestamp: nil, resource_name: nil, type_name: nil) api_instance.submit_metrics( body( metric_name, value, (), resource_name, type_name ) ) end |