diff --git a/libraries/src/AWS.Lambda.Powertools.Tracing/Internal/TracingSubsegment.cs b/libraries/src/AWS.Lambda.Powertools.Tracing/Internal/TracingSubsegment.cs new file mode 100644 index 00000000..68622858 --- /dev/null +++ b/libraries/src/AWS.Lambda.Powertools.Tracing/Internal/TracingSubsegment.cs @@ -0,0 +1,17 @@ +using Amazon.XRay.Recorder.Core.Internal.Entities; + +namespace AWS.Lambda.Powertools.Tracing.Internal; + +/// +/// Class TracingSubsegment. +/// It's a wrapper for Subsegment from Amazon.XRay.Recorder.Core.Internal. +/// +/// +public class TracingSubsegment : Subsegment +{ + /// + /// Wrapper constructor + /// + /// + public TracingSubsegment(string name) : base(name) { } +} \ No newline at end of file diff --git a/libraries/src/AWS.Lambda.Powertools.Tracing/Tracing.cs b/libraries/src/AWS.Lambda.Powertools.Tracing/Tracing.cs index 29e5b88a..33bc321b 100644 --- a/libraries/src/AWS.Lambda.Powertools.Tracing/Tracing.cs +++ b/libraries/src/AWS.Lambda.Powertools.Tracing/Tracing.cs @@ -130,7 +130,7 @@ public static void AddHttpInformation(string key, object value) /// The name of the subsegment. /// The AWS X-Ray subsegment for the wrapped consumer. /// Thrown when the name is not provided. - public static void WithSubsegment(string name, Action subsegment) + public static void WithSubsegment(string name, Action subsegment) { WithSubsegment(null, name, subsegment); } @@ -145,7 +145,7 @@ public static void WithSubsegment(string name, Action subsegment) /// The name of the subsegment. /// The AWS X-Ray subsegment for the wrapped consumer. /// name - public static void WithSubsegment(string nameSpace, string name, Action subsegment) + public static void WithSubsegment(string nameSpace, string name, Action subsegment) { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException(nameof(name)); @@ -154,7 +154,8 @@ public static void WithSubsegment(string nameSpace, string name, ActionThe AWS X-Ray subsegment for the wrapped consumer. /// Thrown when the name is not provided. /// Thrown when the entity is not provided. - public static void WithSubsegment(string name, Entity entity, Action subsegment) + public static void WithSubsegment(string name, Entity entity, Action subsegment) { WithSubsegment(null, name, subsegment); } @@ -191,7 +192,7 @@ public static void WithSubsegment(string name, Entity entity, Action /// The AWS X-Ray subsegment for the wrapped consumer. /// name /// entity - public static void WithSubsegment(string nameSpace, string name, Entity entity, Action subsegment) + public static void WithSubsegment(string nameSpace, string name, Entity entity, Action subsegment) { if (string.IsNullOrWhiteSpace(name)) throw new ArgumentNullException(nameof(name)); @@ -199,7 +200,7 @@ public static void WithSubsegment(string nameSpace, string name, Entity entity, if (entity is null) throw new ArgumentNullException(nameof(entity)); - var childSubsegment = new Subsegment($"## {name}"); + var childSubsegment = new TracingSubsegment($"## {name}"); entity.AddSubsegment(childSubsegment); childSubsegment.Sampled = entity.Sampled; childSubsegment.SetStartTimeToNow();