Browse Source

Improve logging

pull/3703/head
Thomas Kaul 1 year ago
parent
commit
2fe76ab0ce
  1. 8
      apps/api/src/app/portfolio/calculator/portfolio-calculator.ts
  2. 2
      apps/api/src/app/portfolio/current-rate.service.ts
  3. 6
      apps/api/src/services/data-provider/coingecko/coingecko.service.ts
  4. 6
      apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts
  5. 6
      apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

8
apps/api/src/app/portfolio/calculator/portfolio-calculator.ts

@ -1037,14 +1037,6 @@ export abstract class PortfolioCalculator {
JSON.stringify(this.snapshot), JSON.stringify(this.snapshot),
this.configurationService.get('CACHE_QUOTES_TTL') this.configurationService.get('CACHE_QUOTES_TTL')
); );
Logger.debug(
`Computed portfolio snapshot in ${(
(performance.now() - startTimeTotal) /
1000
).toFixed(3)} seconds`,
'PortfolioCalculator'
);
} }
} }
} }

2
apps/api/src/app/portfolio/current-rate.service.ts

@ -1,4 +1,5 @@
import { OrderService } from '@ghostfolio/api/app/order/order.service'; import { OrderService } from '@ghostfolio/api/app/order/order.service';
import { LogPerformance } from '@ghostfolio/api/interceptors/performance-logging/performance-logging.interceptor';
import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service'; import { DataProviderService } from '@ghostfolio/api/services/data-provider/data-provider.service';
import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service'; import { MarketDataService } from '@ghostfolio/api/services/market-data/market-data.service';
import { resetHours } from '@ghostfolio/common/helper'; import { resetHours } from '@ghostfolio/common/helper';
@ -27,6 +28,7 @@ export class CurrentRateService {
@Inject(REQUEST) private readonly request: RequestWithUser @Inject(REQUEST) private readonly request: RequestWithUser
) {} ) {}
@LogPerformance
// TODO: Pass user instead of using this.request.user // TODO: Pass user instead of using this.request.user
public async getValues({ public async getValues({
dataGatheringItems, dataGatheringItems,

6
apps/api/src/services/data-provider/coingecko/coingecko.service.ts

@ -206,9 +206,9 @@ export class CoinGeckoService implements DataProviderInterface {
let message = error; let message = error;
if (error?.code === 'ABORT_ERR') { if (error?.code === 'ABORT_ERR') {
message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${this.configurationService.get( message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${(
'REQUEST_TIMEOUT' this.configurationService.get('REQUEST_TIMEOUT') / 1000
)}ms`; ).toFixed(3)} seconds`;
} }
Logger.error(message, 'CoinGeckoService'); Logger.error(message, 'CoinGeckoService');

6
apps/api/src/services/data-provider/eod-historical-data/eod-historical-data.service.ts

@ -290,9 +290,9 @@ export class EodHistoricalDataService implements DataProviderInterface {
let message = error; let message = error;
if (error?.code === 'ABORT_ERR') { if (error?.code === 'ABORT_ERR') {
message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${this.configurationService.get( message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${(
'REQUEST_TIMEOUT' this.configurationService.get('REQUEST_TIMEOUT') / 1000
)}ms`; ).toFixed(3)} seconds`;
} }
Logger.error(message, 'EodHistoricalDataService'); Logger.error(message, 'EodHistoricalDataService');

6
apps/api/src/services/data-provider/financial-modeling-prep/financial-modeling-prep.service.ts

@ -154,9 +154,9 @@ export class FinancialModelingPrepService implements DataProviderInterface {
let message = error; let message = error;
if (error?.code === 'ABORT_ERR') { if (error?.code === 'ABORT_ERR') {
message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${this.configurationService.get( message = `RequestError: The operation to get the quotes was aborted because the request to the data provider took more than ${(
'REQUEST_TIMEOUT' this.configurationService.get('REQUEST_TIMEOUT') / 1000
)}ms`; ).toFixed(3)} seconds`;
} }
Logger.error(message, 'FinancialModelingPrepService'); Logger.error(message, 'FinancialModelingPrepService');

Loading…
Cancel
Save