-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trace is not displayed. #67
Comments
I have this problem also - it's because the foreach (var property in evnt.Properties)
{
_logFormatter.WritePropertyAsJson(propStruct, property.Key, property.Value);
HandleSpecialProperty(log, property.Key, property.Value);
}
private void HandleSpecialProperty(LogEntry log, string key, LogEventPropertyValue value)
{
if (_sinkOptions.UseLogCorrelation)
{
if (key.Equals("TraceId", StringComparison.OrdinalIgnoreCase))
log.Trace = $"projects/{_projectId}/traces/{GetString(value)}";
if (key.Equals("SpanId", StringComparison.OrdinalIgnoreCase))
log.SpanId = GetString(value);
if (key.Equals("TraceSampled", StringComparison.OrdinalIgnoreCase))
log.TraceSampled = GetBoolean(value);
}
static string GetString(LogEventPropertyValue v) => (v as ScalarValue)?.Value?.ToString() ?? "";
static bool GetBoolean(LogEventPropertyValue v) => (v as ScalarValue)?.Value is true;
} These properties integrate with the |
Serilog starting from v3.1.0 adds two new first-class properties to LogEvent: TraceId and SpanId. These are set automatically in Logger.Write() to the corresponding property values from System.Diagnostics.Activity.Current.
Serilog starting from v3.1.0 adds two new first-class properties to LogEvent: TraceId and SpanId. These are set automatically in Logger.Write() to the corresponding property values from System.Diagnostics.Activity.Current.
I have deployed an application developed in .Net 6 to Cloud Run. Although I have set UseLogCorrelation to True, the Trace is not being displayed in the output logs. Is there a mistake in my configuration?
Program.cs
Controller
Log
The text was updated successfully, but these errors were encountered: