private void LogSpan(Span span) { var memoryStream = new MemoryStream(); _spanSerializer.SerializeTo(memoryStream, span); var serializedSpan = memoryStream.ToArray(); _spanSender.Send(serializedSpan); Statistics.UpdateSpanSent(); Statistics.UpdateSpanSentBytes(serializedSpan.Length); }
public void Report(Span span) { byte[] serializedSpan = null; using (var memoryStream = new MemoryStream()) { _spanSerializer.SerializeTo(memoryStream, span); serializedSpan = memoryStream.ToArray(); } _sender.Send(serializedSpan); _statistics.UpdateSpanSent(); _statistics.UpdateSpanSentBytes(serializedSpan.Length); }
/// <summary> /// Send the data if the current instance is not throttled, discard the data otherwise. /// </summary> /// <param name="data"></param> public void Send(byte[] data) { lock (_lockObject) { _requestsReceived++; if (DecrementBucket()) { _underlyingSender.Send(data); } else { _throttledRequests++; StartLogTimer(); } if (!ShouldLogThrottling()) { return; } LogThrottling(); ResetLogCountersAndTimer(); } }