Skip to content

Commit dc4dea9

Browse files
committed
[SPARK-57943] MetricsSystem should not expose sink property values
### What changes were proposed in this pull request? This PR aims to prevent metrics sink properties from being logged in `MetricsSystem`. - `registerSinks()` logs only the sink names instead of the entire `sinkPropertiesMap`. - The error log on sink creation failure reports only the sink class name, not the properties. ### Why are the changes needed? Sink properties can contain sensitive values such as credentials, which should not be leaked into operator logs. ### Does this PR introduce _any_ user-facing change? No, except the log messages. ### How was this patch tested? Pass the CIs. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Claude Fable 5 Closes #745 from dongjoon-hyun/SPARK-57943. Authored-by: Dongjoon Hyun <dongjoon@apache.org> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent 73097e3 commit dc4dea9

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

spark-operator/src/main/java/org/apache/spark/k8s/operator/metrics/MetricsSystem.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ protected void registerDefaultSources() {
110110
* via reflection.
111111
*/
112112
protected void registerSinks() {
113-
log.info("sinkPropertiesMap: {}", sinkPropertiesMap);
113+
log.info("Configured metrics sinks: {}", sinkPropertiesMap.keySet());
114114
sinkPropertiesMap
115115
.values()
116116
.forEach(
@@ -130,12 +130,7 @@ protected void registerSinks() {
130130
| NoSuchMethodException
131131
| SecurityException
132132
| ClassNotFoundException e) {
133-
if (log.isErrorEnabled()) {
134-
log.error(
135-
"Fail to create metrics sink for sink name {}, sink properties {}",
136-
sinkProp.getClassName(),
137-
sinkProp.getProperties());
138-
}
133+
log.error("Fail to create metrics sink for sink class {}", sinkProp.getClassName());
139134
throw new IllegalStateException("Fail to create metrics sink", e);
140135
}
141136
});

0 commit comments

Comments
 (0)