Skip to content
/ nwiretap Public

A tool for monitoring different points inside .NET Based applications

Notifications You must be signed in to change notification settings

drdk/nwiretap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 

Repository files navigation

#About nwiretap NWiretap is a set of simple tools to monitor points of interest inside your .NET Applications

Create a class with a set of instruments:

public class HomeController : Controller
{
    private static readonly IMeter Meter = Instrument.Meter(typeof(HomeController), "General performance", "Index hits", 3000);
    private static readonly IInvocationTimer Timer = Instrument.Timer(typeof(HomeController), "General performance", "Database fetch", 3000);
    private static readonly ILogger Logger = Instrument.Logger(typeof(HomeController), "General logging", "Log output", 20);
        
    public ActionResult Index()
    {
        Meter.Tick();
        var s = Timer.Time(() => Database.GetSomeStuff());

        Logger.Log("Index was hit");
        return View();
    }
}

The measurements can then be obtained as JSON by acessing /nwiretap (this url is configurable) on your application:

[
   {
      "GroupName":"General performance",
      "Instruments":[
         {
            "InstrumentID":1,
            "InstrumentIdent":"Database fetch",
            "InstrumentType":"InvocationTimer",
            "ImplementorType":"HomeController",
            "InstrumentGroup":"General performance",
            "Measurement":{
               "Samples":[
                  {
                     "AverageInvokationTimeMs":0,
                     "MaxInvocationTimeMs":0,
                     "MinInvocationTimeMs":0
                  },
                  {
                     "AverageInvokationTimeMs":0,
                     "MaxInvocationTimeMs":0,
                     "MinInvocationTimeMs":0
                  },
                  {
                     "AverageInvokationTimeMs":0,
                     "MaxInvocationTimeMs":0,
                     "MinInvocationTimeMs":0
                  },
                  {
                     "AverageInvokationTimeMs":0,
                     "MaxInvocationTimeMs":0,
                     "MinInvocationTimeMs":0
                  },
                  {
                     "AverageInvokationTimeMs":0,
                     "MaxInvocationTimeMs":0,
                     "MinInvocationTimeMs":0
                  },
                  {
                     "AverageInvokationTimeMs":0,
                     "MaxInvocationTimeMs":0,
                     "MinInvocationTimeMs":0
                  },
                  {
                     "AverageInvokationTimeMs":0,
                     "MaxInvocationTimeMs":0,
                     "MinInvocationTimeMs":0
                  }
               ],
               "CurrentFrequency":0,
               "Ticks":1
            }
         },
         {
            "InstrumentID":0,
            "InstrumentIdent":"Index hits",
            "InstrumentType":"Meter",
            "ImplementorType":"HomeController",
            "InstrumentGroup":"General performance",
            "Measurement":{
               "CurrentFrequency":0,
               "Ticks":1
            }
         }
      ]
   },
   {
      "GroupName":"General logging",
      "Instruments":[
         {
            "InstrumentID":2,
            "InstrumentIdent":"Log output",
            "InstrumentType":"Logger",
            "ImplementorType":"HomeController",
            "InstrumentGroup":"General logging",
            "Measurement":{
               "Entries":[
                  {
                     "Line":"Index was hit",
                     "Created":"00:06:03"
                  }
               ]
            }
         }
      ]
   }
]

About

A tool for monitoring different points inside .NET Based applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published