Skip to content

Ensure integrations quickstart connection closed#8

Merged
dd-mergequeue[bot] merged 1 commit into
mainfrom
benjamin.johnsonstaub/ensure-connection-closed
Sep 22, 2025
Merged

Ensure integrations quickstart connection closed#8
dd-mergequeue[bot] merged 1 commit into
mainfrom
benjamin.johnsonstaub/ensure-connection-closed

Conversation

@benjjs
Copy link
Copy Markdown
Collaborator

@benjjs benjjs commented Sep 19, 2025

Summary

I noticed some logs indicating that our rapid service had a bunch of stale connections open. After taking a look at the script, I realized that we would fail to close our connection to that service if we encountered any kind of error before completing the flow, including a SIGINT.

The pythonic way to handle this kind of thing is with a context manager, so that's what I've introduced here.

Testing

I added a print statement immediately before closing the connecting to make sure we were hitting that block when we should:
Screenshot 2025-09-18 at 10 44 52 AM
Note that the connection is closed immediately after the SIGINT

@benjjs benjjs requested review from gpalmz and tedkahwaji September 19, 2025 15:27


@contextmanager
def open_datadog_connection():
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Collaborator Author

@benjjs benjjs Sep 19, 2025

Choose a reason for hiding this comment

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

Some preliminary research suggests that urllib does not support persistent connections, which this currently is. Re-using the connection should allow for lower latency so I'm a bit reluctant to give it up.

I should say though that I'm not deeply knowledgeable on the topic and did not make the original call to implement it this way.

@benjjs benjjs force-pushed the benjamin.johnsonstaub/azints-3933/report-existing-lfos branch from 984d58d to ebd76a5 Compare September 19, 2025 21:54
@benjjs benjjs force-pushed the benjamin.johnsonstaub/ensure-connection-closed branch from 6b0537e to 921703e Compare September 22, 2025 13:39
Base automatically changed from benjamin.johnsonstaub/azints-3933/report-existing-lfos to main September 22, 2025 20:46
@dd-mergequeue dd-mergequeue Bot requested a review from a team as a code owner September 22, 2025 20:46
@dd-mergequeue dd-mergequeue Bot requested a review from dor-weid September 22, 2025 20:46
@benjjs
Copy link
Copy Markdown
Collaborator Author

benjjs commented Sep 22, 2025

/merge

@dd-devflow-routing-codex
Copy link
Copy Markdown

dd-devflow-routing-codex Bot commented Sep 22, 2025

View all feedbacks in Devflow UI.

2025-09-22 21:27:12 UTC ℹ️ Start processing command /merge


2025-09-22 21:27:17 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in main is approximately 1m (p90).


2025-09-22 21:28:32 UTC ℹ️ MergeQueue: This merge request was merged

@dd-mergequeue dd-mergequeue Bot merged commit 19d6854 into main Sep 22, 2025
3 checks passed
@dd-mergequeue dd-mergequeue Bot deleted the benjamin.johnsonstaub/ensure-connection-closed branch September 22, 2025 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants