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

Emit runtime logs in oasis-node logs #4709

Merged
merged 5 commits into from
May 4, 2022
Merged

Emit runtime logs in oasis-node logs #4709

merged 5 commits into from
May 4, 2022

Conversation

mitjat
Copy link
Contributor

@mitjat mitjat commented Apr 26, 2022

Resolves #1819

Testing (besides unit tests): Ran an e2e scenario involving a nontrivial runtime, manually inspected logs (less $(ls -dt --color=none /tmp/oasis-test-runner* | head -1)/e2e/runtime/runtime/network/compute-0/node.log) to verify that runtime logs look as expected.

@mitjat mitjat force-pushed the mitjat/runtime-logs branch 2 times, most recently from 518d990 to ceec4f0 Compare April 28, 2022 20:31
prefixes := []interface{}{
"ts", log.DefaultTimestampUTC,
"caller", log.Caller(defaultUnwind + extraUnwind),
"module", module,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Slight simplification: We only used to set this for module!="". Grepping shows this is currently always the case. I don't think that usage of module=="" is encouraged, so if it ever does happen, it should be fine to explicitly draw attention to it with an empty string in the logs.

// except for the module name. Its level will be set in accordance
// with the global config, which can be per-module.
//
// This may be called from any point, including before Initialize is
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I implemented this (and copy-pasted the doc paragraph) for consistency with GetLogger(), but I'm happy to simplify the code and panic if logging is not initialized and the method is called. It would work for the current use case, and no other use cases are foreseen.

go/runtime/host/sandbox/sandbox.go Show resolved Hide resolved
@mitjat mitjat marked this pull request as ready for review April 28, 2022 20:49
go/runtime/host/helpers.go Outdated Show resolved Hide resolved
go/runtime/host/helpers.go Outdated Show resolved Hide resolved
go/runtime/host/helpers.go Outdated Show resolved Hide resolved
go/runtime/host/sandbox/sandbox.go Outdated Show resolved Hide resolved
go/runtime/host/sgx/sgx.go Outdated Show resolved Hide resolved
go/runtime/host/sgx/sgx.go Outdated Show resolved Hide resolved
go/runtime/host/sandbox/sandbox.go Outdated Show resolved Hide resolved
@mitjat mitjat requested a review from kostko April 29, 2022 15:28
@kostko
Copy link
Member

kostko commented May 3, 2022

Seems like some lints and unit tests are failing.

@mitjat mitjat force-pushed the mitjat/runtime-logs branch 2 times, most recently from 991ab35 to 52582f8 Compare May 4, 2022 07:05
mitjat and others added 5 commits May 4, 2022 12:31
This exposes the previously private base logger. It also slightly
changes the semantics of base logger in that it no longer contains
_any_ prefixes, whereas it used to contain the timestamp.
This is because logs from the runtime already come timestamped,
and we want to expose them via the base logger.
Co-authored-by: Jernej Kos <jernej@kos.mx>
- extract wrapper from helpers.go to a new logger.go
- extract max buffer size constant
- log lines with no specified level at INFO
@codecov
Copy link

codecov bot commented May 4, 2022

Codecov Report

Merging #4709 (ec8878b) into master (3f56208) will increase coverage by 0.11%.
The diff coverage is 84.84%.

@@            Coverage Diff             @@
##           master    #4709      +/-   ##
==========================================
+ Coverage   66.86%   66.97%   +0.11%     
==========================================
  Files         440      441       +1     
  Lines       49254    49338      +84     
==========================================
+ Hits        32934    33045     +111     
+ Misses      12280    12237      -43     
- Partials     4040     4056      +16     
Impacted Files Coverage Δ
go/runtime/host/logger.go 78.68% <78.68%> (ø)
go/common/logging/logging.go 76.07% <90.90%> (-1.85%) ⬇️
go/runtime/host/sandbox/sandbox.go 67.35% <100.00%> (+7.49%) ⬆️
go/runtime/host/sgx/sgx.go 70.25% <100.00%> (+1.10%) ⬆️
go/common/cbor/codec.go 78.37% <0.00%> (-10.82%) ⬇️
go/worker/common/p2p/rpc/server.go 80.76% <0.00%> (-9.62%) ⬇️
go/consensus/tendermint/apps/beacon/genesis.go 63.63% <0.00%> (-6.07%) ⬇️
go/worker/common/p2p/dispatch.go 71.52% <0.00%> (-5.56%) ⬇️
go/worker/common/committee/keymanager.go 89.47% <0.00%> (-5.27%) ⬇️
go/consensus/tendermint/apps/beacon/state/state.go 68.81% <0.00%> (-4.31%) ⬇️
... and 34 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a0404b1...ec8878b. Read the comment docs.

@mitjat mitjat merged commit f2713b0 into master May 4, 2022
@mitjat mitjat deleted the mitjat/runtime-logs branch May 4, 2022 11:55
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.

Parse runtime logs and emit as oasis-node logs
2 participants