ApplicationInsights-Java icon indicating copy to clipboard operation
ApplicationInsights-Java copied to clipboard

Fix log sampling overrides by running preview processors before filtering

Open trask opened this issue 2 months ago • 0 comments

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 AzureMonitorLogFilteringProcessor applies 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 from AgentLogExporter to 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 AzureMonitorLogFilteringProcessor before sampling decisions so overrides can match on transformed attributes.
  • Thread the processor configs from SecondEntryPoint into the filtering processor to maintain the prior processing order.

trask avatar Oct 29 '25 18:10 trask