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

[receiver/azureeventhub] Close storage extension client during component shutdown #36296

Merged

Conversation

mrsillydog
Copy link
Contributor

@mrsillydog mrsillydog commented Nov 11, 2024

Description

When using a storage extension, the component will call Close on the client during component shutdown. This fixes a bug that resulted in a file potentially remaining locked after component shutdown.

Link to tracking issue

#36238

Testing

Since reproducing this was described in the issue as "difficult without custom code", testing just involved ensuring that unit tests covered the added code and ran successfully, and manually ensuring that the collector could still receive events from AEH.

@mrsillydog mrsillydog marked this pull request as ready for review November 11, 2024 20:21
@mrsillydog mrsillydog requested a review from a team as a code owner November 11, 2024 20:21
@atoulme
Copy link
Contributor

atoulme commented Nov 12, 2024

Sorry, this needs tests :/

@mrsillydog mrsillydog requested a review from atoulme November 13, 2024 19:48
@mrsillydog
Copy link
Contributor Author

@atoulme any chance you have a brief moment to re-review this PR in the near future?

if err != nil {
h.settings.Logger.Debug("Error connecting to Storage", zap.Error(err))
return err
if h.storageClient == nil { // set manually for testing.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not going to block this PR since it fixes an important bug, but generally I'm not a fan of tests relying on special access to the internals of the code. A better way to do this would be to mock the host, so that it returns the mock client.

@djaglowski djaglowski merged commit 49efe31 into open-telemetry:main Dec 2, 2024
158 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 2, 2024
@mrsillydog mrsillydog deleted the fix/aeh-shutdown-storageclient branch December 2, 2024 14:45
shivanthzen pushed a commit to shivanthzen/opentelemetry-collector-contrib that referenced this pull request Dec 5, 2024
…ent shutdown (open-telemetry#36296)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
When using a storage extension, the component will call Close on the
client during component shutdown. This fixes a bug that resulted in a
file potentially remaining locked after component shutdown.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36238 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Since reproducing this was described in the issue as "difficult without
custom code", testing just involved ensuring that unit tests covered the
added code and ran successfully, and manually ensuring that the
collector could still receive events from AEH.
ZenoCC-Peng pushed a commit to ZenoCC-Peng/opentelemetry-collector-contrib that referenced this pull request Dec 6, 2024
…ent shutdown (open-telemetry#36296)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
When using a storage extension, the component will call Close on the
client during component shutdown. This fixes a bug that resulted in a
file potentially remaining locked after component shutdown.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36238 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Since reproducing this was described in the issue as "difficult without
custom code", testing just involved ensuring that unit tests covered the
added code and ran successfully, and manually ensuring that the
collector could still receive events from AEH.
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…ent shutdown (open-telemetry#36296)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description
When using a storage extension, the component will call Close on the
client during component shutdown. This fixes a bug that resulted in a
file potentially remaining locked after component shutdown.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
open-telemetry#36238 

<!--Describe what testing was performed and which tests were added.-->
#### Testing
Since reproducing this was described in the issue as "difficult without
custom code", testing just involved ensuring that unit tests covered the
added code and ran successfully, and manually ensuring that the
collector could still receive events from AEH.
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.

4 participants