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

chore(SIPI): add timestamp to some SIPI Lua logs #2311

Merged
merged 7 commits into from Nov 30, 2022

Conversation

BalduinLandolt
Copy link
Collaborator

@BalduinLandolt BalduinLandolt commented Nov 29, 2022

Issue Number: DEV-

Pull Request Checklist

Basic Requirements

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix: represents bug fixes
  • Refactor: represents production code refactoring
  • Feature: represents a new feature
  • Documentation: documentation changes (no production code change)
  • Chore: maintenance tasks (no production code change)
  • Style: styles updates (no production code change)
  • Test: all about tests: adding, refactoring tests (no production code change)
  • Other... Please describe:

Does this PR introduce a breaking change?

  • Yes
  • No

Does this PR change client-test-data?

  • Yes (don't forget to update the JS-LIB team about the change)
  • No

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

Copy link

@irinaschubert irinaschubert left a 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 Show resolved Hide resolved
sipi/scripts/sipi.init.lua Show resolved Hide resolved
sipi/scripts/sipi.init.lua Outdated Show resolved Hide resolved
sipi/scripts/sipi.init.lua Outdated Show resolved Hide resolved
@@ -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)

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).

Copy link
Collaborator Author

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

Copy link
Collaborator Author

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
Copy link

codecov bot commented Nov 29, 2022

Codecov Report

Base: 86.95% // Head: 86.68% // Decreases project coverage by -0.27% ⚠️

Coverage data is based on head (ce7e4ea) compared to base (bfe578a).
Patch coverage: 44.19% of modified lines in pull request are covered.

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     
Impacted Files Coverage Δ
...ain/scala/dsp/project/handler/ProjectHandler.scala 100.00% <ø> (ø)
.../src/main/scala/dsp/role/handler/RoleHandler.scala 88.00% <ø> (ø)
...c/main/scala/dsp/role/repo/impl/RoleRepoLive.scala 100.00% <ø> (ø)
...shared/src/main/scala/dsp/util/UuidGenerator.scala 0.00% <0.00%> (ø)
...erface/src/main/scala/dsp/user/route/GetUser.scala 0.00% <0.00%> (ø)
...ce/src/main/scala/dsp/user/route/MigrateUser.scala 0.00% <0.00%> (ø)
...ace/src/main/scala/dsp/user/route/UserRoutes.scala 0.00% <0.00%> (ø)
...c/main/scala/dsp/user/repo/impl/UserRepoLive.scala 100.00% <ø> (ø)
webapi/src/main/scala/org/knora/webapi/Main.scala 0.00% <0.00%> (ø)
...main/scala/org/knora/webapi/config/AppConfig.scala 81.63% <ø> (ø)
... and 20 more

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.
📢 Do you have feedback about the report comment? Let us know in this issue.

@BalduinLandolt BalduinLandolt merged commit 8f3f19f into main Nov 30, 2022
@BalduinLandolt BalduinLandolt deleted the wip/add-time-stamps-to-sipi-lua-logs branch November 30, 2022 12:39
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.

None yet

4 participants