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 { /// /// All metrics gathered by AyaNova are defined here /// (except for endpoint ones gathered automatically by App.Metrics) /// https://www.app-metrics.io /// public static class MetricsRegistry { /// /// Physical memory /// Memory being used by this process (RAVEN) /// public static GaugeOptions PhysicalMemoryGauge = new GaugeOptions { Name = "Process Physical Memory", MeasurementUnit = Unit.Bytes }; /// /// 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. /// public static GaugeOptions PrivateBytesGauge = new GaugeOptions { Name = "Process Private Bytes", MeasurementUnit = Unit.Bytes }; /// /// Exceptions that are handled by the ApiCustomExceptionFilter /// Basically any exception that is not normal and expected /// public static MeterOptions UnhandledExceptionsMeter => new MeterOptions { Name = "Exceptions Meter", MeasurementUnit = Unit.Calls }; /// /// Login failed meter /// public static MeterOptions FailedLoginMeter => new MeterOptions { Name = "Failed Login Meter", MeasurementUnit = Unit.Calls }; /// /// Login failed meter /// public static MeterOptions SuccessfulLoginMeter => new MeterOptions { Name = "Successful Login Meter", MeasurementUnit = Unit.Calls }; /// /// Records in db /// public static GaugeOptions DBRecordsGauge = new GaugeOptions { Name = "DB Records", MeasurementUnit = Unit.Items }; /// /// Jobs in db /// public static GaugeOptions JobsGauge = new GaugeOptions { Name = "Jobs", MeasurementUnit = Unit.Items }; /// /// File count on disk /// public static GaugeOptions FileCountGauge = new GaugeOptions { Name = "File count", MeasurementUnit = Unit.Items }; /// /// File size on disk /// public static GaugeOptions FileSizeGauge = new GaugeOptions { Name = "File size", MeasurementUnit = Unit.Bytes }; // ================================================================== // /// // /// // /// // public static GaugeOptions Errors => new GaugeOptions // { // Context = "My_Gauge_context", // Name = "Errors" // }; // /// // /// // /// // public static HistogramOptions SampleHistogram => new HistogramOptions // { // Name = "Sample Histogram", // Reservoir = () => new DefaultAlgorithmRReservoir(), // MeasurementUnit = Unit.MegaBytes // }; // /// // /// // /// // public static MeterOptions SampleMeter => new MeterOptions // { // Name = "Sample Meter", // MeasurementUnit = Unit.Calls // }; // /// // /// // /// // 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) // }; // /// // /// // /// // public static ApdexOptions SampleApdex => new ApdexOptions // { // Name = "Sample Apdex" // }; } }