Skip to content

chore: Update examples Tracing to version 1.5.0 related to release 1.12 #623

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

Merged
Merged
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
1 change: 1 addition & 0 deletions examples/AOT/src/AOT/AOT.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
<PackageReference Include="Amazon.Lambda.Core" Version="2.2.0"/>
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.1"/>
<PackageReference Include="AWS.Lambda.Powertools.Metrics" Version="1.7.1" />
<PackageReference Include="AWS.Lambda.Powertools.Tracing" Version="1.5.0" />
</ItemGroup>
</Project>
5 changes: 5 additions & 0 deletions examples/AOT/src/AOT/Function.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Amazon.Lambda.Serialization.SystemTextJson;
using System.Text.Json.Serialization;
using AWS.Lambda.Powertools.Metrics;
using AWS.Lambda.Powertools.Tracing;

namespace AOT;

Expand Down Expand Up @@ -45,6 +46,7 @@ await LambdaBootstrapBuilder.Create(handler,

// You can optionally capture cold start metrics by setting CaptureColdStart parameter to true.
[Metrics(Namespace = "ns", Service = "svc", CaptureColdStart = true)]
[Tracing(CaptureMode = TracingCaptureMode.ResponseAndError)]
public static string FunctionHandler(string input, ILambdaContext context)
{
// You can create metrics using AddMetric
Expand All @@ -53,12 +55,15 @@ public static string FunctionHandler(string input, ILambdaContext context)
return ToUpper(input);
}

[Tracing(SegmentName = "ToUpper Call")]
private static string ToUpper(string input)
{
Metrics.AddMetric("ToUpper invocation", 1, MetricUnit.Count);

var upper = input.ToUpper();

Tracing.AddAnnotation("Upper text", upper);

// You can add high-cardinality data as part of your Metrics log with AddMetadata method.
// This is useful when you want to search highly contextual information along with your metrics in your logs.
Metrics.AddMetadata("Input Uppercase", upper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
<PackageReference Include="Amazon.Lambda.AspNetCoreServer" Version="9.0.0" />
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.5.1" />
<PackageReference Include="AWS.Lambda.Powertools.Metrics" Version="1.7.1" />
<PackageReference Include="AWS.Lambda.Powertools.Tracing" Version="1.4.2" />
<PackageReference Include="AWS.Lambda.Powertools.Tracing" Version="1.5.0" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion examples/Tracing/src/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageReference Include="Amazon.Lambda.APIGatewayEvents" Version="2.7.0" />
<PackageReference Include="Amazon.Lambda.Serialization.SystemTextJson" Version="2.4.1" />
<PackageReference Include="AWS.Lambda.Powertools.Logging" Version="1.5.1" />
<PackageReference Include="AWS.Lambda.Powertools.Tracing" Version="1.4.2" />
<PackageReference Include="AWS.Lambda.Powertools.Tracing" Version="1.5.0" />
<PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.301.18" />
</ItemGroup>
</Project>
Loading