-
Notifications
You must be signed in to change notification settings - Fork 15
Feat/logs service #127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Feat/logs service #127
Changes from all commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
1662670
feat: implement exit logs service with fetcher and DTOs
eddort d7a3be4
feat: integrate exit logs service into job processor and application …
eddort df3ec06
fix: update debug log color to blue in logger printer
eddort 8a115e8
feat: implement LRUCache class with basic operations and tests
eddort eb1d3a6
feat: implement exit logs caching and fetching service with types
eddort 6090312
feat: refactor exit logs service and add logs fetching method in exec…
eddort e1caed4
feat: simplify exit logs service initialization and enhance JSON resp…
eddort df4168d
feat: enhance exit logs processing by adding node operator ID and ack…
eddort d515b7c
feat: enhance configuration validation for OPERATOR_ID and OPERATOR_I…
eddort f23d920
feat: update exit logs fetching to include last block number and impr…
eddort e18c0f7
feat: rename pooling method to loop and update job execution logic
eddort 7a51d3d
feat: update job processing logic to acknowledge events based on fina…
eddort 3a9c084
feat: add base end-to-end tests for exit logs service and increase te…
eddort 893db2d
fix: correct typo in README for polling_last_blocks_duration_seconds …
eddort 2970441
feat: enhance error handling by adding safelyParseJsonResponse for CL…
eddort 037daec
feat: enable exitLogs e2e tests and enhance test timeout for improved…
eddort bc3bf63
fix: update public execution node URL
eddort 182a073
test: add validation for operator identification in config module
eddort 3f06c9d
fix: reduce LRU cache size for transaction and consensus logs to opti…
eddort 2ef1409
fix: remove lido-nanolib dependency
eddort cb32e8e
feat: enhance logging with heap size limit and fetch time metrics in …
eddort b882b40
test: add unit tests for ExitLogsService to validate log fetching beh…
eddort d758912
fix: update nock dependency version to remove caret for consistency
eddort 1b2e4d6
test: implement unit tests for JSON and simple output formats in logger
eddort 9fb54a5
fix: update exitLogs tests to use environment variables for node conf…
eddort a82c731
fix: increase test timeout to 10 minutes for improved test execution
eddort e3933ed
fix: correct debug color comment and enhance error logging for JSON r…
eddort f0e1c49
fix: remove unused getLastFromCache method from exit logs cache service
eddort 1bbadbb
fix: add comment to clarify the number of blocks for ConsensusReached…
eddort cc50332
fix: remove BLOCKS_LOOP configuration option from README and service
eddort 1aa88db
fix: unify operator identification handling by replacing OPERATOR_IDE…
eddort 7853abb
fix: enhance error logging for transaction report hash lookup and dat…
eddort abeffc1
fix: update exit logs tests to use hardcoded mainnet block numbers wi…
eddort 3bff5b6
fix: replace LRUCache implementation with lru-cache package and updat…
eddort b33856e
fix: rename logs function to getLogs for clarity and consistency
eddort e0715a0
fix: update exit logs cache header initialization and adjust related …
eddort 96fbf0b
fix: simplify cached logs check by removing redundant condition
eddort b1c7c71
fix: add comment for future use of baseUrl in the balancer mechanism
eddort File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import dotenv from 'dotenv' | ||
| import { | ||
| makeLogger, | ||
| makeRequest, | ||
| retry, | ||
| abort, | ||
| notOkError, | ||
| prom, | ||
| logger as loggerMiddleware, | ||
| } from '../lib/index.js' | ||
| import { makeLoggerConfig, makeConfig } from '../services/config/service.js' | ||
| import { makeExecutionApi } from '../services/execution-api/service.js' | ||
| import { makeExitLogsService } from '../services/exit-logs/service.js' | ||
| import { makeMetrics } from '../services/prom/service.js' | ||
|
|
||
| dotenv.config() | ||
|
|
||
| const run = async () => { | ||
| const loggerConfig = makeLoggerConfig({ env: process.env }) | ||
|
|
||
| const logger = makeLogger({ | ||
| level: loggerConfig.LOGGER_LEVEL, | ||
| format: loggerConfig.LOGGER_FORMAT, | ||
| sanitizer: { | ||
| secrets: loggerConfig.LOGGER_SECRETS, | ||
| replacer: '<secret>', | ||
| }, | ||
| }) | ||
|
|
||
| const config = makeConfig({ logger, env: process.env }) | ||
|
|
||
| const operatorIds = config.OPERATOR_IDS | ||
|
|
||
| const metrics = makeMetrics({ PREFIX: config.PROM_PREFIX }) | ||
|
|
||
| const executionHttp = makeRequest([ | ||
| retry(3), | ||
| loggerMiddleware(logger), | ||
| prom(metrics.executionRequestDurationSeconds), | ||
| notOkError(), | ||
| abort(30_000), | ||
|
eddort marked this conversation as resolved.
|
||
| ]) | ||
|
|
||
| const executionApi = makeExecutionApi(executionHttp, logger, config) | ||
|
|
||
| const exitLogs = makeExitLogsService(logger, executionApi, config, metrics) | ||
|
|
||
| await executionApi.resolveExitBusAddress() | ||
| await executionApi.resolveConsensusAddress() | ||
| const fetchTimeStart = performance.now() | ||
| const lastBlockNumber = await executionApi.latestBlockNumber() | ||
|
|
||
| const logs = await exitLogs.getLogs(operatorIds, lastBlockNumber) | ||
|
|
||
| logger.info('logs fetched', { count: logs.length }) | ||
|
|
||
| const fetchTimeEnd = performance.now() | ||
| const fetchTime = Math.ceil(fetchTimeEnd - fetchTimeStart) / 1000 | ||
|
|
||
| logger.info(`Logs fetched in ${fetchTime} seconds`) | ||
| } | ||
|
|
||
| run().catch(console.error) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.