-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Describe the bug
For reference: #14959
This PR was released in the newest version. I noticed that the check for instanceof in isLogstashStructuredArgument may not be targeting the correct class, and so MapEntriesAppendingMarker instances will not pass the check. There is logic further down the line that attempts to handle it, but the code will fail this first check.
@NoMuzzle
private static boolean isLogstashStructuredArgument(Object argument) {
return argument instanceof SingleFieldAppendingMarker;
}
MapEntriesAppendingMarker is not extending/implementing SingleFieldAppendingMarker
public class MapEntriesAppendingMarker extends LogstashMarker implements StructuredArgument {
public abstract class SingleFieldAppendingMarker extends LogstashMarker implements StructuredArgument {
Steps to reproduce
Create a log using StructuredArguments.entries:
Map<String, Object> eventData = new HashMap<>();
eventData.put("functionName", "LoggerController.logCustomEvent");
log.info("STRUCTURED ARGS 2: Logging mock object:", StructuredArguments.entries(eventData));
Expected behavior
Resulting log should include the Map entries in the record.
Actual behavior
The resulting log is completely missing any data from entries.
The actual result in fluentbit:
[8] v1_logs: [[1763049975.678229241, {"otlp"=>{"observed_timestamp"=>1763049975409049851, "timestamp"=>1763049975408948976, "severity_number"=>9, "severity_text"=>"INFO", "trace_id"=>"\xfb\x9e\x11\xf95%\xdd\xa8dx!q\xb1\x8f^\xee", "span_id"=>"\x01\x1e\x0c\x83G\xc0n|", "trace_flags"=>1}}], {"log"=>"STRUCTURED ARGS 2: Logging mock object:"}]
Javaagent or library instrumentation version
2.21.0
Environment
JDK: openJDK 21
OS: macOS 15.7.1 (24G231)
Spring Boot: 3.5.5
Additional context
No response
Tip
React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.