Skip to content
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

feat: add global log level parameter #232

Merged
merged 9 commits into from
Aug 21, 2024

Conversation

leovct
Copy link
Member

@leovct leovct commented Aug 21, 2024

Description

Configure args.global_log_level to specify the log level for all components of the CDK stack.

Valid values are error, warn, info, debug and trace.

Also few fixes related to default params (not related to this PR).

Tests

  • Use the default global_log_level value => all components have log level set to info.
$ kurtosis service logs cdk-v1 cdk-erigon-node-001 --follow
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.820] [16/16 Finish] Finished 
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.850] Commit cycle                             in=30.608833ms
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.850] Timings (slower than 50ms)               Batches=12.133s
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.850] Tables                                   PlainState=20.0KB AccountChangeSet=12.0KB StorageChangeSet=36.0KB BlockTransaction=4.0KB TransactionLog=4.0KB FreeList=4.0KB ReclaimableSpace=4.0MB
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] RPC Daemon notified of new headers       from=104 to=107 hash=0xbd114119cec8dc4bbbcf018375aa2e28cbe5a052d8761dd8f48b383ef1e906e2 header sending=63.459µs log sending=250ns
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [1/16 L1Syncer] Starting L1 sync stage 
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [1/16 L1Syncer] Saving L1 syncer progress latestCheckedBlock=718 newVerificationsCount=0 newSequencesCount=0
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [1/16 L1Syncer] Finished L1 sync stage  
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [2/16 L1InfoTree] Starting L1 Info Tree stage 
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [2/16 L1InfoTree] Info tree updates      count=0
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [2/16 L1InfoTree] Finished L1 Info Tree stage 
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [3/16 Batches] Starting batches stage 
[cdk-erigon-node-001] [INFO] [08-21|08:29:30.851] [3/16 Batches] Reading blocks from the datastream.
  • Set global_log_level value to debug => all components have log level set to debug.
$ kurtosis service logs cdk-v1 cdk-erigon-node-001 --follow
[cdk-erigon-node-001] [DBUG] [08-21|07:41:09.126] [1/16 L1Syncer] DONE                     in=66µs
[cdk-erigon-node-001] [INFO] [08-21|07:41:09.126] [2/16 L1InfoTree] Starting L1 Info Tree stage 
[cdk-erigon-node-001] [DBUG] [08-21|07:41:09.126] Initial count:                           LOG15_ERROR= LOG15_ERROR="Normalized odd number of arguments by adding nil"
[cdk-erigon-node-001] [DBUG] [08-21|07:41:09.126] Initial root:                            LOG15_ERROR= LOG15_ERROR="Normalized odd number of arguments by adding nil"
[cdk-erigon-node-001] [INFO] [08-21|07:41:09.126] [2/16 L1InfoTree] Info tree updates      count=0
[cdk-erigon-node-001] [INFO] [08-21|07:41:09.126] [2/16 L1InfoTree] Finished L1 Info Tree stage 
[cdk-erigon-node-001] [DBUG] [08-21|07:41:09.126] [2/16 L1InfoTree] DONE                   in=113.833µs
[cdk-erigon-node-001] [INFO] [08-21|07:41:09.126] [3/16 Batches] Starting batches stage 
[cdk-erigon-node-001] [INFO] [08-21|07:41:09.126] [3/16 Batches] Reading blocks from the datastream. 
  • Wrong global_log_level value => kurtosis throws a descriptive error.
$ yq .args.global_log_level params.yml
"aa"

$ kurtosis run --enclave cdk-v1 --args-file params.yml .
INFO[2024-08-21T09:33:07+02:00] Creating a new enclave for Starlark to run inside... 
INFO[2024-08-21T09:33:08+02:00] Enclave 'cdk-v1' created successfully        
INFO[2024-08-21T09:33:08+02:00] Executing Starlark package at '/Users/leovct/Documents/work/infra/kurtosis-cdk' as the passed argument '.' looks like a directory 
INFO[2024-08-21T09:33:08+02:00] Compressing package 'github.com/0xPolygon/kurtosis-cdk' at '.' for upload 
INFO[2024-08-21T09:33:10+02:00] Uploading and executing package 'github.com/0xPolygon/kurtosis-cdk' 
There was an error interpreting Starlark code 
Evaluation error: fail: Unsupported global log level: 'aa', please use 'error', 'warn', 'info', 'debug' or 'trace'
	at [github.com/0xPolygon/kurtosis-cdk/main.star:34:50]: run
	at [github.com/0xPolygon/kurtosis-cdk/input_parser.star:78:30]: parse_args
	at [github.com/0xPolygon/kurtosis-cdk/input_parser.star:90:13]: validate_global_log_level
	at [0:0]: fail

Error encountered running Starlark code.

⭐ us on GitHub - https://github.com/kurtosis-tech/kurtosis
INFO[2024-08-21T09:33:11+02:00] =============================================== 
INFO[2024-08-21T09:33:11+02:00] ||          Created enclave: cdk-v1          || 
INFO[2024-08-21T09:33:11+02:00] =============================================== 
Name:            cdk-v1
UUID:            cc5b59aa0240
Status:          RUNNING
Creation Time:   Wed, 21 Aug 2024 09:33:07 CEST
Flags:           

========================================= Files Artifacts =========================================
UUID   Name

========================================== User Services ==========================================
UUID   Name   Ports   Status

References (if applicable)

https://0xpolygon.slack.com/archives/C06M06XR5A4/p1724224013558149?thread_ts=1724210533.957389&cid=C06M06XR5A4

@leovct leovct marked this pull request as ready for review August 21, 2024 08:45
@leovct leovct requested a review from a team August 21, 2024 09:10
Copy link
Collaborator

@jhkimqd jhkimqd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 lgtm

kurtosis.yml Show resolved Hide resolved
input_parser.star Show resolved Hide resolved
@leovct leovct merged commit c7059d4 into 0xPolygon:main Aug 21, 2024
5 of 6 checks passed
@leovct leovct deleted the feat/global-log-level branch August 21, 2024 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants