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 |
| metricUsedIn | Filter by where the metric is used. One of experiments, guarded_rollouts, any, none. | 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.
Path parameters
The project key
The project key
Query parameters
A comma-separated list of properties that can reveal additional information in the response.
A comma-separated list of properties that can reveal additional information in the response.
The number of metrics to return in the response. Defaults to 20. Maximum limit is 50.
The number of metrics to return in the response. Defaults to 20. Maximum limit is 50.
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.
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.
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.
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.
A comma-separated list of filters. This endpoint accepts filtering by query, tags, 'eventKind', 'isNumeric', 'unitAggregationType, hasConnections, maintainerIds, maintainerTeamKey, view, dataSourceKeys, and metricUsedIn`. To learn more about the filter syntax, read the 'Filtering metrics' section above.
A comma-separated list of filters. This endpoint accepts filtering by query, tags, 'eventKind', 'isNumeric', 'unitAggregationType, hasConnections, maintainerIds, maintainerTeamKey, view, dataSourceKeys, and metricUsedIn`. To learn more about the filter syntax, read the 'Filtering metrics' section above.
Response
Metrics collection response
Example response
{
"items": [
{
"activeExperimentCount": 2,
"activeGuardedRolloutCount": 1,
"_id": "5902deadbeef667524a01290",
"_versionId": "version-id-123abc",
"_version": 1,
"key": "metric-key-123abc",
"name": "My metric",
"kind": "custom",
"_links": {
"parent": {
"href": "/api/v2/metrics/my-project",
"type": "application/json"
},
"self": {
"href": "/api/v2/metrics/my-project/my-metric",
"type": "application/json"
}
},
"_access": {
"denied": [
{
"reason": {
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
],
"effect": "allow"
}
}
],
"allowed": [
{
"reason": {
"resources": [
"proj/*:env/*;qa_*:/flag/*"
],
"actions": [
"*"
],
"effect": "allow"
}
}
]
},
"tags": [],
"lastModified": {
"date": "2021-08-05T19:46:31.148082Z"
},
"maintainerId": "569fdeadbeef1644facecafe",
"_maintainer": {
"_links": {
"self": {
"href": "/api/v2/members/569f183514f4432160000007",
"type": "application/json"
}
},
"_id": "569f183514f4432160000007",
"firstName": "Ariel",
"lastName": "Flores",
"role": "admin",
"email": "ariel@acme.com"
},
"category": "Error monitoring",
"isNumeric": true,
"eventKey": "Order placed",
"randomizationUnits": [
"user"
],
"filters": {
"type": "contextAttribute",
"attribute": "country",
"values": [
"JP"
],
"contextKind": "user"
},
"unitAggregationType": "average",
"analysisType": "mean",
"percentileValue": 95
}
],
"_links": {
"self": {
"href": "/api/v2/metrics/my-project?limit=20",
"type": "application/json"
}
}
}