How to display timeline information for routines used by controllers in glimpse/Asp.NET MVC

StackOverflow https://stackoverflow.com/questions/18721058

  •  28-06-2022
  •  | 
  •  

Question

I am currently using Asp.Net MVC 4 and I would like to include the time of some routines used by my controllers in the glimpse's timeline tab.

I know that I have to create an ITimeLineMessage Implementation and send the timing information with a message broker. But how to create the ITimeLineMessage ?

Was it helpful?

Solution 2

Here is a way but its not very nice and not supported:

  • Retrieve the MessageBroker for the following static method:
    • Glimpse.Core.Framework.GlimpseConfiguration.GetConfiguredMessageBroker()
  • Then publish an ITimelineMessage to the MessageBroker:
    • messageBroker.Publish(timelineMessage)
    • Note, you could create a generic message type that you use over again that implements ITimelineMessage
  • To populate the properties of your ITimelineMessage implementation you might also need IExecutionTimer. You can get this via the following static method:
    • Glimpse.Core.Framework.GlimpseConfiguration.GetConfiguredTimerStrategy()
    • The above will have the knowledge of when the request started for offsets etc.

As @nikmd23 said, we know this is about as bad as what you could ever want to do but v2 will see a much much more simple way of doing this.

OTHER TIPS

Here is an implementation using anthonyv's suggestion:

https://gist.github.com/droyad/8292852

You can create any custom class you want, that class just has to implement ITimelineMessage.

As a general heads up, we are currently working through a way to make this WAY easier. If the approach described there interests you, please do provide your feedback.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top