Skip to content

Commit 926cada

Browse files
committed
fix: return null for id attribute when targeting key is absent
Per review feedback from dd-oleksii: when targeting key is null, ResolveAttribute("id") should return null like any other missing attribute, not throw MissingTargetingKeyException. The shard path in GetShard() still correctly throws when targeting key is needed.
1 parent 7865f8b commit 926cada

1 file changed

Lines changed: 0 additions & 5 deletions

File tree

tracer/src/Datadog.Trace/FeatureFlags/FeatureFlagsEvaluator.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -417,11 +417,6 @@ internal static int GetShard(string salt, string? targetingKey, int totalShards)
417417
// Special case "id": if not present, use targeting key
418418
if (name == "id" && !context.Attributes.ContainsKey(name))
419419
{
420-
if (context.TargetingKey is null)
421-
{
422-
throw new MissingTargetingKeyException();
423-
}
424-
425420
return context.TargetingKey;
426421
}
427422

0 commit comments

Comments
 (0)