All URIs are relative to https://app.launchdarkly.com
Method | HTTP request | Description |
---|---|---|
delete_metric | DELETE /api/v2/metrics/{projectKey}/{metricKey} | Delete metric |
get_metric | GET /api/v2/metrics/{projectKey}/{metricKey} | Get metric |
get_metrics | GET /api/v2/metrics/{projectKey} | List metrics |
patch_metric | PATCH /api/v2/metrics/{projectKey}/{metricKey} | Update metric |
post_metric | POST /api/v2/metrics/{projectKey} | Create metric |
delete_metric(project_key, metric_key)
Delete metric
Delete a metric by key.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_key = 'metric_key_example' # String | The metric key
begin
# Delete metric
api_instance.delete_metric(project_key, metric_key)
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->delete_metric: #{e}"
end
This returns an Array which contains the response data (nil
in this case), status code and headers.
<Array(nil, Integer, Hash)> delete_metric_with_http_info(project_key, metric_key)
begin
# Delete metric
data, status_code, headers = api_instance.delete_metric_with_http_info(project_key, metric_key)
p status_code # => 2xx
p headers # => { ... }
p data # => nil
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->delete_metric_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
metric_key | String | The metric key |
nil (empty response body)
- Content-Type: Not defined
- Accept: application/json
get_metric(project_key, metric_key, opts)
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.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_key = 'metric_key_example' # String | The metric key
opts = {
expand: 'expand_example', # String | A comma-separated list of properties that can reveal additional information in the response.
version_id: 'version_id_example' # String | The specific version ID of the metric
}
begin
# Get metric
result = api_instance.get_metric(project_key, metric_key, opts)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->get_metric: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_metric_with_http_info(project_key, metric_key, opts)
begin
# Get metric
data, status_code, headers = api_instance.get_metric_with_http_info(project_key, metric_key, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <MetricRep>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->get_metric_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
metric_key | String | The metric key | |
expand | String | A comma-separated list of properties that can reveal additional information in the response. | [optional] |
version_id | String | The specific version ID of the metric | [optional] |
- Content-Type: Not defined
- Accept: application/json
get_metrics(project_key, opts)
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 |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.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
opts = {
expand: 'expand_example', # String | A comma-separated list of properties that can reveal additional information in the response.
limit: 789, # Integer | The number of metrics to return in the response. Defaults to 20. Maximum limit is 50.
offset: 789, # Integer | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next `limit` items.
sort: 'sort_example', # String | A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `createdAt` or `name`.
filter: 'filter_example' # String | A comma-separated list of filters. This endpoint accepts filtering by `query`, `tags`, 'eventKind', 'isNumeric', 'unitAggregationType`, `hasConnections`, `maintainerIds`, and `maintainerTeamKey`. To learn more about the filter syntax, read the 'Filtering metrics' section above.
}
begin
# List metrics
result = api_instance.get_metrics(project_key, opts)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->get_metrics: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> get_metrics_with_http_info(project_key, opts)
begin
# List metrics
data, status_code, headers = api_instance.get_metrics_with_http_info(project_key, opts)
p status_code # => 2xx
p headers # => { ... }
p data # => <MetricCollectionRep>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->get_metrics_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
expand | String | A comma-separated list of properties that can reveal additional information in the response. | [optional] |
limit | Integer | The number of metrics to return in the response. Defaults to 20. Maximum limit is 50. | [optional] |
offset | Integer | Where to start in the list. Use this with pagination. For example, an offset of 10 skips the first ten items and returns the next `limit` items. | [optional] |
sort | String | A field to sort the items by. Prefix field by a dash ( - ) to sort in descending order. This endpoint supports sorting by `createdAt` or `name`. | [optional] |
filter | String | A comma-separated list of filters. This endpoint accepts filtering by `query`, `tags`, 'eventKind', 'isNumeric', 'unitAggregationType`, `hasConnections`, `maintainerIds`, and `maintainerTeamKey`. To learn more about the filter syntax, read the 'Filtering metrics' section above. | [optional] |
- Content-Type: Not defined
- Accept: application/json
patch_metric(project_key, metric_key, patch_operation)
Update metric
Patch a metric by key. Updating a metric uses a JSON patch representation of the desired changes. To learn more, read Updates.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_key = 'metric_key_example' # String | The metric key
patch_operation = [LaunchDarklyApi::PatchOperation.new({op: 'replace', path: '/exampleField'})] # Array<PatchOperation> |
begin
# Update metric
result = api_instance.patch_metric(project_key, metric_key, patch_operation)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->patch_metric: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> patch_metric_with_http_info(project_key, metric_key, patch_operation)
begin
# Update metric
data, status_code, headers = api_instance.patch_metric_with_http_info(project_key, metric_key, patch_operation)
p status_code # => 2xx
p headers # => { ... }
p data # => <MetricRep>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->patch_metric_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
metric_key | String | The metric key | |
patch_operation | Array<PatchOperation> |
- Content-Type: application/json
- Accept: application/json
post_metric(project_key, metric_post)
Create metric
Create a new metric in the specified project. The expected POST
body differs depending on the specified kind
property.
require 'time'
require 'launchdarkly_api'
# setup authorization
LaunchDarklyApi.configure do |config|
# Configure API key authorization: ApiKey
config.api_key['ApiKey'] = 'YOUR API KEY'
# Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
# config.api_key_prefix['ApiKey'] = 'Bearer'
end
api_instance = LaunchDarklyApi::MetricsApi.new
project_key = 'project_key_example' # String | The project key
metric_post = LaunchDarklyApi::MetricPost.new({key: 'metric-key-123abc', kind: 'pageview'}) # MetricPost |
begin
# Create metric
result = api_instance.post_metric(project_key, metric_post)
p result
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->post_metric: #{e}"
end
This returns an Array which contains the response data, status code and headers.
<Array(, Integer, Hash)> post_metric_with_http_info(project_key, metric_post)
begin
# Create metric
data, status_code, headers = api_instance.post_metric_with_http_info(project_key, metric_post)
p status_code # => 2xx
p headers # => { ... }
p data # => <MetricRep>
rescue LaunchDarklyApi::ApiError => e
puts "Error when calling MetricsApi->post_metric_with_http_info: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
project_key | String | The project key | |
metric_post | MetricPost |
- Content-Type: application/json
- Accept: application/json