Admin Usage statistics
GET/usage/:mode/admin
URL | Description |
---|---|
https://ceems-demo.myaddr.tools:7443/api/v1 | Demo |
This admin endpoint will return the usage statistics of queried user. The
current user is always identified by the header X-Grafana-User
in
the request.
The user who is making the request must be in the list of admin users configured for the server.
A path parameter mode
is required to return the kind of usage statistics.
Currently, two modes of statistics are supported:
current
: In this mode the usage between two time periods is returned based onfrom
andto
query parameters.global
: In this mode the total usage statistics are returned. For instance, if the retention period of the DB is set to 2 years, usage statistics of last 2 years will be returned.
The statistics can be limited to certain projects by passing project
query,
parameter.
If to
query parameter is not provided, current time will be used. If from
query parameter is not used, a default query window of 24 hours will be used.
It means if to
is provided, from
will be calculated as to
- 24hrs.
To limit the number of fields in the response, use field
query parameter. By default, all
fields will be included in the response if they are non-empty.
The current
usage mode can be slow query depending the requested
window interval. This is mostly due to the fact that the CEEMS DB
uses custom JSON types to store metric data and usage statistics
needs to aggregate metrics over these JSON types using custom aggregate
functions which can be slow.
Therefore the query results are cached for 15 min to avoid load on server.
URL string is used as the cache key. Thus, the query parameters
from
and to
are rounded to the nearest timestamp that are
multiple of 900 sec (15 min). The first query will make a DB query and
cache results and subsequent queries, for a given user and same URL
query parameters, will return the same cached result until the cache
is invalidated after 15 min.
Request
Responses
- 200
- 401
- 403
- 500
OK
Unauthorized
Forbidden
Internal Server Error