feat: add TagList overload to Metrics-Emit APIs as Attributes parameter #5241
1 issue
Low
TagList null values bypass null check via `!`, producing spurious null-not-supported warnings during serialization - `src/Sentry/SentryMetricEmitter.cs:62`
In SentryAttributes.SetAttributes(in TagList) (new in this PR), TagList exposes entries as KeyValuePair<string, object?> and explicitly permits null values. The new code uses new SentryAttribute(attribute.Value!), silently storing null values into the dictionary. At serialization time, SentryAttributeSerializer.WriteAttribute detects null and emits LogWarning("'null' is not supported by Sentry-Attributes and will be ignored."). This contradicts the documented behavior of nulls being silently ignored (see XML doc on TryGetAttribute: 'null → ignored'), and differs from the IEnumerable/ReadOnlySpan overloads whose KeyValuePair<string, object> element types statically preclude nulls. Recommend skipping null entries explicitly: if (attribute.Value is not null) this[attribute.Key] = new SentryAttribute(attribute.Value);.
4 skills analyzed
| Skill | Findings | Duration | Cost |
|---|---|---|---|
| security-review | 0 | 5.8s | $0.23 |
| code-review | 0 | 10m 8s | $1.40 |
| find-bugs | 1 | 8m 13s | $4.15 |
| gha-security-review | 0 | 8m 9s | $0.16 |
⏱ 26m 35s · 3.2M in / 164.8k out · $5.94