From 8f448bbca46de8a2d0736e98150c69a973910581 Mon Sep 17 00:00:00 2001
From: Henrique <999396+hjgraca@users.noreply.github.com>
Date: Thu, 25 Jul 2024 16:19:08 +0100
Subject: [PATCH] Update examples Tracing to version 1.5.0 related to release
1.12
---
examples/AOT/src/AOT/AOT.csproj | 1 +
examples/AOT/src/AOT/Function.cs | 5 +++++
.../src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj | 2 +-
examples/Tracing/src/HelloWorld/HelloWorld.csproj | 2 +-
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/examples/AOT/src/AOT/AOT.csproj b/examples/AOT/src/AOT/AOT.csproj
index b038edb3..62f453ff 100644
--- a/examples/AOT/src/AOT/AOT.csproj
+++ b/examples/AOT/src/AOT/AOT.csproj
@@ -21,5 +21,6 @@
+
\ No newline at end of file
diff --git a/examples/AOT/src/AOT/Function.cs b/examples/AOT/src/AOT/Function.cs
index df2b4729..823b9d15 100644
--- a/examples/AOT/src/AOT/Function.cs
+++ b/examples/AOT/src/AOT/Function.cs
@@ -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;
@@ -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
@@ -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);
diff --git a/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj b/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj
index d6d050bc..4b8d299c 100644
--- a/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj
+++ b/examples/ServerlessApi/src/LambdaPowertoolsAPI/LambdaPowertoolsAPI.csproj
@@ -15,6 +15,6 @@
-
+
diff --git a/examples/Tracing/src/HelloWorld/HelloWorld.csproj b/examples/Tracing/src/HelloWorld/HelloWorld.csproj
index f63df00c..093f53ae 100644
--- a/examples/Tracing/src/HelloWorld/HelloWorld.csproj
+++ b/examples/Tracing/src/HelloWorld/HelloWorld.csproj
@@ -9,7 +9,7 @@
-
+