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
Please answer these questions before submitting your issue.
Why do you submit this issue?
Question or discussion
Bug
Requirement
Feature or performance improvement
Requirement or improvement
Please describe about your requirements or improvement suggestions.
Example:
public class LoggerRequest
{
public string Message{ get; set; }
public Dictionary<string, object> Tags{ get; set; }
public LoggerSegmentReference SegmentReference { get; set; }
public long Date { get; set; }
}
This will allow custom logs to be processed without overwriting LoggerReporter
Example:
public async Task ReportAsync(IReadOnlyCollection<LoggerRequest> loggerRequests,
CancellationToken cancellationToken = default)
{
if (!_connectionManager.Ready)
{
return;
}
var connection = _connectionManager.GetConnection();
try
{
var stopwatch = Stopwatch.StartNew();
var client = new LogReportService.LogReportServiceClient(connection);
using (var asyncClientStreamingCall = client.collect(_grpcConfig.GetMeta(),
_grpcConfig.GetReportTimeout(), cancellationToken))
{
foreach (var loggerRequest in loggerRequests)
{
var logBody = new LogData()
{
TraceContext = new TraceContext()
{
TraceId = loggerRequest.SegmentReference?.TraceId ?? string.Empty,
TraceSegmentId = loggerRequest.SegmentReference?.SegmentId ?? string.Empty,
//SpanId=item.Segment
},
Timestamp = loggerRequest.Date,
Service = _instrumentConfig.ServiceName,
ServiceInstance = _instrumentConfig.ServiceInstanceName,
Endpoint = "",
Body = new LogDataBody()
{
Type = "text",
Text = new TextLog()
{
Text = Message,
},
},
Tags=...//todo loggerRequest.Tags
};
await asyncClientStreamingCall.RequestStream.WriteAsync(logBody);
}
await asyncClientStreamingCall.RequestStream.CompleteAsync();
await asyncClientStreamingCall.ResponseAsync;
stopwatch.Stop();
_logger.Information($"Report {loggerRequests.Count} logs. cost: {stopwatch.Elapsed}s");
}
}
catch (IOException ex)
{
_logger.Error("Report trace segment fail.", ex);
_connectionManager.Failure(ex);
}
catch (Exception ex)
{
_logger.Error("Report trace segment fail.", ex);
}
}
The text was updated successfully, but these errors were encountered:
Please answer these questions before submitting your issue.
Requirement or improvement
Example:
This will allow custom logs to be processed without overwriting
LoggerReporter
Example:
The text was updated successfully, but these errors were encountered: