Class: Wavefront::Writer::Http

Inherits:
Core
  • Object
show all
Defined in:
lib/wavefront-sdk/writers/http.rb

Overview

HTTP POST points to a local proxy. This method does not support any authentication or authorization, as these are not supported by the proxy at the time of writing. When the proxy acquires these functions, a new writer will be made.

Instance Attribute Summary

Attributes inherited from Core

#calling_class, #conn, #creds, #logger, #opts, #summary

Instance Method Summary collapse

Methods inherited from Core

#do_write, #hash_to_wf, #initialize, #log_invalid_point, #prefix_points, #respond, #screen_points, #send_point, #valid_point?, #write

Methods included from Validators

#uuid?, #wf_account_id?, #wf_alert_id?, #wf_alert_severity?, #wf_apitoken_id?, #wf_cloudintegration_id?, #wf_dashboard_id?, #wf_derivedmetric_id?, #wf_distribution?, #wf_distribution_count?, #wf_distribution_interval?, #wf_distribution_values?, #wf_epoch?, #wf_event_id?, #wf_granularity?, #wf_ingestionpolicy_id?, #wf_integration_id?, #wf_link_id?, #wf_link_template?, #wf_maintenance_window_id?, #wf_message_id?, #wf_metric_name?, #wf_monitoredcluster_id?, #wf_ms_ts?, #wf_name?, #wf_notificant_id?, #wf_permission?, #wf_point?, #wf_point_tag?, #wf_point_tags?, #wf_proxy_id?, #wf_sampling_value?, #wf_savedsearch_entity?, #wf_savedsearch_id?, #wf_serviceaccount_id?, #wf_source_id?, #wf_string?, #wf_tag?, #wf_ts?, #wf_user_id?, #wf_usergroup_id?, #wf_value?, #wf_version?, #wf_webhook_id?

Constructor Details

This class inherits a constructor from Wavefront::Writer::Core

Instance Method Details

#api_pathObject



23
24
25
# File 'lib/wavefront-sdk/writers/http.rb', line 23

def api_path
  nil
end

#chunk_sizeObject



38
39
40
# File 'lib/wavefront-sdk/writers/http.rb', line 38

def chunk_size
  100
end

#default_portObject



27
28
29
# File 'lib/wavefront-sdk/writers/http.rb', line 27

def default_port
  2878
end

#openObject



15
16
17
18
19
20
21
# File 'lib/wavefront-sdk/writers/http.rb', line 15

def open
  creds[:endpoint] = format('%<proxy>s:%<port>s',
                            proxy: creds[:proxy],
                            port: creds[:port] || default_port)
  opts[:scheme] = 'http'
  @conn = Wavefront::ApiCaller.new(self, creds, opts)
end

#validate_credentials(creds) ⇒ Object



31
32
33
34
35
36
# File 'lib/wavefront-sdk/writers/http.rb', line 31

def validate_credentials(creds)
  return true if creds.key?(:proxy)

  raise(Wavefront::Exception::CredentialError,
        'credentials must contain proxy')
end