Skip to content
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

Size based EventId LogEventProperty cache #259

Closed
AndreReise opened this issue Oct 31, 2024 · 0 comments
Closed

Size based EventId LogEventProperty cache #259

AndreReise opened this issue Oct 31, 2024 · 0 comments

Comments

@AndreReise
Copy link

AndreReise commented Oct 31, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant