Skip to content

Retry connection errors - #214

Merged
alexmojaki merged 3 commits into
mainfrom
alex/retry-connection-errors
May 27, 2024
Merged

alexmojaki merged 3 commits into
mainfrom
alex/retry-connection-errors

Conversation

@alexmojaki

Copy link
Copy Markdown
Contributor

After some investigation, I've found that neither OTEL nor requests does any retrying by default when there's a connection or timeout error while making a request.

OTEL does retry on certain status codes in a way that looks sensible so I'm leaving that case as is, although it's not the kind of problem we usually see.

It's possible to configure retries with requests but OTEL doesn't do so and it didn't seem easier than just coding the retries myself.

@alexmojaki
alexmojaki requested a review from adriangb May 27, 2024 14:37
@codecov

codecov Bot commented May 27, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented May 27, 2024 •

Copy link
Copy Markdown

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 10c81e2
Status: ✅  Deploy successful!
Preview URL: https://d8389f62.logfire-docs.pages.dev
Branch Preview URL: https://alex-retry-connection-errors.logfire-docs.pages.dev

View logs

request.body = gen() # type: ignore
return super().send(request, **kwargs)

max_attempts = 7

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should this be configurable in any way?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think so. Making it configurable would be painful with little benefit, and OTEL's retrying of status codes isn't configurable.

@alexmojaki
alexmojaki merged commit b202619 into main May 27, 2024
@alexmojaki
alexmojaki deleted the alex/retry-connection-errors branch May 27, 2024 14:50
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

Successfully merging this pull request may close these issues.

2 participants