peschuster

Technology, .NET and Web

  • Info

StatsD

Reporting Exceptions from ELMAH to Graphite and StatsD

October 25, 2012 by peter

On one project we use Graphite and StatsD to monitor some webserver and performance parameters of the site and ELMAH to catch all unhandled exceptions. Wouldn’t it be cool to also see the occurrence of exceptions captured by ELMAH in our Graphite graphs?

For this purpose I extended my library of Graphite “tools” by a Graphite.Elmah project.

ELMAH is designed to support only on backend for logging errors. This is usually configured to be some kind of database backend to store exception details for later access. Therefore Graphite.Elmah hooks into ELMAH using a custom error filter, to report exceptions to Graphite or StatsD.

You can configure ELMAH in your project to use this error filter with the following configuration snipped:

<errorFilter>
  <test
      xmlns:my="http://schemas.microsoft.com/clr/nsassem/Graphite/Graphite.Elmah">
    <my:log />
  </test>
</errorFilter>

Graphite.Elmah itself needs to be configured with the following settings:

<graphite.elmah
    key="elmah_errors"
    type="counter"
    target="statsd" />

You can set a metric key, a metric type and a target for the metrics (either “statsd” or “graphite”). The complete configuration for your web.config file is also included in the respective readme for reference: Graphite.Elmah web.config

Graphite.Elmah was build upon the Graphite base library. Therefore some configuration for the Graphite backend(s) is required as well:

<configSections>
  <section name="graphite" type="Graphite.Configuration.GraphiteConfiguration, Graphite" />
</configSections>
<graphite xmlns="http://github.com/peschuster/Graphite/Configuration">
  <!--<graphite address="127.0.0.1" port="2003" transport="Tcp" />-->
  <statsd address="127.0.0.1" port="8125" prefixKey="test" />
</graphite>

When using the NuGet package Graphite.Elmah all required settings are added to your project automatically during installation:

Install-Package Graphite.Elmah
Posted in: .NET, ASP.NET, Monitoring Tagged: ELMAH, Graphite, StatsD

Syndication

  • RSS 2.0

Recent Posts

  • Ubiquiti EdgeRouter™ X SFP – Teardown
  • Force HttpWebRequest to IPv4
  • Blackmagic Design ATEM GPI and Tally Interface Teardown
  • WinForms ListView DoubleClick Event for Empty Lists
  • Planning Center Online – Custom Plan Reports in Landscape Orientation

Tags

.NET AntiXssEncoder ASP.NET Build c# Configuration crawler Debugging EF ELMAH Expression tree Graphite Interop IssuerNameRegistry iTunes Linq ListView MVC pco pdf Security SecurityKey SecurityToken simulatebe sql server StatsD STS teardown TYPO3 UAC UI UserSettings Visual Studio WIF WIF in depth WinForms WndProc
profile for Peter at Stack Overflow, Q&A for professional and enthusiast programmers Peter Schuster

Copyright © 2025 peschuster.

Alpha WordPress Theme by themehall.com