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/file] Initial implementation #6712

Closed
wants to merge 2 commits into from

Conversation

atoulme
Copy link
Contributor

@atoulme atoulme commented Dec 11, 2021

Description:
New receiver able to read pipeline data stored as JSON in files in a watched directory.

Testing:
Unit tests

Documentation:
README and example doc.

@atoulme atoulme requested review from a team and anuraaga December 11, 2021 08:45
@atoulme atoulme force-pushed the new_file_receiver branch 6 times, most recently from 6e7ec9b to ffbc713 Compare December 11, 2021 19:05
@atoulme atoulme mentioned this pull request Dec 14, 2021
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

The code looks sane, but I have a few comments:

  • it would have been nice to have followed the contribution guidelines, by splitting this into several PRs, to make reviewing easier (other reviewers might still require this from you)
  • we are just about to decide that new components need a sponsor, who will be responsible for doing code reviews -- do you have an approver who'd be open to sponsor this component?
  • related to the point above: did you discuss adding this with a maintainer/approver already?

internal/components/receivers_test.go Outdated Show resolved Hide resolved
receiver/filereceiver/watcher.go Outdated Show resolved Hide resolved
receiver/filereceiver/watcher.go Outdated Show resolved Hide resolved
@tigrannajaryan
Copy link
Member

I think a receiver like this is great but I have reservations since OTLP/JSON is unstable. I am worried that if we accept this people will start storing files in this format and will be very disappointed when we break the format. Yes, the file exporter exists, but without a complimentary file receiver it is primarily a troubleshooting tool. With the corresponding file receiver we suddenly have an easy way to use OTLP/JSON as a long term storage and transfer format for telemetry data that can be then processed by the Collector. I don't want to end up having frustrated users when we make changes to the OTLP/JSON.

Anyone willing to spend time and resolve open-telemetry/opentelemetry-specification#1443 before we move forward with this PR?

@jpkrohling jpkrohling changed the title Add a file receiver component to receive pipeline data written to file [receiver/file] Initial implementation Dec 16, 2021
@atoulme
Copy link
Contributor Author

atoulme commented Dec 17, 2021

Thanks for the review. I am happy to break this PR into several. I am sure we can find an approver when this component is closer to merge. No, I didn't discuss this with an approver or maintainer yet.

@tigrannajaryan I am going to review the issue and will apply myself to help resolve the stability issues.

Copy link
Contributor

@MovieStoreGuy MovieStoreGuy left a comment

Choose a reason for hiding this comment

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

I have concerns that this may not work with an application still writing to a file that is being read.

cmd/configschema/go.mod Show resolved Hide resolved

func createLogsReceiver(_ context.Context, settings component.ReceiverCreateSettings, configuration config.Receiver, logs consumer.Logs) (component.LogsReceiver, error) {
readLogs := func(path string) error {
fileHandle, _ := os.Open(path)
Copy link
Contributor

Choose a reason for hiding this comment

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

The error returned here needs to be handled.

I worry that the file could be still be open by another application and cause issues that way.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not a fan of lambdas within a function since it make it harder to provide debug information back to the user and being able to unit test them in isolation is problematic due to being coupled with a method that may not allow for unit testing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

True, that's a miss. I can rework the lambda as a separate method, sure thing.

As for the file being opened by something else, etc, there's no guarantee in anything here. The file can be deleted, chmoded, moved, truncated, appended. It's going to be exactly as good as the operator makes it. This particular filereceiver is not very smart and we can spell that out in the docs if you like.

For concurrent access and live updates, we can work on kafka/redis/ queues.

Choose a reason for hiding this comment

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

Is it right to assume that an exporter writing to the listened folder will be able to atomically write to it ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, I'm not particularly trying to be good about it right now.

@jpkrohling
Copy link
Member

I am sure we can find an approver when this component is closer to merge. No, I didn't discuss this with an approver or maintainer yet.

Sounds good, please ping me here when it happens.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2022

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jan 8, 2022
@github-actions
Copy link
Contributor

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Jan 23, 2022
@atoulme
Copy link
Contributor Author

atoulme commented Feb 10, 2022

Can someone please reopen this PR?

@tigrannajaryan
Copy link
Member

I can't reopen the PR (which is weird, I thought admins should be able to).
Please submit a new PR.

@atoulme atoulme mentioned this pull request Feb 11, 2022
@oliora
Copy link

oliora commented May 3, 2022

That would be really great to get it merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants