Skip to content

Commit 411d953

Browse files
always report optimized config as numbers
1 parent a50c699 commit 411d953

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

superstream-clients/src/main/java/ai/superstream/core/SuperstreamManager.java

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,26 @@ public boolean optimizeProducer(String bootstrapServers, String clientId, Proper
169169
// If not present in current props, fall back to original value (may be null as well)
170170
finalVal = originalProperties.get(key);
171171
}
172-
optimizedProperties.put(key, finalVal);
172+
if (finalVal != null) {
173+
// Convert numeric strings to actual numbers for reporting
174+
if (finalVal instanceof String) {
175+
String strVal = ((String) finalVal).trim();
176+
try {
177+
if (!strVal.isEmpty()) {
178+
// Prefer Integer when within range, otherwise Long
179+
long longVal = Long.parseLong(strVal);
180+
if (longVal >= Integer.MIN_VALUE && longVal <= Integer.MAX_VALUE) {
181+
finalVal = (int) longVal;
182+
} else {
183+
finalVal = longVal;
184+
}
185+
}
186+
} catch (NumberFormatException ignored) {
187+
// leave as String if not purely numeric
188+
}
189+
}
190+
optimizedProperties.put(key, finalVal);
191+
}
173192
}
174193

175194
// If the application is latency-sensitive we leave linger.ms untouched. Ensure we still report its value

0 commit comments

Comments
 (0)