1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-10-18 20:09:08 +02:00
unleash.unleash/website/docs/reference/api/legacy/unleash/admin/metrics.md

195 lines
4.9 KiB
Markdown
Raw Normal View History

---
id: metrics
title: /api/admin/metrics
---
refactor: move docs into new structure / fix links for SEO (#2416) ## What This (admittedly massive) PR updates the "physical" documentation structure and fixes url inconsistencies and SEO problems reported by marketing. The main points are: - remove or move directories : advanced, user_guide, deploy, api - move the files contained within to the appropriate one of topics, how-to, tutorials, or reference - update internal doc links and product links to the content - create client-side redirects for all the urls that have changed. A number of the files have been renamed in small ways to better match their url and to make them easier to find. Additionally, the top-level api directory has been moved to /reference/api/legacy/unleash (see the discussion points section for more on this). ## Why When moving our doc structure to diataxis a while back, we left the "physical' files lying where they were, because it didn't matter much to the new structure. However, that did introduce some inconsistencies with where you place docs and how we organize them. There's also the discrepancies in whether urls us underscores or hyphens (which isn't necessarily the same as their file name), which has been annoying me for a while, but now has also been raised by marketing as an issue in terms of SEO. ## Discussion points The old, hand-written API docs have been moved from /api to /reference/api/legacy/unleash. There _is_ a /reference/api/unleash directory, but this is being populated by the OpenAPI plugin, and mixing those could only cause trouble. However, I'm unsure about putting /legacy/ in the title, because the API isn't legacy, the docs are. Maybe we could use another path? Like /old-docs/ or something? I'd appreciate some input on this.
2022-11-22 10:05:30 +01:00
> In order to access the admin API endpoints you need to identify yourself. Unless you're using the `none` authentication method, you'll need to [create an ADMIN token](/how-to/how-to-create-api-tokens) and add an Authorization header using the token.
2017-06-28 10:17:48 +02:00
# This document describes the metrics endpoint for admin ui
2016-11-30 18:56:25 +01:00
### Seen-toggles {#seen-toggles}
2016-11-30 18:56:25 +01:00
2017-06-28 10:17:48 +02:00
`GET http://unleash.host.com/api/admin/seen-toggles`
2016-11-30 18:56:25 +01:00
2020-10-12 07:59:59 +02:00
This enpoints returns a list of applications and what toogles unleash has seen for each application. It will only guarantee toggles reported by client applications within the last hour, but will in most cases remember seen toggles for applications longer.
2016-11-30 18:56:25 +01:00
2018-11-22 11:20:28 +01:00
**Example response:**
2016-11-30 18:56:25 +01:00
```json
[
{
"appName": "demo-app",
2018-11-22 11:20:28 +01:00
"seenToggles": ["add-feature-2", "toggle-2", "toggle-3"],
2016-11-30 18:56:25 +01:00
"metricsCount": 127
},
{
"appName": "demo-app-2",
2018-11-22 11:20:28 +01:00
"seenToggles": ["add-feature-2", "toggle-2", "toggle-3"],
2016-11-30 18:56:25 +01:00
"metricsCount": 21
}
]
```
**Fields:**
2018-11-22 11:20:28 +01:00
- **appName** - Name of the application seen by unleash-server
- **seenToggles** - array of toggles names seen by unleash-server for this application
- **metricsCount** - number of metrics counted across all toggles for this application.
2016-11-30 18:56:25 +01:00
### Feature-Toggles metrics {#feature-toggles-metrics}
2016-11-30 18:56:25 +01:00
2017-06-28 10:17:48 +02:00
`GET http://unleash.host.com/api/admin/metrics/feature-toggles`
2016-11-30 18:56:25 +01:00
This endpoint gives _last minute_ and _last hour_ metrics for all active toggles. This is based on metrics reported by client applications. Yes is the number of times a given feature toggle was evaluated to enabled in a client application, and no is the number it was evaluated to false.
2016-11-30 18:56:25 +01:00
2018-11-22 11:20:28 +01:00
**Example response:**
2016-11-30 18:56:25 +01:00
```json
{
"lastHour": {
"add-feature-2": {
"yes": 0,
"no": 527
},
"toggle-2": {
"yes": 265,
"no": 85
},
"toggle-3": {
"yes": 257,
"no": 93
}
},
"lastMinute": {
"add-feature-2": {
"yes": 0,
"no": 527
},
"toggle-2": {
"yes": 265,
"no": 85
},
"toggle-3": {
"yes": 257,
"no": 93
}
}
}
```
**Fields:**
2018-11-22 11:20:28 +01:00
- **lastHour** - Hour projection collected metrics for all feature toggles.
- **lastMinute** - Minute projection collected metrics for all feature toggles.
2016-11-30 18:56:25 +01:00
### Applications {#applications}
2016-11-30 18:56:25 +01:00
2018-11-22 11:20:28 +01:00
`GET http://unleash.host.com/api/admin/applications`
2016-11-30 18:56:25 +01:00
This endpoint returns a list of known applications (seen the last two days) and a link to follow for more details.
2016-11-30 18:56:25 +01:00
```json
{
"applications": [
{
"appName": "another",
2018-11-22 11:20:28 +01:00
"strategies": ["default", "other", "brother"],
"createdAt": "2016-12-09T14:56:36.730Z",
2016-11-30 18:56:25 +01:00
"links": {
2017-06-28 10:17:48 +02:00
"appDetails": "/api/admin/applications/another"
2016-11-30 18:56:25 +01:00
}
},
{
"appName": "bow",
2018-11-22 11:20:28 +01:00
"strategies": ["default", "other", "brother"],
"createdAt": "2016-12-09T14:56:36.730Z",
2016-11-30 18:56:25 +01:00
"links": {
2017-06-28 10:17:48 +02:00
"appDetails": "/api/admin/applications/bow"
2016-11-30 18:56:25 +01:00
}
}
]
}
```
#### Query Params {#query-params}
2018-11-22 11:20:28 +01:00
You can also specify the query param: _strategyName_, which will return all applications implementing the given strategy.
2018-11-22 11:20:28 +01:00
`GET http://unleash.host.com/api/admin/applications?strategyName=someStrategyName`
2016-11-30 18:56:25 +01:00
### Application Details {#application-details}
2016-11-30 18:56:25 +01:00
2018-11-22 11:20:28 +01:00
`GET http://unleash.host.com/api/admin/applications/:appName`
2016-11-30 18:56:25 +01:00
This endpoint gives insight into details about a client application, such as instances, strategies implemented and seen toggles.
2016-11-30 18:56:25 +01:00
```json
{
"appName": "demo-app",
"instances": [
{
"instanceId": "generated-732038-17080",
"clientIp": "::ffff:127.0.0.1",
"lastSeen": "2016-11-30T17:32:04.265Z",
"createdAt": "2016-11-30T17:31:08.914Z"
},
{
"instanceId": "generated-639919-11185",
"clientIp": "::ffff:127.0.0.1",
"lastSeen": "2016-11-30T16:04:15.991Z",
"createdAt": "2016-11-30T10:49:11.223Z"
2018-11-22 11:20:28 +01:00
}
2016-11-30 18:56:25 +01:00
],
"strategies": [
{
"appName": "demo-app",
2018-11-22 11:20:28 +01:00
"strategies": ["default", "extra"]
2016-11-30 18:56:25 +01:00
}
],
2018-11-22 11:20:28 +01:00
"seenToggles": ["add-feature-2", "toggle-2", "toggle-3"]
2016-11-30 18:56:25 +01:00
}
2017-01-06 16:02:43 +01:00
```
### Seen applications {#seen-applications}
2017-01-06 16:02:43 +01:00
2018-11-22 11:20:28 +01:00
`GET http://unleash.host.com/api/admin/seen-apps`
2017-01-06 16:02:43 +01:00
This endpoint gives insight into details about application seen per feature toggle.
```json
{
"my-toggle": [
{
"appName": "my-app",
"createdAt": "2016-12-28T10:39:24.966Z",
"updatedAt": "2017-01-06T15:32:41.932Z",
"description": "our main app",
"strategies": [
"gradualRolloutRandom",
"abTest",
"default",
"betaUser",
"userWithId",
"byHostName",
"gradualRolloutWithSessionId",
"gradualRollout",
"byRemoteAddr"
],
"url": "http://example.com",
"color": null,
"icon": "terrain"
},
{
"appName": "my-other-app",
"createdAt": "2016-12-28T10:39:24.966Z",
"updatedAt": "2017-01-06T15:32:41.932Z",
"description": "our other app",
2018-11-22 11:20:28 +01:00
"strategies": ["default"],
2017-01-06 16:02:43 +01:00
"url": "http://example.com",
"color": null,
"icon": "desktop"
}
]
}
```