سؤال

I want to start monitoring the performance of my applications by logging business events. I was looking for something similiar to log4net or other logging libraries, but tailored for performance/health monitoring.

My goal is to publish these business events using performance counters, but I don't really feel like it's a good idea to litter my code with performance counter code. Just like how log4net abstracts logging out, is there an existing library that abstracts performance/health monitoring to its own library?

هل كانت مفيدة؟

المحلول

You definitely should try Gibraltar. You can combine it with PostSharp and your performantce monitoring will be a piece of cake. Just look into the following code example:

    [GTrace]
    public Connection ConnectToServer(Server server)
    {
        ConnectionStatus connectionStatus = server.TryConnect();
        return connectionStatus;
    }

And the result in log will look like the following:

Starting method call (you can see passed arguments) alt text

Ending method call

alt text

No crap in code, only thing you need is one attribute. Attrubutes can be used for whole project excluding not needed methods, on namespases, classes or just on any methos you need. Enjoy!

Edit Forgot to mention that Gibraltar has a very rich client and support any metrics you ever need, it's just too powerfull: alt text

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top