Skip to content

Commit

Permalink
Revisit logs
Browse files Browse the repository at this point in the history
  • Loading branch information
Siegrift committed Mar 21, 2024
1 parent 0f66be6 commit 7dd87a6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/data-fetcher-loop/data-fetcher-loop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,17 @@ export const callSignedApi = async (url: string, timeout: number): Promise<Signe

export const runDataFetcher = async () => {
return logger.runWithContext({ dataFetcherCoordinatorId: Date.now().toString() }, async () => {
logger.debug('Running data fetcher.');
logger.info('Running data fetcher.');

const state = getState();
const {
config: { signedDataFetchInterval },
signedApiUrls,
} = state;

const signedDataFetchIntervalMs = signedDataFetchInterval * 1000;

// Better to log the non-decomposed object to see which URL comes from which chain-provider group.
logger.debug('Fetching data from signed APIs.', { signedApiUrls });

const urls = uniq(
Object.values(signedApiUrls)
.map((urlsPerProvider) => Object.values(urlsPerProvider))
Expand Down
12 changes: 3 additions & 9 deletions src/data-fetcher-loop/signed-data-state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const verifySignedDataIntegrity = (signedData: SignedData) => {
};

export const saveSignedData = (signedData: SignedData) => {
const { airnode, templateId, signature, timestamp, encodedValue } = signedData;
const { airnode, templateId, timestamp } = signedData;

if (!verifySignedDataIntegrity(signedData)) {
return;
Expand All @@ -76,17 +76,11 @@ export const saveSignedData = (signedData: SignedData) => {
}

if (!isSignedDataFresh(signedData)) {
logger.debug('Skipping state update. The signed data value is older than 24 hours.');
// This should not happen under normal circumstances. Something must be off with the Signed API.
logger.warn('Skipping state update. The signed data value is older than 24 hours.');
return;
}

logger.debug(`Storing signed data.`, {
airnode,
templateId,
timestamp,
signature,
encodedValue,
});
updateState((draft) => {
draft.signedDatas[dataFeedId] = signedData;
});
Expand Down
2 changes: 1 addition & 1 deletion src/gas-price/gas-price.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const getRecommendedGasPrice = async (
gasPrices.map((gasPrice) => gasPrice.price)
);
if (!percentileGasPrice) {
logger.debug('No historical gas prices to compute the percentile. Using the provider recommended gas price.');
logger.info('No historical gas prices to compute the percentile. Using the provider recommended gas price.');
return multiplyBigNumber(gasPrice, recommendedGasPriceMultiplier);
}

Expand Down
4 changes: 2 additions & 2 deletions src/update-feeds-loops/update-feeds-loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const runUpdateFeeds = async (providerName: ProviderName, chain: Chain, c
// Create a provider and connect it to the AirseekerRegistry contract.
const provider = await createProvider(providers[providerName]!.url);
if (!provider) {
logger.info('Failed to create provider. This is likely an RPC issue.');
logger.warn('Failed to create provider. This is likely an RPC issue.');
return;
}
const airseekerRegistry = getAirseekerRegistry(contracts.AirseekerRegistry, provider);
Expand Down Expand Up @@ -239,7 +239,7 @@ export const runUpdateFeeds = async (providerName: ProviderName, chain: Chain, c
const skippedBatchesCount = processedBatches.filter((batch) => !batch).length;
const dataFeedUpdates = processedBatches.reduce((acc, batch) => acc + (batch ? batch.successCount : 0), 0);
const dataFeedUpdateFailures = processedBatches.reduce((acc, batch) => acc + (batch ? batch.errorCount : 0), 0);
logger.debug(`Finished processing batches of active data feeds.`, {
logger.info(`Finished processing batches of active data feeds.`, {
skippedBatchesCount,
dataFeedUpdates,
dataFeedUpdateFailures,
Expand Down

0 comments on commit 7dd87a6

Please sign in to comment.