Class: LaunchDarklyApi::MetricsApi
- Inherits:
-
Object
- Object
- LaunchDarklyApi::MetricsApi
- Defined in:
- lib/launchdarkly_api/api/metrics_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#delete_metric(project_key, metric_key, opts = {}) ⇒ nil
Delete metric Delete a metric by key.
-
#delete_metric_with_http_info(project_key, metric_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete metric Delete a metric by key.
-
#get_metric(project_key, metric_key, opts = {}) ⇒ MetricRep
Get metric Get information for a single metric from the specific project.
-
#get_metric_with_http_info(project_key, metric_key, opts = {}) ⇒ Array<(MetricRep, Integer, Hash)>
Get metric Get information for a single metric from the specific project.
-
#get_metrics(project_key, opts = {}) ⇒ MetricCollectionRep
List metrics Get a list of all metrics for the specified project.
-
#get_metrics_with_http_info(project_key, opts = {}) ⇒ Array<(MetricCollectionRep, Integer, Hash)>
List metrics Get a list of all metrics for the specified project.
-
#initialize(api_client = ApiClient.default) ⇒ MetricsApi
constructor
A new instance of MetricsApi.
-
#patch_metric(project_key, metric_key, patch_operation, opts = {}) ⇒ MetricRep
Update metric Patch a metric by key.
-
#patch_metric_with_http_info(project_key, metric_key, patch_operation, opts = {}) ⇒ Array<(MetricRep, Integer, Hash)>
Update metric Patch a metric by key.
-
#post_metric(project_key, metric_post, opts = {}) ⇒ MetricRep
Create metric Create a new metric in the specified project.
-
#post_metric_with_http_info(project_key, metric_post, opts = {}) ⇒ Array<(MetricRep, Integer, Hash)>
Create metric Create a new metric in the specified project.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ MetricsApi
Returns a new instance of MetricsApi.
19 20 21 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#delete_metric(project_key, metric_key, opts = {}) ⇒ nil
Delete metric Delete a metric by key.
28 29 30 31 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 28 def delete_metric(project_key, metric_key, opts = {}) delete_metric_with_http_info(project_key, metric_key, opts) nil end |
#delete_metric_with_http_info(project_key, metric_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>
Delete metric Delete a metric by key.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 39 def delete_metric_with_http_info(project_key, metric_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.delete_metric ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.delete_metric" end # verify the required parameter 'metric_key' is set if @api_client.config.client_side_validation && metric_key.nil? fail ArgumentError, "Missing the required parameter 'metric_key' when calling MetricsApi.delete_metric" end # resource path local_var_path = '/api/v2/metrics/{projectKey}/{metricKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'metricKey' + '}', CGI.escape(metric_key.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"MetricsApi.delete_metric", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#delete_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_metric(project_key, metric_key, opts = {}) ⇒ MetricRep
Get metric Get information for a single metric from the specific project. ### Expanding the metric response LaunchDarkly supports four fields for expanding the "Get metric" response. By default, these fields are not included in the response. To expand the response, append the ‘expand` query parameter and add a comma-separated list with any of the following fields: - `experiments` includes all experiments from the specific project that use the metric - `experimentCount` includes the number of experiments from the specific project that use the metric - `metricGroups` includes all metric groups from the specific project that use the metric - `metricGroupCount` includes the number of metric groups from the specific project that use the metric For example, `expand=experiments` includes the `experiments` field in the response.
99 100 101 102 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 99 def get_metric(project_key, metric_key, opts = {}) data, _status_code, _headers = get_metric_with_http_info(project_key, metric_key, opts) data end |
#get_metric_with_http_info(project_key, metric_key, opts = {}) ⇒ Array<(MetricRep, Integer, Hash)>
Get metric Get information for a single metric from the specific project. ### Expanding the metric response LaunchDarkly supports four fields for expanding the "Get metric" response. By default, these fields are not included in the response. To expand the response, append the `expand` query parameter and add a comma-separated list with any of the following fields: - `experiments` includes all experiments from the specific project that use the metric - `experimentCount` includes the number of experiments from the specific project that use the metric - `metricGroups` includes all metric groups from the specific project that use the metric - `metricGroupCount` includes the number of metric groups from the specific project that use the metric For example, `expand=experiments` includes the `experiments` field in the response.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 112 def get_metric_with_http_info(project_key, metric_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.get_metric ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.get_metric" end # verify the required parameter 'metric_key' is set if @api_client.config.client_side_validation && metric_key.nil? fail ArgumentError, "Missing the required parameter 'metric_key' when calling MetricsApi.get_metric" end # resource path local_var_path = '/api/v2/metrics/{projectKey}/{metricKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'metricKey' + '}', CGI.escape(metric_key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil? query_params[:'versionId'] = opts[:'version_id'] if !opts[:'version_id'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'MetricRep' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"MetricsApi.get_metric", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#get_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_metrics(project_key, opts = {}) ⇒ MetricCollectionRep
List metrics Get a list of all metrics for the specified project. ### Filtering metrics The ‘filter` parameter supports the following operators: `contains`, `equals`, `anyOf`. #### Supported fields and operators You can only filter certain fields in metrics when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for metrics, the `filter` parameter supports the following fields and operators: |<div style="width:120px">Field</div> |Description |Supported operators | |—|—|—| | `eventKind` | The metric event kind. One of `custom`, `pageview`, `click`. | `equals` | | `hasConnections` | Whether the metric has connections to experiments or guarded rollouts. One of `true`, `false`. | `equals` | | `isNumeric` | Whether the metric is numeric. One of `true`, `false`. | `equals` | | `maintainerIds` | A comma-separated list of metric maintainer IDs. | `anyOf` | | `maintainerTeamKey` | The metric maintainer team key. | `equals` | | `query` | A "fuzzy" search across metric key and name. Supply a string or list of strings to the operator. | `equals` | | `tags` | The metric tags. | `contains` | | `unitAggregationType` | The metric’s unit aggregation type. One of ‘sum`, `average`. | `equals` | For example, the filter `?filter=tags contains ["tag1", "tag2", "tag3"]` matches metrics that have all three tags. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags contains ["tag1", "tag2", "tag3"]` must be encoded to `%5B`. ### Expanding the metric list response LaunchDarkly supports expanding the "List metrics" response. By default, the expandable field is not included in the response. To expand the response, append the `expand` query parameter and add the following supported field: - `experimentCount` includes the number of experiments from the specific project that use the metric For example, `expand=experimentCount` includes the `experimentCount` field for each metric in the response.
176 177 178 179 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 176 def get_metrics(project_key, opts = {}) data, _status_code, _headers = get_metrics_with_http_info(project_key, opts) data end |
#get_metrics_with_http_info(project_key, opts = {}) ⇒ Array<(MetricCollectionRep, Integer, Hash)>
List metrics Get a list of all metrics for the specified project. ### Filtering metrics The `filter` parameter supports the following operators: `contains`, `equals`, `anyOf`. #### Supported fields and operators You can only filter certain fields in metrics when using the `filter` parameter. Additionally, you can only filter some fields with certain operators. When you search for metrics, the `filter` parameter supports the following fields and operators: |<div style="width:120px">Field</div> |Description |Supported operators | |—|—|—| | `eventKind` | The metric event kind. One of `custom`, `pageview`, `click`. | `equals` | | `hasConnections` | Whether the metric has connections to experiments or guarded rollouts. One of `true`, `false`. | `equals` | | `isNumeric` | Whether the metric is numeric. One of `true`, `false`. | `equals` | | `maintainerIds` | A comma-separated list of metric maintainer IDs. | `anyOf` | | `maintainerTeamKey` | The metric maintainer team key. | `equals` | | `query` | A "fuzzy" search across metric key and name. Supply a string or list of strings to the operator. | `equals` | | `tags` | The metric tags. | `contains` | | `unitAggregationType` | The metric's unit aggregation type. One of `sum`, `average`. | `equals` | For example, the filter `?filter=tags contains ["tag1", "tag2", "tag3"]` matches metrics that have all three tags. The documented values for `filter` query parameters are prior to URL encoding. For example, the `[` in `?filter=tags contains ["tag1", "tag2", "tag3"]` must be encoded to `%5B`. ### Expanding the metric list response LaunchDarkly supports expanding the "List metrics" response. By default, the expandable field is not included in the response. To expand the response, append the `expand` query parameter and add the following supported field: - `experimentCount` includes the number of experiments from the specific project that use the metric For example, `expand=experimentCount` includes the `experimentCount` field for each metric in the response.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 191 def get_metrics_with_http_info(project_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.get_metrics ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.get_metrics" end # resource path local_var_path = '/api/v2/metrics/{projectKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil? query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil? query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'MetricCollectionRep' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"MetricsApi.get_metrics", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#get_metrics\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#patch_metric(project_key, metric_key, patch_operation, opts = {}) ⇒ MetricRep
Update metric Patch a metric by key. Updating a metric uses a [JSON patch](datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes. To learn more, read [Updates](launchdarkly.com/docs/api#updates).
251 252 253 254 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 251 def patch_metric(project_key, metric_key, patch_operation, opts = {}) data, _status_code, _headers = patch_metric_with_http_info(project_key, metric_key, patch_operation, opts) data end |
#patch_metric_with_http_info(project_key, metric_key, patch_operation, opts = {}) ⇒ Array<(MetricRep, Integer, Hash)>
Update metric Patch a metric by key. Updating a metric uses a [JSON patch](datatracker.ietf.org/doc/html/rfc6902) representation of the desired changes. To learn more, read [Updates](launchdarkly.com/docs/api#updates).
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 263 def patch_metric_with_http_info(project_key, metric_key, patch_operation, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.patch_metric ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.patch_metric" end # verify the required parameter 'metric_key' is set if @api_client.config.client_side_validation && metric_key.nil? fail ArgumentError, "Missing the required parameter 'metric_key' when calling MetricsApi.patch_metric" end # verify the required parameter 'patch_operation' is set if @api_client.config.client_side_validation && patch_operation.nil? fail ArgumentError, "Missing the required parameter 'patch_operation' when calling MetricsApi.patch_metric" end # resource path local_var_path = '/api/v2/metrics/{projectKey}/{metricKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'metricKey' + '}', CGI.escape(metric_key.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(patch_operation) # return_type return_type = opts[:debug_return_type] || 'MetricRep' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"MetricsApi.patch_metric", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#patch_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#post_metric(project_key, metric_post, opts = {}) ⇒ MetricRep
Create metric Create a new metric in the specified project. The expected ‘POST` body differs depending on the specified `kind` property.
330 331 332 333 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 330 def post_metric(project_key, metric_post, opts = {}) data, _status_code, _headers = post_metric_with_http_info(project_key, metric_post, opts) data end |
#post_metric_with_http_info(project_key, metric_post, opts = {}) ⇒ Array<(MetricRep, Integer, Hash)>
Create metric Create a new metric in the specified project. The expected `POST` body differs depending on the specified `kind` property.
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/launchdarkly_api/api/metrics_api.rb', line 341 def post_metric_with_http_info(project_key, metric_post, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MetricsApi.post_metric ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling MetricsApi.post_metric" end # verify the required parameter 'metric_post' is set if @api_client.config.client_side_validation && metric_post.nil? fail ArgumentError, "Missing the required parameter 'metric_post' when calling MetricsApi.post_metric" end # resource path local_var_path = '/api/v2/metrics/{projectKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(metric_post) # return_type return_type = opts[:debug_return_type] || 'MetricRep' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"MetricsApi.post_metric", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MetricsApi#post_metric\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |