Add profiling to MarketDataServer controllers
This commit is contained in:
@@ -4,6 +4,7 @@ using MarketDataServer.Authorization;
|
||||
using MarketData;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using LogLevel = MarketData.LogLevel;
|
||||
using MarketData.Utils;
|
||||
|
||||
namespace MarketDataServer.Controllers
|
||||
{
|
||||
@@ -15,9 +16,10 @@ namespace MarketDataServer.Controllers
|
||||
[HttpGet(Name = "GetDistinctPriceIndices")]
|
||||
public IEnumerable<String> GetDistinctPriceIndices(String token)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceIndexController::GetDistinctPriceIndices]",DateTime.Now));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
return ConsumerPriceIndexDA.GetDistinctIndices();
|
||||
}
|
||||
@@ -26,14 +28,19 @@ namespace MarketDataServer.Controllers
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet(Name = "GetConsumerPriceIndex")]
|
||||
public IEnumerable<PriceIndex> GetConsumerPriceIndex(String token,String indexCode)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[{0:G}][PriceIndexController::GetOpenPositionsWithDescriptionAsOf]",DateTime.Now));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Start");
|
||||
if (!Authorizations.GetInstance().IsAuthorized(token)) return null;
|
||||
PriceIndices priceIndices=ConsumerPriceIndexDA.GetConsumerPriceIndex(indexCode);
|
||||
return priceIndices;
|
||||
@@ -43,6 +50,10 @@ namespace MarketDataServer.Controllers
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Exception:{exception.ToString()}");
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Done, total took {profiler.End()} (ms)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user