-
Notifications
You must be signed in to change notification settings - Fork 22
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
Use Seq.Syntax
for message templating/property substitution?
#68
Comments
Seq.Syntax
for message templating/property substitution?
Pure speculation, from a total outsider (in terms of how seq works) The flow would be like: Receive Log Event data > submit request to Seq Templating Service > Receive Templated Result > Process the result making use of the template. Does any of that make sense? I guess the main point of this would be, rather than a plugin developer consuming templating capability as a library that it would use to produce / expand a template, it would instead be asking some seq service for an expanded result based on whatever trmplate is configured in seq and howver seq chooses to expand that payload based on that setup Example:-
|
The mechanism might end up slightly different, but this is the kind of thing we've considered a few times and will definitely be thinking about for the next revision of the apps system. In the short term, building out consistent support for the same syntax across apps, via Seq.Syntax, is an incremental improvement in this direction :-) |
While Seq has always supported nested structures in properties, the more recent versions make heavier use of this via the
@Resource
object populated from OpenTelemetry resource attributes.These kinds of events frequently carry important information nested under
@Resource
, for example@Resource.ApplicationName
in the example presented at: datalust/seq-tickets#1937.The app doesn't currently support substituting nested property paths into messages, nor including them as attachments in the comma-separated list -
a.b
is interpreted as a property with a dot in its name@Properties['a.b']
.While it would be possible to come up with a more elaborate syntax here, Seq.App.Mail.Smtp, Seq.App.Mail.Microsoft365, and Seq.App.HttpRequest now use a common Seq.Syntax package to deal with this.
Seq.Syntax provides templating along the lines of:
The great things about Seq.Syntax are:
@Level
,@Message
,@Exception
, etc.)Nested.Properties
and@Properties['irregular-names']
using identical syntax to Seq itself... in fact, nearly 100% of Seq's expression language is covered, so
Substring()
,if
, ... etc. all work.We're also aiming for syntax highlighting and autocomplete in a future Seq version for app settings tagged with
Syntax="template"
orSyntax="expression"
, and on this basis we think it'll become commonplace to use with Seq apps (replacing the mix of Handlebars and custom syntaxes the app ecosystem uses today).The downsides, and why there's a
?
in the title and not an all-out pitch here are:ISubscribeToAsync<LogEvent>
instead of theISubscribToAsync<LogEventData>
implementation the app uses right now; bringing in a dependency on Serilog'sLogEvent
is not ideal, though it's also something we want to break upstream, so should hopefully only be a matter of time, and{braces}
instead of[square brackets]
for property substitutions - this would mean some busywork and potential breakage for consumers updating to the new (2.0.0) version, andIncludedProperties
app setting, dotted property names likea.b
today would need to be rewritten as@Properties['a.b']
to avoid them being interpreted differently after then change.So definitely some drawbacks and support load.
The alternatives (besides preserving the status quo) I think are:
@Resource
and/or nested property names,Neither seem great but both are reasonable I guess, if the drawbacks are too great.
See also #25 (comment)
The text was updated successfully, but these errors were encountered: