Menu

Post image 1
Post image 2
1 / 2
0

Why Quarkus MDC numeric fields silently break OpenSearch queries — and how to fix it

DEV Community·Zahan Turel·22 days ago
#zONHh7gH
#fix#java#quarkus#fullscreen#field#string
Reading 0:00
15s threshold

If you're running Quarkus with JSON logging and shipping to OpenSearch, there's a non-obvious bug waiting for you: every numeric field you put in MDC arrives in OpenSearch as a string. This means queries like durationMs > 1000 silently return nothing. No error. No warning. Just wrong results. Here's why it happens and two ways to fix it. The problem Quarkus uses JBoss Log Manager under the hood. When you set MDC values: MDC . put ( "durationMs" , String . valueOf ( duration )); MDC . put ( "fundsProcessed" , String . valueOf ( count )); Enter fullscreen mode Exit fullscreen mode The SLF4J MDC API only accepts String . So even if your value is numeric, it's a string from the moment it enters MDC.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More