Stephen Bailey
05/18/2022, 3:45 PM<http://ad.datadoghq.com/tags|ad.datadoghq.com/tags>: '{"<TAG_KEY>": "<TAG_VALUE>"}'
I see that Dagster is already labeling pods with job names, etc., and that is essentially what I'm trying to get into Datadog. Am I right in thinking that if I wanted all the pods generated from a certain job to bear the <http://ad.datadoghq.com/tags|ad.datadoghq.com/tags>: '{"dagster/job-name": "my_job_name"}'
annotation, then I would need to pass this in during job construction?Stephen Bailey
05/18/2022, 3:46 PMAndrea Giardini
05/18/2022, 3:48 PMStephen Bailey
05/18/2022, 5:24 PMdagster-k8s/config
? getting errors when i try to override via the UI
adding dagster-k8s/config: {"pod_template_spec_metadata": {"annotations": {"<http://ad.datadoghq.com/tags|ad.datadoghq.com/tags>": {"FOO": "BAR"}}}}
as a tag, yields:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
File "/dagster-cloud/dagster_cloud/agent/dagster_cloud_agent.py", line 538, in _process_api_request
api_result = self._handle_api_request(request, instance, user_code_launcher)
File "/dagster-cloud/dagster_cloud/agent/dagster_cloud_agent.py", line 424, in _handle_api_request
launcher.launch_run(LaunchRunContext(pipeline_run=run, workspace=None))
File "/dagster-k8s/dagster_k8s/launcher.py", line 298, in launch_run
self._launch_k8s_job_with_args(job_name, args, run, pipeline_origin)
File "/dagster-k8s/dagster_k8s/launcher.py", line 233, in _launch_k8s_job_with_args
user_defined_k8s_config = get_user_defined_k8s_config(frozentags(run.tags))
File "/dagster-k8s/dagster_k8s/job.py", line 150, in get_user_defined_k8s_config
user_defined_k8s_config_value = json.loads(tags[USER_DEFINED_K8S_CONFIG_KEY])
File "/usr/local/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
daniel
05/18/2022, 5:33 PMStephen Bailey
05/18/2022, 5:35 PMdagster-k8s/config
? doesn't like it as a string `'`{"pod_template_spec_metadata": {"annotations": {"ad.datadoghq.com/tags": {"FOO": "BAR"}}}}'` or just as a dictdaniel
05/18/2022, 6:12 PM{
"container_config": {
"resources": {
"requests": {
"cpu": "500m",
"memory": "4Gi"
}
}
}
}
daniel
05/18/2022, 6:14 PM{
"pod_template_spec_metadata": {
"annotations": {
"<http://ad.datadoghq.com/tags|ad.datadoghq.com/tags>": {
"FOO": "BAR"
}
}
}
}
Are you sure its not getting prepended with a single-quote or something?daniel
05/18/2022, 6:15 PMStephen Bailey
05/18/2022, 7:24 PMdagster-k8s/config: {"pod_template_spec_metadata": {"annotations": {"<http://ad.datadoghq.com/tags|ad.datadoghq.com/tags>": "{\"dagster_job_name\": \"replicate_main_backend_orders\"}"}}}
. That's what I get when I load it programmatically using this:
def make_dagster_datadog_annotations(**kwargs):
return {
"dagster-k8s/config": {
"pod_template_spec_metadata": {
"annotations": {
"<http://ad.datadoghq.com/tags|ad.datadoghq.com/tags>": json.dumps(**kwargs)
}
}
}
}
daniel
05/18/2022, 7:26 PMdaniel
05/18/2022, 7:28 PMdaniel
05/18/2022, 7:33 PMStephen Bailey
05/18/2022, 7:38 PMdaniel
05/18/2022, 7:38 PMStephen Bailey
05/18/2022, 7:40 PMhelm upgrade --install user-cloud dagster-cloud/dagster-cloud-agent
do that?Stephen Bailey
05/18/2022, 7:46 PMdaniel
05/18/2022, 7:47 PM