0

How do I persist Glimpse (for MVC4) information for historical purposes? For example, I would like to store specific dashboard data items (e.g., time on the wire) a database, per request, so as to create a chart based on that. I have searched all over the docs and forums for something like this, but I have not found anything really useful for setting up this use case.

This question may be related to How glimpse persists debugging information?. It suggests implementing IDataStore However, if go down this route, how do I actually reference my interface implementation so my Glimpse installation will use it?

Community
  • 1
  • 1
prmph
  • 7,616
  • 11
  • 37
  • 46

1 Answers1

0

If you are only interested in persisting the data and getting it out independently (for your dashboard) that should be fairly easy. You will will probably want to inherit from ApplicationPersistenceStore (which implements IPersistenceStore) so that you get the out of the box behavior of the default PersistenceStore and just save off to your store before calling base.Seve(...).

In order to register the you will want to take a look at whats going on here. You will see that we look to the UserServiceLocator (which is a IServiceLocator) to see if you want to customize whats going on. To register your service locator, you can do this off the Glimpse config section. Here is an example of how to do it:

  <glimpse serviceLocatorType="Glimpse.Test.Core.TestDoubles.DummyServiceLocator, Glimpse.Test.Core" ...>

Let me know how you get on.

anthonyv
  • 2,455
  • 1
  • 14
  • 18
  • Thanks, but there is nothing to override on ApplicationPersistenceStore; How to I extend it's it's Save() method? I think it is better to implement IPersistenceStore using an internal ApplicationPersistenceStore. Then the ApplicationPersistenceStore also requires an IDataStore upon instantation, so I guess I will have to provide an implementation of that as well. – prmph Oct 04 '15 at 22:10
  • Got it working, thanks! But I wonder how to extract the display view timings data (such as total query, view, action/controller, and wire time) from the GlimpseRequest object passed to the Save() method of the my custom IPersistenceStore. Also, how do I enable such logging (but without displaying the Glimpse tabs to users) in production mode? – prmph Oct 04 '15 at 23:43
  • Look at the `DisplayData` property of the `GlimpseRequest` object passed into the the `Save(...)` method. I can't remember which key exactly it is but you should be able to set a break point and have a look for the data you need. – anthonyv Oct 05 '15 at 01:15