1

I have used BigQuery and DataSet to store billing data.

I am not able to map line items from billing data to asset data line item. For example I am getting asset id in asset data, but not getting asset id in billing data.

So here I am facing issues to understand which cost, line item is for which asset? Can anyone help me on this?

Note : I am considering mainly these types of assets:

  1. Google Compute Engine
  2. Google App Engine

  3. Storage

  4. SQL

  5. Loadbalancer

GalloCedrone
  • 4,869
  • 3
  • 25
  • 41
Nitesh Singh Rajput
  • 607
  • 1
  • 7
  • 24
  • Could you please specify what do you mean with Asset.id? I've checked my own Bigquery export and the fields like Service_id or service_description could match this value you mean. I can post them as an answer (Service.id and service.description) if you need them – Ggrimaldo Mar 27 '18 at 14:41
  • Asset Id means resource id such as compute instance will have one id field that is asset id here. I have one compute instance running and i want to identify that instance in billing invoice line item. How can I do that ? – Nitesh Singh Rajput Apr 03 '18 at 09:28

1 Answers1

0

There is no Asset Id in the billing data structure. Although, you could set labels in the instances to then use the export to filter by them.

Since labels are key/value pairs, you could use the same key and different values to differentiate each resource's cost.

You could see a few samples in this documentation. i.e :

SELECT
  labels.value as environment,
  SUM(cost) as cost
FROM `project.dataset.table`
LEFT JOIN UNNEST(labels) as labels
  ON labels.key = "environment"
GROUP BY environment;

Also, for the load balancer, you could look into the instance template to customize labels here as well.

Miller G.
  • 178
  • 6
  • Yes labels are there but the problem here with label is, labels are not mandatory fields so if labels are there then well and good. But I am facing issues in case of there is no labels available on resource, then I am unable to identify resources on billing invoice line items. – Nitesh Singh Rajput Apr 10 '18 at 09:55
  • Indeed there is a limitation on what resources labels are applied to. Nonetheless, you could play with `service.id`, `service.description` and `sku.description`. These will return more information on resources such as CLoud SQL, Cloud Storage, App Engine, etc., which you can filter in Bigquery. Also you may want to take a look at this [Reports](https://cloud.google.com/billing/docs/how-to/reports) documentation which may help you understand charges a bit better. – Miller G. Apr 12 '18 at 08:00