-
Notifications
You must be signed in to change notification settings - Fork 144
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
[ASM] Update Iast Log Warning to Error #6492
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 229704 Passed, 2078 Skipped, 18h 52m 19.21s Total Time |
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing the following branches/commits: Execution-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 shown 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). gantt
title Execution time (ms) FakeDbCommand (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6492) - mean (68ms) : 65, 71
. : milestone, 68,
master - mean (68ms) : 66, 71
. : milestone, 68,
section CallTarget+Inlining+NGEN
This PR (6492) - mean (981ms) : 958, 1004
. : milestone, 981,
master - mean (980ms) : 955, 1006
. : milestone, 980,
gantt
title Execution time (ms) FakeDbCommand (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6492) - mean (107ms) : 105, 110
. : milestone, 107,
master - mean (107ms) : 105, 109
. : milestone, 107,
section CallTarget+Inlining+NGEN
This PR (6492) - mean (674ms) : 662, 687
. : milestone, 674,
master - mean (677ms) : 664, 689
. : milestone, 677,
gantt
title Execution time (ms) FakeDbCommand (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6492) - mean (91ms) : 89, 93
. : milestone, 91,
master - mean (91ms) : 89, 93
. : milestone, 91,
section CallTarget+Inlining+NGEN
This PR (6492) - mean (627ms) : 613, 642
. : milestone, 627,
master - mean (630ms) : 611, 649
. : milestone, 630,
gantt
title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6492) - mean (194ms) : 189, 199
. : milestone, 194,
master - mean (194ms) : 189, 199
. : milestone, 194,
section CallTarget+Inlining+NGEN
This PR (6492) - mean (1,097ms) : 1072, 1122
. : milestone, 1097,
master - mean (1,100ms) : 1078, 1122
. : milestone, 1100,
gantt
title Execution time (ms) HttpMessageHandler (.NET Core 3.1)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6492) - mean (279ms) : 275, 284
. : milestone, 279,
master - mean (279ms) : 274, 284
. : milestone, 279,
section CallTarget+Inlining+NGEN
This PR (6492) - mean (868ms) : 849, 887
. : milestone, 868,
master - mean (872ms) : 843, 900
. : milestone, 872,
gantt
title Execution time (ms) HttpMessageHandler (.NET 6)
dateFormat X
axisFormat %s
todayMarker off
section Baseline
This PR (6492) - mean (268ms) : 264, 272
. : milestone, 268,
master - mean (268ms) : 263, 273
. : milestone, 268,
section CallTarget+Inlining+NGEN
This PR (6492) - mean (843ms) : 811, 875
. : milestone, 843,
master - mean (850ms) : 823, 878
. : milestone, 850,
|
Benchmarks Report for appsec 🐌Benchmarks for #6492 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.Asm.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecEncoderBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Asm.AppSecWafBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Iast.StringAspectsBenchmark - Slower
|
Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 1.863 | 312,300.00 | 581,900.00 |
Benchmark | Base Allocated | Diff Allocated | Change | Change % |
---|---|---|---|---|
Benchmarks.Trace.Iast.StringAspectsBenchmark.StringConcatAspectBenchmark‑net6.0 | 255.54 KB | 326.51 KB | 70.97 KB | 27.77% |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StringConcatBenchmark |
net6.0 | 61μs | 721ns | 7.21μs | 0 | 0 | 0 | 43.44 KB |
master | StringConcatBenchmark |
netcoreapp3.1 | 62.1μs | 1.01μs | 10.1μs | 0 | 0 | 0 | 42.64 KB |
master | StringConcatBenchmark |
net472 | 38.1μs | 141ns | 528ns | 0 | 0 | 0 | 59.07 KB |
master | StringConcatAspectBenchmark |
net6.0 | 313μs | 1.37μs | 6.45μs | 0 | 0 | 0 | 255.54 KB |
master | StringConcatAspectBenchmark |
netcoreapp3.1 | 340μs | 1.74μs | 9.99μs | 0 | 0 | 0 | 254.06 KB |
master | StringConcatAspectBenchmark |
net472 | 291μs | 6.87μs | 68μs | 0 | 0 | 0 | 278.53 KB |
#6492 | StringConcatBenchmark |
net6.0 | 60.7μs | 749ns | 7.41μs | 0 | 0 | 0 | 43.44 KB |
#6492 | StringConcatBenchmark |
netcoreapp3.1 | 62.8μs | 892ns | 8.79μs | 0 | 0 | 0 | 42.64 KB |
#6492 | StringConcatBenchmark |
net472 | 37.5μs | 90.3ns | 326ns | 0 | 0 | 0 | 59.12 KB |
#6492 | StringConcatAspectBenchmark |
net6.0 | 594μs | 3.3μs | 21.9μs | 0 | 0 | 0 | 326.51 KB |
#6492 | StringConcatAspectBenchmark |
netcoreapp3.1 | 341μs | 1.52μs | 8.73μs | 0 | 0 | 0 | 253.23 KB |
#6492 | StringConcatAspectBenchmark |
net472 | 289μs | 6.84μs | 66.3μs | 0 | 0 | 0 | 278.53 KB |
Benchmarks Report for tracer 🐌Benchmarks for #6492 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.ActivityBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Faster 🎉 Same allocations ✔️
|
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.ILoggerBenchmark.EnrichedLog‑net6.0 | 1.147 | 1,644.01 | 1,433.61 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 1.64μs | 0.686ns | 2.57ns | 0.0227 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
netcoreapp3.1 | 2.17μs | 1.9ns | 7.1ns | 0.0218 | 0 | 0 | 1.64 KB |
master | EnrichedLog |
net472 | 2.78μs | 2.18ns | 8.16ns | 0.249 | 0 | 0 | 1.57 KB |
#6492 | EnrichedLog |
net6.0 | 1.43μs | 0.683ns | 2.56ns | 0.0232 | 0 | 0 | 1.64 KB |
#6492 | EnrichedLog |
netcoreapp3.1 | 2.27μs | 1.68ns | 6.49ns | 0.0222 | 0 | 0 | 1.64 KB |
#6492 | EnrichedLog |
net472 | 2.68μs | 1.39ns | 5.39ns | 0.249 | 0 | 0 | 1.57 KB |
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 118μs | 153ns | 591ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
netcoreapp3.1 | 122μs | 207ns | 801ns | 0 | 0 | 0 | 4.28 KB |
master | EnrichedLog |
net472 | 151μs | 206ns | 772ns | 0.673 | 0.224 | 0 | 4.46 KB |
#6492 | EnrichedLog |
net6.0 | 119μs | 110ns | 425ns | 0.0604 | 0 | 0 | 4.28 KB |
#6492 | EnrichedLog |
netcoreapp3.1 | 121μs | 162ns | 605ns | 0 | 0 | 0 | 4.28 KB |
#6492 | EnrichedLog |
net472 | 154μs | 135ns | 523ns | 0.688 | 0.229 | 0 | 4.46 KB |
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 3.04μs | 1.09ns | 4.21ns | 0.0304 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
netcoreapp3.1 | 4.26μs | 1.1ns | 4.25ns | 0.0298 | 0 | 0 | 2.2 KB |
master | EnrichedLog |
net472 | 4.85μs | 1.37ns | 5.31ns | 0.321 | 0 | 0 | 2.02 KB |
#6492 | EnrichedLog |
net6.0 | 3.07μs | 1.25ns | 4.7ns | 0.0315 | 0 | 0 | 2.2 KB |
#6492 | EnrichedLog |
netcoreapp3.1 | 4.17μs | 1.11ns | 4.02ns | 0.0294 | 0 | 0 | 2.2 KB |
#6492 | EnrichedLog |
net472 | 4.77μs | 0.734ns | 2.84ns | 0.321 | 0 | 0 | 2.02 KB |
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | SendReceive |
net6.0 | 1.44μs | 0.712ns | 2.76ns | 0.0158 | 0 | 0 | 1.14 KB |
master | SendReceive |
netcoreapp3.1 | 1.83μs | 0.892ns | 3.34ns | 0.0156 | 0 | 0 | 1.14 KB |
master | SendReceive |
net472 | 2.11μs | 1.34ns | 5.17ns | 0.183 | 0 | 0 | 1.16 KB |
#6492 | SendReceive |
net6.0 | 1.41μs | 0.435ns | 1.63ns | 0.0163 | 0 | 0 | 1.14 KB |
#6492 | SendReceive |
netcoreapp3.1 | 1.8μs | 0.58ns | 2.25ns | 0.0154 | 0 | 0 | 1.14 KB |
#6492 | SendReceive |
net472 | 2.19μs | 1.41ns | 5.27ns | 0.183 | 0 | 0 | 1.16 KB |
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | EnrichedLog |
net6.0 | 2.72μs | 0.53ns | 2.05ns | 0.0218 | 0 | 0 | 1.6 KB |
master | EnrichedLog |
netcoreapp3.1 | 3.93μs | 2.1ns | 7.27ns | 0.0216 | 0 | 0 | 1.65 KB |
master | EnrichedLog |
net472 | 4.28μs | 4.16ns | 16.1ns | 0.322 | 0 | 0 | 2.04 KB |
#6492 | EnrichedLog |
net6.0 | 2.63μs | 1.75ns | 6.79ns | 0.0223 | 0 | 0 | 1.6 KB |
#6492 | EnrichedLog |
netcoreapp3.1 | 3.76μs | 10.9ns | 42.3ns | 0.0224 | 0 | 0 | 1.65 KB |
#6492 | EnrichedLog |
net472 | 4.39μs | 2.53ns | 9.47ns | 0.322 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Faster 🎉 Same allocations ✔️
Faster 🎉 in #6492
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
1.174
654.22
557.11
Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
---|---|---|---|---|
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.174 | 654.22 | 557.11 |
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | StartFinishSpan |
net6.0 | 406ns | 0.224ns | 0.838ns | 0.00795 | 0 | 0 | 576 B |
master | StartFinishSpan |
netcoreapp3.1 | 654ns | 0.336ns | 1.3ns | 0.0075 | 0 | 0 | 576 B |
master | StartFinishSpan |
net472 | 689ns | 0.494ns | 1.91ns | 0.0917 | 0 | 0 | 578 B |
master | StartFinishScope |
net6.0 | 566ns | 0.376ns | 1.46ns | 0.00984 | 0 | 0 | 696 B |
master | StartFinishScope |
netcoreapp3.1 | 723ns | 0.611ns | 2.37ns | 0.00911 | 0 | 0 | 696 B |
master | StartFinishScope |
net472 | 884ns | 0.963ns | 3.73ns | 0.105 | 0 | 0 | 658 B |
#6492 | StartFinishSpan |
net6.0 | 401ns | 0.306ns | 1.18ns | 0.00803 | 0 | 0 | 576 B |
#6492 | StartFinishSpan |
netcoreapp3.1 | 557ns | 0.478ns | 1.79ns | 0.00784 | 0 | 0 | 576 B |
#6492 | StartFinishSpan |
net472 | 690ns | 0.332ns | 1.28ns | 0.0916 | 0 | 0 | 578 B |
#6492 | StartFinishScope |
net6.0 | 562ns | 0.357ns | 1.38ns | 0.00982 | 0 | 0 | 696 B |
#6492 | StartFinishScope |
netcoreapp3.1 | 698ns | 2.01ns | 7.79ns | 0.0095 | 0 | 0 | 696 B |
#6492 | StartFinishScope |
net472 | 858ns | 0.632ns | 2.45ns | 0.104 | 0 | 0 | 658 B |
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
---|---|---|---|---|---|---|---|---|---|
master | RunOnMethodBegin |
net6.0 | 672ns | 0.465ns | 1.8ns | 0.00975 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
netcoreapp3.1 | 902ns | 0.54ns | 2.02ns | 0.00961 | 0 | 0 | 696 B |
master | RunOnMethodBegin |
net472 | 1.14μs | 0.507ns | 1.96ns | 0.104 | 0 | 0 | 658 B |
#6492 | RunOnMethodBegin |
net6.0 | 700ns | 0.431ns | 1.61ns | 0.00954 | 0 | 0 | 696 B |
#6492 | RunOnMethodBegin |
netcoreapp3.1 | 903ns | 0.698ns | 2.7ns | 0.0095 | 0 | 0 | 696 B |
#6492 | RunOnMethodBegin |
net472 | 1.05μs | 0.456ns | 1.71ns | 0.104 | 0 | 0 | 658 B |
@@ -53,7 +53,7 @@ public class MongoDatabaseAspect | |||
} | |||
catch (global::System.Exception ex) | |||
{ | |||
IastModule.Log.Warning(ex, $"Error invoking {nameof(MongoDatabaseAspect)}.{nameof(AnalyzeCommand)}"); | |||
IastModule.Log.Error(ex, $"Error invoking {nameof(MongoDatabaseAspect)}.{nameof(AnalyzeCommand)}"); |
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'd rather add a LogAspectException
function in the IastModule
and call it, so if we want to change the functionality in the future we will only have to touch that function instead of all call sites
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.
Also, it can ensure no Error flooding happens, sending only one of each
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.
Good idea, I'll do it in another PR 😄
Summary of changes
Change
Iast.Log.Warning(..)
to.Error(..)
in try catch blocks of Aspects.Reason for change
Improve error logging. These errors could be shown in the Error Tracking telemetry.