Skip to content

hudl/stackdriver.net

Repository files navigation

This repo contains the Stackdriver.net library and the Hudl.Stackdriver.Perfmon service

stackdriver.net

A C# wrapper for sending custom metrics to StackDriver

Usage

You can use this one of two ways. The easiest way to do collect basic counting metrics is to use the MetricAggregator class. The simplest way to use it is to somewhere keep a single instance of it and then call Increment("foo.bar");. Once you instantiate the aggregator, it will publish all collected metrics up to StackDriver every 60 seconds. It will publish the metrics using a single batched request.

public const string ApiKey = "<your api key here>";
public static readonly MetricAggregator Aggregator = new MetricAggregator(ApiKey);

// elsewhere in your code...
Aggregator.Increment("logins");
...
Aggregator.Increment("purchase.books", order.Items.Count);
// etc.

Another way of using this is to simply use the CustomMetricsPoster class. It exposes a synchronous and an async version of both single and batch metric sending.

var poster = new CustomMetricsPoster(ApiKey);
poster.SendMetric("purchase.amount", 105.25);

Hudl.Stackdriver.Perfmon

A Windows service for delivering Perfmon metrics to Stackdriver.

For documentation view the README

About

A C# wrapper for sending custom metrics to StackDriver

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages