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

Development Tutorial

Adriana Dimitrova edited this page Mar 8, 2018 · 5 revisions

When you have an application or service which is ready to send metering data, you can follow the steps below. You can refer to the broker test app as an example.

Two demo videos showing the steps below are also available:

  • A demo video showing how to update your metering plan in the dashboard.
  • A demo video showing how to create and update your metering service instance plan definition via the command line.

You can also see the Metering with Abacus Simple Demo project on how to send usage data to Abacus to meter the usage of a service or application. The README.md explains what the demo does, how to build and run it, how to use its UI, some hints on implementations, as well as some basic information about Abacus and the most important terms related to the submission of usage data.

1. Create a Service Instance

In order to create the service you need to run the following commands:

  • cf marketplace

  • cf create-service metering standard <myservice>, where <myservice> is the name of your service.
    ℹ️ You could also provide your metering plan configuration via the -c option of cf create-service command as described under Use Abacus Broker.

2. Bind the Service to Your Application

Execute:

  • cf bind-service <myapp> <myservice>, where <myapp> is the name of your application.

To update your environment and enable your app to access the service instance, execute:

  • cf restart <myapp>

3. Edit your metering plans

I. From the Dashboard

The dashboard shows the metering plan for the resource provider application that is bound to the service instance. The metering plan has a sample Measure and a sample Metric.

  1. Navigate to the metering plan to maintain the Measures and Metrics of the metering plan.
  2. On the Measures tab, the application developer can add/edit/delete the Measures for the metering plan.
  3. On the Metrics tab, the application developer can add/edit/delete the Metrics for the metering plan.
  4. Navigate to a metric to maintain the details of the metric and its relevant functions - meter, accumulate, aggregate, and summarize.

Note: The abacus wiki provides sample plans. If you decide to use them keep in mind that you don't need to convert the plan toString() as this is done implicitly by the dashboard for you.

II. Using the CF CLI

To update your metering plan using the cf CLI use the cf update-service command as described under Using-the-Project.

4. Submit Your Usage

In order to submit a usage document, use the insert method, described in the API doc with the URL of the Usage Event Collector. You can see the structure of the data which is to be sent through a Usage Document here. See Use Abacus Broker.

5. Develop your application/service to send usage data according to your metric

6. Get your Usage summary report

You can get your usage summary report by using a GET method and the same credentials, used for sending metering data. See Usage Reports.

Clone this wiki locally