I wanted to make a MiniProfiler dashboard that would show stats of what we have profiled. Of course, to have good stats, the metrics needs to be saved in a database. I have studied your code to have an idea of how i could do that and i have a few questions for you.
Firstly, i wanted to extand your IStorage interface and use the code that was already there but i saw one major problem or maybe i missed something. The problem i see is when you use, for example, SqlServerStorage, the executed code is not async. I already saw this problem with your Sqlite demo. The webpages are really slow to show on my computer because of the storage mechanism. Since that i don’t want to slow down the user because i’m profiling it, this is a no go on that direction.
So my thoughts was to make another storage mechanism that would be async. When the profiler do his job, it will also call the second storage module to store permanantly the data somewhere without slowing down the user. But after that, i said to myself “why would duplicate the logic of the storage only to get what i need”. Well, this is where i think you could help me!
Like i said, maybe i missed something but i think your Storage module should be revised. I think that natively, the storage that is used to show the profiled metrics to the user should be really quick: memoryStorage and other quick storage like that. If we want persistance storage, then another module would do this job in async mode: database and alike.
So to summarize, we might need 2 storages module:
- On/Off depending if the end-user wants to see the metrics or not
- can it be async? the webpage would not have to wait for it, only the little UI could be delayed
- On/Off depending of the administers needs
- async so there’s no wait anywhere for the end-user
- could be used for analitics
I have no experience with async function so maybe there’s an easier solution for that. I would like to have your thoughts if possible.