Repository navigation
Conversation
Matches a span against five TraceSamplingRules that mix the matcher kinds Matchers.compileGlob produces (any, exact and wildcard globs): the first rule matching, only the last, none, and none with a 500-character resource. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matchers.compileGlob turned every glob other than "*" and an exact name into a case-insensitive java.util.regex Pattern, which created a Matcher on every match. It now uses the toolbox's GlobMatcher, which gives the same results without allocating. GlobPattern, which built those regexes, has no other users and is removed. One result changes: GlobPattern didn't escape '+', so it reached the regex as a quantifier. The glob a+b* matched aabc, and c++* couldn't match the text c++17. '+' is now the literal it is in glob syntax. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Matchers.compileGlob no longer matches with a regex, and GlobPattern, which built it, is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LLM ValidationLLM Validation Gate — java-agent-instructions✅ PASS
6 case(s) · quality 81.5 → 81.9 (+0.4) · win-rate 50% [47%–53%] Details — analysis and per-case resultsAnalysisChanged instruction file(s): No safety or blocking-case regressions across 6 case(s). Overall pairwise win-rate 50% [47%–53%], quality +0.4 — see the verdict above for whether that clears the noise band. Results
Cases
Per-dimension scores, token usage, latency, and estimated cost are in the CI job logs. |
Contributor
Contributor
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Does This Do
Trace and span sampling rules now match service, operation, resource and tag globs with
GlobMatcher, the toolbox's engine-free matcher from #13597, instead of a regex.Matchers.compileGlobstill handles*and exact names on their own; only the wildcard globs change.GlobPattern, which built the regexes, has no other users and is removed.Adds
SamplingRuleMatchBenchmark(dd-trace-core JMH) in its own commit, ahead of the change, so the same benchmark measures before and after.Motivation
Every wildcard glob was a case-insensitive
java.util.regex.Pattern, so every match against a span created aMatcher.RuleBasedTraceSamplerwalks the rules until one matches, which means the rules ahead of a match, or every rule when none matches, all pay that cost on every trace's sampling decision.GlobMatchergives the same results without allocating.Additional Notes
One behavior change,
+:GlobPattern.globToRegexdidn't escape+, so it reached the regex as a quantifier. The globa+b*matchedaabc, andc++*couldn't match the textc++17.+is now the literal it is in glob syntax.MatchersTestpins the new behavior.Same results otherwise:
GlobMatchermatches the regex the glob translates to, including its handling of line terminators, surrogate pairs and ASCII-only case folding (see Add an engine-free GlobMatcher to the toolbox #13597's differential tests).Benchmark: five
TraceSamplingRules mixing any, exact and wildcard globs, so theMatchercall sites see the same mix of receiver types as in production. Cases: the first rule matches, only the last, none, and none with a 500-character resource.Timing:
SamplingRuleMatchBenchmarkon JDK 21, 3 forks per commit alternated, 4 threads, 3×5 s warmup, 5×5 s measurement,-prof gc, steal 0.2%. Median fork in ns/op per thread (min–max). Before is the benchmark commit; after is the switch toGlobMatcher. Later commits on this branch don't change matching.Matcherper span.none-longstill costs about 3 µs: one rule's* /health*searches the 500-character resource, at about 5 ns per character. That's more thanGlobMatcherBenchmark's 1.4 ns per character on aString. The span's resource is aCharSequence, so each character read is an interface call, which may explain the difference. I haven't profiled it.Stacked on Add an engine-free GlobMatcher to the toolbox #13597.
Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issue🤖 Generated with Claude Code