Skip to content

Commit 6424a6b

Browse files
committed
Merge branch 'release/oci' into dev
2 parents ac62e1c + 449241a commit 6424a6b

File tree

53 files changed

+1132
-352
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+1132
-352
lines changed

Libraries/src/Amazon.Lambda.APIGatewayEvents/Amazon.Lambda.APIGatewayEvents.csproj

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,31 @@
1010
<AssemblyName>Amazon.Lambda.APIGatewayEvents</AssemblyName>
1111
<PackageId>Amazon.Lambda.APIGatewayEvents</PackageId>
1212
<PackageTags>AWS;Amazon;Lambda</PackageTags>
13-
<PackageReadmeFile>README.md</PackageReadmeFile>
13+
<PackageReadmeFile>README.md</PackageReadmeFile>
14+
15+
<!--
16+
Disabling the EOL check because when we remove support in our libraries is a different and slower cycle then the framework's cycle.
17+
We need to be confident there is no longer a critical mass of customers still using the framework version and we need to be
18+
ready to make a major version release of our libraries.
19+
-->
20+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1421
</PropertyGroup>
1522

1623
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
1724
<DefineConstants>NETSTANDARD_2_0</DefineConstants>
1825
</PropertyGroup>
1926

2027
<ItemGroup>
21-
<None Include="README.md" Pack="true" PackagePath="\"/>
28+
<None Include="README.md" Pack="true" PackagePath="\"/>
2229
</ItemGroup>
2330

2431
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
2532
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
2633
</ItemGroup>
2734

28-
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
29-
<WarningsAsErrors>IL2026,IL2067,IL2075</WarningsAsErrors>
30-
<IsTrimmable>true</IsTrimmable>
35+
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
36+
<WarningsAsErrors>IL2026,IL2067,IL2075</WarningsAsErrors>
37+
<IsTrimmable>true</IsTrimmable>
3138
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
32-
</PropertyGroup>
39+
</PropertyGroup>
3340
</Project>

Libraries/src/Amazon.Lambda.ApplicationLoadBalancerEvents/Amazon.Lambda.ApplicationLoadBalancerEvents.csproj

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@
1010
<AssemblyName>Amazon.Lambda.ApplicationLoadBalancerEvents</AssemblyName>
1111
<PackageId>Amazon.Lambda.ApplicationLoadBalancerEvents</PackageId>
1212
<PackageTags>AWS;Amazon;Lambda</PackageTags>
13+
<!--
14+
Disabling the EOL check because when we remove support in our libraries is a different and slower cycle then the framework's cycle.
15+
We need to be confident there is no longer a critical mass of customers still using the framework version and we need to be
16+
ready to make a major version release of our libraries.
17+
-->
18+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1319
</PropertyGroup>
1420

15-
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
16-
<WarningsAsErrors>IL2026,IL2067,IL2075</WarningsAsErrors>
17-
<IsTrimmable>true</IsTrimmable>
18-
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
21+
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
22+
<WarningsAsErrors>IL2026,IL2067,IL2075</WarningsAsErrors>
23+
<IsTrimmable>true</IsTrimmable>
24+
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
1925
</PropertyGroup>
2026
</Project>

Libraries/src/Amazon.Lambda.AspNetCoreServer.Hosting/Amazon.Lambda.AspNetCoreServer.Hosting.csproj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
10-
<Version>1.9.0</Version>
11-
<PackageReadmeFile>README.md</PackageReadmeFile>
10+
<Version>1.9.0</Version>
11+
<PackageReadmeFile>README.md</PackageReadmeFile>
1212
<AssemblyName>Amazon.Lambda.AspNetCoreServer.Hosting</AssemblyName>
13-
<PackageId>Amazon.Lambda.AspNetCoreServer.Hosting</PackageId>
13+
<PackageId>Amazon.Lambda.AspNetCoreServer.Hosting</PackageId>
14+
<!--
15+
Disabling the EOL check because when we remove support in our libraries is a different and slower cycle then the framework's cycle.
16+
We need to be confident there is no longer a critical mass of customers still using the framework version and we need to be
17+
ready to make a major version release of our libraries.
18+
-->
19+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1420

1521
<WarningsAsErrors>IL2104,IL2026,IL2067,IL2075</WarningsAsErrors>
1622
<IsTrimmable>true</IsTrimmable>

Libraries/src/Amazon.Lambda.AspNetCoreServer/Amazon.Lambda.AspNetCoreServer.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<LangVersion>Latest</LangVersion>
1414
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
1515
<PackageReadmeFile>README.md</PackageReadmeFile>
16+
<!--
17+
Disabling the EOL check because when we remove support in our libraries is a different and slower cycle then the framework's cycle.
18+
We need to be confident there is no longer a critical mass of customers still using the framework version and we need to be
19+
ready to make a major version release of our libraries.
20+
-->
21+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1622

1723
<WarningsAsErrorsA>IL2026,IL2067,IL2075,IL2091</WarningsAsErrorsA>
1824
<IsTrimmable>true</IsTrimmable>

Libraries/src/Amazon.Lambda.Core/Amazon.Lambda.Core.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
2222
<_Parameter1>Amazon.Lambda.RuntimeSupport.UnitTests, PublicKey="0024000004800000940000000602000000240000525341310004000001000100db5f59f098d27276c7833875a6263a3cc74ab17ba9a9df0b52aedbe7252745db7274d5271fd79c1f08f668ecfa8eaab5626fa76adc811d3c8fc55859b0d09d3bc0a84eecd0ba891f2b8a2fc55141cdcc37c2053d53491e650a479967c3622762977900eddbf1252ed08a2413f00a28f3a0752a81203f03ccb7f684db373518b4"</_Parameter1>
2323
</AssemblyAttribute>
24+
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
25+
<_Parameter1>Amazon.Lambda.Core.Tests, PublicKey="0024000004800000940000000602000000240000525341310004000001000100db5f59f098d27276c7833875a6263a3cc74ab17ba9a9df0b52aedbe7252745db7274d5271fd79c1f08f668ecfa8eaab5626fa76adc811d3c8fc55859b0d09d3bc0a84eecd0ba891f2b8a2fc55141cdcc37c2053d53491e650a479967c3622762977900eddbf1252ed08a2413f00a28f3a0752a81203f03ccb7f684db373518b4"</_Parameter1>
26+
</AssemblyAttribute>
2427
</ItemGroup>
2528

2629
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
8+
namespace Amazon.Lambda.Core
9+
{
10+
internal class Constants
11+
{
12+
internal const string ENV_VAR_AWS_LAMBDA_MAX_CONCURRENCY = "AWS_LAMBDA_MAX_CONCURRENCY";
13+
internal const string ENV_VAR_AWS_LAMBDA_TRACE_ID = "_X_AMZN_TRACE_ID";
14+
}
15+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
5+
using System;
6+
using System.Threading;
7+
8+
namespace Amazon.Lambda.Core
9+
{
10+
/// <summary>
11+
/// Provides global access to the current trace id for the current Lambda event invocation.
12+
/// </summary>
13+
public class LambdaTraceProvider
14+
{
15+
// Use separate backing fields based on if multi-concurrency is being used or not.
16+
// This is done because accessing from the AsyncLocal is slower then a backing string field
17+
// so only use AsyncLocal when we have to in a multi-concurrency scenario.
18+
private static string _traceIdField;
19+
private readonly static AsyncLocal<string> _traceIdStorage = new AsyncLocal<string>();
20+
21+
internal static void SetCurrentTraceId(string traceId)
22+
{
23+
if (Utils.IsUsingMultiConcurrency)
24+
_traceIdStorage.Value = traceId;
25+
else
26+
_traceIdField = traceId;
27+
}
28+
29+
/// <summary>
30+
/// The current trace id for the current Lambda event invocation.
31+
/// </summary>
32+
public static string CurrentTraceId
33+
{
34+
get
35+
{
36+
if (Utils.IsUsingMultiConcurrency)
37+
return _traceIdStorage.Value;
38+
else if (_traceIdField != null)
39+
return _traceIdField;
40+
41+
// Fallback to the environment variable if the backing field is not set.
42+
// This would happen if the version of Amazon.Lambda.RuntimeSupport being used is out of date
43+
// and doesn't call SetCurrentTraceId.
44+
return Environment.GetEnvironmentVariable(Constants.ENV_VAR_AWS_LAMBDA_TRACE_ID);
45+
}
46+
}
47+
}
48+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Text;
7+
8+
namespace Amazon.Lambda.Core
9+
{
10+
internal static class Utils
11+
{
12+
internal static bool IsUsingMultiConcurrency
13+
{
14+
get
15+
{
16+
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(Constants.ENV_VAR_AWS_LAMBDA_MAX_CONCURRENCY));
17+
}
18+
}
19+
}
20+
}

Libraries/src/Amazon.Lambda.RuntimeSupport/Amazon.Lambda.RuntimeSupport.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1717
<NoWarn>NU5048;NU1903;NU1902</NoWarn>
1818
<LangVersion>9.0</LangVersion>
19+
<!--
20+
Disabling the EOL check because when we remove support in our libraries is a different and slower cycle then the framework's cycle.
21+
We need to be confident there is no longer a critical mass of customers still using the framework version and we need to be
22+
ready to make a major version release of our libraries.
23+
-->
24+
<CheckEolTargetFramework>false</CheckEolTargetFramework>
1925
</PropertyGroup>
2026

2127
<PropertyGroup Condition=" '$(ExecutableOutputType)'=='true' ">

Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/Constants.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ internal class Constants
2424
// variable should never be set when function is deployed to Lambda.
2525
internal const string ENVIRONMENT_VARIABLE_AWS_LAMBDA_DOTNET_DEBUG_RUN_ONCE = "AWS_LAMBDA_DOTNET_DEBUG_RUN_ONCE";
2626

27+
// Lambda Environment variable used to check if user has configured the function to run in multi concurrency mode.
28+
// To be in multi concurrency mode the environment has to exist and have an int value greater then 1.
29+
internal const string ENVIRONMENT_VARIABLE_AWS_LAMBDA_MAX_CONCURRENCY = "AWS_LAMBDA_MAX_CONCURRENCY";
30+
31+
// .NET Lambda runtime specific environment variable used to override the number of .NET Tasks started
32+
// that will reach out to the Lambda Runtime API for new events to process. This environment variable is only
33+
// used if AWS_LAMBDA_MAX_CONCURRENCY environment variable is set.
34+
internal const string ENVIRONMENT_VARIABLE_AWS_LAMBDA_DOTNET_PROCESSING_TASKS = "AWS_LAMBDA_DOTNET_PROCESSING_TASKS";
35+
2736
internal const string ENVIRONMENT_VARIABLE_DISABLE_HEAP_MEMORY_LIMIT = "AWS_LAMBDA_DOTNET_DISABLE_MEMORY_LIMIT_CHECK";
2837

2938
internal const string ENVIRONMENT_VARIABLE_AWS_LAMBDA_DOTNET_PREJIT = "AWS_LAMBDA_DOTNET_PREJIT";
@@ -60,4 +69,4 @@ internal enum AwsLambdaDotNetPreJit
6069
internal const BindingFlags DefaultFlags = BindingFlags.DeclaredOnly | BindingFlags.NonPublic | BindingFlags.Public
6170
| BindingFlags.Instance | BindingFlags.Static;
6271
}
63-
}
72+
}

0 commit comments

Comments
 (0)