-
Notifications
You must be signed in to change notification settings - Fork 16.8k
Airflow logging secrets masker assumes dict_key is type str #16597
Copy link
Copy link
Closed
Description
Apache Airflow version: 2.1.0
What happened:
Airflow logging assume dict_key is type str
logging.info("Dictionary where key is int type: %s", modified_table_mapping)
File "/usr/lib64/python3.6/logging/__init__.py", line 1902, in info
root.info(msg, *args, **kwargs)
File "/usr/lib64/python3.6/logging/__init__.py", line 1308, in info
self._log(INFO, msg, args, **kwargs)
File "/usr/lib64/python3.6/logging/__init__.py", line 1444, in _log
self.handle(record)
File "/usr/lib64/python3.6/logging/__init__.py", line 1453, in handle
if (not self.disabled) and self.filter(record):
File "/usr/lib64/python3.6/logging/__init__.py", line 720, in filter
result = f.filter(record)
File "/bb/bin/airflow_env/lib/python3.6/site-packages/airflow/utils/log/secrets_masker.py", line 157, in filter
record.__dict__[k] = self.redact(v)
File "/bb/bin/airflow_env/lib/python3.6/site-packages/airflow/utils/log/secrets_masker.py", line 193, in redact
return {dict_key: self.redact(subval, dict_key) for dict_key, subval in item.items()}
File "/bb/bin/airflow_env/lib/python3.6/site-packages/airflow/utils/log/secrets_masker.py", line 193, in <dictcomp>
return {dict_key: self.redact(subval, dict_key) for dict_key, subval in item.items()}
File "/bb/bin/airflow_env/lib/python3.6/site-packages/airflow/utils/log/secrets_masker.py", line 189, in redact
if name and should_hide_value_for_key(name):
File "/bb/bin/airflow_env/lib/python3.6/site-packages/airflow/utils/log/secrets_masker.py", line 74, in should_hide_value_for_key
name = name.strip().lower()
AttributeError: 'int' object has no attribute 'strip'
How to reproduce it:
Define a dictionary where the type of keys is int and print it in any Airflow tasks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
kind:bugThis is a clearly a bugThis is a clearly a bug