You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.
RemoteReporter uses ArrayBlockingQueue to store commands, but adding new commands is done with ArrayBlockingQueue.add(x) method which:
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available. When using a capacity-restricted queue, it is generally preferable to use offer.
Right now RemoteReporter.report checks if queue is full but it is not thread-safe.
It would be better to avoid IllegalStateException by using RemoteReporter.offer(x), and if it fails (returns false) increment reporterDropped metric.
New version:
public void report(Span span) {
// Its better to drop spans, than to block here
boolean added = commandQueue.offer(new AppendCommand(span));
if(!added) {
metrics.reporterDropped.inc(1);
}
}
The other adds should also offer instead.
The text was updated successfully, but these errors were encountered:
RemoteReporter uses ArrayBlockingQueue to store commands, but adding new commands is done with
ArrayBlockingQueue.add(x)
method which:Right now
RemoteReporter.report
checks if queue is full but it is not thread-safe.It would be better to avoid
IllegalStateException
by usingRemoteReporter.offer(x)
, and if it fails (returns false) incrementreporterDropped
metric.New version:
The other
adds
should alsooffer
instead.The text was updated successfully, but these errors were encountered: