Difference between revisions of "Accounting Model"

From Gcube Wiki
Jump to: navigation, search
(StorageUsageRecord)
(StorageVolumeUsageRecord)
 
Line 112: Line 112:
 
* '''dataVolume'''(Kbytes)
 
* '''dataVolume'''(Kbytes)
  
=== StorageVolumeUsageRecord ===
+
=== StorageStatusRecord ===
  
 
Required Field:
 
Required Field:

Latest revision as of 14:21, 18 November 2016


The Accounting Model is based on the concept of Usage Record (UR).

Accounting Usage Records Hierarchy

UsageRecord.png

Interfaces

Abstract Implementation

Interfaces

Usage Record

This is the very basic interface to respect for every Usage Record. It mainly define the generic access methods. In particular:

  • Getter and Setter for basic fields;
  • Generic Key-Value method both to set and retrieve a single value (key:String, value:Comparable<? extends Serializable>);
  • Generic Map<String, Comparable<? extends Serializable>> to set all property at once.

Single Usage Record

Used to identify if an UsageRecord is referred to a single operation to account.

Common SingleUsageRecord fields:

  • id
  • consumerId
  • creationTime
  • scope
  • operationResult

Fields derived from UsageRecord implementation type (internal use only):

  • usageRecordType

Aggregated Usage Record

Used to identify if an UsageRecord is referred to the aggregation of one (degenerate case) or more UsageRecords becoming from different accounting operations.

This interface define additional methods which allow to retry information regarding

  • how many SingleUsageRecords were aggregated
  • the time interval related to the aggregated SingleUsageRecords

Common AggregatedUsageRecord fields:

  • startTime
  • endTime
  • aggregated
  • operationCount

Abstract Implementation

Basic Usage Record

This is an abstract class which implements the UsageRecord interface and moreover contains basic functionality to reduce the amount of time and lines of code to create a new type of Usage Records. It uses extensively decorators and

Even if is not strictly mandatory, the developers is strongly encouraged to inherits from this base class to create a new UsageRecord, so that he/she can take advance of validations and harmonization facility provided.

Usage Records Standard Types

JobUsageRecord

Required Fields

  • jobId
  • jobStartTime
  • jobEndTime

Optional Fields

  • jobQualifier
  • jobName

The stored records will also contains a Computed Field (see Document Store Lib#Internals):

  • _wallDuration

This field cannot be set manually (even with generic key-value setter method). It is always automatically calculated using jobStartTime and jobEndTime values when the validation occur. Clearly the _wallDuration can only be calculated only if both jobStartTime and jobEndTime are available.

PortletUsageRecord

Required Fields

  • portletId
  • operationId
  • message

ServiceUsageRecord

This records is automatically accounted by gcore and smartgears on service invocation. The service developers SHOULD not use it.

Required Fields:

  • callerHost
  • host
  • serviceClass
  • serviceName
  • calledMethod
  • duration
  • callerQualifier

StorageUsageRecord

Required Field:

  • resourceOwner
  • resourceScope
  • resourceURI
  • providerURI
  • operationType
  • dataType
  • dataVolume(Kbytes)

StorageStatusRecord

Required Field:

  • dataType
  • dataVolume (Kbytes)
  • dataCount
  • dataServiceClass
  • dataServiceName
  • dataServiceId
  • providerId

TaskUsageRecord

Required fields:

  • taskId
  • refJobId
  • host
  • refHostingNodeId
  • taskStartTime
  • taskEndTime

The stored records will also contains a Computed Field (see Document Store Lib#Internals):

  • _wallDuration

This field cannot be set manually (even with generic key-value setter method). It is always automatically calculated using taskStartTime and taskEndTime values when the validation occur. Clearly the _wallDuration can only be calculated only if both taskStartTime and taskEndTime are available.