datalust / seq-tickets

Issues, design discussions and feature roadmap for the Seq log server
https://datalust.co/seq
98 stars 5 forks source link

Event viewer now shows `$type` property, and sorts structured object fields alphabetically (2023.1 change) #2109

Closed spointeau closed 6 months ago

spointeau commented 9 months ago

Describe the bug in version 2022.1, the property "$type" was not displayed and the property ordering of the json object followed the compact json formatter. In version 2024.1, "$type" is displayed, and json properties are ordered by alphabetical order (a-z)

Expected behavior The old behavior of 2022.1 was good, we were not annoyed by $type and json properties were as serialized, following the class member ordering.

Screenshots image

Environment (please complete the following information):

nblumhardt commented 9 months ago

Thanks for the heads-up, we'll take a look.

Is the issue a breaking change for you because you rely on consuming the value of the object programmatically? Thanks!

thomasarduin commented 9 months ago

Hello @nblumhardt,

This is a breaking change for us (I work with @spointeau) because we rely on a specific order for properties to be read. If Seq sorts these properties alphabetically, it disrupts our workflow.

For instance, when we view EDI x12 messages inside Seq, the sequence of segments doesn't adhere to x12 requirements. As such, we won't be able to use it in the 2024.01 version.

image

nblumhardt commented 9 months ago

Thanks for the additional info, @thomasarduin.

I believe the formatter tweak discussed in https://github.com/serilog/serilog-formatting-compact/issues/64 will address the $type issue.

The ordering problem will need some more analysis, we'll update this ticket with our findings.

Best regards, Nick

nblumhardt commented 8 months ago

Hi @thomasarduin; thanks for your patience.

Unfortunately this has been a deeply-ingrained change since Seq 2023.1; it's possible we could address this or add a means to work around it in a future update, but because the code involved is performance-sensitive it's not likely this can be reversed in a near-term release.

If you need a precise 1:1 representation of the original object, logging it as a string, and using FromJson(x) to convert to structured data at query time is the best available workaround.

Sorry about the workflow disruption. If you can spot any other ways we could potentially support your use case please let me know.

Sebbl22 commented 8 months ago

We appreciate the alphabetical ordering of properties, since it makes them easier to find.

nblumhardt commented 6 months ago

Hi everyone; unfortunately, although we recognize that there's a valid request here, there are enough benefits both for the implementation and usage in the current alphabetical ordering scheme that we've decided to leave this as-is.

To guarantee a particular representation in Seq, raw string data is the recommended format - e.g. storing the original JSON in its own property at the source will provide the needed info here.

Thanks again, Nick