Files
raven/server/AyaNova/util/MetricsRegistry.cs
2018-06-28 23:41:48 +00:00

168 lines
4.6 KiB
C#

using App.Metrics;
using App.Metrics.Counter;
using App.Metrics.Gauge;
using App.Metrics.Histogram;
using App.Metrics.ReservoirSampling.Uniform;
using App.Metrics.Meter;
using App.Metrics.Timer;
using App.Metrics.Apdex;
using App.Metrics.ReservoirSampling.ExponentialDecay;
namespace AyaNova.Util
{
/// <summary>
/// All metrics gathered by AyaNova are defined here
/// (except for endpoint ones gathered automatically by App.Metrics)
/// https://www.app-metrics.io
/// </summary>
public static class MetricsRegistry
{
/// <summary>
/// Physical memory
/// Memory being used by this process (RAVEN)
/// </summary>
public static GaugeOptions PhysicalMemoryGauge = new GaugeOptions
{
Name = "Process Physical Memory",
MeasurementUnit = Unit.Bytes
};
/// <summary>
/// Private bytes
/// The current size, in bytes, of the committed memory owned by this process.
/// Memory leaks are identified by a consistent and prolonged increase in Private Bytes.
/// This is the best performance counter for detecting memory leaks.
/// </summary>
public static GaugeOptions PrivateBytesGauge = new GaugeOptions
{
Name = "Process Private Bytes",
MeasurementUnit = Unit.Bytes
};
/// <summary>
/// Exceptions that are handled by the ApiCustomExceptionFilter
/// Basically any exception that is not normal and expected
/// </summary>
public static MeterOptions UnhandledExceptionsMeter => new MeterOptions
{
Name = "Exceptions Meter",
MeasurementUnit = Unit.Calls
};
/// <summary>
/// Login failed meter
/// </summary>
public static MeterOptions FailedLoginMeter => new MeterOptions
{
Name = "Failed Login Meter",
MeasurementUnit = Unit.Calls
};
/// <summary>
/// Login failed meter
/// </summary>
public static MeterOptions SuccessfulLoginMeter => new MeterOptions
{
Name = "Successful Login Meter",
MeasurementUnit = Unit.Calls
};
/// <summary>
/// Records in db
/// </summary>
public static GaugeOptions DBRecordsGauge = new GaugeOptions
{
Name = "DB Records",
MeasurementUnit = Unit.Items
};
/// <summary>
/// Jobs in db
/// </summary>
public static GaugeOptions JobsGauge = new GaugeOptions
{
Name = "Jobs",
MeasurementUnit = Unit.Items
};
/// <summary>
/// File count on disk
/// </summary>
public static GaugeOptions FileCountGauge = new GaugeOptions
{
Name = "File count",
MeasurementUnit = Unit.Items
};
/// <summary>
/// File size on disk
/// </summary>
public static GaugeOptions FileSizeGauge = new GaugeOptions
{
Name = "File size",
MeasurementUnit = Unit.Bytes
};
// ==================================================================
// /// <summary>
// ///
// /// </summary>
// public static GaugeOptions Errors => new GaugeOptions
// {
// Context = "My_Gauge_context",
// Name = "Errors"
// };
// /// <summary>
// ///
// /// </summary>
// public static HistogramOptions SampleHistogram => new HistogramOptions
// {
// Name = "Sample Histogram",
// Reservoir = () => new DefaultAlgorithmRReservoir(),
// MeasurementUnit = Unit.MegaBytes
// };
// /// <summary>
// ///
// /// </summary>
// public static MeterOptions SampleMeter => new MeterOptions
// {
// Name = "Sample Meter",
// MeasurementUnit = Unit.Calls
// };
// /// <summary>
// ///
// /// </summary>
// public static TimerOptions SampleTimer => new TimerOptions
// {
// Name = "Sample Timer",
// MeasurementUnit = Unit.Items,
// DurationUnit = TimeUnit.Milliseconds,
// RateUnit = TimeUnit.Milliseconds,
// Reservoir = () => new DefaultForwardDecayingReservoir(sampleSize: 1028, alpha: 0.015)
// };
// /// <summary>
// ///
// /// </summary>
// public static ApdexOptions SampleApdex => new ApdexOptions
// {
// Name = "Sample Apdex"
// };
}
}