Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NH-29380 Remove unused enable_sanitize_sql config #164

Merged
merged 7 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Removed
- Removed unused log_trace_id config storage ([#163](https://github.com/solarwindscloud/solarwinds-apm-python/pull/163))
- Removed unused enable_sanitize_sql config storage ([#164](https://github.com/solarwindscloud/solarwinds-apm-python/pull/164))
- Removed unused is_grpc_clean_hack_enabled config storage ([#165](https://github.com/solarwindscloud/solarwinds-apm-python/pull/165))

## [0.12.0](https://github.com/solarwindscloud/solarwinds-apm-python/releases/tag/rel-0.12.0) - 2023-06-01
### Changed
Expand Down
7 changes: 0 additions & 7 deletions solarwinds_apm/apm_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ def __init__(
"bufsize": -1,
"histogram_precision": -1,
"reporter_file_single": 0,
"enable_sanitize_sql": True,
"proxy": "",
"is_grpc_clean_hack_enabled": False,
"transaction_filters": [],
}
self.agent_enabled = True
Expand Down Expand Up @@ -445,9 +443,6 @@ def __setitem__(self, key: str, value: str) -> None:
"""Refresh the configurations in liboboe global struct while user changes settings."""
if key == "tracing_mode":
self._set_config_value(key, value)

elif key in {"enable_sanitize_sql", "warn_deprecated"}:
self._set_config_value(key, value)
else:
logger.warning(
"Unsupported SolarWinds APM config key: %s",
Expand Down Expand Up @@ -708,8 +703,6 @@ def _convert_to_bool(val):
self.__config[key] = val
# update logging level of agent logger
apm_logging.set_sw_log_level(val)
elif keys == ["is_grpc_clean_hack_enabled"]:
self.__config[key] = _convert_to_bool(val)
elif isinstance(sub_dict, dict) and keys[-1] in sub_dict:
if isinstance(sub_dict[keys[-1]], bool):
val = _convert_to_bool(val)
Expand Down
4 changes: 0 additions & 4 deletions tests/unit/test_apm_config/fixtures/cnf_dict.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,8 @@ def fixture_cnf_dict():
"bufsize": 2,
"histogramPrecision": 2,
"reporterFileSingle": 2,
"enableSanitizeSql": True,
"logTraceId": "always",
"proxy": "http://foo-bar",
"isGrpcCleanHackEnabled": True,
}

@pytest.fixture
Expand All @@ -54,8 +52,6 @@ def fixture_cnf_dict_enabled_false():
"bufsize": 2,
"histogramPrecision": 2,
"reporterFileSingle": 2,
"enableSanitizeSql": True,
"logTraceId": "always",
"proxy": "http://foo-bar",
"isGrpcCleanHackEnabled": True,
}
14 changes: 0 additions & 14 deletions tests/unit/test_apm_config/test_apm_config_cnf_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,7 @@ def test_update_with_cnf_file_all_valid(
assert resulting_config.get("bufsize") == 2
assert resulting_config.get("histogram_precision") == 2
assert resulting_config.get("reporter_file_single") == 2
assert resulting_config.get("enable_sanitize_sql") == True
assert resulting_config.get("proxy") == "http://foo-bar"
assert resulting_config.get("is_grpc_clean_hack_enabled") == True

# update_transaction_filters was called
mock_update_txn_filters.assert_called_once_with(fixture_cnf_dict)
Expand Down Expand Up @@ -177,9 +175,7 @@ def test_update_with_cnf_file_mostly_invalid(
"bufsize": "foo",
"histogramPrecision": "foo",
"reporterFileSingle": "foo",
"enableSanitizeSql": "foo",
"proxy": "foo",
"isGrpcCleanHackEnabled": "foo",
}
mock_get_cnf_dict = mocker.patch(
"solarwinds_apm.apm_config.SolarWindsApmConfig.get_cnf_dict"
Expand Down Expand Up @@ -209,9 +205,7 @@ def test_update_with_cnf_file_mostly_invalid(
assert resulting_config.get("bufsize") == -1
assert resulting_config.get("histogram_precision") == -1
assert resulting_config.get("reporter_file_single") == 0
assert resulting_config.get("enable_sanitize_sql") == True
assert resulting_config.get("proxy") == ""
assert resulting_config.get("is_grpc_clean_hack_enabled") == False
# Meanwhile these are pretty open
assert resulting_config.get("collector") == "False"
assert resulting_config.get("hostname_alias") == "False"
Expand Down Expand Up @@ -257,9 +251,7 @@ def test_update_with_cnf_file_and_all_validenv_vars(
"SW_APM_BUFSIZE": "3",
"SW_APM_HISTOGRAM_PRECISION": "3",
"SW_APM_REPORTER_FILE_SINGLE": "3",
"SW_APM_ENABLE_SANITIZE_SQL": "false",
"SW_APM_PROXY": "http://other-foo-bar",
"SW_APM_IS_GRPC_CLEAN_HACK_ENABLED": "false",
})
mock_update_txn_filters = mocker.patch(
"solarwinds_apm.apm_config.SolarWindsApmConfig.update_transaction_filters"
Expand Down Expand Up @@ -298,9 +290,7 @@ def test_update_with_cnf_file_and_all_validenv_vars(
assert resulting_config.get("bufsize") == 3
assert resulting_config.get("histogram_precision") == 3
assert resulting_config.get("reporter_file_single") == 3
assert resulting_config.get("enable_sanitize_sql") == False
assert resulting_config.get("proxy") == "http://other-foo-bar"
assert resulting_config.get("is_grpc_clean_hack_enabled") == False

# Restore old collector
if old_collector:
Expand Down Expand Up @@ -339,9 +329,7 @@ def test_update_with_cnf_file_and_several_invalid_env_vars(
"SW_APM_BUFSIZE": "other-foo-bar",
"SW_APM_HISTOGRAM_PRECISION": "other-foo-bar",
"SW_APM_REPORTER_FILE_SINGLE": "other-foo-bar",
"SW_APM_ENABLE_SANITIZE_SQL": "other-foo-bar",
"SW_APM_PROXY": "other-foo-bar",
"SW_APM_IS_GRPC_CLEAN_HACK_ENABLED": "other-foo-bar",
})
mock_update_txn_filters = mocker.patch(
"solarwinds_apm.apm_config.SolarWindsApmConfig.update_transaction_filters"
Expand Down Expand Up @@ -377,9 +365,7 @@ def test_update_with_cnf_file_and_several_invalid_env_vars(
assert resulting_config.get("bufsize") == 2
assert resulting_config.get("histogram_precision") == 2
assert resulting_config.get("reporter_file_single") == 2
assert resulting_config.get("enable_sanitize_sql") == True
assert resulting_config.get("proxy") == "http://foo-bar"
assert resulting_config.get("is_grpc_clean_hack_enabled") == True

# These are still valid, so env_var > cnf_file
assert resulting_config.get("collector") == "False"
Expand Down