Hound 0.1.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Hound --version 0.1.1
NuGet\Install-Package Hound -Version 0.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hound" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hound --version 0.1.1
#r "nuget: Hound, 0.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Hound as a Cake Addin
#addin nuget:?package=Hound&version=0.1.1

// Install Hound as a Cake Tool
#tool nuget:?package=Hound&version=0.1.1

Hound

A C# library for publishing events and metrics to Datadog via the Datadog API.

Includes a simple exception logger that logs directly to Datadog, in a swappable way if you change your strategy later.

LogHound

You can call LogHound to store exceptions as simply as:

LogHound.LogException(apiKey, ex);

A full example is below.

try
{
    throw new AuthorException("Hound-001", "Sheridan Le Fanu");
}
catch (HoundException ex)
{
    LogHound.LogException(apiKey, ex);
}
catch (Exception ex)
{
    LogHound.LogException(apiKey, new UnexpectedException("Hound-001", ex));
}

To isolate yourself from LogHound, in case you decide to use something else later; isolate yourself from the specific HoundException type by creating your own tree of exception types:

public class MyCompanyException
    : HoundException
{
    public MyCompanyException(string host, string message)
        : base(host, message)
    {
        Severity = HoundEventType.Error;
    }
}

If you are handling other exceptions, you can wrap them:

public class MyWrapperException
    : HoundException
{
    public MyWrapperException(string host, Exception innerException)
        : base(host, "General exception caught.", innerException)
    {
        Severity = HoundEventType.Error;
    }
}

Severity

You may find it useful to have errors of different severities. LogHound allows success, info, warning, error.

You can set this in the constructor of your custom exception types.

public class TestException
    : HoundException
{
    public TestException(string host, string author)
        : base(host, $"The author is {author}")
    {
        Severity = HoundEventType.Error;
    }
}

Events

Create an event:

HoundEvent data = new HoundEvent
{
    Title = "Test Event",
    Text = "This is the contents of the test event.",
    AggregationKey = "testevent",
    Host = "Hound-001",
    AlertType = HoundEventType.Success
};

Publish the event:

IEventDestination target = new DogEvents(apiKey);
HoundResult eventResponse = await target.Publish(data);

The eventResponse.IsSuccess boolean indicates success, and if this is false, you can check out the exception under eventResponse.Error.

A typical strategy would swallow a failure to publish an event, but place this information somewhere transient in case you need to investigate lack of events.

Metrics

Create a metric collection:

HoundMetricCollection data = new HoundMetricCollection
{
    Title = "test.metric",
    Host = "Hound-001",
    Points = new List<HoundMetricPoint>
        {
            new HoundMetricPoint
            {
                Timestamp = DateTime.UtcNow.AddSeconds(-30),
                Value = 11
            },
            new HoundMetricPoint
            {
                Timestamp = DateTime.UtcNow.AddSeconds(-15),
                Value = 10
            },
            new HoundMetricPoint
            {
                Timestamp = DateTime.UtcNow,
                Value = 12
            }
        }
};

Publish the metrics:

IMetricDestination target = new DogMetrics(apiKey);
HoundResult eventResponse = await target.RaiseMetric(data);

The eventResponse.IsSuccess boolean indicates success, and if this is false, you can check out the exception under eventResponse.Error.

Metric Notes

Passing a collection of metrics is more efficient than sending one at a time.

The recommended gap between metrics is 15 seconds or more (use your judgement to collect it just often enough to make changes visible, if you measure something that changes once an hour; you don't need to collect it every 15 seconds!)

General

As the two areas are publish-only, you only need to supply a Datadog API key and Hound will take care of the REST. You don't need an application key for these methods.

The doc comments on the data objects will guide you!

https://github.com/Steve-Fenton/Hound/blob/master/Hound/Events/HoundEvent.cs

https://github.com/Steve-Fenton/Hound/blob/master/Hound/Metrics/HoundMetric.cs

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.1.4 67,650 8/28/2018
0.1.3 1,074 8/18/2018
0.1.2 2,197 3/16/2018
0.1.1 1,321 3/16/2018
0.1.0 1,094 3/6/2018