clean up and various little improvements after search for static wasted memory objects (not found) At this point it appears I don't have any leaks and it's all pretty efficient.
This commit is contained in:
@@ -1,31 +1,10 @@
|
||||
|
||||
namespace AyaNova.Api.ControllerHelpers
|
||||
{
|
||||
|
||||
|
||||
//return the response with optional readonly flag
|
||||
//this exists basically for consistency and to reduce the bandwidth if not readonly which is most common
|
||||
//UPDATE: Actually, there's no way for the biz object to set the readonly status and the client doesn't really use it at this point 2020-05-18 09:09:29
|
||||
//in theory it should be a non db property of the model if it's going to be used at all so removing it entirely from response as a separate property
|
||||
public static class ApiOkResponse
|
||||
{
|
||||
public static object Response(object result)
|
||||
{
|
||||
// if (isReadOnly)
|
||||
// {
|
||||
// return new
|
||||
// {
|
||||
// Data = result,
|
||||
// ReadOnly = true
|
||||
// };
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
return new { Data = result };
|
||||
//}
|
||||
|
||||
return new { Data = result };
|
||||
}
|
||||
}//eoc
|
||||
|
||||
|
||||
}//eons
|
||||
@@ -56,7 +56,7 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
/// <param name="objectType"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool HasAnyRole(AuthorizationRoles currentUserRoles, AyaType objectType)
|
||||
{
|
||||
{
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change | RoleSet.Select;
|
||||
return currentUserRoles.HasAnyFlags(AllowedRoles);
|
||||
@@ -120,14 +120,6 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
var RoleSet = BizRoles.GetRoleSet(objectType);
|
||||
var AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
return currentUserRoles.HasAnyFlags(AllowedRoles);
|
||||
|
||||
// if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Change))
|
||||
// return true;
|
||||
|
||||
// if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).ReadFullRecord))
|
||||
// return true;
|
||||
|
||||
//return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,14 +146,10 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
{
|
||||
if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Change))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// MODIFY
|
||||
/// </summary>
|
||||
@@ -172,7 +160,6 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
internal static bool HasModifyRole(IDictionary<object, object> HttpContextItems, AyaType objectType)
|
||||
{
|
||||
AuthorizationRoles currentUserRoles = UserRolesFromContext.Roles(HttpContextItems);
|
||||
|
||||
return HasModifyRole(currentUserRoles, objectType);
|
||||
}
|
||||
|
||||
@@ -219,8 +206,6 @@ namespace AyaNova.Api.ControllerHelpers
|
||||
{
|
||||
if (currentUserRoles.HasAnyFlags(BizRoles.GetRoleSet(objectType).Change))
|
||||
return true;
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,8 +35,6 @@ namespace AyaNova.Api.Controllers
|
||||
private readonly AyContext ct;
|
||||
private readonly ILogger<AttachmentController> log;
|
||||
private readonly ApiServerState serverState;
|
||||
//private static readonly FormOptions _defaultFormOptions = new FormOptions();
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
|
||||
@@ -300,19 +300,19 @@ namespace AyaNova.DataList
|
||||
break;
|
||||
|
||||
|
||||
/* NOTE: CASE - I decided to NOT do case insensitive for now for datalists like I did for picklists because it's a bit of a different situation
|
||||
I would need to make big changes to the select builder and this criteria builder so it's TTM at the moment because it's all tested and working
|
||||
however also the use is a bit different in that it's much more necessary to be hyper accurate here since this drives reporting and potentially a lot
|
||||
of important business data. Matching two different clients inadvertantly because of a case issue would be a bit of a kerfuffle potentially so I'd rather err on the side of accuracy
|
||||
and also I'm not certain how the case code will work with other languages so it's a bit more risky here, if a picklist doesn't work I get a support call but if a report is missing data then maybe
|
||||
the user doesn't realize it and has bad reports.
|
||||
/* NOTE: CASE - I decided to NOT do case insensitive for now for datalists like I did for picklists because it's a bit of a different situation
|
||||
I would need to make big changes to the select builder and this criteria builder so it's TTM at the moment because it's all tested and working
|
||||
however also the use is a bit different in that it's much more necessary to be hyper accurate here since this drives reporting and potentially a lot
|
||||
of important business data. Matching two different clients inadvertantly because of a case issue would be a bit of a kerfuffle potentially so I'd rather err on the side of accuracy
|
||||
and also I'm not certain how the case code will work with other languages so it's a bit more risky here, if a picklist doesn't work I get a support call but if a report is missing data then maybe
|
||||
the user doesn't realize it and has bad reports.
|
||||
|
||||
code from picklist in case I decide to do it later
|
||||
if (ServerGlobalBizSettings.SearchCaseSensitiveOnly)
|
||||
sWhere = $"({valueColumnName} like '%{autoCompleteQuery}%')";
|
||||
else
|
||||
sWhere = $"(lower({valueColumnName}) like lower('%{autoCompleteQuery}%'))";
|
||||
*/
|
||||
code from picklist in case I decide to do it later
|
||||
if (ServerGlobalBizSettings.SearchCaseSensitiveOnly)
|
||||
sWhere = $"({valueColumnName} like '%{autoCompleteQuery}%')";
|
||||
else
|
||||
sWhere = $"(lower({valueColumnName}) like lower('%{autoCompleteQuery}%'))";
|
||||
*/
|
||||
|
||||
//Following 7 operators added 14-June-2006
|
||||
case DataListFilterComparisonOperator.NotContains:
|
||||
@@ -592,16 +592,6 @@ code from picklist in case I decide to do it later
|
||||
sb.Append("'");
|
||||
}
|
||||
|
||||
// public static string SqlDateFormatHighLow(bool bhigh)
|
||||
// {
|
||||
// //new test version
|
||||
// if (bhigh)
|
||||
// return SqlDateFormat() + ".999";
|
||||
// else
|
||||
// return SqlDateFormat() + ".000";
|
||||
|
||||
// }
|
||||
|
||||
|
||||
private static DateTime ZeroMilliseconds(DateTime d)
|
||||
{
|
||||
|
||||
@@ -4,29 +4,34 @@ namespace AyaNova.Biz
|
||||
{
|
||||
public static class CustomFieldType
|
||||
{
|
||||
//v7 custom field types:
|
||||
// - Currency
|
||||
// - DateAndTime
|
||||
// - TimeOnly
|
||||
// - DateOnly
|
||||
// - Number
|
||||
// - Text
|
||||
// - Bool
|
||||
|
||||
private static List<int> _validCustomFieldTypes = new List<int>();
|
||||
static CustomFieldType()
|
||||
{
|
||||
//v7 custom field types:
|
||||
// - Currency
|
||||
// - DateAndTime
|
||||
// - TimeOnly
|
||||
// - DateOnly
|
||||
// - Number
|
||||
// - Text
|
||||
// - Bool
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.Currency);
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.Date);
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.Time);
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.DateTime);
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.Text);
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.Decimal);
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.Integer);
|
||||
_validCustomFieldTypes.Add((int)UiFieldDataType.Bool);
|
||||
}
|
||||
|
||||
|
||||
public static List<int> ValidCustomFieldTypes
|
||||
{
|
||||
get
|
||||
{
|
||||
var ret = new List<int>();
|
||||
ret.Add((int)UiFieldDataType.Currency);
|
||||
ret.Add((int)UiFieldDataType.Date);
|
||||
ret.Add((int)UiFieldDataType.Time);
|
||||
ret.Add((int)UiFieldDataType.DateTime);
|
||||
ret.Add((int)UiFieldDataType.Text);
|
||||
ret.Add((int)UiFieldDataType.Decimal);
|
||||
ret.Add((int)UiFieldDataType.Integer);
|
||||
ret.Add((int)UiFieldDataType.Bool);
|
||||
return ret;
|
||||
return _validCustomFieldTypes;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,21 +2,6 @@ using System.Collections.Generic;
|
||||
|
||||
namespace AyaNova.Biz
|
||||
{
|
||||
// public static class AyDataType
|
||||
// {
|
||||
// //Date and time types, all stored internally as a date and time timestamp, but may display as date only or time only
|
||||
// public const string DateTime = "datetime";
|
||||
// public const string Date = "date";
|
||||
// public const string Time = "time";
|
||||
// public const string Text = "text";
|
||||
// public const string Integer = "int";
|
||||
// public const string Bool = "bool";
|
||||
// public const string Decimal = "decimal";
|
||||
// public const string Currency = "currency";
|
||||
// public const string Tags = "tags";
|
||||
// public const string Enum = "enum";//enums are just integers in the db so the sql code handles it like an int, but the client needs to know it's an enum
|
||||
// }
|
||||
|
||||
//DataTypes used to format display properly and for custom fields definition etc
|
||||
public enum UiFieldDataType : int
|
||||
{
|
||||
@@ -34,6 +19,5 @@ namespace AyaNova.Biz
|
||||
EmailAddress = 11,
|
||||
HTTP = 12,
|
||||
InternalId = 13
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,21 +20,20 @@ namespace AyaNova.Biz
|
||||
private static Process _process = Process.GetCurrentProcess();
|
||||
|
||||
private static TimeSpan _oldCPUTime = TimeSpan.Zero;
|
||||
private static DateTime _lastMMSnapshot = DateTime.UtcNow;
|
||||
private static DateTime _lastMMSnapshot = DateTime.UtcNow;
|
||||
private static DateTime _lastDDSnapshot = DateTime.UtcNow;
|
||||
|
||||
// private static DateTime _lastRpsTime = DateTime.UtcNow;
|
||||
private static double _cpu = 0;
|
||||
|
||||
#if(DEBUG)
|
||||
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
|
||||
#if (DEBUG)
|
||||
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
|
||||
private static TimeSpan ts24Hours = new TimeSpan(24, 0, 0);
|
||||
#else
|
||||
private static TimeSpan tsOneMinute = new TimeSpan(0, 1, 0);
|
||||
private static TimeSpan ts24Hours = new TimeSpan(24, 0, 0);
|
||||
#endif
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// DoAsync
|
||||
//
|
||||
//
|
||||
public static void DoJob()
|
||||
{
|
||||
@@ -68,7 +67,7 @@ namespace AyaNova.Biz
|
||||
// cannot be shared with other processes.
|
||||
var PrivateBytes = _process.PrivateMemorySize64;//bigint
|
||||
|
||||
|
||||
|
||||
//NOTE: CPU percentage is *our* process cpu percentage over timeframe of last captured avg
|
||||
//So it does *not* show the entire server cpu load, only for RAVEN.
|
||||
//Overall, server stats need to be captured / viewed independently (digital ocean control panel for example or windows task manager)
|
||||
@@ -76,8 +75,9 @@ namespace AyaNova.Biz
|
||||
//In some cases the first snapshot taken after a reboot
|
||||
//is a huge number way beyond 100 which fucks up the charts
|
||||
//likely due to the algorithm above and new values but not worth looking into atm
|
||||
if(CPU > 100){
|
||||
CPU=0;
|
||||
if (CPU > 100)
|
||||
{
|
||||
CPU = 0;
|
||||
}
|
||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
@@ -90,7 +90,7 @@ namespace AyaNova.Biz
|
||||
_lastMMSnapshot = now;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////
|
||||
//ONCE A DAY SNAPS AND CLEANUP
|
||||
@@ -147,8 +147,8 @@ namespace AyaNova.Biz
|
||||
DateTime ClearDate = DateTime.UtcNow - tsDataRetention;
|
||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||
{
|
||||
ct.Database.ExecuteSqlInterpolated($"delete from ametricmm where t < {ClearDate.ToUniversalTime()}");
|
||||
ct.Database.ExecuteSqlInterpolated($"delete from ametricdd where t < {ClearDate.ToUniversalTime()}");
|
||||
ct.Database.ExecuteSqlInterpolated($"delete from ametricmm where t < {ClearDate.ToUniversalTime()}");
|
||||
ct.Database.ExecuteSqlInterpolated($"delete from ametricdd where t < {ClearDate.ToUniversalTime()}");
|
||||
}
|
||||
_lastDDSnapshot = now;
|
||||
}
|
||||
|
||||
@@ -8,17 +8,9 @@ namespace AyaNova.Util
|
||||
/// </summary>
|
||||
internal static class ApplicationLogging
|
||||
{
|
||||
internal static ILogger theLogger{get;set;}
|
||||
internal static NLogLoggerProvider LoggerProvider { get; set; }// = new LoggerFactory();
|
||||
internal static ILogger CreateLogger<T>() => LoggerProvider.CreateLogger(typeof(T).FullName);
|
||||
//internal static ILogger CreateLogger(string categoryName) => theLogger;
|
||||
internal static ILogger CreateLogger(string categoryName)=> LoggerProvider.CreateLogger(categoryName);
|
||||
|
||||
|
||||
|
||||
// internal static ILoggerFactory LoggerFactory { get; set; }// = new LoggerFactory();
|
||||
// internal static ILogger CreateLogger<T>() => LoggerFactory.CreateLogger<T>();
|
||||
// internal static ILogger CreateLogger(string categoryName) => LoggerFactory.CreateLogger(categoryName);
|
||||
|
||||
internal static ILogger theLogger { get; set; }
|
||||
internal static NLogLoggerProvider LoggerProvider { get; set; }
|
||||
internal static ILogger CreateLogger<T>() => LoggerProvider.CreateLogger(typeof(T).FullName);
|
||||
internal static ILogger CreateLogger(string categoryName) => LoggerProvider.CreateLogger(categoryName);
|
||||
}
|
||||
}
|
||||
@@ -1,29 +1,11 @@
|
||||
namespace AyaNova.Util
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Version strings centrally located for convenience
|
||||
/// </summary>
|
||||
internal static class AyaNovaVersion
|
||||
{
|
||||
public static string VersionString
|
||||
{
|
||||
get
|
||||
{
|
||||
return "8.0.0-alpha.5";
|
||||
}
|
||||
}
|
||||
|
||||
public static string FullNameAndVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return "AyaNova server " + VersionString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public const string VersionString = "8.0.0-alpha.6";
|
||||
public const string FullNameAndVersion = "AyaNova server " + VersionString;
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AyaNova.Util
|
||||
{
|
||||
|
||||
@@ -2,8 +2,6 @@ using System;
|
||||
|
||||
namespace AyaNova.Util
|
||||
{
|
||||
|
||||
|
||||
internal static class DateUtil
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -87,19 +87,6 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// Delete a utility file (backup folder file)
|
||||
// /// </summary>
|
||||
// /// <param name="fileName"></param>
|
||||
// internal static void DeleteUtilityFile(string fileName)
|
||||
// {
|
||||
// var utilityFilePath = GetFullPathForUtilityFile(fileName);
|
||||
// if (File.Exists(utilityFilePath))
|
||||
// {
|
||||
// File.Delete(utilityFilePath);
|
||||
// }
|
||||
// }
|
||||
|
||||
public class BackupFileInfo
|
||||
{
|
||||
public string length { get; set; }
|
||||
@@ -311,42 +298,6 @@ namespace AyaNova.Util
|
||||
return zipEntries;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// Import utility - get individual files specified in zip archive as JSON objects
|
||||
// ///
|
||||
// /// </summary>
|
||||
// /// <param name="zipFileName">Name of utility zip import file</param>
|
||||
// /// <param name="entryList">Name of entries in utility file archive to fetch</param>
|
||||
// /// <returns></returns>
|
||||
// internal static List<JObject> ZipGetUtilityArchiveEntriesAsJsonObjects(List<string> entryList, string zipFileName)
|
||||
// {
|
||||
// List<JObject> jList = new List<JObject>();
|
||||
// var zipPath = GetFullPathForUtilityFile(zipFileName);
|
||||
// using (ZipArchive archive = ZipFile.OpenRead(zipPath))
|
||||
// {
|
||||
// foreach (string importFileName in entryList)
|
||||
// {
|
||||
// ZipArchiveEntry entry = archive.GetEntry(importFileName);
|
||||
// if (entry != null)
|
||||
// {
|
||||
// //stream entry into a new jobject and add it to the list
|
||||
// StreamReader reader = new StreamReader(entry.Open());
|
||||
// string text = reader.ReadToEnd();
|
||||
// var j = JObject.Parse(text);
|
||||
|
||||
// //Here add v7 import file name as sometimes it's needed later (Translations)
|
||||
// j.Add("V7_SOURCE_FILE_NAME", JToken.FromObject(importFileName));
|
||||
// jList.Add(j);
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
// return jList;
|
||||
|
||||
// }
|
||||
|
||||
|
||||
#endregion Zip handling
|
||||
|
||||
#region Attachment file handling
|
||||
|
||||
@@ -32,22 +32,6 @@ namespace AyaNova.Util
|
||||
return Convert.ToBase64String(salt);
|
||||
}
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// Generate a random ID
|
||||
// /// </summary>
|
||||
// /// <returns>HEX</returns>
|
||||
// internal static string GenerateStrongId()
|
||||
// {
|
||||
// var s = new byte[32];
|
||||
// var random = RandomNumberGenerator.Create();
|
||||
// random.GetNonZeroBytes(s);
|
||||
// return BitConverter.ToString(s).Replace("-", string.Empty).ToLowerInvariant();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}//eoc
|
||||
|
||||
}//eons
|
||||
@@ -1,5 +1,3 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
@@ -28,14 +26,12 @@ namespace AyaNova.Util
|
||||
JArray j = JArray.Parse(jsonIn);
|
||||
return JsonConvert.SerializeObject(j, Formatting.None);
|
||||
}
|
||||
|
||||
if (jsonIn.StartsWith("{"))
|
||||
{
|
||||
JObject j = JObject.Parse(jsonIn);
|
||||
return JsonConvert.SerializeObject(j, Formatting.None);
|
||||
}
|
||||
|
||||
//Not an object or an array so just return it, possibly suspect, maybe log this shit
|
||||
//Not an object or an array so just return it
|
||||
return jsonIn;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,167 +0,0 @@
|
||||
// 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"
|
||||
// // };
|
||||
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
@@ -10,8 +10,7 @@ namespace AyaNova.Util
|
||||
/// </summary>
|
||||
public static class RetryHelper
|
||||
{
|
||||
//private static ILog logger = LogManager.GetLogger(); //use a logger or trace of your choice
|
||||
// private readonly ILogger log;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
|
||||
@@ -90,32 +90,6 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// Make a unique but duplicate object name of desired length
|
||||
// /// (Used by Duplicate object function)
|
||||
// /// </summary>
|
||||
// /// <param name="s"></param>
|
||||
// /// <param name="maxLength"></param>
|
||||
// /// <returns></returns>
|
||||
// public static string NameUniquify(string s, int maxLength)
|
||||
// {
|
||||
// //Unique string
|
||||
// string unique = " - " + DateUtil.SortableShortCurrentDateTimeValue;
|
||||
// string ret = s + unique;
|
||||
// var diff = maxLength - ret.Length;
|
||||
// if (diff < 0)
|
||||
// {
|
||||
// if (unique.Length >= maxLength)
|
||||
// {
|
||||
// throw new System.ArgumentOutOfRangeException("StringUtil::nameUniquify - maxlength> unique value, source field too short for this function?");
|
||||
// }
|
||||
// ret = s.Substring(0, Math.Abs(diff)) + unique;
|
||||
// }
|
||||
|
||||
// return ret;
|
||||
// }
|
||||
|
||||
|
||||
//Used to ensure a unique name generated by appending -nnn is within length requirements by splitting and chopping part of text to keep name
|
||||
public static string UniqueNameBuilder(string oldName, long appendValue, int maxLength)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user