Skip to content

Commit c8350f4

Browse files
authored
vdk-structlog: rename structlog configs (#3002)
## Why? Structlog config options have the same name as some vdk-core config options. This causes a conflict when running jobs with minimal config. ## What? Rename the structlog config options ## How was this tested? Ran a hello-world example locally CI ## What kind of change is this? Bugfix Signed-off-by: Dilyan Marinov <mdilyan@vmware.com>
1 parent 6a38d3d commit c8350f4

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

projects/vdk-plugins/vdk-structlog/src/vdk/plugin/structlog/constants.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# SPDX-License-Identifier: Apache-2.0
33
import logging
44

5-
STRUCTLOG_LOGGING_METADATA_KEY = "logging_metadata"
6-
STRUCTLOG_LOGGING_FORMAT_KEY = "logging_format"
7-
STRUCTLOG_CONSOLE_LOG_PATTERN = "logging_custom_format"
5+
STRUCTLOG_LOGGING_METADATA_KEY = "structlog_metadata"
6+
STRUCTLOG_LOGGING_FORMAT_KEY = "structlog_format"
7+
STRUCTLOG_CONSOLE_LOG_PATTERN = "structlog_console_custom_format"
88

99
STRUCTLOG_LOGGING_FORMAT_POSSIBLE_VALUES = ["console", "json"]
1010
STRUCTLOG_LOGGING_FORMAT_DEFAULT = "console"

projects/vdk-plugins/vdk-structlog/tests/test_structlog.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ def test_structlog(log_format):
7878
with mock.patch.dict(
7979
os.environ,
8080
{
81-
"VDK_LOGGING_METADATA": f"timestamp,level,file_name,line_number,vdk_job_name,{BOUND_TEST_KEY},{EXTRA_TEST_KEY}",
82-
"VDK_LOGGING_FORMAT": log_format,
81+
"VDK_STRUCTLOG_METADATA": f"timestamp,level,file_name,line_number,vdk_job_name,{BOUND_TEST_KEY},{EXTRA_TEST_KEY}",
82+
"VDK_STRUCTLOG_FORMAT": log_format,
8383
"LOG_LEVEL_MODULE": "test_structlog=WARNING",
8484
},
8585
):
@@ -119,8 +119,8 @@ def test_stock_fields_removal(log_format):
119119
with mock.patch.dict(
120120
os.environ,
121121
{
122-
"VDK_LOGGING_METADATA": vdk_logging_metadata,
123-
"VDK_LOGGING_FORMAT": log_format,
122+
"VDK_STRUCTLOG_METADATA": vdk_logging_metadata,
123+
"VDK_STRUCTLOG_FORMAT": log_format,
124124
},
125125
):
126126
logs = _run_job_and_get_logs()
@@ -144,8 +144,8 @@ def test_custom_format_applied(log_format):
144144
with mock.patch.dict(
145145
os.environ,
146146
{
147-
"VDK_LOGGING_FORMAT": log_format,
148-
"VDK_CUSTOM_CONSOLE_LOG_PATTERN": custom_format_string,
147+
"VDK_STRUCTLOG_FORMAT": log_format,
148+
"VDK_STRUCTLOG_CONSOLE_CUSTOM_FORMAT": custom_format_string,
149149
},
150150
):
151151
logs = _run_job_and_get_logs()
@@ -165,9 +165,9 @@ def test_custom_format_not_applied_for_non_console_formats(log_format):
165165
with mock.patch.dict(
166166
os.environ,
167167
{
168-
"VDK_LOGGING_METADATA": "timestamp,level,file_name,vdk_job_name",
169-
"VDK_LOGGING_FORMAT": log_format,
170-
"VDK_CUSTOM_CONSOLE_LOG_PATTERN": custom_format_string,
168+
"VDK_STRUCTLOG_METADATA": "timestamp,level,file_name,vdk_job_name",
169+
"VDK_STRUCTLOG_FORMAT": log_format,
170+
"VDK_STRUCTLOG_CUSTOM_CONSOLE_FORMAT": custom_format_string,
171171
},
172172
):
173173
logs = _run_job_and_get_logs()
@@ -188,8 +188,8 @@ def test_step_name_step_type(log_format):
188188
with mock.patch.dict(
189189
os.environ,
190190
{
191-
"VDK_LOGGING_METADATA": "vdk_step_type,vdk_step_name",
192-
"VDK_LOGGING_FORMAT": log_format,
191+
"VDK_STRUCTLOG_METADATA": "vdk_step_type,vdk_step_name",
192+
"VDK_STRUCTLOG_FORMAT": log_format,
193193
},
194194
):
195195
logs = _run_job_and_get_logs()
@@ -200,8 +200,8 @@ def test_step_name_step_type(log_format):
200200
with mock.patch.dict(
201201
os.environ,
202202
{
203-
"VDK_LOGGING_METADATA": "vdk_step_name",
204-
"VDK_LOGGING_FORMAT": log_format,
203+
"VDK_STRUCTLOG_METADATA": "vdk_step_name",
204+
"VDK_STRUCTLOG_FORMAT": log_format,
205205
},
206206
):
207207
logs = _run_job_and_get_logs()
@@ -212,8 +212,8 @@ def test_step_name_step_type(log_format):
212212
with mock.patch.dict(
213213
os.environ,
214214
{
215-
"VDK_LOGGING_METADATA": "vdk_step_type",
216-
"VDK_LOGGING_FORMAT": log_format,
215+
"VDK_STRUCTLOG_METADATA": "vdk_step_type",
216+
"VDK_STRUCTLOG_FORMAT": log_format,
217217
},
218218
):
219219
logs = _run_job_and_get_logs()

0 commit comments

Comments
 (0)