Adding labels to Dataflow

Hi, I am trying to add labels to a Dataflow job that I’m creating from a template.

Under the “optional parameters”, there’s a section called Additional User Labels but I’m not able to find the correct format to add it as shown below. I tried Json notation but I can’t resolve that Regex somehow. Do you know how to add single/multiple labels on this field?

In Cloud Dataflow, labels can be added to a job either programmatically or via the command-line when launching a job. Note that GCP has restrictions on the length and characters that can be used in labels.

Can you try creating the job template using gcloud?

1 Like

Hello,
Can you try setting the following label:
{“environment”:“landing”}

1 Like

I don’t see this option to add user labels when setting up a dataflow job using GCP provided templates. was this functionality removed?

1 Like

Not all templates support the User Labels. Check in the Optional parameters if you find User Labels.

1 Like

thanks for the reply. why do all templates not support user labels? we need labels for cost

1 Like

What template do you intend to use?

1 Like

https://cloud.google.com/dataflow/docs/guides/templates/provided/pubsub-to-bigquery

1 Like

It has “Additional User Labels” in the Optional Parameters when using the console. Can you check:

Expand the Optional Parameters → CRTL + F → Labels

1 Like

I just checked, there is no field for labels:

1 Like

would additional experiments accomplish the same?

1 Like

If the built-in templates don’t allow for labels, or the functionality you need, you can always customize them to your liking. Their source code is available on GitHub at the following location: https://github.com/GoogleCloudPlatform/DataflowTemplates

2 Likes

Label=value works


Best regards
David Regalado
Web | Linkedin | Twitter