From d8fd78a17b9e36ad0fe700aad80db591b4796072 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Tue, 5 Dec 2023 15:08:14 +1000 Subject: [PATCH] Revert "Revert "Package updates, use Serilog built-ins for trace and span ids"" --- .../Seq.App.Mail.Microsoft365.csproj | 6 +++--- src/Seq.App.Mail.Smtp/Seq.App.Mail.Smtp.csproj | 2 +- src/Seq.Mail/Seq.Mail.csproj | 4 ++-- src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs | 5 +++-- src/Seq.Syntax/Expressions/BuiltInProperty.cs | 2 ++ .../Compilation/Linq/LinqExpressionCompiler.cs | 2 ++ src/Seq.Syntax/Seq.Syntax.csproj | 2 +- test/Seq.Mail.Tests/Seq.Mail.Tests.csproj | 8 ++++---- test/Seq.Syntax.Tests/Seq.Syntax.Tests.csproj | 8 ++++---- 9 files changed, 22 insertions(+), 17 deletions(-) diff --git a/src/Seq.App.Mail.Microsoft365/Seq.App.Mail.Microsoft365.csproj b/src/Seq.App.Mail.Microsoft365/Seq.App.Mail.Microsoft365.csproj index bee76c8..5ec53cb 100644 --- a/src/Seq.App.Mail.Microsoft365/Seq.App.Mail.Microsoft365.csproj +++ b/src/Seq.App.Mail.Microsoft365/Seq.App.Mail.Microsoft365.csproj @@ -24,9 +24,9 @@ - - - + + + diff --git a/src/Seq.App.Mail.Smtp/Seq.App.Mail.Smtp.csproj b/src/Seq.App.Mail.Smtp/Seq.App.Mail.Smtp.csproj index 9c35ecb..1219a07 100644 --- a/src/Seq.App.Mail.Smtp/Seq.App.Mail.Smtp.csproj +++ b/src/Seq.App.Mail.Smtp/Seq.App.Mail.Smtp.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/Seq.Mail/Seq.Mail.csproj b/src/Seq.Mail/Seq.Mail.csproj index 793edd6..8309ace 100644 --- a/src/Seq.Mail/Seq.Mail.csproj +++ b/src/Seq.Mail/Seq.Mail.csproj @@ -23,9 +23,9 @@ - + - + diff --git a/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs b/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs index 7bf6064..14464e6 100644 --- a/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs +++ b/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs @@ -17,9 +17,10 @@ public override bool TryResolveBuiltInPropertyName(string alias, [NotNullWhen(tr "EventType" => "@i", "Exception" => "@x", "Id" => "@p['@seqid']", - "TraceId" or "@tr" => "@p['@tr']", - "SpanId" or "@sp" => "@p['@sp']", + "TraceId" => "@tr", + "SpanId" => "@sp", "Resource" or "@ra" => "@p['@ra']", + "ParentId" or "@ps" => "@p['@ps']", "Arrived" or "Document" or "Data" => "undefined()", _ => null }; diff --git a/src/Seq.Syntax/Expressions/BuiltInProperty.cs b/src/Seq.Syntax/Expressions/BuiltInProperty.cs index ae8d502..4d569e5 100644 --- a/src/Seq.Syntax/Expressions/BuiltInProperty.cs +++ b/src/Seq.Syntax/Expressions/BuiltInProperty.cs @@ -25,4 +25,6 @@ static class BuiltInProperty public const string Properties = "p"; public const string Renderings = "r"; public const string EventId = "i"; + public const string TraceId = "tr"; + public const string SpanId = "sp"; } \ No newline at end of file diff --git a/src/Seq.Syntax/Expressions/Compilation/Linq/LinqExpressionCompiler.cs b/src/Seq.Syntax/Expressions/Compilation/Linq/LinqExpressionCompiler.cs index 442c8e2..6c229eb 100644 --- a/src/Seq.Syntax/Expressions/Compilation/Linq/LinqExpressionCompiler.cs +++ b/src/Seq.Syntax/Expressions/Compilation/Linq/LinqExpressionCompiler.cs @@ -219,6 +219,8 @@ protected override ExpressionBody Transform(AmbientNameExpression px) null)), BuiltInProperty.Renderings => Splice(context => Intrinsics.GetRenderings(context.LogEvent, formatProvider)), BuiltInProperty.EventId => Splice(context => Intrinsics.GetEventId(context.LogEvent)), + BuiltInProperty.TraceId => Splice(context => new ScalarValue(context.LogEvent.TraceId)), + BuiltInProperty.SpanId => Splice(context => new ScalarValue(context.LogEvent.SpanId)), var alias when _nameResolver.TryResolveBuiltInPropertyName(alias, out var target) => Transform(ExpressionCompiler.Translate(new ExpressionParser().Parse(target))), _ => LX.Constant(null, typeof(LogEventPropertyValue)) diff --git a/src/Seq.Syntax/Seq.Syntax.csproj b/src/Seq.Syntax/Seq.Syntax.csproj index a1a0cd6..d9103c5 100644 --- a/src/Seq.Syntax/Seq.Syntax.csproj +++ b/src/Seq.Syntax/Seq.Syntax.csproj @@ -21,7 +21,7 @@ - + diff --git a/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj b/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj index 1edc19b..c9fdaf5 100644 --- a/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj +++ b/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj @@ -5,13 +5,13 @@ true - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + diff --git a/test/Seq.Syntax.Tests/Seq.Syntax.Tests.csproj b/test/Seq.Syntax.Tests/Seq.Syntax.Tests.csproj index 66fe62d..227c6b2 100644 --- a/test/Seq.Syntax.Tests/Seq.Syntax.Tests.csproj +++ b/test/Seq.Syntax.Tests/Seq.Syntax.Tests.csproj @@ -5,13 +5,13 @@ true - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + +