Skip to content

Commit

Permalink
chore: move ADDITIONAL_QUERY_FILTERS to constants
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Nov 22, 2024
1 parent d9b1925 commit d26062a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
10 changes: 10 additions & 0 deletions helpers/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ export const networks = {
pod_name: 'validator-primary-0',
},
};

export const ADDITIONAL_QUERY_FILTERS = `
(
jsonPayload.type = "create-vat" OR
jsonPayload.type = "cosmic-swingset-end-block-start" OR
jsonPayload.type = "deliver" OR
jsonPayload.type = "deliver-result" OR
jsonPayload.type = "syscall"
)
`;
13 changes: 3 additions & 10 deletions services/fetchGCPLogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@
import { getCredentials } from '../helpers/getGCPCredentials.js';
import { getAccessToken } from '../helpers/getAccessToken.js';
import { formatDateString } from '../helpers/utils.js';
import { ADDITIONAL_QUERY_FILTERS } from '../helpers/constants.js';

const LOG_ENTRIES_ENDPOINT = 'https://logging.googleapis.com/v2/entries:list';
// eslint-disable-next-line no-unused-vars
const COMMIT_BLOCK_FINISH_EVENT_TYPE = 'cosmic-swingset-commit-block-finish';
const ADDITIONAL_FILTERS = `
(
jsonPayload.type = "create-vat" OR
jsonPayload.type = "cosmic-swingset-end-block-start" OR
jsonPayload.type = "deliver" OR
jsonPayload.type = "deliver-result" OR
jsonPayload.type = "syscall"
)
`;

/**
* @typedef {{
Expand Down Expand Up @@ -71,7 +64,7 @@ export const fetchGCPLogs = async ({
}) => {
const fullFilter = `
${filter} AND
${ADDITIONAL_FILTERS}
${ADDITIONAL_QUERY_FILTERS}
timestamp >= "${formatDateString(startTime)}"
AND timestamp <= "${formatDateString(endTime)}"
`;
Expand Down

0 comments on commit d26062a

Please sign in to comment.