diff --git a/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs b/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs index d7febca..3c456ef 100644 --- a/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs +++ b/src/Seq.Syntax/BuiltIns/SeqBuiltInPropertyNameResolver.cs @@ -13,7 +13,7 @@ public override bool TryResolveBuiltInPropertyName(string alias, [NotNullWhen(tr { target = alias switch { - "Properties" => "{..@p, @seqid: undefined(), @i: undefined(), @tr: undefined(), @sp: undefined(), @ra: undefined(), @st: undefined(), @ps: undefined(), @sa: undefined()}", + "Properties" => "{..@p, @seqid: undefined(), @i: undefined(), @ra: undefined(), @st: undefined(), @ps: undefined(), @sa: undefined()}", "Timestamp" => "@t", "Level" => "@l", "Message" => "@m", @@ -21,11 +21,11 @@ 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']", - "Start" or "st" => "@p['@st']", "ParentId" or "ps" => "@p['@ps']", + "Start" or "st" => "@p['@st']", "Scope" or "sa" => "@p['@sa']", "Elapsed" => "_Elapsed(@st, @t)", "Arrived" or "Document" or "Data" => "undefined()", 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 68ca324..bc35531 100644 --- a/src/Seq.Syntax/Seq.Syntax.csproj +++ b/src/Seq.Syntax/Seq.Syntax.csproj @@ -20,7 +20,7 @@ - + diff --git a/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj b/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj index 93e7fd5..70ac1a6 100644 --- a/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj +++ b/test/Seq.Mail.Tests/Seq.Mail.Tests.csproj @@ -11,7 +11,7 @@ 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 7067b9c..5e981ea 100644 --- a/test/Seq.Syntax.Tests/Seq.Syntax.Tests.csproj +++ b/test/Seq.Syntax.Tests/Seq.Syntax.Tests.csproj @@ -11,7 +11,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - +