Menu
Grafana Cloud RSS

Generate usage attribution reports

By attributing usage to teams, services, departments, or systems, you can gain insight into how resources are being used and create usage budgets to manage costs more efficiently. Importantly, the accountability of cost reduction becomes shared, rather than solely the responsibility of a centralized business unit. With this usage and cost visibility, for example, the Finance team can generate reports for monthly financial analysis.

In managing usage costs, you can implement chargebacks, where it is feasible for teams or departments to pay for their own usage. In cases where there is no dedicated budget for usage at a team level, you can create showbacks to provide usage visibility, which helps to raise awareness of how much money is being spent, even if a particular team or department does not directly pay for their costs.

Note

Usage attribution reports are currently available for metrics only. Metrics usage-attributions are based on your monthly billable usage, and are not generated for shorter intervals.

To understand Metrics attribution, there are key underlying concepts:

You can also break down previously billed months by metric labels, for historical usage attributions.

Identify labels to appear on the report

The label names by which you choose to attribute usage depend on your use-case. There is no need to specify the label values, all the values available for the selected labels appear in the report.

Manage costs via chargebacks or showbacks

In this case, pick a label name where each label value represents ownership by a single billing center, whether that’s a division, team, squad, or similar. For example:

  • namespace
  • app, application, or service
  • <CLOUD-PROVIDER-ACCOUNT-ID>_account_id or _account

Perform financial analysis or create a report

To understand your cost of goods sold (COGS), and the breakdown between fixed and variable costs, you need to attribute costs to production versus non-production environments.

For example:

  • environment or env
  • cluster

Examples of other analyses, such as customer, product lines, region, or cloud provider, are as follows:

  • region or location
  • cloud

Identify the best labels to use from your metrics

  1. Go to Home > Dashboards > GrafanaCloud.

  2. Search for the Cardinality management - 3 - labels dashboard.

  3. At the top of the dashboard in the Label field, search the available labels.

  4. Select a label to see data about that label.

    For example:

    • The count of total values.
    • The percentage of total series with that label.
    • The values that occur most often and their distribution.
    • A list of the highest-cardinality metrics for each value.

    In some cases you don’t know which label to use, or you have multiple candidates with similar names. For example you might have all of app, appid, app_id, or application present on your metrics.

  5. Pick the best option based on the following criteria:

    • A high percentage of total series
    • A distribution which is:
      • More than one label value. Value-count could be anything between two to tens, or a few hundred.
      • A somewhat flat distribution.

Configure a usage report

When you first configure a report, contact Customer Support who sets up generation of it for the past three billing months.

Provide the following information in your support ticket:

View the usage attribution report

You can view all available monthly usage attribution reports via the attributions HTTP API endpoint.

Note

Currently, this API only has one endpoint.

Before you begin:

To interact with the API, gather the following information:

  • URL: In the form https://insights-<STACK ZONE>.grafana.net/. To find your Grafana Cloud Stack’s zone, go to your Grafana Cloud account. Check the Details of your stack, then the Details page of your hosted Grafana. Take the hyphenated slug only. For example, if the Grafana instance shows “Grafana Cloud cluster / region: US Central - us - prod-us-central-0” then use prod-us-central-0 for the STACK ZONE.
    cluster-slug can be found at the end of the 'Grafana Cloud cluster / region' field on the Grafana Instance details page
    cluster-slug can be found at the end of the ‘Grafana Cloud cluster / region’ field on the Grafana Instance details page
  • TENANT: The numeric instance ID where you want to fetch usage attribution reports. To find your TENANT value, go to your Grafana Cloud account and check the Details page of your hosted Prometheus endpoint for Username / Instance ID.
  • TOKEN: A token from a Grafana Cloud Access Policy, make sure the access policy has metrics:read scope for the stack ID where you want to fetch usage attribution reports.
  • Accept: Either text/csv or application/json

Example request (CSV):

curl
curl -u "$TENANT:$TOKEN" --header "Accept: text/csv" "$URL/usage/v0/attributions/$TENANT"

Example response:

csv
label_job,label_probe,Month(ISO),BillableSeries,_InstanceID,_OrgID,_HasDpmPerSeriesLargerThanIncluded,_P95Time,_SumOfAttributions,_BillableSeriesAtP95Time,_BillableSeriesBilled
job_1,Atlanta,2023-12,163,12345,123,false,2023-12-07 03:16:04.246 +0000 UTC,376,416,402
job_1,NewYork,2023-12,163,12345,123,false,2023-12-07 03:16:04.246 +0000 UTC,376,416,402
job_2,Atlanta,2023-12,25,12345,123,false,2023-12-07 03:16:04.246 +0000 UTC,376,416,402
job_2,NewYork,2023-12,25,12345,123,false,2023-12-07 03:16:04.246 +0000 UTC,376,416,402
job_1,Atlanta,2023-11,163,12345,123,false,2023-11-18 02:33:04.246 +0000 UTC,564,578,570
job_1,NewYork,2023-11,325,12345,123,false,2023-11-18 02:33:04.246 +0000 UTC,564,578,570
job_2,Atlanta,2023-11,25,12345,123,false,2023-11-18 02:33:04.246 +0000 UTC,564,578,570
job_2,NewYork,2023-11,51,12345,123,false,2023-11-18 02:33:04.246 +0000 UTC,564,578,570

Edit an existing report

You can specify a new set of labels for the report by contacting Customer Support. Refer to Configure a usage report.