Skip to content

Conversation

chicco785
Copy link
Contributor

fix #160 and introduce multiple level of logs

  • differentia log levels
  • add LOGLEVEL env variable
  • document env variables

fix #160 and introduce multiple level of logs
@chicco785 chicco785 requested a review from c0c0n3 April 3, 2020 19:58
Copy link
Member

@c0c0n3 c0c0n3 left a comment

Choose a reason for hiding this comment

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

Thanks this is great. Just a couple of things though:

  1. I'm assuming you verified manually that the log level gets picked up from the env and then you can see log lines being output at that level or higher but not below. E.g. if env log level = info, then you should not see any debug lines in the logs.
  2. Have a look at the other comment in the review---trifling point :-)
  3. I added your TODOs about failing geocoding tests to the list of things to look into for #292, so we can deal with that separately, hope that's okay.

self.cursor = self.conn.cursor()

# IMPORTANT this reduce queries to crate, but it also means
# that you need to redeploy ql in case of major crate update
Copy link
Member

Choose a reason for hiding this comment

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

Are you saying this because of global state? There's no global state here, you'll get a fresh translator instance each time the notify endpoint gets hit:

Notice the use of a context manager

If that's what you were worrying about I suggest we get rid of this sentence "but it also means that you need to redeploy ql in case of major crate update" since it's going to be confusing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

then we can remove the comment, still is a query that consume time and 99% with the same result, so if we have somewhere this a static value that is not refreshed every notification, may be a better option.

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 updated the TODO text

Copy link
Member

Choose a reason for hiding this comment

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

yep, excellent point, I opened a separate issue just for that: #302

@chicco785
Copy link
Contributor Author

1 . I'm assuming you verified manually that the log level gets picked up from the env and then you can see log lines being output at that level or higher but not below. E.g. if env log level = info, then you should not see any debug lines in the logs.

Yes, have verified that, not sure we can develop a test though. It may be quite a pain.

  1. Have a look at the other comment in the review---trifling point :-)

Did that

  1. I added your TODOs about failing geocoding tests to the list of things to look into for Fix geocoding tests #292, so we can deal with that separately, hope that's okay.

Top!

@c0c0n3
Copy link
Member

c0c0n3 commented Apr 6, 2020

not sure we can develop a test though. It may be quite a pain.

totally. visual inspection is more than enough for me.

Thanks for the PR, awesome work. I'm going to merge if there's nothing else you'd like to add.

@chicco785
Copy link
Contributor Author

yes please fill free to merge

@c0c0n3 c0c0n3 assigned c0c0n3 and unassigned c0c0n3 Apr 6, 2020
@c0c0n3 c0c0n3 merged commit aeb3230 into master Apr 6, 2020
@chicco785 chicco785 deleted the fix-#160 branch April 12, 2020 20:04
fisuda added a commit to fisuda/ngsi-timeseries-api that referenced this pull request Jul 4, 2020
c0c0n3 pushed a commit that referenced this pull request Jul 6, 2020
* (ja) Add documentation for crate 4.x (#300)

* (ja) Add documentation for environment variables (#299,#330)
@c0c0n3 c0c0n3 mentioned this pull request Jul 20, 2020
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.

Log Level
2 participants