Ditched app.metrics
This commit is contained in:
@@ -1,108 +1,108 @@
|
||||
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;
|
||||
// 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
|
||||
{
|
||||
// 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>
|
||||
// /// 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>
|
||||
// /// 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>
|
||||
// /// 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 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>
|
||||
// /// 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>
|
||||
// /// 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>
|
||||
// /// 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 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>
|
||||
// /// File size on disk
|
||||
// /// </summary>
|
||||
// public static GaugeOptions FileSizeGauge = new GaugeOptions
|
||||
// {
|
||||
// Name = "File size",
|
||||
// MeasurementUnit = Unit.Bytes
|
||||
// };
|
||||
|
||||
|
||||
|
||||
@@ -110,58 +110,58 @@ namespace AyaNova.Util
|
||||
|
||||
|
||||
|
||||
// ==================================================================
|
||||
// /// <summary>
|
||||
// ///
|
||||
// /// </summary>
|
||||
// public static GaugeOptions Errors => new GaugeOptions
|
||||
// {
|
||||
// Context = "My_Gauge_context",
|
||||
// Name = "Errors"
|
||||
// };
|
||||
// // ==================================================================
|
||||
// // /// <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 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 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 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"
|
||||
// };
|
||||
// // /// <summary>
|
||||
// // ///
|
||||
// // /// </summary>
|
||||
// // public static ApdexOptions SampleApdex => new ApdexOptions
|
||||
// // {
|
||||
// // Name = "Sample Apdex"
|
||||
// // };
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -51,17 +51,7 @@ namespace AyaNova.Util
|
||||
internal static string AYANOVA_LOG_LEVEL { get; set; }
|
||||
internal static bool AYANOVA_LOG_ENABLE_LOGGER_DIAGNOSTIC_LOG { get; set; }
|
||||
|
||||
|
||||
|
||||
//METRICS
|
||||
internal static bool AYANOVA_METRICS_USE_INFLUXDB { get; set; }
|
||||
internal static string AYANOVA_METRICS_INFLUXDB_BASEURL { get; set; }
|
||||
internal static string AYANOVA_METRICS_INFLUXDB_DBNAME { get; set; }
|
||||
internal static string AYANOVA_METRICS_INFLUXDB_CONSISTENCY { get; set; }
|
||||
internal static string AYANOVA_METRICS_INFLUXDB_USERNAME { get; set; }
|
||||
internal static string AYANOVA_METRICS_INFLUXDB_PASSWORD { get; set; }
|
||||
internal static string AYANOVA_METRICS_INFLUXDB_RETENTION_POLICY { get; set; }
|
||||
internal static bool AYANOVA_METRICS_INFLUXDB_CREATE_DATABASE_IF_NOT_EXISTS { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Populate the config from the configuration found at boot
|
||||
@@ -168,32 +158,7 @@ namespace AyaNova.Util
|
||||
|
||||
#endregion server BASICS
|
||||
|
||||
#region METRICS
|
||||
//InfluxDB
|
||||
bTemp = config.GetValue<bool?>("AYANOVA_METRICS_USE_INFLUXDB");
|
||||
AYANOVA_METRICS_USE_INFLUXDB = (null == bTemp) ? false : (bool)bTemp;
|
||||
|
||||
AYANOVA_METRICS_INFLUXDB_BASEURL = config.GetValue<string>("AYANOVA_METRICS_INFLUXDB_BASEURL");
|
||||
AYANOVA_METRICS_INFLUXDB_BASEURL = string.IsNullOrWhiteSpace(AYANOVA_METRICS_INFLUXDB_BASEURL) ? "http://127.0.0.1:8086" : AYANOVA_METRICS_INFLUXDB_BASEURL;
|
||||
|
||||
AYANOVA_METRICS_INFLUXDB_DBNAME = config.GetValue<string>("AYANOVA_METRICS_INFLUXDB_DBNAME");
|
||||
AYANOVA_METRICS_INFLUXDB_DBNAME = string.IsNullOrWhiteSpace(AYANOVA_METRICS_INFLUXDB_DBNAME) ? "AyaNova" : AYANOVA_METRICS_INFLUXDB_DBNAME;
|
||||
|
||||
AYANOVA_METRICS_INFLUXDB_CONSISTENCY = config.GetValue<string>("AYANOVA_METRICS_INFLUXDB_CONSISTENCY");
|
||||
//No default value, if it's null or empty or whitespace then it won't be set
|
||||
|
||||
AYANOVA_METRICS_INFLUXDB_USERNAME = config.GetValue<string>("AYANOVA_METRICS_INFLUXDB_USERNAME");
|
||||
AYANOVA_METRICS_INFLUXDB_USERNAME = string.IsNullOrWhiteSpace(AYANOVA_METRICS_INFLUXDB_USERNAME) ? "root" : AYANOVA_METRICS_INFLUXDB_USERNAME;
|
||||
|
||||
AYANOVA_METRICS_INFLUXDB_PASSWORD = config.GetValue<string>("AYANOVA_METRICS_INFLUXDB_PASSWORD");
|
||||
AYANOVA_METRICS_INFLUXDB_PASSWORD = string.IsNullOrWhiteSpace(AYANOVA_METRICS_INFLUXDB_PASSWORD) ? "root" : AYANOVA_METRICS_INFLUXDB_PASSWORD;
|
||||
|
||||
AYANOVA_METRICS_INFLUXDB_RETENTION_POLICY = config.GetValue<string>("AYANOVA_METRICS_INFLUXDB_RETENTION_POLICY");
|
||||
//No default value, if it's null or empty or whitespace then it won't be set
|
||||
|
||||
bTemp = config.GetValue<bool?>("AYANOVA_METRICS_INFLUXDB_CREATE_DATABASE_IF_NOT_EXISTS");
|
||||
AYANOVA_METRICS_INFLUXDB_CREATE_DATABASE_IF_NOT_EXISTS = (null == bTemp) ? true : (bool)bTemp;
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user