datalust / seq-tickets

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

Empty objects in event properties cause rendering of the event property list to fail #2180

Closed c0shea closed 6 months ago

c0shea commented 6 months ago

Describe the bug Previously, when I clicked on an event in the stream, it would expand and show all of the properties for that event. Now, it only shows a couple properties and the rest are not exposed in the UI. I have to copy or download the raw JSON to view the other properties. I was trying to quickly see the UserName property to see who made the request to the API that failed to trace it through, but that was no longer visible.

When I uncheck the "Flatten the event properties view" setting in my preferences, all of the properties properly display. I have a feeling the flatten logic is breaking when it encounters the empty FormData collection in the JSON. That happens to be immediately after the Environment property, which is the last one shown in the UI.

To Reproduce Steps to reproduce the behavior:

  1. Check off "Flatten the event properties view" in your user preferences
  2. Send an event in to Seq that you know has a lot of properties attached. In my use case, it's the logs from our web service that tracks all of the requests and responses.
  3. Click on one of the events to expand its properties
  4. Only the AbsoluteUri, Application, Elapsed, and Environment properties are shown
  5. The other properties sent on the event are missing. These include:
    • FormData
    • Headers
    • MachineName
    • Outcome
    • RequestBody
    • RequestDto
    • RequestId
    • Route
    • StatusCode
    • StatusDescription
    • UserName
    • Verb

Expected behavior All of the properties for the event should be visible, as they used to be. I know they all used to be shown, as the behavior changed for how nested properties were displayed (FormData, RequestBody, and RequestDto).

Screenshots image

Environment (please complete the following information):

Additional context This seems to have started after the upgrade to the most recent version. I know it was working in one of the first 2024.1 releases, but I may have missed some of the versions before the latest.

Full message

{
    "@i": "a48a3de8",
    "@l": "Error",
    "@m": "HTTP GET to /locationorders failed with status code 500 in 770919.206 ms",
    "@mt": "HTTP {Verb} to {Route} {Outcome} with status code {StatusCode} in {Elapsed:0.000} ms",
    "@r": [
        "770919.206"
    ],
    "@t": "2024-04-22T13:05:36.2325425Z",
    "@x": "OutOfMemoryException Exception of type 'System.OutOfMemoryException' was thrown.\r\n[FindLocationOrders: 4/22/2024 1:05:35 PM]:\n[REQUEST: {LocationOrderType:WarehouseStoreOrder,ExpectedDeliveryDateRangeStart:1904-04-20,ExpectedDeliveryDateRangeEnd:2024-04-20,IsDeleted:False}]\r\nSystem.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.\r\n   at System.Collections.Generic.Dictionary`2.Resize(Int32 newSize, Boolean forceNewHashCodes)\r\n   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)\r\n   at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)\r\n   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)\r\n   at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)\r\n   at Api.Core.Data.Repository.LocationOrderRepository.FindShippedQuantitiesForLocationOrderItemsAsync(IDbConnection db, TemporaryTableScope scope, IEnumerable`1 items) in D:\\a\\34\\s\\Api\\Api.Core\\Data\\Repository\\LocationOrderRepository.cs:line 1232\r\n   at Api.Core.Data.Repository.LocationOrderRepository.FindLocationOrdersAsync(FindLocationOrders request) in D:\\a\\34\\s\\Api\\Api.Core\\Data\\Repository\\LocationOrderRepository.cs:line 319\r\n   at Api.Core.Service.LocationOrderService.Get(FindLocationOrders request) in D:\\a\\34\\s\\Api\\Api.Core\\Service\\LocationOrderService.cs:line 26\r\n   at ServiceStack.Host.ServiceRunner`1.ExecuteAsync(IRequest req, Object instance, TRequest requestDto) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Host/ServiceRunner.cs:line 149\r\n",
    "AbsoluteUri": "https://MYDOMAINHERE/locationorders?locationOrderType=WarehouseStoreOrder&expectedDeliveryDateRangeStart=1904-04-20&expectedDeliveryDateRangeEnd=2024-04-20&isDeleted=False",
    "Application": "Api",
    "Elapsed": 770919.2063,
    "Environment": "Dev",
    "FormData": {},
    "Headers": {
        "Accept": "application/jsv",
        "User-Agent": "ServiceStackClient/6.110",
        "X-Forwarded-For": "MYINTERNALIPHERE"
    },
    "MachineName": "MYWEBSERVERHERE",
    "Outcome": "failed",
    "RequestBody": "",
    "RequestDto": {
        "ExpectedDeliveryDateRangeEnd": "2024-04-20T00:00:00.0000000-04:00",
        "ExpectedDeliveryDateRangeStart": "1904-04-20T00:00:00.0000000-04:00",
        "IsDeleted": false,
        "LocationOrderType": "WarehouseStoreOrder",
        "__type": "Api.Model.Core.FindLocationOrders, Api.Model"
    },
    "RequestId": "40002430-0001-ed00-b63f-84710c7967bb",
    "Route": "/locationorders",
    "StatusCode": 500,
    "StatusDescription": "OutOfMemoryException",
    "UserName": "Fulfillment",
    "Verb": "GET"
}
nblumhardt commented 6 months ago

Checking this out now - thanks for the report @c0shea

nblumhardt commented 6 months ago

This is caused by property "flattening" when empty objects like FormData: {} are present on the event:

image

Deselecting "Flatten the event properties view" in your user preferences:

image

Will cause the full event to display properly:

image

We'll ship a patch for this in the next day or two. Thanks for spotting it, @c0shea!

c0shea commented 6 months ago

Thanks @nblumhardt for the quick turnaround!

nblumhardt commented 6 months ago

Published in 2024.2.11456 now 🚀