-
Notifications
You must be signed in to change notification settings - Fork 7
Feat/logtail pino #427
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
base: dev
Are you sure you want to change the base?
Feat/logtail pino #427
Conversation
WalkthroughThe changes introduce structured logging and heartbeat monitoring to both the relayer and validator CLI tools. New environment variables ( Changes
Sequence Diagram(s)Heartbeat Integration (Relayer/Validator)sequenceDiagram
participant CLI
participant Env
participant Logger
participant MonitoringService
CLI->>Env: Load HEARTBEAT_URL
CLI->>Logger: Initialize logger (with LOGTAIL_TOKEN if set)
CLI->>MonitoringService: sendHeartbeat() at startup
loop Main Loop
CLI->>MonitoringService: sendHeartbeat() periodically
CLI->>Logger: Log events
end
CLI->>MonitoringService: sendHeartbeat() at shutdown
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for veascan ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
♻️ Duplicate comments (2)
validator-cli/src/utils/env.ts (1)
2-8
: Keep logic consistent with relayer fixIf you accept the tightened
value === undefined
check in the relayer utility, mirror it here to prevent subtle behavioural differences between the two CLIs.relayer-cli/src/utils/logger.ts (1)
17-36
: Same dependency / env handling concernsReplicate the fixes applied to the validator logger:
- Move
pino-pretty
to runtime deps.- Fetch
LOGTAIL_TOKEN
via theenv
helper for consistency.
🧹 Nitpick comments (6)
relayer-cli/src/utils/env.ts (2)
2-8
: Empty string is treated as “missing” – is that intentional?
if (!value)
rejects an env var that is set but intentionally blank (e.g.VAR=""
). If you only want to fail when the key is truly undefined, checkvalue === undefined
instead.- if (!value) { + if (value === undefined) {
1-13
: Avoid copy-pasted utilities across packagesAn identical
env
helper is introduced in two different packages. Duplicating code increases maintenance cost and the risk of divergence. Export a small shared package (e.g.@kleros/vea-env
) or move the helper to the monorepo root and import it from both CLI tools.validator-cli/.env.dist (1)
24-26
: Order keys & keep sample files tidyThe linter warning is legit: place
HEARTBEAT_URL
beforeLOGTAIL_TOKEN
to keep alphabetical order and minimise merge noise.-LOGTAIL_TOKEN= -HEARTBEAT_URL= +HEARTBEAT_URL= +LOGTAIL_TOKEN=relayer-cli/.env.dist (1)
26-28
: Alphabetical order & trailing newline
- Alphabetise:
HEARTBEAT_URL
should precedeLOGTAIL_TOKEN
.- Add a trailing blank line to satisfy common linters and POSIX tools.
-LOGTAIL_TOKEN= -HEARTBEAT_URL= +HEARTBEAT_URL= +LOGTAIL_TOKEN= +validator-cli/src/watcher.ts (1)
88-96
: Tight loop may overload monitoring endpoint
sendHeartbeat()
is called every loop iteration (≈ 10 s) per watched network.
If multiple networks are configured the frequency scales linearly and could breach rate-limits.
Consider extracting a singlesetInterval
-based heartbeat or using a token-bucket.validator-cli/src/utils/logger.ts (1)
19-40
: Runtime dependency & env util consistency
pino-pretty
is loaded viatransport
– ensure it’s under"dependencies"
(see package.json comment).- Prefer
env.optional("LOGTAIL_TOKEN")
instead of readingprocess.env
directly to keep all env look-ups centralised.-const logtailToken = process.env.LOGTAIL_TOKEN; +const logtailToken = env.optional("LOGTAIL_TOKEN");
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
yarn.lock
is excluded by!**/yarn.lock
,!**/*.lock
📒 Files selected for processing (10)
relayer-cli/.env.dist
(1 hunks)relayer-cli/package.json
(1 hunks)relayer-cli/src/relayer.ts
(4 hunks)relayer-cli/src/utils/env.ts
(1 hunks)relayer-cli/src/utils/logger.ts
(2 hunks)validator-cli/.env.dist
(1 hunks)validator-cli/package.json
(1 hunks)validator-cli/src/utils/env.ts
(1 hunks)validator-cli/src/utils/logger.ts
(3 hunks)validator-cli/src/watcher.ts
(3 hunks)
🧰 Additional context used
🪛 dotenv-linter (3.3.0)
relayer-cli/.env.dist
[warning] 24-24: [QuoteCharacter] The value has quote characters (', ")
[warning] 28-28: [EndingBlankLine] No blank line at the end of the file
[warning] 28-28: [UnorderedKey] The HEARTBEAT_URL key should go before the LOGTAIL_TOKEN key
validator-cli/.env.dist
[warning] 26-26: [UnorderedKey] The HEARTBEAT_URL key should go before the LOGTAIL_TOKEN key
⏰ Context from checks skipped due to timeout of 90000ms (7)
- GitHub Check: Redirect rules - veascan
- GitHub Check: Header rules - veascan
- GitHub Check: Pages changed - veascan
- GitHub Check: Analyze (javascript)
- GitHub Check: Scorecard analysis
- GitHub Check: test
- GitHub Check: dependency-review
|
PR-Codex overview
This PR introduces monitoring capabilities by adding heartbeat signals and logging enhancements. It updates environment variable management and includes new dependencies for logging.
Detailed summary
LOGTAIL_TOKEN
andHEARTBEAT_URL
to.env.dist
files.sendHeartbeat
function inrelayer-cli/src/watcher.ts
andrelayer-cli/src/relayer.ts
.pino
inlogger.ts
files.@logtail/pino
andpino-pretty
dependencies inpackage.json
files.Summary by CodeRabbit
New Features
LOGTAIL_TOKEN
,HEARTBEAT_URL
).Refactor
pino
library, with optional Logtail integration for advanced log management.Chores