-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Add NamedPipe input operator #28841
Add NamedPipe input operator #28841
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a changelog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks about right to me.
This is a namedpipe input operator, which will read from a named pipe and send the data to the pipeline. It pretty closely mimicks the file input operator, but with a few differences. In particular, named pipes have an interesting property that they receive EOFs when a writer closes the pipe, but that _doesn't_ mean that the pipe is closed. To solve this issue, we crib from existing `tail -f` implementations and use an inotify watcher to detect whenever the pipe receives new data, and then read it using the standard `bufio.Scanner` reader. Signed-off-by: sinkingpoint <colin@quirl.co.nz>
This allows the user to configure the maximum size of a log line, rather than always using the default. Signed-off-by: sinkingpoint <colin@quirl.co.nz>
5913350
to
5daa897
Compare
Rebased and added licenses |
Here we add a couple of tests to cover more cases of named pipe creation. In particular: - A test to check that if a file already exists (i.e. not a named pipe), fail the operator creation. - A test to check that if a _pipe_ already exists, pass the operator construction because we can just use the existing pipe. Signed-off-by: sinkingpoint <colin@quirl.co.nz>
5daa897
to
e1d11bc
Compare
Signed-off-by: sinkingpoint <colin@quirl.co.nz>
e1d11bc
to
a546114
Compare
So many checks 😅 |
@djaglowski is there a |
Unfortuantely there's not a catchall because so much is only encoded in github actions. I should mention, if your changes are pretty well isolated to one or two modules, you can run |
**Description:** This is a namedpipe input operator, which will read from a named pipe and send the data to the pipeline. It pretty closely mimics the file input operator, but with a few differences. In particular, named pipes have an interesting property that they receive EOFs when a writer closes the pipe, but that _doesn't_ mean that the pipe is closed. To solve this issue, we crib from existing `tail -f` implementations and use an inotify watcher to detect whenever the pipe receives new data, and then read it using the standard `bufio.Scanner` reader. **Link to tracking Issue:** open-telemetry#27234 **Testing:** We add a couple of tests for the new operator. The first tests simply the creation of the named pipe - checking that it's created as a pipe, with the right permissions. The second goes further by inserting logs over several different `Open`s into the pipe, testing that the logs are read, and that the operator is able to handle the named pipe behavior of skipping over EOFs. **Documentation:** None, at the moment /cc @djaglowski --------- Signed-off-by: sinkingpoint <colin@quirl.co.nz>
**Description:** This adds a new receiver that reads from a named pipe, using the previously created namedpipeinput stanza operator (#28841). Because that operator does the majority of the work, this is mostly boilerplate + a few tests to confirm that it works e2e. Link to tracking Issue: #27234 **Testing:** Added a few tests, loading the config, and actually creating a receiver to verify that it can read logs from the pipe. **Documentation:** None, yet. /cc @djaglowski - where should I add docs for this if any?
**Description:** This adds a new receiver that reads from a named pipe, using the previously created namedpipeinput stanza operator (open-telemetry#28841). Because that operator does the majority of the work, this is mostly boilerplate + a few tests to confirm that it works e2e. Link to tracking Issue: open-telemetry#27234 **Testing:** Added a few tests, loading the config, and actually creating a receiver to verify that it can read logs from the pipe. **Documentation:** None, yet. /cc @djaglowski - where should I add docs for this if any?
Description:
This is a namedpipe input operator, which will read from a named pipe and send the data to the pipeline. It pretty closely mimics the file input operator, but with a few differences.
In particular, named pipes have an interesting property that they receive EOFs when a writer closes the pipe, but that doesn't mean that the pipe is closed. To solve this issue, we crib from existing
tail -f
implementations and use an inotify watcher to detect whenever the pipe receives new data, and then read it using the standardbufio.Scanner
reader.Link to tracking Issue: #27234
Testing:
We add a couple of tests for the new operator. The first tests simply the creation of the named pipe - checking that it's created as a pipe, with the right permissions. The second goes further by inserting logs over several different
Open
s into the pipe, testing that the logs are read, and that the operator is able to handle the named pipe behavior of skipping over EOFs.Documentation:
None, at the moment
/cc @djaglowski