deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark McLoughlin <mar...@redhat.com>
Subject Re: Proposal: Adding billing API support to Deltacloud
Date Thu, 09 Aug 2012 07:30:39 GMT
Hi,

On Mon, 2012-08-06 at 18:56 +0530, samridh srinath wrote:
> Hello All,
> 
> Let me start by introducing myself. I am Samridh, a student developer part
> of Google Summer of Code (GSoC). I have been contributing to the Aeolus
> project for the better part of the summer, adding API support for hardware
> profiles to the Conductor API. My mentor is Mo Morsi who has been assisting
> me.
> For what remains of the coding period of GSoC and also after that, Mo and I
> thought that it would be a good idea for me to look into adding billing
> support to the Deltacloud API. I have also been in conversation with
> mfojitk and marios in this regard.

Excellent!

I spent a little while thinking about this some time back and wrote down
some notes quickly. I've added them below FWIW.

The place I'd like to eventually see us get to is that clouds would
provide historical metering data and the cost basis applied to those
meters. So, rather than just "you've spent $200 on instances this week"
you get enough information to calculate the bill yourself.

Now, it looks like AWS is a long way from that but I could see OpenStack
get there soon enough, so it'd be nice if we could design the API to
allow for it in the future.

I guess the summary is there are at least three things worth modelling -
meters, rates and billing.

Cheers,
Mark.

     GET /api HTTP/1.1
     Accept: application/xml

     HTTP/1.1 200 OK
     Content-Type: application/xml

     <api>
       ...
       <link rel="meters" href="/api/meters?start={start}&end={end}"/>
       <link rel="costmodels" href="/api/costmodels"/>
       <link rel="currencies" href="/api/currrencies"/>
       ...
     </api>

 - meters: current and historical information on resource usage

     GET /api/meters?start=2010-10-01&end=2010-10-31 HTTP/1.1
     Accept: application/xml

     HTTP/1.1 200 OK
     Content-Type: application/xml

     <meters start="2010-10-01T00:00:00" end="2010-10-01T00:00:00">
       <meter id="instance.inst1.uptime" href="/api/meters/instance.inst1.uptime">
         <name>Instance1 Running Time</name>
         <description>Number of hours Instance1 is running</description>
         <value units="hours">42</value>
         <instance id="inst1" href="/api/instances/inst1"/>
         <link rel="rates" href="/api/meters/instance.inst1.uptime/rates"/>
         <link rel="samples" href="/api/meters/instance.inst1.uptime/samples"/>
       </meter>
       <meter id="instance.inst2.uptime" href="/api/meters/instance.inst2.uptime">
         <name>Instance2 Running Time</name>
         <description>Number of hours Instance2 is running</description>
         <value units="hours">156</value>
         <instance id="inst1" href="/api/instances/inst2"/>
         <link rel="rates" href="/api/meters/instance.inst2.uptime/rates"/>
         <link rel="samples" href="/api/meters/instance.inst2.uptime/samples"/>
       </meter>
       <meter id="network.rx" href="/api/meters/network.rx">
         <name>Network Data In</name>
         <description>Number of Gb network data received</description>
         <value units="Gb">15.3</value>
         <link rel="rates" href="/api/meters/network.rx/rates"/>
         <link rel="samples" href="/api/meters/network.rx/samples"/>
       </meter>
       <meter id="network.tx" href="/api/meters/network.tx">
         <name>Network Data Out</name>
         <description>Number of Gb network data transmitted</description>
         <value units="Gb">38.2</value>
         <link rel="rates" href="/api/meters/network.tx/rates"/>
         <link rel="samples" href="/api/meters/network.tx/samples"/>
       </meter>
       <meter id="ebs.provisioned" href="/api/meters/ebs.provisioned">
         <name>EBS Storage Provisioned</name>
         <description>Number of Gb allocated in EBS storage</description>
         <value units="Gb">40.0</value>
         <link rel="rates" href="/api/meters/ebs.provisioned/rates"/>
         <link rel="samples" href="/api/meters/ebs.provisioned/samples"/>
       </meter>
       <meter id="ebs.ios" href="/api/meters/ebs.ios">
         <name>EBS Storage I/Os</name>
         <description>Number of EBS I/O operations</description>
         <value>4000000000</value>
         <link rel="rates" href="/api/meters/ebs.ios/rates"/>
         <link rel="samples" href="/api/meters/ebs.ios/samples"/>
       </meter>
     </meters>

     ---

     GET /api/meters/instance.inst1.uptime/samples?start=2010-10-01&end=2010-10-31 HTTP/1.1
     Accept: application/xml

     HTTP/1.1 200 OK
     Content-Type: application/xml

     <samples>
       <meter id="instance.inst1.uptime" href="/api/meters/instance.ints1.uptime"/>
       <sample start="2010-10-16T00:00:00" end="2010-10-16T23:59:59">
         <value>3</value>
       </sample>
       <sample start="2010-10-17T00:00:00" end="2010-10-17T23:59:59">
         <value>24</value>
       </sample>
       <sample start="2010-10-18T00:00:00" end="2010-10-18T23:59:59">
         <value>15</value>
       </sample>
     </samples>

     ---

     GET /api/meters/network.tx/samples?start=2010-10-01&end=2010-10-31 HTTP/1.1
     Accept: application/xml

     HTTP/1.1 200 OK
     Content-Type: application/xml

     <samples>
       <meter id="network.tx" href="/api/meters/network.tx"/>
       <sample start="2010-10-01T00:00:00" end="2010-10-01T23:59:59">
         <value>5.2</value>
       </sample>
       <sample start="2010-10-02T00:00:00" end="2010-10-02T23:59:59">
         <value>8.1</value>
       </sample>
       <sample start="2010-10-03T00:00:00" end="2010-10-03T23:59:59">
         <value>0.3</value>
       </sample>
       ...
     </samples>


 - cost model - defines the costs a user incurs by using various resources

     GET /api/costmodels HTTP/1.1
     Accept: application/xml

     HTTP/1.1 200 OK
     Content-Type: application/xml

     <cost_models>
       <cost_model id="eu-small" href="/api/costmodels/eu-small">
         <name>EU Small Instances</name>
         <description>Cost model for small EC2 instances in the EU region</description>
         <currency id="euro" href="/api/currencies/euro"/>
         <link rel="rates" href="/api/costmodels/eu-small/rates"/>
       </cost_model>
       ...
       <cost_model id="us-network" href="/api/costmodels/us-network">
         <name>US Network I/O</name>
         <description>Cost model for network I/O in the US region</description>
         <currency id="usd" href="/api/currencies/usd"/>
         <link rel="rates" href="/api/costmodels/us-network/rates"/>
       </cost_model>
       ...
    </cost_models>

     ---

     GET /api/costmodels/eu-small/rates HTTP/1.1
     Accept: application/xml

     HTTP/1.1 200 OK
     Content-Type: application/xml

     <rates>
       <rate id="7" href="/api/costmodels/eu-small/rates/7">
         <value>9.5</value>
         <effective>
           <start>2010-01-01T00:00:00</start>
         </effective>
         <duration id="hourly" href="/api/durations/hourly"/>
       </rate>
       <rate id="8" href="/api/costmodels/eu-small/rates/8">
         <value>10.7</value>
         <effective>
           <start>2009-01-01T00:00:00</start>
           <end>2009-12-31T23:59:59</end>
         </effective>
         <duration id="hourly" href="/api/durations/hourly"/>
       </rate>
       ...
     </rates>



Mime
View raw message