Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Resource Usage Document

PlamenDoychev edited this page Aug 8, 2018 · 21 revisions

Submitting a document

Who can submit?

Resource providers

How to submit it?

See https://github.com/cloudfoundry-incubator/cf-abacus/blob/master/doc/api.md#method-insert

If Abacus is secured, you'll need to obtain an OAuth token with the correct scope first.

Document structure

Payload

The body of the insert/POST request looks like this:

{
  "start": 1396421450000,
  "end": 1396421451000,
  "organization_id": "idz:54257f98-83f0-4eca-ae04-9ea35277a538",
  "space_id": "d98b5916-3c77-44b9-ac12-04456df23eae",
  "consumer_id": "app:d98b5916-3c77-44b9-ac12-045678edabae",
  "resource_id": "7971aac1-8e39-46e4-91de-41cda206f782",
  "plan_id": "standard",
  "resource_instance_id": "d98b5916-3c77-44b9-ac12-04d61c7a4eae",
  "measured_usage": [
    {
      "measure": "storage",
      "quantity": 10
    },
    {
      "measure": "api_calls",
      "quantity": 10
    }
  ]
}

Used fields

Temporal

  • start

    Start timestamp (UNIX epoch time in milliseconds) of the usage document.

  • end

    End timestamp (UNIX epoch time in milliseconds) of the usage document. Could equal start timestamp.

Resource hierarchy

  • organization_id

    Organization GUID can be uniquely identified by using the space GUID. That's why this field contains UAA Identity zone ID and not organization guid.

  • space_id

    Space GUID of the consuming application. Service Brokers receive the consumer's space GUID when a service instance is created. Applications read their own space GUID from VCAP_APPLICATION

  • consumer_id

    GUID of the application or entity (VM, DB, API) that consumes the resources. Service Brokers receive the consumer's app GUID (optional) and binding GUID when a service binding is created. Applications read their own app GUID from VCAP_APPLICATION

    ⚠️ Note: Consumer ID should be unique under across spaces

  • resource_id

    ID of the resource provider ("7971aac1-8e39-46e4-91de-41cda206f782"). Generated by Abacus Service Broker and available under VCAP_SERVICES credentials key resource_id

  • plan_id

    Use hard-coded value standard. This is not a service instance plan, but a metering plan.

  • resource_instance_id

    Resources can have instances (DB tables/schemes, CPU core, etc.). Can be service instance ID or used to sub-structuring the usage data.

    ⚠️ Note: Resource instance ID should be unique under across resources

Measures

  • measured_usage

    Array of measure and quantity pairs

Usually all measures are mandatory since we consider the metrics to be built by all of the measures.

If you want to be able to skip a measure your plan have to be able to handle this situation. Another approach would be to split your plan in two smaller plans.

Clone this wiki locally