public class MeteringStats extends Object
Constructor and Description |
---|
MeteringStats(String serviceId,
Role meteringRole,
HttpDestinationProperties meteringServiceDestination)
Initializes a new
MeteringStats with the given service id, role and metering service destination name. |
Modifier and Type | Method and Description |
---|---|
long |
getApiCountsFor(TenantMetricKeyPair key)
Getter for the current number of API accesses.
|
long |
getDistinctApiCounts()
Number of metric key stored.
|
long |
getSumOfApiCounts()
Aggregates the number of API accesses over all entries.
|
long |
record(TenantMetricKeyPair key)
Record a single access by the tenant to the API specified by the key.
|
long |
record(TenantMetricKeyPair key,
long increment)
Record a specified number accesses by a the tenant to the API specified by the key.
|
void |
sendToMeteringService()
Sends the stored data to the metering service.
|
public MeteringStats(String serviceId, Role meteringRole, HttpDestinationProperties meteringServiceDestination)
MeteringStats
with the given service id, role and metering service destination name.serviceId
- The id needed for the metering service.meteringRole
- The role needed to obtain tenant information.meteringServiceDestination
- The name of the metering destination.public long record(TenantMetricKeyPair key)
key
- The metric key.public long record(TenantMetricKeyPair key, long increment)
key
- The metric key.increment
- The number of API accesses to record.public long getApiCountsFor(TenantMetricKeyPair key)
key
- The metric key to get the number of accesses for.public long getSumOfApiCounts()
public long getDistinctApiCounts()
public void sendToMeteringService() throws TenantAccessException
TenantAccessException
- If there is an issue while accessing the Tenant.Copyright © 2020 SAP SE. All rights reserved.