Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix NPE in dropped spans stats #3590

Merged
merged 3 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Use subheadings with the "=====" level for adding notes for unreleased changes:
[float]
===== Bug fixes
* Fixed edge case where inferred spans could cause cycles in the trace parent-child relationships, subsequently resulting in the UI crashing - {pull}3588[#3588]
* Fix NPE in dropped spans statistics - {pull}3590[#3590]

[[release-notes-1.x]]
=== Java Agent version 1.x
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,13 @@ public void captureDroppedSpan(Span span) {
private Stats getOrCreateStats(ServiceTarget serviceTarget, Outcome outcome) {
StatsKey statsKey = statsKeyObjectPool.createInstance().init(serviceTarget, outcome);
Stats stats = statsMap.get(statsKey);
if (stats != null || statsMap.size() > 127) {
if (stats != null) {
statsKeyObjectPool.recycle(statsKey);
return stats;
}
if (statsMap.size() > 127) {
statsKeyObjectPool.recycle(statsKey);
}

stats = statsObjectPool.createInstance();

Expand Down
Loading