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

Backport of Fix: avoid redundant logs on failures to export metrics into release/1.17.x #1075

Open
2 of 4 tasks
dhiaayachi opened this issue Sep 27, 2024 · 0 comments
Open
2 of 4 tasks

Comments

@dhiaayachi
Copy link
Owner

Backport

This PR is auto-generated from hashicorp#20519 to be assessed for backporting due to the inclusion of the label backport/1.17.

🚨

Warning automatic cherry-pick of commits failed. If the first commit failed,
you will see a blank no-op commit below. If at least one commit succeeded, you
will see the cherry-picked commits up to, not including, the commit where
the merge conflict occurred.

The person who merged in the original PR is:
@jjti
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.

merge conflict error: POST https://api.github.com/repos/hashicorp/consul/merges: 409 Merge conflict []

The below text is copied from the body of the original PR.


Description

I'm seeing redundant log lines on failures to push metrics to HCP:

2024-02-07T14:22:37.358Z [ERROR] agent.hcp.hcp_telemetry_client: request failed: error="Post "https://consul-telemetry.hcp.dev/otlp/v1/metrics\": http2: Transport: cannot retry err [http2: Transport received Server's graceful shutdown GOAWAY] after Request.Body was written; define Request.GetBody to avoid this error" method=POST url=https://consul-telemetry.hcp.dev/otlp/v1/metrics

2024/02/07 14:22:37 failed to export metrics: failed to post metrics: POST https://consul-telemetry.hcp.dev/otlp/v1/metrics giving up after 1 attempt(s): Post "https://consul-telemetry.hcp.dev/otlp/v1/metrics": http2: Transport: cannot retry err [http2: Transport received Server's graceful shutdown GOAWAY] after Request.Body was written; define Request.GetBody to avoid this error

We log in two places:

The fix here is to pass a NullLogger to the http client so:

An alternative approach is to combine this PR with the other logging-related PR: hashicorp#20514. And:

  • set the otel global logger to a no-op logger that does nothing
  • also disable logging in the go-retryablehttp client (NullLogger as in this PR)
  • only log in ExportMetrics

Testing & Reproduction steps

Links

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

Overview of commits
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

No branches or pull requests

1 participant