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

Added PeerManagement.Timeout config option #491

Merged
merged 3 commits into from
Sep 8, 2022

Conversation

thrawn01
Copy link
Contributor

@thrawn01 thrawn01 commented Aug 29, 2022

Which problem is this PR solving?

This PR adds a new config option called PeerManagement.Timeout which will be used when communicating with peer discovery systems implementing the Peers interface. This PR also add support for context.Context when first connecting to the Peers implementation.

Short description of the changes

  • NewPeers() now accepts a context.Context
  • Moved NewPeers() initialization after logging setup to take advantage of logs during any initial connect attempts.
  • Added //go:build all || race which is the new 1.18+ format for build tags (I can revert if not needed, my IDE auto fixed it 😄 )
  • Fixed minor memory leak in Router where the cancel() function is never called.

Note

I'm noting here that context.Context passed to NewPeer() is not as useful to redis because the redis dial function already has a retry and timeout loop. However, it will be useful for other concrete implementations of the Peers interface. If this PR is accepted, I wish to follow up with a PR that uses https://github.com/hashicorp/memberlist for peer discovery.

@thrawn01 thrawn01 requested review from a team and emilyashley August 29, 2022 17:09
@thrawn01 thrawn01 force-pushed the thrawn.peer-timeout branch from 5fb061f to ef32214 Compare August 29, 2022 18:00
@JamieDanielson JamieDanielson added the status: oncall Flagged for awareness from Honeycomb Telemetry Oncall label Aug 29, 2022
@thrawn01 thrawn01 force-pushed the thrawn.peer-timeout branch from ef32214 to 128f0d6 Compare August 30, 2022 02:23
@thrawn01 thrawn01 force-pushed the thrawn.peer-timeout branch from 128f0d6 to 3b3137e Compare August 30, 2022 02:23
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

I like where this is headed -- I'll likely have more comments on the next one. But the stuff in this one is useful, so please just use AddFields and we can run with this.

if err != nil {
// TODO maybe do something better here?
logrus.WithField("name", p.publicAddr).
Copy link
Contributor

Choose a reason for hiding this comment

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

A nit, but could you please do this with logrus.WithFields rather than a succession of WithField calls?

Copy link
Contributor

Choose a reason for hiding this comment

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

@thrawn01 -- to clarify, although I approved this PR, I would like to see that change before we merge it. Are you able to do that, please?

Copy link
Contributor

Choose a reason for hiding this comment

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

Done.

@@ -1,3 +1,4 @@
//go:build all || race
Copy link
Contributor

Choose a reason for hiding this comment

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

We're on 1.18+, so this is a good change. Thank you.

Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

As per @kentquirk's request, please can you update your logs to use WithFields 👍🏻

@MikeGoldsmith MikeGoldsmith added type: enhancement New feature or request status: revision needed Waiting for response to changes requested. version: bump minor A PR that adds behavior, but is backwards-compatible. and removed status: oncall Flagged for awareness from Honeycomb Telemetry Oncall labels Sep 6, 2022
@MikeGoldsmith
Copy link
Contributor

MikeGoldsmith commented Sep 7, 2022

This will also need a rebase to resolve conflicts.

@Baliedge
Copy link
Contributor

Baliedge commented Sep 7, 2022

This will also need a rebase to resolve conflicts.

Done.

@MikeGoldsmith
Copy link
Contributor

@Baliedge please could you update the log to use WithFields as @kentquirk suggestion too?

@Baliedge
Copy link
Contributor

Baliedge commented Sep 7, 2022

@Baliedge please could you update the log to use WithFields as @kentquirk suggestion too?

Also done.

Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Thanks @thrawn01 @Baliedge 👍🏻

@MikeGoldsmith MikeGoldsmith merged commit 27191f7 into honeycombio:main Sep 8, 2022
ghost pushed a commit to opsramp/tracing-proxy that referenced this pull request Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: revision needed Waiting for response to changes requested. type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants