ApplicationInsights-Java
ApplicationInsights-Java copied to clipboard
Fix log sampling overrides by running preview processors before filtering
Summary
- Add a smoke test (
TelemetryProcessorLogFilterSamplingOverridesTest) that reproduces issue #4526 by exercising sampling overrides based on attributes derived by preview processors. - Adjust the log filtering pipeline so
AzureMonitorLogFilteringProcessorapplies preview attribute/log processors before executing severity filtering and sampling overrides, ensuring those overrides see the processed attributes.
Root Cause
- PR #4130 introduced
AzureMonitorLogFilteringProcessor, moving severity filtering and sampling overrides fromAgentLogExporterto a processor that now runs ahead of preview attribute and log processors. - Because these preview processors still wrap only the exporter, overrides that relied on attributes they extract (e.g., regex-based fields) were evaluated against unprocessed log records, causing the regression described in issue #4526.
Fix Details
- Apply preview attribute and log processors inside
AzureMonitorLogFilteringProcessorbefore sampling decisions so overrides can match on transformed attributes. - Thread the processor configs from
SecondEntryPointinto the filtering processor to maintain the prior processing order.