This repository was archived by the owner on Nov 24, 2021. It is now read-only.

Description
When using the HttpAppender adding a non-string value to the MDC can cause the app to hang.
The error:
Exception in thread "HTTP appender dispatcher" java.lang.RuntimeException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at io.phdata.pulse.log.HttpAppender$Dispatcher.flush(HttpAppender.java:357)
at io.phdata.pulse.log.HttpAppender$Dispatcher.run(HttpAppender.java:341)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
at io.phdata.pulse.log.JsonParser.marshallEventInternal(JsonParser.java:68)
at io.phdata.pulse.log.JsonParser.marshallArray(JsonParser.java:24)
at io.phdata.pulse.log.HttpAppender$Dispatcher.flush(HttpAppender.java:355)
The location:
for (Map.Entry<String, String> entry : props) {
jg.writeStringField(entry.getKey(), entry.getValue());
}
I think the easy fix is to just call toString on the entry.getValue(), I don't see any downsides to this.