Class: Wavefront::SpanSamplingPolicy
- Defined in:
- lib/wavefront-sdk/spansamplingpolicy.rb
Overview
View and manage the Wavefront span sampling policy.
Instance Attribute Summary
Attributes inherited from CoreApi
Instance Method Summary collapse
-
#create(body) ⇒ Wavefront::Response
POST /api/v2/spansamplingpolicy Create a span sampling policy.
-
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/spansamplingpolicy/id Delete a specific span sampling policy.
-
#deleted ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy/deleted Get all deleted sampling policies for a customer.
-
#describe(id, version = nil) ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy/id GET /api/v2/spansamplingpolicy/id/history/version Get a specific span sampling policy Get a specific policy / Get a specific historical version of a specific sampling policy.
-
#history(id, offset = nil, limit = nil) ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy/id/history Get the version history of a specific sampling policy.
-
#list(offset = 0, limit = 100) ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy Get all sampling policies for a customer.
-
#undelete(id) ⇒ Wavefront::Response
POST /api/v2/spansamplingpolicy/id/undelete Restore a deleted span sampling policy.
-
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/spansamplingpolicy/id Update a specific span sampling policy.
- #update_keys ⇒ Object
Methods inherited from CoreApi
#api_base, #api_path, #hash_for_update, #initialize, #setup_api, #time_to_ms
Methods included from Mixins
#log, #parse_relative_time, #parse_time, #relative_time, #time_multiplier, #valid_relative_time?
Methods included from Validators
#uuid?, #wf_account_id?, #wf_alert_id?, #wf_alert_severity?, #wf_apitoken_id?, #wf_aws_external_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_metricspolicy_id?, #wf_monitoredapplication_id?, #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_role_id?, #wf_sampling_value?, #wf_savedsearch_entity?, #wf_savedsearch_id?, #wf_serviceaccount_id?, #wf_source_id?, #wf_spansamplingpolicy_id?, #wf_string?, #wf_tag?, #wf_trace?, #wf_ts?, #wf_user_id?, #wf_usergroup_id?, #wf_value?, #wf_version?, #wf_webhook_id?
Constructor Details
This class inherits a constructor from Wavefront::CoreApi
Instance Method Details
#create(body) ⇒ Wavefront::Response
POST /api/v2/spansamplingpolicy Create a span sampling policy
32 33 34 35 36 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 32 def create(body) raise ArgumentError unless body.is_a?(Hash) api.post('', body, 'application/json') end |
#delete(id) ⇒ Wavefront::Response
DELETE /api/v2/spansamplingpolicy/id Delete a specific span sampling policy
Deleting an active policy moves it to ‘trash’, from where it can be restored with an #undelete operation. Deleting an policy in ‘trash’ removes it for ever.
48 49 50 51 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 48 def delete(id) wf_spansamplingpolicy_id?(id) api.delete(id) end |
#deleted ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy/deleted Get all deleted sampling policies for a customer
57 58 59 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 57 def deleted api.get('deleted') end |
#describe(id, version = nil) ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy/id GET /api/v2/spansamplingpolicy/id/history/version Get a specific span sampling policy Get a specific policy / Get a specific historical version of a specific sampling policy
71 72 73 74 75 76 77 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 71 def describe(id, version = nil) wf_spansamplingpolicy_id?(id) wf_version?(version) if version fragments = [id] fragments += ['history', version] if version api.get(fragments.uri_concat) end |
#history(id, offset = nil, limit = nil) ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy/id/history Get the version history of a specific sampling policy
106 107 108 109 110 111 112 113 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 106 def history(id, offset = nil, limit = nil) wf_spansamplingpolicy_id?(id) qs = {} qs[:offset] = offset if offset qs[:limit] = limit if limit api.get([id, 'history'].uri_concat, qs) end |
#list(offset = 0, limit = 100) ⇒ Wavefront::Response
GET /api/v2/spansamplingpolicy Get all sampling policies for a customer
22 23 24 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 22 def list(offset = 0, limit = 100) api.get('', offset: offset, limit: limit) end |
#undelete(id) ⇒ Wavefront::Response
POST /api/v2/spansamplingpolicy/id/undelete Restore a deleted span sampling policy
121 122 123 124 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 121 def undelete(id) wf_spansamplingpolicy_id?(id) api.post([id, 'undelete'].uri_concat) end |
#update(id, body, modify = true) ⇒ Wavefront::Response
PUT /api/v2/spansamplingpolicy/id Update a specific span sampling policy
90 91 92 93 94 95 96 97 98 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 90 def update(id, body, modify = true) wf_spansamplingpolicy_id?(id) raise ArgumentError unless body.is_a?(Hash) return api.put(id, body, 'application/json') unless modify api.put(id, hash_for_update(describe(id).response, body), 'application/json') end |
#update_keys ⇒ Object
11 12 13 |
# File 'lib/wavefront-sdk/spansamplingpolicy.rb', line 11 def update_keys %i[name active expression description samplingPercent] end |