Class: Fluent::NewrelicInsights::Client
- Inherits:
-
Object
- Object
- Fluent::NewrelicInsights::Client
- Defined in:
- lib/fluent/plugin/newrelic_insights/client.rb
Instance Method Summary collapse
-
#initialize(account_id, insert_key) ⇒ Client
constructor
A new instance of Client.
- #insert_events(events) ⇒ Object
Constructor Details
#initialize(account_id, insert_key) ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 |
# File 'lib/fluent/plugin/newrelic_insights/client.rb', line 6 def initialize(account_id, insert_key) @account_id = account_id @insert_key = insert_key @url = "https://insights-collector.newrelic.com/v1/accounts/#{account_id}/events" end |
Instance Method Details
#insert_events(events) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fluent/plugin/newrelic_insights/client.rb', line 12 def insert_events(events) response = RestClient::Request.execute( method: :post, url: @url, payload: events.to_json, headers: { "Content-Type" => "application/json", "X-Insert-Key" => @insert_key } ) JSON.load(response.to_s) end |