Question: Is it possible to track the cost of bigquery queries using the `configuration.labels` attribute on a query request? I have specified some labels and I do find it in the job definition as you can see here:

```
{
  "configuration": {
    "labels": {
      "label1": "tomas",
      "label2": "yolo"
    },
    "query": {
      "allowLargeResults": false,
      "createDisposition": "CREATE_IF_NEEDED",
      "destinationTable": {
        "datasetId": "dataset",
        "projectId": "project name",
        "tableId": "label "
      },
      "priority": "INTERACTIVE",
      "query": "a select query",
      "useLegacySql": false,
      "writeDisposition": "WRITE_TRUNCATE"
...
}

```

I have also enabled billing export under billing, but when I look at the exported data I can’t find my labels.

Labeling works fine when applied to dataset and tables, but I can't get it to work with queries. Are these labels for queries something else and doesn't show up in the billing?

Answer: 
I have not been able to query or filter on specific labels, but can at least display them with this...

```
SELECT  service.description, cost, labels
FROM `PROJECTNAME.billing_report.gcp_billing_export_v1_016D47_E84908_9F5AB5` 
WHERE cost > 0
LIMIT 1000

```
If you use `bq` command, you can do it by adding `--label` flag as below

```sh
bq query \
--nouse_legacy_sql \
--label foo:bar \
'SELECT COUNT(*) FROM `bigquery-public-data`.samples.shakespeare'

```

Then, you can issue below filter in Cloud logging

```
resource.type="bigquery_resource"
protoPayload.serviceData.jobCompletedEvent.job.jobConfiguration.labels.foo="bar"

```

For API or Client Library, check this [object](https://cloud.google.com/bigquery/docs/reference/rest/v2/Job#jobconfiguration)