Gibraltar Support

Start a new topic

Ability to define metrics views by attribute in the source code

When developing or analysing Metrics in Loupe Desktop we need to (re)create the Graph/Chart/Grid views every time we open a session. The ability to persist the created views would be very welcome and I believe are already planned. However, this will still require us to create and persist the views in Loupe Desktop and (like user settings) will likely be available only on the workstation it was created.

I think an attribute based view definition at the source code level, would be a convenient way to define an ‘persist’ the views, ensuring they would be available in any Loupe installation and perhaps even online if graphing tools are available.

It’s also very natural that the programmer creating the metrics, creates the default views in which they will be presented and analysed.

Consider a simple CommandExecution EventMetric to record the duration and count of each command executed in an application. Imagine you could define the default view with something like this:

[MetricsViewAttribute ( Type = ViewType.Chart, CounterName = nameof(Duration), GroupedBy = nameof(Command), etc…] 
[EventMetric("Loupe", "Command", "Command Execution", Caption = "Command Execution Performance")] public class CommandExecutionMetric : MetricBase 


Of course, this is a very simple scenario, but it would cover 99% of my needs.

What do you guys think?

1 person likes this idea

I agree a 25 parameters attribute is not a viable solution. Perhaps it could be simpler to have dedicated attributes to reduce the params... something like GraphViewMetricAttribute, GridViewMetricAttribute and ChartViewMetricAttribute. If it gets too complex, you could even provide a 'Copy C# Attribute To Clipboard' command in Loupe Desktop, where we would create the desired view and with one click, copy the c# formatted attribute to clipboard, ready to be pasted in VS!

I don't know how other use it, but my current graphing needs are generally very simple: A combination of count and/or duration grouped by one of the metric property. Nothing super fancy.

I like this idea - a way to extend what the developer does on a given "agent" to indicate common views/analysis of the data beyond just the metadata of the raw information collected.  I suspect for us the biggest risk is not going too far with it and making it too complicated to bother with.  This would be useful for us with our intrinsic agents as well (I'm looking at you, Loupe Agent for Entity Framework) where there are some clear charts/graphs that are useful but don't occur to most folks to set up in Desktop (and lets face it, who likes setting those things up over and over...)

Login to post a comment