[serverless] No-op AWS Lambda integration on missing API Key#5900
Conversation
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). |
Datadog ReportBranch report: ✅ 0 Failed, 350893 Passed, 1782 Skipped, 14h 38m 33.94s Total Time |
Benchmarks Report for tracer 🐌Benchmarks for #5900 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 - Faster 🎉 Same allocations ✔️
|
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearchAsync‑net6.0 | 1.833 | 2,208.71 | 1,205.04 | several? |
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑net6.0 | 1.770 | 2,192.63 | 1,238.51 | bimodal |
| Benchmarks.Trace.ElasticsearchBenchmark.CallElasticsearch‑netcoreapp3.1 | 1.644 | 2,684.47 | 1,633.38 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | CallElasticsearch |
net6.0 | 2.22μs | 22.2ns | 222ns | 0.0131 | 0 | 0 | 976 B |
| master | CallElasticsearch |
netcoreapp3.1 | 2.68μs | 19.8ns | 197ns | 0.0133 | 0 | 0 | 976 B |
| master | CallElasticsearch |
net472 | 2.57μs | 1.93ns | 7.47ns | 0.157 | 0 | 0 | 995 B |
| master | CallElasticsearchAsync |
net6.0 | 2.23μs | 21.2ns | 212ns | 0.0128 | 0 | 0 | 952 B |
| master | CallElasticsearchAsync |
netcoreapp3.1 | 1.67μs | 1.13ns | 4.36ns | 0.0143 | 0 | 0 | 1.02 KB |
| master | CallElasticsearchAsync |
net472 | 2.53μs | 1.71ns | 6.63ns | 0.166 | 0 | 0 | 1.05 KB |
| #5900 | CallElasticsearch |
net6.0 | 1.24μs | 0.515ns | 1.93ns | 0.0133 | 0 | 0 | 976 B |
| #5900 | CallElasticsearch |
netcoreapp3.1 | 1.63μs | 0.808ns | 3.13ns | 0.0131 | 0 | 0 | 976 B |
| #5900 | CallElasticsearch |
net472 | 2.48μs | 1.71ns | 6.64ns | 0.157 | 0 | 0 | 995 B |
| #5900 | CallElasticsearchAsync |
net6.0 | 1.2μs | 0.666ns | 2.49ns | 0.0133 | 0 | 0 | 952 B |
| #5900 | CallElasticsearchAsync |
netcoreapp3.1 | 1.72μs | 0.685ns | 2.56ns | 0.0137 | 0 | 0 | 1.02 KB |
| #5900 | CallElasticsearchAsync |
net472 | 2.63μs | 0.891ns | 3.33ns | 0.166 | 0 | 0 | 1.05 KB |
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | ExecuteAsync |
net6.0 | 1.26μs | 0.757ns | 2.73ns | 0.0133 | 0 | 0 | 952 B |
| master | ExecuteAsync |
netcoreapp3.1 | 1.63μs | 0.963ns | 3.6ns | 0.0123 | 0 | 0 | 952 B |
| master | ExecuteAsync |
net472 | 1.77μs | 0.685ns | 2.65ns | 0.145 | 0 | 0 | 915 B |
| #5900 | ExecuteAsync |
net6.0 | 1.26μs | 0.609ns | 2.36ns | 0.0133 | 0 | 0 | 952 B |
| #5900 | ExecuteAsync |
netcoreapp3.1 | 1.7μs | 1.55ns | 5.8ns | 0.0127 | 0 | 0 | 952 B |
| #5900 | ExecuteAsync |
net472 | 1.7μs | 1.61ns | 6.22ns | 0.145 | 0 | 0 | 915 B |
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | SendAsync |
net6.0 | 4.18μs | 2.31ns | 8.33ns | 0.0312 | 0 | 0 | 2.22 KB |
| master | SendAsync |
netcoreapp3.1 | 5.07μs | 2.67ns | 10.3ns | 0.0354 | 0 | 0 | 2.76 KB |
| master | SendAsync |
net472 | 7.75μs | 3.09ns | 11.6ns | 0.497 | 0 | 0 | 3.15 KB |
| #5900 | SendAsync |
net6.0 | 4.24μs | 2.31ns | 8.94ns | 0.0299 | 0 | 0 | 2.22 KB |
| #5900 | SendAsync |
netcoreapp3.1 | 5.05μs | 3.41ns | 13.2ns | 0.0354 | 0 | 0 | 2.76 KB |
| #5900 | SendAsync |
net472 | 7.85μs | 2.69ns | 10.4ns | 0.498 | 0 | 0 | 3.15 KB |
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | EnrichedLog |
net6.0 | 1.49μs | 0.756ns | 2.83ns | 0.0228 | 0 | 0 | 1.64 KB |
| master | EnrichedLog |
netcoreapp3.1 | 2.16μs | 1.76ns | 6.81ns | 0.0216 | 0 | 0 | 1.64 KB |
| master | EnrichedLog |
net472 | 2.69μs | 1.91ns | 6.6ns | 0.249 | 0 | 0 | 1.57 KB |
| #5900 | EnrichedLog |
net6.0 | 1.56μs | 0.711ns | 2.75ns | 0.0229 | 0 | 0 | 1.64 KB |
| #5900 | EnrichedLog |
netcoreapp3.1 | 2.18μs | 2.87ns | 10.7ns | 0.0216 | 0 | 0 | 1.64 KB |
| #5900 | EnrichedLog |
net472 | 2.68μs | 1.26ns | 4.7ns | 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 | 116μs | 180ns | 699ns | 0.058 | 0 | 0 | 4.28 KB |
| master | EnrichedLog |
netcoreapp3.1 | 120μs | 106ns | 397ns | 0 | 0 | 0 | 4.28 KB |
| master | EnrichedLog |
net472 | 151μs | 113ns | 437ns | 0.684 | 0.228 | 0 | 4.46 KB |
| #5900 | EnrichedLog |
net6.0 | 118μs | 231ns | 895ns | 0 | 0 | 0 | 4.28 KB |
| #5900 | EnrichedLog |
netcoreapp3.1 | 121μs | 211ns | 818ns | 0.0609 | 0 | 0 | 4.28 KB |
| #5900 | EnrichedLog |
net472 | 153μs | 181ns | 702ns | 0.694 | 0.231 | 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.06μs | 0.879ns | 3.29ns | 0.0306 | 0 | 0 | 2.2 KB |
| master | EnrichedLog |
netcoreapp3.1 | 4.33μs | 1.39ns | 5.4ns | 0.0281 | 0 | 0 | 2.2 KB |
| master | EnrichedLog |
net472 | 5.05μs | 1.66ns | 6.21ns | 0.319 | 0 | 0 | 2.02 KB |
| #5900 | EnrichedLog |
net6.0 | 2.97μs | 2.94ns | 11ns | 0.03 | 0 | 0 | 2.2 KB |
| #5900 | EnrichedLog |
netcoreapp3.1 | 4.23μs | 2.8ns | 10.8ns | 0.0279 | 0 | 0 | 2.2 KB |
| #5900 | EnrichedLog |
net472 | 4.88μs | 2.33ns | 9.02ns | 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.34μs | 0.682ns | 2.55ns | 0.0162 | 0 | 0 | 1.14 KB |
| master | SendReceive |
netcoreapp3.1 | 1.85μs | 0.859ns | 3.33ns | 0.0158 | 0 | 0 | 1.14 KB |
| master | SendReceive |
net472 | 2.1μs | 0.52ns | 1.88ns | 0.183 | 0 | 0 | 1.16 KB |
| #5900 | SendReceive |
net6.0 | 1.34μs | 1.05ns | 4.06ns | 0.0161 | 0 | 0 | 1.14 KB |
| #5900 | SendReceive |
netcoreapp3.1 | 1.8μs | 0.755ns | 2.93ns | 0.0149 | 0 | 0 | 1.14 KB |
| #5900 | SendReceive |
net472 | 2.08μs | 1.65ns | 5.94ns | 0.184 | 0.00106 | 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.77μs | 0.893ns | 3.22ns | 0.0222 | 0 | 0 | 1.6 KB |
| master | EnrichedLog |
netcoreapp3.1 | 3.98μs | 1.83ns | 7.11ns | 0.0219 | 0 | 0 | 1.65 KB |
| master | EnrichedLog |
net472 | 4.46μs | 2.99ns | 11.2ns | 0.322 | 0 | 0 | 2.04 KB |
| #5900 | EnrichedLog |
net6.0 | 2.61μs | 5.36ns | 20.8ns | 0.0219 | 0 | 0 | 1.6 KB |
| #5900 | EnrichedLog |
netcoreapp3.1 | 4.08μs | 2.42ns | 9.36ns | 0.0204 | 0 | 0 | 1.65 KB |
| #5900 | EnrichedLog |
net472 | 4.36μs | 1.91ns | 7.15ns | 0.324 | 0 | 0 | 2.04 KB |
Benchmarks.Trace.SpanBenchmark - Slower ⚠️ Same allocations ✔️
Slower ⚠️ in #5900
Benchmark
diff/base
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1
1.136
561.35
637.71
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472
1.130
582.32
658.06
Faster 🎉 in #5900
Benchmark
base/diff
Base Median (ns)
Diff Median (ns)
Modality
Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0
1.218
483.57
397.07
| Benchmark | diff/base | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑netcoreapp3.1 | 1.136 | 561.35 | 637.71 | |
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net472 | 1.130 | 582.32 | 658.06 |
| Benchmark | base/diff | Base Median (ns) | Diff Median (ns) | Modality |
|---|---|---|---|---|
| Benchmarks.Trace.SpanBenchmark.StartFinishSpan‑net6.0 | 1.218 | 483.57 | 397.07 |
Raw results
| Branch | Method | Toolchain | Mean | StdError | StdDev | Gen 0 | Gen 1 | Gen 2 | Allocated |
|---|---|---|---|---|---|---|---|---|---|
| master | StartFinishSpan |
net6.0 | 484ns | 0.177ns | 0.684ns | 0.00799 | 0 | 0 | 576 B |
| master | StartFinishSpan |
netcoreapp3.1 | 563ns | 0.804ns | 3.11ns | 0.00783 | 0 | 0 | 576 B |
| master | StartFinishSpan |
net472 | 583ns | 0.504ns | 1.95ns | 0.0916 | 0 | 0 | 578 B |
| master | StartFinishScope |
net6.0 | 484ns | 0.138ns | 0.533ns | 0.00977 | 0 | 0 | 696 B |
| master | StartFinishScope |
netcoreapp3.1 | 736ns | 0.692ns | 2.68ns | 0.00953 | 0 | 0 | 696 B |
| master | StartFinishScope |
net472 | 908ns | 1.49ns | 5.56ns | 0.104 | 0 | 0 | 658 B |
| #5900 | StartFinishSpan |
net6.0 | 397ns | 0.365ns | 1.41ns | 0.00819 | 0 | 0 | 576 B |
| #5900 | StartFinishSpan |
netcoreapp3.1 | 633ns | 2.45ns | 9.51ns | 0.00763 | 0 | 0 | 576 B |
| #5900 | StartFinishSpan |
net472 | 658ns | 1.19ns | 4.62ns | 0.0915 | 0 | 0 | 578 B |
| #5900 | StartFinishScope |
net6.0 | 485ns | 0.633ns | 2.45ns | 0.00976 | 0 | 0 | 696 B |
| #5900 | StartFinishScope |
netcoreapp3.1 | 707ns | 3.82ns | 20.9ns | 0.00956 | 0 | 0 | 696 B |
| #5900 | StartFinishScope |
net472 | 817ns | 1.33ns | 5.14ns | 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 | 613ns | 0.267ns | 1.04ns | 0.00984 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
netcoreapp3.1 | 896ns | 0.281ns | 1.05ns | 0.00937 | 0 | 0 | 696 B |
| master | RunOnMethodBegin |
net472 | 1.11μs | 0.768ns | 2.98ns | 0.104 | 0 | 0 | 658 B |
| #5900 | RunOnMethodBegin |
net6.0 | 582ns | 0.5ns | 1.94ns | 0.00994 | 0 | 0 | 696 B |
| #5900 | RunOnMethodBegin |
netcoreapp3.1 | 914ns | 1.17ns | 4.52ns | 0.00911 | 0 | 0 | 696 B |
| #5900 | RunOnMethodBegin |
net472 | 1.09μs | 1.53ns | 5.91ns | 0.104 | 0 | 0 | 658 B |
| /// <returns>CallTarget state value</returns> | ||
| internal static CallTargetState OnMethodBegin<TTarget>(TTarget instance, ref Delegate handler) | ||
| { | ||
| if (IsApiKeyMissing.Value) |
There was a problem hiding this comment.
Is this definitely the only place you need it? No other handlers?
There was a problem hiding this comment.
It seems like it, there's no other method which calls our delegates
… of ssh://github.com/DataDog/dd-trace-dotnet into jordan.gonzalez/SLES-1806/aws/no-op-on-missing-api-key
## Summary of changes Verifies that an API key is set in order to call the Lambda Extension. ## Reason for change It would not crash the customers, but it logs errors that should be avoided and handled better by not doing the operation. ## Implementation details Just created an API key getter in order to then check if the API is missing. ## Test coverage Tested manually on AWS Lambda. <img width="1486" alt="Screenshot 2024-08-14 at 9 00 16 PM" src="https://github.com/user-attachments/assets/7a993627-3b68-4ef1-9960-3d69890a8f56"> ## Other details <!-- Fixes #{issue} --> <!--⚠️ Note: where possible, please obtain 2 approvals prior to merging. Unless CODEOWNERS specifies otherwise, for external teams it is typically best to have one review from a team member, and one review from apm-dotnet. Trivial changes do not require 2 reviews. -->
Summary of changes
Verifies that an API key is set in order to call the Lambda Extension.
Reason for change
It would not crash the customers, but it logs errors that should be avoided and handled better by not doing the operation.
Implementation details
Just created an API key getter in order to then check if the API is missing.
Test coverage
Tested manually on AWS Lambda.

Other details