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

nacos.client.MetricsHttpAgent record one request twice #5026

Closed
shalk opened this issue Mar 6, 2021 · 0 comments · Fixed by #5029
Closed

nacos.client.MetricsHttpAgent record one request twice #5026

shalk opened this issue Mar 6, 2021 · 0 comments · Fixed by #5029
Assignees
Labels
kind/enhancement Category issues or prs related to enhancement.
Milestone

Comments

@shalk
Copy link
Contributor

shalk commented Mar 6, 2021

Describe the bug
A clear and concise description of what the bug is.

timer.close() is equivalent with timer.observeDuration(), so timer will observe twice. then we get wrong metric for request count.

we should removetimer.close().

    @Override
    public HttpRestResult<String> httpGet(String path, Map<String, String> headers, Map<String, String> paramValues,
            String encode, long readTimeoutMs) throws Exception {
        Histogram.Timer timer = MetricsMonitor.getConfigRequestMonitor("GET", path, "NA");
        HttpRestResult<String> result;
        try {
            result = httpAgent.httpGet(path, headers, paramValues, encode, readTimeoutMs);
        } catch (IOException e) {
            throw e;
        } finally {
            timer.observeDuration();
            timer.close();
        }
        
        return result;
    }

ref https://github.com/prometheus/client_java#histogram

Expected behavior
A clear and concise description of what you expected to happen.

Acutally behavior
A clear and concise description of what you actually to happen.

How to Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Desktop (please complete the following information):

  • OS: [e.g. Centos]
  • Version [e.g. nacos-server 1.3.1, nacos-client 1.3.1]
  • Module [e.g. naming/config]
  • SDK [e.g. original, spring-cloud-alibaba-nacos, dubbo]

Additional context
Add any other context about the problem here.

@KomachiSion KomachiSion added the kind/enhancement Category issues or prs related to enhancement. label Mar 8, 2021
@KomachiSion KomachiSion added this to the 1.4.2 milestone Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Category issues or prs related to enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants