Skip to content

Size based EventId LogEventProperty cache #259

Closed
@AndreReise

Description

@AndreReise

Currently, the EventId LogEventProperty cache is already implemented. Unfortunately, the caching approach assumes that large event IDs are rare.

However, in the Microsoft logging documentation, large IDs are demonstrated.

Currently, I'm working on a proprietary framework where Event IDs are structured as follows:

From 100 to (exclusively) 200: IDs represent events related to 'A' logical context.
From 200 to (exclusively) 300: IDs represent events related to 'B'.

I wonder if other framework or library developers use a similar approach. If so, the current EventId caching mechanism may not work well, as a new LogEventProperty might be allocated per call. In the case of source-generated logging, which implicitly generates an EventId, this could become a problem.

image

I propose storing EventId.Id in a Dictionary<int, LogEventProperty> and limiting the maximum number of items in this dictionary. I may submit a PR once this idea is accepted.

Any thoughts or concerns?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions