Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/Idempotency/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0" />
Expand Down
4 changes: 1 addition & 3 deletions examples/Kafka/Avro/src/Avro.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0"/>
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4"/>
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\libraries\src\AWS.Lambda.Powertools.Kafka.Avro\AWS.Lambda.Powertools.Kafka.Avro.csproj" />
<PackageReference Include="AWS.Lambda.Powertools.Kafka.Avro" Version="1.0.2" />
</ItemGroup>
<Target Name="GenerateAvroClasses" BeforeTargets="CoreCompile">
<Exec Command="avrogen -s $(ProjectDir)CustomerProfile.avsc $(ProjectDir)Generated"/>
Expand Down
4 changes: 1 addition & 3 deletions examples/Kafka/Json/src/Json.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0"/>
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4"/>
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\libraries\src\AWS.Lambda.Powertools.Kafka.Json\AWS.Lambda.Powertools.Kafka.Json.csproj" />
<PackageReference Include="AWS.Lambda.Powertools.Kafka.Json" Version="1.0.2" />
</ItemGroup>
<ItemGroup>
<None Remove="kafka-json-event.json" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0"/>
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4"/>
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="2.0.0" />
<PackageReference Include="AWS.Lambda.Powertools.Kafka.Protobuf" Version="1.0.2" />
<PackageReference Include="Grpc.Tools" Version="2.72.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\libraries\src\AWS.Lambda.Powertools.Kafka.Protobuf\AWS.Lambda.Powertools.Kafka.Protobuf.csproj" />
</ItemGroup>
<ItemGroup>
<Content Update="kafka-protobuf-event.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
4 changes: 1 addition & 3 deletions examples/Kafka/Protobuf/src/Protobuf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="2.0.0" />
<PackageReference Include="AWS.Lambda.Powertools.Kafka.Protobuf" Version="1.0.2" />
<PackageReference Include="Grpc.Tools" Version="2.72.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -38,7 +39,4 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Protobuf>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\libraries\src\AWS.Lambda.Powertools.Kafka.Protobuf\AWS.Lambda.Powertools.Kafka.Protobuf.csproj" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion examples/Logging/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0" />
Expand Down
2 changes: 1 addition & 1 deletion examples/Metrics/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
<RootNamespace>HelloWorld.Cfn</RootNamespace>
Expand Down
2 changes: 1 addition & 1 deletion examples/Parameters/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<EnableDefaultContentItems>False</EnableDefaultContentItems>
Expand Down
2 changes: 1 addition & 1 deletion examples/Tracing/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions examples/Tracing/test/HelloWorld.Test/FunctionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class FunctionTest

public FunctionTest(ITestOutputHelper testOutputHelper)
{
Environment.SetEnvironmentVariable("LAMBDA_TASK_ROOT", "AWS");
_testOutputHelper = testOutputHelper;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.5.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,8 @@ await Client.GetLatestConfigurationAsync(request)
.ConfigureAwait(false);

result.PollConfigurationToken = response.NextPollConfigurationToken;
result.NextAllowedPollTime = _dateTimeWrapper.UtcNow.AddSeconds(response.NextPollIntervalInSeconds);
if (response.NextPollIntervalInSeconds != null)
result.NextAllowedPollTime = _dateTimeWrapper.UtcNow.AddSeconds((double)response.NextPollIntervalInSeconds);

if (!string.Equals(response.ContentType, "application/json", StringComparison.CurrentCultureIgnoreCase))
throw new NotImplementedException($"Not implemented AppConfig type: {response.ContentType}");
Expand Down
28 changes: 14 additions & 14 deletions libraries/src/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@
<PackageVersion Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.4" />
<PackageVersion Include="Apache.Avro" Version="1.12.0" />
<PackageVersion Include="AspectInjector" Version="2.8.1" />
<PackageVersion Include="Amazon.Lambda.Core" Version="2.5.0" />
<PackageVersion Include="AWSSDK.AppConfig" Version="3.7.301" />
<PackageVersion Include="AWSSDK.AppConfigData" Version="3.7.301.15" />
<PackageVersion Include="Amazon.Lambda.Core" Version="2.7.0" />
<PackageVersion Include="AWSSDK.AppConfig" Version="4.0.2.2" />
<PackageVersion Include="AWSSDK.AppConfigData" Version="4.0.1.2" />
<PackageVersion Include="AWSSDK.BedrockAgentRuntime" Version="4.0.2.2" />
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="3.7.301.18" />
<PackageVersion Include="AWSSDK.DynamoDBv2" Version="4.0.6.2" />
<PackageVersion Include="AWSXRayRecorder.Handlers.AwsSdk" Version="2.13.0" />
<PackageVersion Include="Google.Protobuf" Version="3.31.1" />
<PackageVersion Include="Google.Protobuf" Version="3.32.1" />
<PackageVersion Include="Microsoft.AspNetCore.Http" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageVersion Include="AWSSDK.SecretsManager" Version="3.7.302.29" />
<PackageVersion Include="AWSSDK.SimpleSystemsManagement" Version="3.7.303.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="AWSSDK.XRay" Version="3.7.400.8" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.9" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="9.0.9" />
<PackageVersion Include="AWSSDK.SecretsManager" Version="4.0.1.2" />
<PackageVersion Include="AWSSDK.SimpleSystemsManagement" Version="4.0.3.2" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="9.0.9" />
<PackageVersion Include="AWSSDK.XRay" Version="4.0.2.1" />
<PackageVersion Include="AWSXRayRecorder.Core" Version="2.15.0" />
<PackageVersion Include="Amazon.Lambda.DynamoDBEvents" Version="3.1.0" />
<PackageVersion Include="Amazon.Lambda.KinesisEvents" Version="2.2.0" />
<PackageVersion Include="Amazon.Lambda.DynamoDBEvents" Version="3.1.1" />
<PackageVersion Include="Amazon.Lambda.KinesisEvents" Version="3.0.0" />
<PackageVersion Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Logging.Configuration" Version="9.0.9" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.IO;
using AWS.Lambda.Powertools.Common;
using AWS.Lambda.Powertools.Metrics.Tests.Handlers;
Expand All @@ -6,7 +7,7 @@
namespace AWS.Lambda.Powertools.Metrics.Tests;

[Collection("Sequential")]
public class ClearDimensionsTests
public class ClearDimensionsTests : IDisposable
{
[Fact]
public void WhenClearAllDimensions_NoDimensionsInOutput()
Expand All @@ -23,8 +24,12 @@ public void WhenClearAllDimensions_NoDimensionsInOutput()

// Assert
Assert.Contains("{\"Namespace\":\"dotnet-powertools-test\",\"Metrics\":[{\"Name\":\"Metric Name\",\"Unit\":\"Count\"}],\"Dimensions\":[[]]", metricsOutput);

// Reset
}

public void Dispose()
{
// Reset metrics state after each test
Metrics.ResetForTest();
MetricsAspect.ResetForTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ public void WhenMetricsWithSameNameAdded_ValidateMetricArray()

var result = _consoleOut.ToString();

// Debug output to see what's actually being written
System.Diagnostics.Debug.WriteLine($"Actual output: {result}");

// Assert
Assert.Contains("\"Metrics\":[{\"Name\":\"Time\",\"Unit\":\"Milliseconds\"}]"
, result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace AWS.Lambda.Powertools.Metrics.Tests;

[Collection("Sequential")]
public class MetricsTests
public class MetricsTests : IDisposable
{
[Fact]
public void Metrics_Set_Execution_Environment_Context()
Expand Down Expand Up @@ -423,4 +423,11 @@ public void Build_Should_Preserve_FunctionName_When_Set_Through_Builder()
// Assert
Assert.Equal("TestFunction", metrics.Options.FunctionName);
}

public void Dispose()
{
// Reset metrics state after each test
Metrics.ResetForTest();
MetricsAspect.ResetForTest();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using AWS.Lambda.Powertools.Parameters.Transform;
using NSubstitute;
using Xunit;
#pragma warning disable CS8629 // Nullable value type may be null.

namespace AWS.Lambda.Powertools.Parameters.Tests.SimpleSystemsManagement;

Expand Down Expand Up @@ -350,7 +351,7 @@ public async Task GetAsync_WhenForceFetch_IgnoresCachedObject()
await client
.Received(1)
.GetParameterAsync(
Arg.Is<GetParameterRequest>(x => x.Name == key && !x.WithDecryption),
Arg.Is<GetParameterRequest>(x => x.Name == key && !x.WithDecryption.Value),
Arg.Any<CancellationToken>());
Assert.NotNull(result);
Assert.Equal(value, result);
Expand Down Expand Up @@ -392,7 +393,7 @@ public async Task GetAsync_WhenMaxAgeNotSet_StoresCachedObjectWithDefaultMaxAge(
cacheManager.Received(1).Get(key);
await client.Received(1)
.GetParameterAsync(Arg.Is<GetParameterRequest>(x =>
x.Name == key && !x.WithDecryption), Arg.Any<CancellationToken>());
x.Name == key && !x.WithDecryption.Value), Arg.Any<CancellationToken>());
cacheManager.Received(1).Set(key, value, duration);
Assert.NotNull(result);
Assert.Equal(value, result);
Expand Down Expand Up @@ -435,7 +436,7 @@ public async Task GetAsync_WhenMaxAgeClientSet_StoresCachedObjectWithDefaultMaxA
cacheManager.Received(1).Get(key);
await client.Received(1)
.GetParameterAsync(Arg.Is<GetParameterRequest>(x =>
x.Name == key && !x.WithDecryption), Arg.Any<CancellationToken>());
x.Name == key && !x.WithDecryption.Value), Arg.Any<CancellationToken>());
cacheManager.Received(1).Set(key, value, duration);
Assert.NotNull(result);
Assert.Equal(value, result);
Expand Down Expand Up @@ -481,7 +482,7 @@ public async Task GetAsync_WhenMaxAgeSet_StoresCachedObjectWithMaxAge()
cacheManager.Received(1).Get(key);
await client.Received(1)
.GetParameterAsync(Arg.Is<GetParameterRequest>(x =>
x.Name == key && !x.WithDecryption), Arg.Any<CancellationToken>());
x.Name == key && !x.WithDecryption.Value), Arg.Any<CancellationToken>());
cacheManager.Received(1).Set(key, value, duration);
Assert.NotNull(result);
Assert.Equal(value, result);
Expand Down Expand Up @@ -524,7 +525,7 @@ public async Task GetAsync_WithDecryption_CallsClientWithDecryption()
cacheManager.Received(1).Get(key);
await client.Received(1)
.GetParameterAsync(Arg.Is<GetParameterRequest>(x =>
x.Name == key && x.WithDecryption), Arg.Any<CancellationToken>());
x.Name == key && x.WithDecryption.Value), Arg.Any<CancellationToken>());
Assert.NotNull(result);
Assert.Equal(value, result);
}
Expand Down Expand Up @@ -918,7 +919,7 @@ public async Task GetMultipleAsync_WhenMaxAgeNotSet_StoresCachedObjectWithDefaul
cacheManager.Received(1).Get(key);
await client.Received(1).GetParametersByPathAsync(
Arg.Is<GetParametersByPathRequest>(x =>
x.Path == key && !x.WithDecryption
x.Path == key && !x.WithDecryption.Value
),
Arg.Any<CancellationToken>()
);
Expand Down Expand Up @@ -980,7 +981,7 @@ public async Task GetMultipleAsync_WhenMaxAgeClientSet_StoresCachedObjectWithDef
cacheManager.Received(1).Get(key);
await client.Received(1).GetParametersByPathAsync(
Arg.Is<GetParametersByPathRequest>(x =>
x.Path == key && !x.WithDecryption
x.Path == key && !x.WithDecryption.Value
),
Arg.Any<CancellationToken>()
);
Expand Down Expand Up @@ -1045,7 +1046,7 @@ public async Task GetMultipleAsync_WhenMaxAgeSet_StoresCachedObjectWithMaxAge()
cacheManager.Received(1).Get(key);
await client.Received(1).GetParametersByPathAsync(
Arg.Is<GetParametersByPathRequest>(x =>
x.Path == key && !x.WithDecryption
x.Path == key && !x.WithDecryption.Value
),
Arg.Any<CancellationToken>()
);
Expand Down Expand Up @@ -1108,7 +1109,7 @@ public async Task GetMultipleAsync_WithDecryption_CallsClientWithDecryption()
cacheManager.Received(1).Get(key);
await client.Received(1).GetParametersByPathAsync(
Arg.Is<GetParametersByPathRequest>(x =>
x.Path == key && x.WithDecryption
x.Path == key && x.WithDecryption.Value
),
Arg.Any<CancellationToken>()
);
Expand Down Expand Up @@ -1167,7 +1168,7 @@ public async Task GetMultipleAsync_WhenRecursive_CallsClientRecursive()
cacheManager.Received(1).Get(key);
await client.Received(1).GetParametersByPathAsync(
Arg.Is<GetParametersByPathRequest>(x =>
x.Path == key && x.Recursive
x.Path == key && x.Recursive.Value
),
Arg.Any<CancellationToken>()
);
Expand Down Expand Up @@ -1241,14 +1242,14 @@ public async Task GetMultipleAsync_WhileNextToken_RetrieveAll()
cacheManager.Received(1).Get(key);
await client.Received(1).GetParametersByPathAsync(
Arg.Is<GetParametersByPathRequest>(x =>
x.Path == key && x.Recursive && x.WithDecryption && string.IsNullOrEmpty(x.NextToken)
x.Path == key && x.Recursive.Value && x.WithDecryption.Value && string.IsNullOrEmpty(x.NextToken)
),
Arg.Any<CancellationToken>()
);

await client.Received(1).GetParametersByPathAsync(
Arg.Is<GetParametersByPathRequest>(x =>
x.Path == key && x.Recursive && x.WithDecryption && x.NextToken == nextToken
x.Path == key && x.Recursive.Value && x.WithDecryption.Value && x.NextToken == nextToken
),
Arg.Any<CancellationToken>()
);
Expand Down
Loading
Loading