Skip to content

2.9 Billing statistics

jwebs1 edited this page Jul 6, 2015 · 2 revisions

Billing statistics

You have a possibility to receive and aggregate billing statistics by data centers, groups, and servers. This can be done using the BillingStatsFilter filter, which needs to be specified beforehand. BillingStatsFilter supports filtering by data canters, groups, and servers. Statistics can be further aggregated with subgroups. To do that, call the aggregateSubItems() method. Here are some examples:

1. Billing statistics filtered and grouped by servers:

        List<BillingStatsEntry> statsByServer = statisticsService
            .billingStats()
            .forServers(
                new ServerFilter()
                    .nameContains("md-srv")
            )
            .groupByServer();

2. Billing statistics filtered by servers and grouped by data centers:

        List<BillingStatsEntry> statsByDataCenter = statisticsService
            .billingStats()
            .forServers(
                new ServerFilter()
                    .nameContains("md-srv")
            )
            .groupByDataCenter();

3. Billing statistics filtered and arranged by groups and subgroups:

        List<BillingStatsEntry> statsByGroup = statisticsService
            .billingStats()
            .forGroups(
                new GroupFilter()
                    .groups(group)
             )
            .aggregateSubItems()
            .groupByGroup();

4. Summarized billing statistics filtered by data centers:

        Statistics summarize = statisticsService
            .billingStats()
            .forDataCenters(
                new DataCenterFilter()
                   .dataCenters(DataCenter.DE_FRANKFURT)
            )
            .summarize();