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

Move file storage extension to core #3273

Closed

Conversation

pmm-sumo
Copy link
Contributor

@pmm-sumo pmm-sumo commented May 24, 2021

Description:

This is a copy of file storage extension moved into the core, which might be required for file-storage extension backed WAL implementation

@pmm-sumo pmm-sumo changed the title Initial implementation of WAL in queued_retry backed by file storage extension Initial implementation of WAL in queued_retry, backed by file storage extension May 24, 2021
@pmm-sumo pmm-sumo force-pushed the main-with-storage-extension branch from 1cbb225 to af7e210 Compare May 24, 2021 18:05
@pmm-sumo pmm-sumo force-pushed the main-with-storage-extension branch from af7e210 to 10c5218 Compare May 24, 2021 18:06
@pmm-sumo pmm-sumo changed the title Initial implementation of WAL in queued_retry, backed by file storage extension File storage extension moved to core May 24, 2021
Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

That is the motivation of this change?

@@ -0,0 +1 @@
include ../../Makefile.Common
Copy link
Member

Choose a reason for hiding this comment

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

Why this?

Copy link
Member

Choose a reason for hiding this comment

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

Artifact from being a contrib component. Should be removed in core implementation.

@@ -0,0 +1 @@
include ../../Makefile.Common
Copy link
Member

Choose a reason for hiding this comment

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

Why this change?

Copy link
Member

Choose a reason for hiding this comment

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

Should be removed.

if err != nil {
return nil, fmt.Errorf("create client: %v", err)
}
lfs.clients = append(lfs.clients, client)
Copy link
Member

Choose a reason for hiding this comment

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

Is it guaranteed that GetClient is not called by multiple goroutines? You need to protect the slice.

Copy link
Member

Choose a reason for hiding this comment

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

This slice is only used for client closure, which will become the responsibility of each component that requests a client. So this will go away entirely. Point taken though.

Comment on lines +62 to +64
for _, client := range lfs.clients {
client.close()
}
Copy link
Member

Choose a reason for hiding this comment

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

Sounds like a chaos here, there is no clear owner of the components. Which component is responsible to close the "client" instance? Not well documented and based on the code seems a bit strange to say the least.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, fair point.

When I implemented this, I had in mind the concept of cleaning up stale storage files #3149 (contrib), which I think would properly be the responsibility of this extension and might look similar to this implementation of tracking/closing clients.

In any case, you are right - the clients can and should be handled by the components that requested them, and this expectation should be clearly documented.

@pmm-sumo
Copy link
Contributor Author

pmm-sumo commented May 24, 2021

Thanks @bogdandrutu , let me give a bit of context. I am researching how to implement WAL in queued_retry (and then other components, batch processor, group by trace processor, etc.) and one of the ideas is to leverage storage extension which is already part of opentelemetry-collector-contrib. The idea behind this extension was to make it generally available to other components and it's largely happening here. The PR for WAL implementation in queued_retry using storage extension is here: #3274

In this PR, I just wanted to show what would be the scope of bringing storage extension to the core, without changing the structure of it

Copy link
Member

@djaglowski djaglowski left a comment

Choose a reason for hiding this comment

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

@pmm-sumo I will make the noted change on a contrib PR. Please let me know if you'd like to me to PR to your branch here as well.

@@ -0,0 +1 @@
include ../../Makefile.Common
Copy link
Member

Choose a reason for hiding this comment

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

Artifact from being a contrib component. Should be removed in core implementation.

@@ -0,0 +1 @@
include ../../Makefile.Common
Copy link
Member

Choose a reason for hiding this comment

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

Should be removed.

Comment on lines +62 to +64
for _, client := range lfs.clients {
client.close()
}
Copy link
Member

Choose a reason for hiding this comment

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

Yeah, fair point.

When I implemented this, I had in mind the concept of cleaning up stale storage files #3149 (contrib), which I think would properly be the responsibility of this extension and might look similar to this implementation of tracking/closing clients.

In any case, you are right - the clients can and should be handled by the components that requested them, and this expectation should be clearly documented.

if err != nil {
return nil, fmt.Errorf("create client: %v", err)
}
lfs.clients = append(lfs.clients, client)
Copy link
Member

Choose a reason for hiding this comment

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

This slice is only used for client closure, which will become the responsibility of each component that requests a client. So this will go away entirely. Point taken though.

@pmm-sumo pmm-sumo changed the title File storage extension moved to core Move file storage extension to core May 25, 2021
@pmm-sumo
Copy link
Contributor Author

pmm-sumo commented May 25, 2021

@pmm-sumo I will make the noted change on a contrib PR. Please let me know if you'd like to me to PR to your branch here as well.

Thank you @djaglowski ! I can take care of that later and just sync the changes. Also, if you prefer the prepare the PR with filestorage changes to core (which I think you deserve, as the author) :) then it works perfectly fine for me too. I can adjust my PR with WAL implementation later accordingly to either of options.

@pmm-sumo
Copy link
Contributor Author

As per our discussion during the SIG, closing this one. Going to extract just the API part and propose it in a separate PR

@pmm-sumo pmm-sumo closed this May 27, 2021
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.

3 participants