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
chore(SIPI): add timestamp to some SIPI Lua logs #2311
Conversation
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.
LGTM, just some minor remarks/suggestions. Feel free to ignore them as they are probably out of scope for now.
sipi/scripts/sipi.init.lua
Outdated
@@ -20,14 +20,16 @@ require "get_knora_session" | |||
-- filepath: server-path where the master file is located | |||
------------------------------------------------------------------------------- | |||
function pre_flight(prefix, identifier, cookie) | |||
server.log("pre_flight called in sipi.init.lua", server.loglevel.LOG_DEBUG) | |||
server.log(os.date("!%Y-%m-%dT%H:%M:%S") .. " - pre_flight called in sipi.init.lua", server.loglevel.LOG_DEBUG) |
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.
Would it be possible to also have miliseconds in the timestamp? This would later be useful when it comes to measuring durations (metrics).
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.
not without using a different library, which I wanted to avoid
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.
this proved to be too annoying because in our Lua setup we don't have a package manager or anything. So I'd rather leave it out for now.
If you need millisecond precise time measurements, that is however possible:
before = os.clock()
-- do the work
after = os.clock()
duration = (after - before) * 1000
log("work took " .. duration .. "ms")
Codecov ReportBase: 86.95% // Head: 86.68% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #2311 +/- ##
==========================================
- Coverage 86.95% 86.68% -0.28%
==========================================
Files 242 251 +9
Lines 28102 28253 +151
==========================================
+ Hits 24435 24490 +55
- Misses 3667 3763 +96
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
Issue Number: DEV-
Pull Request Checklist
Basic Requirements
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?
Does this PR change client-test-data?
Other information
Previously SIPI Lua logs did not have a any timestamps attached. This PR introduces it to some - can be used as a template for future works on the lua script. On the long run we should have this done for all log calls in the lua scripts