Match OpenTelemetry subject filters without per-message allocation#1206
Conversation
FilterSubjects split the subject into a string[] on every traced operation. Walk the subject token by token with spans instead; the patterns are still tokenized once at configuration time. Adds coverage for empty-token boundaries.
|
Claude finished @mtmk's task in 3m 39s —— View job PR Review
SummaryThe optimization is correct and sound. Eliminating Correctness trace for key cases:
The Two minor comments left inline:
Neither is a bug. The allocation removal is correct, and the edge-case tests match the old code's behaviour exactly. |
|
@claude the latest commit addresses your review comments, please re-check. |
|
Claude finished @mtmk's task in 45s —— View job Re-checking PR after latest commit
Both previous review comments have been fully addressed in commit Comment 1 — The imprecise return !exhausted; // '>' needs at least one remaining subject token; exhausted means the subject is fully consumed✅ Resolved. Comment 2 — Test method naming ( Both test methods have been renamed to include // Trailing dots are not valid in NATS subjects; this pins the matcher to the same
// behavior as the previous Split-based implementation, not protocol compliance.
public void FilterSubjects_invalid_subject_empty_trailing_token(...)
// Consecutive dots are not valid in NATS subjects; this pins the matcher to the same
// behavior as the previous Split-based implementation, not protocol compliance.
public void FilterSubjects_invalid_subject_greater_than_spans_empty_tokens(...)✅ Resolved — the intent is now unambiguous. No remaining concerns. The PR is good to merge. |
The subject filter installed by FilterSubjects split the subject into a string array on every traced publish/subscribe when a filter is configured. Match the subject against the pre-tokenized patterns by walking it token by token with spans, dropping the per-message allocation. Adds coverage for empty-token boundaries (trailing and consecutive dots).