private async Task SendMetricsAsync(long timestamp, string attributes, byte[] metrics) { if (!_cluster.IsConnected) // last chance to avoid an exception { _logger.LogDebug("Cannot send metrics, client is not connected."); return; } _logger.LogDebug("Send metrics."); var requestMessage = ClientStatisticsCodec.EncodeRequest(timestamp, attributes, metrics); var responseMessage = await _cluster.Messaging.SendAsync(requestMessage).CfAwait(); var _ = ClientStatisticsCodec.DecodeResponse(responseMessage); }
private void SendStatsToOwner(StringBuilder stats) { var request = ClientStatisticsCodec.EncodeRequest(stats.ToString()); try { _client.GetInvocationService().InvokeOnTarget(request, _ownerAddress); } catch (Exception e) { // suppress exception, do not print too many messages if (Logger.IsFinestEnabled()) { Logger.Finest("Could not send stats ", e); } } }