Skip to content

Instantly share code, notes, and snippets.

@besquared
Created March 14, 2013 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save besquared/5164617 to your computer and use it in GitHub Desktop.
Save besquared/5164617 to your computer and use it in GitHub Desktop.
public class WebBase : NancyModule
{
private ExponentiallyDecayingSample _sample;
public WebBase()
{
Setup();
Get["/sampling"] = param =>
{
_sample.Clear();
for (int i = 0; i < 100; i++)
{
_sample.Update(i);
}
var values = new List<long>(_sample.Values);
values.Sort();
return string.Join(",", values);
};
}
private void Setup()
{
_sample = new ExponentiallyDecayingSample(1024, 0.15);
}
}
@besquared
Copy link
Author

This causes a problem in timers where only 3 values are ever in the sample even when there have been a lot of things timed.

Broker.Worker: {
BlobDelete: {
type: "timer",
duration: {
unit: "Milliseconds",
min: 20.037987,
max: 1225.699515,
mean: 73.35299645333333,
median: 51.318412,
p75: 478.825806,
p95: 478.825806,
p98: 478.825806,
p99: 478.825806,
p999: 478.825806,
values: "478.825806, 21.784853, 51.318412"
},
rate: {
unit: "Seconds",
count: 225,
mean: 0.5495942080080811,
m1: 0.4888301904187456,
m5: 0.5077636432513755,
m15: 0.45482446625868517
}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment