1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/website/docs/reference/api/legacy/unleash/admin/metrics.md
2024-05-24 15:07:01 +03:00

5.1 KiB

id title
metrics /api/admin/metrics

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 and add an Authorization header using the token.

This document describes the metrics endpoint for admin ui

Seen-toggles

:::caution Deprecation notice

This endpoint has been deprecated

:::

GET http://unleash.host.com/api/admin/metrics/seen-toggles

This enpoints returns a list of applications and what toogles unleash has seen for each application. It will only guarantee flags reported by client applications within the last hour, but will in most cases remember seen flags for applications longer.

Example response:

[
  {
    "appName": "demo-app",
    "seenToggles": ["add-feature-2", "flag-2", "flag-3"],
    "metricsCount": 127
  },
  {
    "appName": "demo-app-2",
    "seenToggles": ["add-feature-2", "flag-2", "flag-3"],
    "metricsCount": 21
  }
]

Fields:

  • 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 flags for this application.

Feature-Toggles metrics

GET http://unleash.host.com/api/admin/metrics/feature-toggles

This endpoint gives last minute and last hour metrics for all active flags. This is based on metrics reported by client applications. Yes is the number of times a given feature flag was evaluated to enabled in a client application, and no is the number it was evaluated to false.

Example response:

{
  "lastHour": {
    "add-feature-2": {
      "yes": 0,
      "no": 527
    },
    "flag-2": {
      "yes": 265,
      "no": 85
    },
    "flag-3": {
      "yes": 257,
      "no": 93
    }
  },
  "lastMinute": {
    "add-feature-2": {
      "yes": 0,
      "no": 527
    },
    "flag-2": {
      "yes": 265,
      "no": 85
    },
    "flag-3": {
      "yes": 257,
      "no": 93
    }
  }
}

Fields:

  • lastHour - Hour projection collected metrics for all feature flags.
  • lastMinute - Minute projection collected metrics for all feature flags.

Applications

GET http://unleash.host.com/api/admin/metrics/applications

This endpoint returns a list of known applications (seen in the last day) and a link to follow for more details.

{
  "applications": [
    {
      "appName": "another",
      "strategies": ["default", "other", "brother"],
      "createdAt": "2016-12-09T14:56:36.730Z",
      "links": {
        "appDetails": "/api/admin/applications/another"
      }
    },
    {
      "appName": "bow",
      "strategies": ["default", "other", "brother"],
      "createdAt": "2016-12-09T14:56:36.730Z",
      "links": {
        "appDetails": "/api/admin/applications/bow"
      }
    }
  ]
}

Query Params

You can also specify the query param: strategyName, which will return all applications implementing the given strategy.

GET http://unleash.host.com/api/admin/metrics/applications?strategyName=someStrategyName

Application Details

GET http://unleash.host.com/api/admin/metrics/applications/:appName

This endpoint gives insight into details about a client application, such as instances, strategies implemented and seen flags.

{
  "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"
    }
  ],
  "strategies": [
    {
      "appName": "demo-app",
      "strategies": ["default", "extra"]
    }
  ],
  "seenToggles": ["add-feature-2", "flag-2", "flag-3"]
}

Seen applications

:::caution Deprecation notice

This endpoint has been deprecated

:::

GET http://unleash.host.com/api/admin/metrics/seen-apps

This endpoint gives insight into details about application seen per feature flag.

{
  "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",
      "strategies": ["default"],
      "url": "http://example.com",
      "color": null,
      "icon": "desktop"
    }
  ]
}