Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

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?

Dataflow User Label field.png 

Solved Solved
0 12 5,380
1 ACCEPTED SOLUTION

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

View solution in original post

12 REPLIES 12

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?

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

Label=value works

Screen Shot 2023-05-29 at 21.33.15.png

 

Screen Shot 2023-05-29 at 21.33.31.png

 

--
Best regards
David Regalado
Web | Linkedin | Twitter

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

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

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

What template do you intend to use?

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

Expand the Optional Parameters --> CRTL + F --> Labels

I just checked, there is no field for labels:

Screenshot 2023-04-14 at 5.13.04 PM.png

would additional experiments accomplish the same? 

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