Skip to content

Conversation

@andrewlock
Copy link
Member

@andrewlock andrewlock commented Jan 12, 2024

Summary of changes

  • Reenables AwsLambdaTests that were (accidentally) not running
  • Fix incorrect function signature in top-level handler sample
  • Update snapshots

Reason for change

We spotted that the AWS lambda tests were accidentally disabled due to an invalid #if directive. After fixing the directive, we discovered one bug (Fixed in #5049) and also some issues with the sample introduced in #4535 (because the tests weren't running, so not surprising!)

Implementation details

  • #if NET6_OR_GREATER -> #if NET6_0_OR_GREATER
  • Fix incorrect function handler (Error converting the Lambda event JSON payload to type System.String: The JSON value could not be converted to System.String - changed to a type and that fixed it)
  • Update snapshots (add missing top-level function handler span after fixing above)

Test coverage

We have some now 😄

Other details

The snapshot diff looks big because all the span IDs changed, but it's actually just three additions from the fixed top-level handler execution:

+  {
+    TraceId: Id_75,
+    SpanId: Id_76,
+    Name: lambda.invocation,
+    Resource: /lambda/end-invocation,
+    Service: LambdaExtension,
+    Tags: {
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_75,
+    SpanId: Id_114,
+    Name: manual.ToplevelStatements,
+    Resource: manual.ToplevelStatements,
+    Service: Samples.Amazon.Lambda.RuntimeSupport,
+    ParentId: Id_76,
+    Tags: {
+      language: dotnet,
+      runtime-id: Guid_38
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_75,
+    SpanId: Id_152,
+    Name: http.request,
+    Resource: GET serverless-dummy-api:9005/function/ToplevelStatements,
+    Service: Samples.Amazon.Lambda.RuntimeSupport-http-client,
+    Type: http,
+    ParentId: Id_114,
+    Tags: {
+      component: WebRequest,
+      http.method: GET,
+      http.status_code: 200,
+      http.url: http://serverless-dummy-api:9005/function/ToplevelStatements,
+      out.host: serverless-dummy-api,
+      runtime-id: Guid_38,
+      span.kind: client
+    },
+    Metrics: {
+      _dd.top_level: 1.0
+    }
+  },

@andrewlock andrewlock added area:tests unit tests, integration tests area:serverless labels Jan 12, 2024
@andrewlock andrewlock requested a review from a team as a code owner January 12, 2024 10:06
@andrewlock andrewlock requested a review from a team January 12, 2024 10:06
@github-actions
Copy link
Contributor

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

1 occurrences of :

+  {
+    TraceId: Id_75,
+    SpanId: Id_76,
+    Name: lambda.invocation,
+    Resource: /lambda/end-invocation,
+    Service: LambdaExtension,
+    Tags: {
+      _sampling_priority_v1: 1.0
+    }
+  },
[...]
-    SpanId: Id_75,
+    SpanId: Id_77,

1 occurrences of :

-    SpanId: Id_76,
+    SpanId: Id_78,

1 occurrences of :

-    SpanId: Id_77,
+    SpanId: Id_79,

1 occurrences of :

-    SpanId: Id_78,
+    SpanId: Id_80,

1 occurrences of :

-    SpanId: Id_79,
+    SpanId: Id_81,

1 occurrences of :

-    SpanId: Id_80,
+    SpanId: Id_82,

1 occurrences of :

-    SpanId: Id_81,
+    SpanId: Id_83,

1 occurrences of :

-    SpanId: Id_82,
+    SpanId: Id_84,

1 occurrences of :

-    SpanId: Id_83,
+    SpanId: Id_85,

1 occurrences of :

-    SpanId: Id_84,
+    SpanId: Id_86,

1 occurrences of :

-    SpanId: Id_85,
+    SpanId: Id_87,

1 occurrences of :

-    SpanId: Id_86,
+    SpanId: Id_88,

1 occurrences of :

-    SpanId: Id_87,
+    SpanId: Id_89,

1 occurrences of :

-    SpanId: Id_88,
+    SpanId: Id_90,

1 occurrences of :

-    SpanId: Id_89,
+    SpanId: Id_91,

1 occurrences of :

-    SpanId: Id_90,
+    SpanId: Id_92,

1 occurrences of :

-    SpanId: Id_91,
+    SpanId: Id_93,

1 occurrences of :

-    SpanId: Id_92,
+    SpanId: Id_94,

1 occurrences of :

-    SpanId: Id_93,
+    SpanId: Id_95,

1 occurrences of :

-    SpanId: Id_94,
+    SpanId: Id_96,

1 occurrences of :

-    SpanId: Id_95,
+    SpanId: Id_97,

1 occurrences of :

-    SpanId: Id_96,
+    SpanId: Id_98,

1 occurrences of :

-    SpanId: Id_97,
+    SpanId: Id_99,

1 occurrences of :

-    SpanId: Id_98,
+    SpanId: Id_100,

1 occurrences of :

-    SpanId: Id_99,
+    SpanId: Id_101,

1 occurrences of :

-    SpanId: Id_100,
+    SpanId: Id_102,

1 occurrences of :

-    SpanId: Id_101,
+    SpanId: Id_103,

1 occurrences of :

-    SpanId: Id_102,
+    SpanId: Id_104,

1 occurrences of :

-    SpanId: Id_103,
+    SpanId: Id_105,

1 occurrences of :

-    SpanId: Id_104,
+    SpanId: Id_106,

1 occurrences of :

-    SpanId: Id_105,
+    SpanId: Id_107,

1 occurrences of :

-    SpanId: Id_106,
+    SpanId: Id_108,

1 occurrences of :

-    SpanId: Id_107,
+    SpanId: Id_109,

1 occurrences of :

-    SpanId: Id_108,
+    SpanId: Id_110,

1 occurrences of :

-    SpanId: Id_109,
+    SpanId: Id_111,

1 occurrences of :

-    SpanId: Id_110,
+    SpanId: Id_112,

1 occurrences of :

-    SpanId: Id_111,
+    SpanId: Id_113,
[...]
+    },
+    Metrics: {
+      process_id: 0,
+      _dd.top_level: 1.0,
+      _dd.tracer_kr: 1.0,
+      _sampling_priority_v1: 1.0
+    }
+  },
+  {
+    TraceId: Id_75,
+    SpanId: Id_114,
+    Name: manual.ToplevelStatements,
+    Resource: manual.ToplevelStatements,
+    Service: Samples.Amazon.Lambda.RuntimeSupport,
+    ParentId: Id_76,
+    Tags: {
+      language: dotnet,
+      runtime-id: Guid_38

1 occurrences of :

-    SpanId: Id_112,
+    SpanId: Id_115,
[...]
-    ParentId: Id_75,
+    ParentId: Id_77,

1 occurrences of :

-    SpanId: Id_113,
+    SpanId: Id_116,
[...]
-    ParentId: Id_76,
+    ParentId: Id_78,

1 occurrences of :

-    SpanId: Id_114,
+    SpanId: Id_117,
[...]
-    ParentId: Id_77,
+    ParentId: Id_79,

1 occurrences of :

-    SpanId: Id_115,
+    SpanId: Id_118,
[...]
-    ParentId: Id_78,
+    ParentId: Id_80,

1 occurrences of :

-    SpanId: Id_116,
+    SpanId: Id_119,
[...]
-    ParentId: Id_79,
+    ParentId: Id_81,

1 occurrences of :

-    SpanId: Id_117,
+    SpanId: Id_120,
[...]
-    ParentId: Id_80,
+    ParentId: Id_82,

1 occurrences of :

-    SpanId: Id_118,
+    SpanId: Id_121,
[...]
-    ParentId: Id_81,
+    ParentId: Id_83,

1 occurrences of :

-    SpanId: Id_119,
+    SpanId: Id_122,
[...]
-    ParentId: Id_82,
+    ParentId: Id_84,

1 occurrences of :

-    SpanId: Id_120,
+    SpanId: Id_123,
[...]
-    ParentId: Id_83,
+    ParentId: Id_85,

1 occurrences of :

-    SpanId: Id_121,
+    SpanId: Id_124,
[...]
-    ParentId: Id_84,
+    ParentId: Id_86,

1 occurrences of :

-    SpanId: Id_122,
+    SpanId: Id_125,
[...]
-    ParentId: Id_85,
+    ParentId: Id_87,

1 occurrences of :

-    SpanId: Id_123,
+    SpanId: Id_126,
[...]
-    ParentId: Id_86,
+    ParentId: Id_88,

1 occurrences of :

-    SpanId: Id_124,
+    SpanId: Id_127,
[...]
-    ParentId: Id_87,
+    ParentId: Id_89,

1 occurrences of :

-    SpanId: Id_125,
+    SpanId: Id_128,
[...]
-    ParentId: Id_88,
+    ParentId: Id_90,

1 occurrences of :

-    SpanId: Id_126,
+    SpanId: Id_129,
[...]
-    ParentId: Id_89,
+    ParentId: Id_91,

1 occurrences of :

-    SpanId: Id_127,
+    SpanId: Id_130,
[...]
-    ParentId: Id_90,
+    ParentId: Id_92,

1 occurrences of :

-    SpanId: Id_128,
+    SpanId: Id_131,
[...]
-    ParentId: Id_91,
+    ParentId: Id_93,

1 occurrences of :

-    SpanId: Id_129,
+    SpanId: Id_132,
[...]
-    ParentId: Id_92,
+    ParentId: Id_94,

1 occurrences of :

-    SpanId: Id_130,
+    SpanId: Id_133,
[...]
-    ParentId: Id_93,
+    ParentId: Id_95,

1 occurrences of :

-    SpanId: Id_131,
+    SpanId: Id_134,
[...]
-    ParentId: Id_94,
+    ParentId: Id_96,

1 occurrences of :

-    SpanId: Id_132,
+    SpanId: Id_135,
[...]
-    ParentId: Id_95,
+    ParentId: Id_97,

1 occurrences of :

-    SpanId: Id_133,
+    SpanId: Id_136,
[...]
-    ParentId: Id_96,
+    ParentId: Id_98,

1 occurrences of :

-    SpanId: Id_134,
+    SpanId: Id_137,
[...]
-    ParentId: Id_97,
+    ParentId: Id_99,

1 occurrences of :

-    SpanId: Id_135,
+    SpanId: Id_138,
[...]
-    ParentId: Id_98,
+    ParentId: Id_100,

1 occurrences of :

-    SpanId: Id_136,
+    SpanId: Id_139,
[...]
-    ParentId: Id_99,
+    ParentId: Id_101,

1 occurrences of :

-    SpanId: Id_137,
+    SpanId: Id_140,
[...]
-    ParentId: Id_100,
+    ParentId: Id_102,

1 occurrences of :

-    SpanId: Id_138,
+    SpanId: Id_141,
[...]
-    ParentId: Id_101,
+    ParentId: Id_103,

1 occurrences of :

-    SpanId: Id_139,
+    SpanId: Id_142,
[...]
-    ParentId: Id_102,
+    ParentId: Id_104,

1 occurrences of :

-    SpanId: Id_140,
+    SpanId: Id_143,
[...]
-    ParentId: Id_103,
+    ParentId: Id_105,

1 occurrences of :

-    SpanId: Id_141,
+    SpanId: Id_144,
[...]
-    ParentId: Id_104,
+    ParentId: Id_106,

1 occurrences of :

-    SpanId: Id_142,
+    SpanId: Id_145,
[...]
-    ParentId: Id_105,
+    ParentId: Id_107,

1 occurrences of :

-    SpanId: Id_143,
+    SpanId: Id_146,
[...]
-    ParentId: Id_106,
+    ParentId: Id_108,

1 occurrences of :

-    SpanId: Id_144,
+    SpanId: Id_147,
[...]
-    ParentId: Id_107,
+    ParentId: Id_109,

1 occurrences of :

-    SpanId: Id_145,
+    SpanId: Id_148,
[...]
-    ParentId: Id_108,
+    ParentId: Id_110,

1 occurrences of :

-    SpanId: Id_146,
+    SpanId: Id_149,
[...]
-    ParentId: Id_109,
+    ParentId: Id_111,

1 occurrences of :

-    SpanId: Id_147,
+    SpanId: Id_150,
[...]
-    ParentId: Id_110,
+    ParentId: Id_112,

1 occurrences of :

-    SpanId: Id_148,
+    SpanId: Id_151,
[...]
-    ParentId: Id_111,
+    ParentId: Id_113,

1 occurrences of :

+  },
+  {
+    TraceId: Id_75,
+    SpanId: Id_152,
+    Name: http.request,
+    Resource: GET serverless-dummy-api:9005/function/ToplevelStatements,
+    Service: Samples.Amazon.Lambda.RuntimeSupport-http-client,
+    Type: http,
+    ParentId: Id_114,
+    Tags: {
+      component: WebRequest,
+      http.method: GET,
+      http.status_code: 200,
+      http.url: http://serverless-dummy-api:9005/function/ToplevelStatements,
+      out.host: serverless-dummy-api,
+      runtime-id: Guid_38,
+      span.kind: client
+    },
+    Metrics: {
+      _dd.top_level: 1.0
+    }

Copy link
Member

@tonyredondo tonyredondo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@datadog-ddstaging
Copy link

datadog-ddstaging bot commented Jan 12, 2024

Datadog Report

Branch report: andrew/ci/fix-lambda
Commit report: b592a49
Test service: dd-trace-dotnet

✅ 0 Failed, 303967 Passed, 1015 Skipped, 55m 57.04s Wall Time

@andrewlock
Copy link
Member Author

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:

  • Welch test with statistical test for significance of 5%
  • Only results indicating a difference greater than 5% and 5 ms are considered.

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 (5050) - mean (72ms)  : 63, 82
     .   : milestone, 72,
    master - mean (69ms)  : 66, 73
     .   : milestone, 69,

    section CallTarget+Inlining+NGEN
    This PR (5050) - mean (1,029ms)  : 1002, 1055
     .   : milestone, 1029,
    master - mean (1,029ms)  : 1008, 1051
     .   : milestone, 1029,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5050) - mean (106ms)  : 103, 109
     .   : milestone, 106,
    master - mean (105ms)  : 101, 109
     .   : milestone, 105,

    section CallTarget+Inlining+NGEN
    This PR (5050) - mean (728ms)  : 707, 749
     .   : milestone, 728,
    master - mean (730ms)  : 709, 751
     .   : milestone, 730,

Loading
gantt
    title Execution time (ms) FakeDbCommand (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5050) - mean (89ms)  : 85, 93
     .   : milestone, 89,
    master - mean (90ms)  : 87, 93
     .   : milestone, 90,

    section CallTarget+Inlining+NGEN
    This PR (5050) - mean (687ms)  : 669, 705
     .   : milestone, 687,
    master - mean (696ms)  : 672, 721
     .   : milestone, 696,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Framework 4.6.2) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5050) - mean (188ms)  : 184, 191
     .   : milestone, 188,
    master - mean (188ms)  : 185, 191
     .   : milestone, 188,

    section CallTarget+Inlining+NGEN
    This PR (5050) - mean (1,134ms)  : 1116, 1153
     .   : milestone, 1134,
    master - mean (1,137ms)  : 1116, 1158
     .   : milestone, 1137,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET Core 3.1) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5050) - mean (271ms)  : 266, 275
     .   : milestone, 271,
    master - mean (272ms)  : 268, 275
     .   : milestone, 272,

    section CallTarget+Inlining+NGEN
    This PR (5050) - mean (1,097ms)  : 1075, 1120
     .   : milestone, 1097,
    master - mean (1,093ms)  : 1073, 1114
     .   : milestone, 1093,

Loading
gantt
    title Execution time (ms) HttpMessageHandler (.NET 6) 
    dateFormat  X
    axisFormat %s
    todayMarker off
    section Baseline
    This PR (5050) - mean (261ms)  : 257, 265
     .   : milestone, 261,
    master - mean (262ms)  : 258, 265
     .   : milestone, 262,

    section CallTarget+Inlining+NGEN
    This PR (5050) - mean (1,061ms)  : 1035, 1087
     .   : milestone, 1061,
    master - mean (1,058ms)  : 1026, 1090
     .   : milestone, 1058,

Loading

@andrewlock
Copy link
Member Author

Throughput/Crank Report:zap:

Throughput results for AspNetCoreSimpleController comparing the following branches/commits:

Cases where throughput results for the PR are worse than latest master (5% drop or greater), results are shown in red.

Note that these results are based on a single point-in-time result for each branch. For full results, see one of the many, many dashboards!

gantt
    title Throughput Linux x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5050) (11.686M)   : 0, 11685960
    master (11.893M)   : 0, 11892622
    benchmarks/2.9.0 (11.642M)   : 0, 11641842

    section Automatic
    This PR (5050) (8.057M)   : 0, 8057212
    master (8.099M)   : 0, 8098638
    benchmarks/2.9.0 (8.382M)   : 0, 8382125

    section Trace stats
    This PR (5050) (8.383M)   : 0, 8383423
    master (5.895M)   : 0, 5895492

    section Manual
    This PR (5050) (10.148M)   : 0, 10148068
    master (10.361M)   : 0, 10361124

    section Manual + Automatic
    This PR (5050) (7.654M)   : 0, 7653528
    master (7.670M)   : 0, 7670088

    section Version Conflict
    This PR (5050) (6.838M)   : 0, 6837931
    master (6.859M)   : 0, 6859229

Loading
gantt
    title Throughput Linux arm64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5050) (9.494M)   : 0, 9493539
    master (9.617M)   : 0, 9616856
    benchmarks/2.9.0 (9.719M)   : 0, 9718800

    section Automatic
    This PR (5050) (6.646M)   : 0, 6645995
    master (6.615M)   : 0, 6615394

    section Trace stats
    This PR (5050) (6.932M)   : 0, 6931834
    master (6.934M)   : 0, 6934299

    section Manual
    This PR (5050) (8.406M)   : 0, 8405517
    master (8.540M)   : 0, 8539968

    section Manual + Automatic
    This PR (5050) (5.910M)   : 0, 5910308
    master (6.148M)   : 0, 6147793

    section Version Conflict
    This PR (5050) (5.700M)   : 0, 5699505
    master (5.693M)   : 0, 5693193

Loading
gantt
    title Throughput Windows x64 (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    This PR (5050) (9.900M)   : 0, 9899728
    benchmarks/2.9.0 (9.943M)   : 0, 9943294

    section Automatic
    This PR (5050) (7.014M)   : 0, 7013843
    benchmarks/2.9.0 (7.260M)   : 0, 7260428

    section Trace stats
    This PR (5050) (7.345M)   : 0, 7344530

    section Manual
    This PR (5050) (8.699M)   : 0, 8698966

    section Manual + Automatic
    This PR (5050) (6.742M)   : 0, 6741829

    section Version Conflict
    This PR (5050) (6.048M)   : 0, 6048198

Loading
gantt
    title Throughput Linux x64 (ASM) (Total requests) 
    dateFormat  X
    axisFormat %s
    section Baseline
    master (7.496M)   : 0, 7496114
    benchmarks/2.9.0 (7.836M)   : 0, 7835831

    section No attack
    master (1.764M)   : 0, 1763502
    benchmarks/2.9.0 (3.226M)   : 0, 3226182

    section Attack
    master (1.399M)   : 0, 1399328
    benchmarks/2.9.0 (2.474M)   : 0, 2473872

    section Blocking
    master (3.098M)   : 0, 3097902

    section IAST default
    master (6.459M)   : 0, 6458516

    section IAST full
    master (5.769M)   : 0, 5769139

    section Base vuln
    master (0.971M)   : 0, 970670

    section IAST vuln
    master (0.901M)   : 0, 900962

Loading

@andrewlock andrewlock merged commit 996080a into master Jan 12, 2024
@andrewlock andrewlock deleted the andrew/ci/fix-lambda branch January 12, 2024 17:23
@github-actions github-actions bot added this to the vNext milestone Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:serverless area:tests unit tests, integration tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants