C# Agent for Instrumental Application Monitoring
C# Shell
Pull request Compare This branch is 102 commits ahead, 3 commits behind ralphrodkey:master.


Instrumental .NET Agent

Instrumental is a application monitoring platform built for developers who want a better understanding of their production software. Powerful tools, like the Instrumental Query Language, combined with an exploration-focused interface allow you to get real answers to complex questions, in real-time.

This agent supports custom metric monitoring for .NET applications. It provides high-data reliability at high scale, without ever blocking your process or causing an exception.

Getting Started

If you are using NuGet, add Instrumental.NET to your packages.config:

<id="instrumental_agent" version="1.0.0" targetFramework="net45" />

Or, download Instrumental.dll.

Visit instrumentalapp.com and create an account, then initialize the agent with your API token, found in the Docs section.

Simple Example

Here are the basic Instrumental monitoring commands:

using Instrumental;

var agent = new Agent("project api token here");

agent.Gauge("myapp.server1.free_ram", 1234567890);
agent.Notice("Server maintenance window", TimeSpan.FromMinutes(15));
Func<string> action = () => { DoLongRunningAction(); return "everything is fine"; };
String actionResult = agent.Time("myapp.expensive_operation", action);

Worker Example

You can easily use Instrumental Agent with background workers too, in this somewhat contrived timing example:

using Instrumental;
using System.ComponentModel;

BackgroundWorker bg = new BackgroundWorker();
bg.DoWork += delegate { agent.Time("csharp.worker.TimedWorker", () => { System.Threading.Thread.Sleep(500); return 0;} );

Developing/Building/Releasing this Agent

During development, you will need these scripts:

  • script/setup: prepare your environment for working with the agent
  • script/test: compile the agent and run the tests
  • script/build: compile the agent and build the nuget package

To release a new version of the agent, do the following:

  • Do the tests pass?
  • Use script/build to build the nuget package. It will help you to update the version number in all the appropriate places.
  • Use ./script/nuget push bin/instrumental_agent.<your version here>.nupkg to push to nuget. You may need to set your api key with ./script/nuget setApiKey <your key here>
  • Go to https://www.nuget.org/packages/instrumental_agent//Edit to update package release notes, if necessary.