@@ -41,8 +41,8 @@ public class AWSXRayPropagator : TextMapPropagator
4141 private const string LineageKey = "Lineage" ;
4242 private const char LineageDelimiter = ':' ;
4343 private const int LineageHashLength = 8 ;
44- private const int LineageMaxRequestCounter = 255 ;
45- private const int LineageMaxLoopCounter = 32767 ;
44+ private const int LineageMaxCounter1 = 32767 ;
45+ private const int LineageMaxCounter2 = 255 ;
4646
4747 /// <inheritdoc/>
4848 public override ISet < string > Fields => new HashSet < string > ( ) { AWSXRayTraceHeaderKey } ;
@@ -340,23 +340,23 @@ internal static bool IsLineageIdValid(string lineageId)
340340 return false ;
341341 }
342342
343- if ( ! int . TryParse ( lineageSubstrings [ 0 ] , out var requestCounter ) )
343+ if ( ! int . TryParse ( lineageSubstrings [ 0 ] , out var lineageCounter1 ) )
344344 {
345345 return false ;
346346 }
347347
348- var hashedResourceId = lineageSubstrings [ 1 ] ;
348+ var hashedString = lineageSubstrings [ 1 ] ;
349349
350- if ( ! int . TryParse ( lineageSubstrings [ 2 ] , out var loopCounter ) )
350+ if ( ! int . TryParse ( lineageSubstrings [ 2 ] , out var lineageCounter2 ) )
351351 {
352352 return false ;
353353 }
354354
355- var isValidKey = hashedResourceId . Length == LineageHashLength && Regex . IsMatch ( hashedResourceId , "^[0-9a-fA-F]+$" ) ;
356- var isValidRequestCounter = requestCounter >= 0 && requestCounter <= LineageMaxRequestCounter ;
357- var isValidLoopCounter = loopCounter >= 0 && loopCounter <= LineageMaxLoopCounter ;
355+ var isValidHash = hashedString . Length == LineageHashLength && Regex . IsMatch ( hashedString , "^[0-9a-fA-F]+$" ) ;
356+ var isValidCounter1 = lineageCounter1 >= 0 && lineageCounter1 <= LineageMaxCounter1 ;
357+ var isValidCounter2 = lineageCounter2 >= 0 && lineageCounter2 <= LineageMaxCounter2 ;
358358
359- return isValidKey && isValidRequestCounter && isValidLoopCounter ;
359+ return isValidHash && isValidCounter1 && isValidCounter2 ;
360360 }
361361
362362 internal static string ToXRayTraceIdFormat ( string traceId )
0 commit comments