-
Notifications
You must be signed in to change notification settings - Fork 149
Support custom LogEventPropertyValue values in direct log submission
#8034
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bouwkast
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice thanks!
This comment has been minimized.
This comment has been minimized.
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (8034) and master. ✅ No regressions detected - check the details below Full Metrics ComparisonFakeDbCommand
HttpMessageHandler
Comparison explanationExecution-time benchmarks measure the whole time it takes to execute a program, and are intended to measure the one-off costs. Cases where the execution time results for the PR are worse than latest master results are highlighted in **red**. The following thresholds were used for comparing the execution times:
Note that these results are based on a single point-in-time result for each branch. For full results, see the dashboard. Graphs show the p99 interval based on the mean and StdDev of the test run, as well as the mean value of the run (shown as a diamond below the graph). Duration chartsFakeDbCommand (.NET Framework 4.8)gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (68ms) : 67, 70
master - mean (68ms) : 67, 70
section Bailout
This PR (8034) - mean (72ms) : 71, 73
master - mean (72ms) : 71, 73
section CallTarget+Inlining+NGEN
This PR (8034) - mean (1,007ms) : 959, 1056
master - mean (1,011ms) : 951, 1071
FakeDbCommand (.NET Core 3.1)gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (106ms) : 103, 108
master - mean (105ms) : 103, 108
section Bailout
This PR (8034) - mean (106ms) : 105, 108
master - mean (106ms) : 105, 108
section CallTarget+Inlining+NGEN
This PR (8034) - mean (738ms) : 678, 797
master - mean (733ms) : 672, 793
FakeDbCommand (.NET 6)gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (94ms) : 92, 96
master - mean (94ms) : 92, 96
section Bailout
This PR (8034) - mean (94ms) : 93, 95
master - mean (94ms) : 93, 95
section CallTarget+Inlining+NGEN
This PR (8034) - mean (710ms) : 677, 743
master - mean (710ms) : 676, 743
FakeDbCommand (.NET 8)gantt
title Execution time (ms) FakeDbCommand (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (92ms) : 89, 94
master - mean (92ms) : 90, 94
section Bailout
This PR (8034) - mean (93ms) : 92, 94
master - mean (93ms) : 92, 94
section CallTarget+Inlining+NGEN
This PR (8034) - mean (628ms) : 616, 641
master - mean (633ms) : 618, 648
HttpMessageHandler (.NET Framework 4.8)gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (193ms) : 190, 195
master - mean (193ms) : 189, 197
section Bailout
This PR (8034) - mean (198ms) : 194, 201
master - mean (196ms) : 194, 198
section CallTarget+Inlining+NGEN
This PR (8034) - mean (1,121ms) : 1051, 1192
master - mean (1,121ms) : 1048, 1194
HttpMessageHandler (.NET Core 3.1)gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (277ms) : 272, 283
master - mean (276ms) : 271, 282
section Bailout
This PR (8034) - mean (277ms) : 273, 281
master - mean (276ms) : 273, 279
section CallTarget+Inlining+NGEN
This PR (8034) - mean (923ms) : 872, 974
master - mean (923ms) : 874, 973
HttpMessageHandler (.NET 6)gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (270ms) : 265, 275
master - mean (270ms) : 266, 274
section Bailout
This PR (8034) - mean (269ms) : 266, 272
master - mean (270ms) : 266, 273
section CallTarget+Inlining+NGEN
This PR (8034) - mean (923ms) : 880, 966
master - mean (923ms) : 870, 976
HttpMessageHandler (.NET 8)gantt
title Execution time (ms) HttpMessageHandler (.NET 8)
dateFormat x
axisFormat %Q
todayMarker off
section Baseline
This PR (8034) - mean (269ms) : 263, 274
master - mean (270ms) : 262, 278
section Bailout
This PR (8034) - mean (270ms) : 265, 274
master - mean (269ms) : 265, 273
section CallTarget+Inlining+NGEN
This PR (8034) - mean (825ms) : 809, 842
master - mean (822ms) : 803, 841
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // This is likely an edge case, so we just write the value as a string and then embed that in the JSON | ||
| var sb = StringBuilderCache.Acquire(); | ||
| var stringWriter = new StringWriter(sb); | ||
| propertyValue.Render(stringWriter, null, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Render() launches an exception, we should probably catch it, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually an interesting one - currently we don't catch exceptions anywhere in here they bubble up and will cause a whole batch to be dropped. It seems like it would make sense to catch exceptions at the log level? 🤔 i.e. if we get an exception anywhere in the serialization, we should drop that log, but not the whole batch. Does that make sense to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a try-catch at a higher level (where we call the top-level Format method, inside the direct log submission sink. That way we will catch any errors coming from formatter methods (there are multiple implementations, so I think it's better to be high-level here). That single log will then be dropped, but the overall batch isn't which seems preferable
BenchmarksBenchmark execution time: 2026-01-08 10:39:01 Comparing candidate commit b6e2f57 in PR branch Found 9 performance improvements and 14 performance regressions! Performance is the same for 150 metrics, 13 unstable metrics. scenario:Benchmarks.Trace.ActivityBenchmark.StartStopWithChild netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody net472
scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.ObjectExtractorSimpleBody netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs netcoreapp3.1
scenario:Benchmarks.Trace.Asm.AppSecWafBenchmark.RunWafRealisticBenchmarkWithAttack netcoreapp3.1
scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net472
scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1
scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSliceWithPool net6.0
scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync netcoreapp3.1
scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark netcoreapp3.1
scenario:Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatBenchmark netcoreapp3.1
scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1
scenario:Benchmarks.Trace.RedisBenchmark.SendReceive netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope net6.0
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishScope netcoreapp3.1
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishSpan net6.0
scenario:Benchmarks.Trace.SpanBenchmark.StartFinishTwoScopes netcoreapp3.1
|
Summary of changes
Handle the case where a customer is using a custom
LogEventPropertyValueimplementation and direct log submissionReason for change
#8010 handled a case where we were generating invalid JSON by dropping the offending value. This PR adds support for serializing the value as a string instead.
Implementation details
Ducktyped
LogEventPropertyValueand called itsRendermethod with a cachedStringBuilderto get the value, then use the same mechanismsTest coverage
Should be covered by the tests added in #8010
Other details