On this page

    Usage

    With this API, you can retrieve the count of Dremio Consumption Units (DCU) used by jobs run within projects or on engines within projects. The DCUs are added together by hour or by day. You can retrieve the usage for various time periods up to one year in the past.

    note:

    There is a lag of between one to two hours between the time that a job ends and the time that the number of DCUs used by the job is available to be added into results returned by this API.

    Usage Object
    {
      "id": "95c31978-63c6-437c-9501-951cd712fdc6",
      "type": "PROJECT",
      "startTime": "2021-07-21T17:00:00Z",
      "endTime": "2021-07-21T18:00:00Z",
      "usage": 7.2
    }
    

    Usage Attributes

    id

    String

    A UUID that identifies the project or engine that the object records the usage of.


    type

    String

    Explains whether the usage is reported for a project or for an engine.

    Enum PROJECT , ENGINE


    startTime

    String

    The date and time of the start of the time period for which the usage is reported in the object.


    endTime

    String

    The date and time of the end of the time period for which the usage is reported in the object.


    usage

    Float

    A float number that gives the usage for the object with the ID reported in the id field. Usage is measured in Dremio Consumption Units (DCU).


    Usages Object
    {
      "data": [
      {
        Usage object
      },
      {
        Usage object
      },
      ...
      ],
      "previousPageToken": "",
      "nextPageToken": "CAIaBkhPVVJMWSIGRU5HSU5FKAI="
    }
    

    Usages Attributes

    data

    array

    An array of returned usage objects.


    Pagination Parameters

    previousPageToken

    string

    An token that can be used in requests to retrieve the previous page of usage objects in a usages object.

    Example null


    nextPageToken

    string

    An token that can be used in requests to retrieve the next page of usage objects in a usages object.

    Example CAIaBkhPVVJMWSIGRU5HSU5FKAI=


    Retrieving Usage Objects

    Retrieves a paginated array of usage objects for all projects or engines in the organization that the requestor belongs to. The default is all projects, with 20 usage objects per page.

    Retrieving Usage Objects
    GET /v0/usage
    

    Parameters

    pageToken

    query

    String

    Used to get the next/previous page of paginated usages. Other parameters must not change when using the pageToken. This parameter is not required.

    Example CAIaBkhPVVJMWSIGRU5HSU5FKAI=


    maxResults

    query

    Integer

    Maximum number of usage objects to return per page. The default is 20 usage objects. This parameter is not required.


    filter

    query

    String

    Allows filtering on id and start_time, which is in milliseconds since UNIX epoch. The maximum supported date period is 90 days, and data cannot be retrieved further than 1 year in the past. The default is 30 days from the time of request. This parameter is not required.

    Example id == '95c31978-63c6-437c-9501-951cd712fdc6' && start_time >= 1638234061000 && start_time < 1638320461000


    frequency

    query

    String

    Whether to group the usage data by day or hour. The default is DAILY. This parameter is not required.

    Enum DAILY , HOURLY


    groupBy

    query

    String

    Whether to group the results by project or engine. Default is by project. The default is PROJECT. This parameter is not required.

    Enum PROJECT , ENGINE


    Examples of Requests

    This example retrieves thirty usage objects (one for each of the past thirty days) for the project that has the ID specified in the filter. For each day, the usages of the jobs that ran in the project that day are added together.

    Example 1
    curl -X GET "http://api.dremio.cloud/v0/usage?filter=id=='671653b1-5a63-44db-a88e-1aa89cecf0d0'" \
    -H "Authorization: Bearer <Authorization token>" \
    -H "Content-Type: application/json"
    

    This example uses the token from either the previousPageToken or nextPageToken of a usages object to retrieve the previous or next page of usage objects. The example also specifies to retrieve only up to ten usage objects. Each usage object represents an hour of usage. No filter is specified, so the request retrieves the amount of usage for each project and engine in the organization connected to, and for the default of the previous thirty days.

    note:

    Except for the value of the pageToken parameter, the values of all of the other parameters are the same as they were in previous requests for subsets of the same set of usage objects. Changing the value of maxResults would change the number of usage objects returned per page, therefore changing the pagination. Changing the value of frequency, groupBy, or both would retrieve an entirely different set of usage objects. So, too, would using a non-default values for filter.

    Example 2
    curl -X GET "http://dcs-aws-9315-ns.api.drem.io/v0/usage?pageToken=CAIaBkhPVVJMWSIGRU5HSU5FKAI=&maxResults=10&frequency=HOURLY&groupBy=ENGINE" \
    -H "Authorization: Bearer JJ+PU3feQDG5eB5MyGlKWrVyx3eorNEWlS82NoWSKakQUwQiiWsrFHu28DMATg==" \
    -H "Content-Type: application/json"
    

    Responses

    200

    Success.

    400

    Invalid parameter(s) passed in.

    401

    Unauthorized request.

    404

    Resource not found.