Skip to content

Commit

Permalink
Fix NPE in dropped spans stats (#3590)
Browse files Browse the repository at this point in the history
* fix npe

* update changelog
  • Loading branch information
SylvainJuge authored May 2, 2024
1 parent c339b00 commit b14f658
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
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

0 comments on commit b14f658

Please sign in to comment.