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

*: add a log when getting timestamps are too slow #1863

Merged
merged 3 commits into from
Oct 30, 2019

Conversation

rleungx
Copy link
Member

@rleungx rleungx commented Oct 29, 2019

What problem does this PR solve?

To make clear about whether the server is slow or the network is slow when getting timestamps.

What is changed and how it works?

This PR will print a log when the cost time of getting timestamps is more than one second.

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@rleungx rleungx added needs-cherry-pick-release-2.1 The PR needs to cherry pick to release-2.1 branch. needs-cherry-pick-release-3.0 The PR needs to cherry pick to release-3.0 branch. needs-cherry-pick-release-3.1 The PR needs to cherry pick to release-3.1 branch. labels Oct 29, 2019
@@ -87,6 +87,11 @@ func (s *Server) Tso(stream pdpb.PD_TsoServer) error {
if err != nil {
return status.Errorf(codes.Unknown, err.Error())
}

elapsed := time.Since(start)
if elapsed > time.Second {
Copy link
Contributor

Choose a reason for hiding this comment

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

1s is too long. Consider 1ms?

Copy link
Member Author

Choose a reason for hiding this comment

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

I doubt if it will too noisy?

Copy link
Member Author

Choose a reason for hiding this comment

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

I did a test and found the cost time was only several microseconds. So I change it to 1ms.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@codecov-io
Copy link

codecov-io commented Oct 30, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@17383d9). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1863   +/-   ##
=========================================
  Coverage          ?   77.89%           
=========================================
  Files             ?      169           
  Lines             ?    16990           
  Branches          ?        0           
=========================================
  Hits              ?    13235           
  Misses            ?     2691           
  Partials          ?     1064
Impacted Files Coverage Δ
server/grpc_service.go 57.32% <100%> (ø)

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 17383d9...e6b71b5. Read the comment docs.

@nolouch nolouch added the status/can-merge Indicates a PR has been approved by a committer. label Oct 30, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Oct 30, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Oct 30, 2019

@rleungx merge failed.

Signed-off-by: Ryan Leung <rleungx@gmail.com>
@sre-bot
Copy link
Contributor

sre-bot commented Oct 30, 2019

cherry pick to release-2.1 in PR #1866

@sre-bot
Copy link
Contributor

sre-bot commented Oct 30, 2019

cherry pick to release-3.0 in PR #1867

@sre-bot
Copy link
Contributor

sre-bot commented Oct 30, 2019

cherry pick to release-3.1 in PR #1868

lhy1024 pushed a commit that referenced this pull request Oct 31, 2019
* add log for get timestamps

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* change to millisecond

Signed-off-by: Ryan Leung <rleungx@gmail.com>

* change threshold to 5ms

Signed-off-by: Ryan Leung <rleungx@gmail.com>
nolouch pushed a commit that referenced this pull request Oct 31, 2019
* add log for get timestamps

Signed-off-by: Ryan Leung <rleungx@gmail.com>
nolouch pushed a commit that referenced this pull request Oct 31, 2019
* add log for get timestamps

Signed-off-by: Ryan Leung <rleungx@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cherry-pick-release-2.1 The PR needs to cherry pick to release-2.1 branch. needs-cherry-pick-release-3.0 The PR needs to cherry pick to release-3.0 branch. needs-cherry-pick-release-3.1 The PR needs to cherry pick to release-3.1 branch. status/can-merge Indicates a PR has been approved by a committer.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants