Class: Chef::Telemetry::Client

Inherits:
Object
  • Object
show all
Includes:
Concurrent::Async
Defined in:
lib/chef/telemetry/client.rb

Constant Summary collapse

TELEMETRY_ENDPOINT =
"https://telemetry.chef.io".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endpoint = TELEMETRY_ENDPOINT) ⇒ Client

Returns a new instance of Client.



12
13
14
15
# File 'lib/chef/telemetry/client.rb', line 12

def initialize(endpoint = TELEMETRY_ENDPOINT)
  super()
  @http = HTTP.persistent(endpoint)
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http.



11
12
13
# File 'lib/chef/telemetry/client.rb', line 11

def http
  @http
end

Instance Method Details

#fire(event) ⇒ Object



17
18
19
# File 'lib/chef/telemetry/client.rb', line 17

def fire(event)
  http.post("/events", json: event).flush
end