8000 test: logging level by Yongxuanzhang · Pull Request #1774 · jina-ai/serve · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

test: logging level #1774

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

Merged
merged 3 commits into from
Jan 25, 2021
Merged

test: logging level #1774

merged 3 commits into from
Jan 25, 2021

Conversation

Yongxuanzhang
Copy link
Contributor

Test the logging level with os variable 'JINA_LOG_LEVEL' setting.
Related to #1744.

@jina-bot jina-bot added size/S area/testing This issue/PR affects testing labels Jan 25, 2021
@codecov
Copy link
codecov bot commented Jan 25, 2021

Codecov Report

Merging #1774 (228c13f) into master (f2c132a) will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1774      +/-   ##
==========================================
+ Coverage   85.70%   85.74%   +0.04%     
==========================================
  Files         135      135              
  Lines        6924     6924              
==========================================
+ Hits         5934     5937       +3     
+ Misses        990      987       -3     
Impacted Files Coverage Δ
jina/optimizers/flow_runner.py 84.44% <ø> (ø)
jina/flow/base.py 87.53% <0.00%> (-0.51%) ⬇️
jina/importer.py 67.24% <0.00%> (+2.15%) ⬆️

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 51af9bb...1d1d4a2. Read the comment docs.

@github-actions
Copy link
github-actions bot commented Jan 25, 2021

Latency summary

Current PR yields:

  • 😶 index QPS at 1399, delta to last 3 avg.: +0%
  • 😶 query QPS at 36, delta to last 3 avg.: -2%

Breakdown

Version Index QPS Query QPS
current 1399 36
0.9.21 1397 36
0.9.20 1403 37

Backed by latency-tracking. Further commits will update this comment.

@Yongxuanzhang Yongxuanzhang marked this pull request as ready for review January 25, 2021 05:24
@Yongxuanzhang Yongxuanzhang requested a review from a team as a code owner January 25, 2021 05:24
log(logger)
assert logger.logger.level == LogVerbosity.from_string('INFO')

os.environ['JINA_LOG_LEVEL'] = 'SUCCESS'
Copy link
Contributor

Choose a reason for hiding this comment

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

add a try catch mechanism that ensures thr os env is properly deleted but at same time captures the assertion error

Copy link
Contributor

Choose a reason for hiding this comment

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

or split the test so that u can use fixtures to guarantee this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split the test and use fixtures in the latest commit. Thanks!

Copy link
Member
@hanxiao hanxiao left a comment

Choose a reason for hiding this comment

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

this is not a valid test, as in your test assertion you write the same code as in the logger

        if 'JINA_LOG_LEVEL' in os.environ:
            verbose_level = LogVerbosity.from_string(os.environ['JINA_LOG_LEVEL'])
        self.logger.setLevel(verbose_level.value)

This is the same as having the code a=1 and then test it via assert a==1, it is almost meaningless in most cases.

The correct way is to test the emission of the logger, and see if it is suppressed given the current loglevel.

@Yongxuanzhang
Copy link
Contributor Author

this is not a valid test, as in your test assertion you write the same code as in the logger

        if 'JINA_LOG_LEVEL' in os.environ:
            verbose_level = LogVerbosity.from_string(os.environ['JINA_LOG_LEVEL'])
        self.logger.setLevel(verbose_level.value)

This is the same as having the code a=1 and then test it via assert a==1, it is almost meaningless in most cases.

The correct way is to test the emission of the logger, and see if it is suppressed given the current loglevel.

Revised in the latest commit.

@hanxiao hanxiao merged commit ce7e274 into master Jan 25, 2021
@hanxiao hanxiao deleted the test-logging-level branch January 25, 2021 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/testing This issue/PR affects testing size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0