Add Process.ExtractAsFile interface#427
Merged
fabled merged 2 commits intoopen-telemetry:mainfrom Apr 4, 2025
Merged
Conversation
For live processes a direct filename to /proc is returned, and for coredump cases a temporary file is created with the data extracted. This is a last resort method to access the contets and mainly suitable if the is inspected via 3rd party module/library which does not support Go ReaderAt interface.
rockdaboot
approved these changes
Apr 3, 2025
| } | ||
|
|
||
| func (tc *trackedCoredump) ExtractAsFile(fileName string) (string, error) { | ||
| prefixedFileName := tc.prefix + fileName |
Contributor
There was a problem hiding this comment.
Ideally, we should use path.Join here and at other places, as tc.prefix is a path part.
Contributor
Author
There was a problem hiding this comment.
I'd also then fix the whole in follow up PR if ok?
|
|
||
| // ExtractAsFile implements the Process interface | ||
| func (cd *CoredumpProcess) ExtractAsFile(_ string) (string, error) { | ||
| // No filesystem level backing file in coredumps |
Contributor
There was a problem hiding this comment.
Suggested change
| // No filesystem level backing file in coredumps | |
| // There is no filesystem level backing file in coredumps. |
| return nil, fmt.Errorf("ELF file `%s` not found", path) | ||
| } | ||
|
|
||
| // ExtractAsFile implements the Process interface |
Contributor
There was a problem hiding this comment.
Suggested change
| // ExtractAsFile implements the Process interface | |
| // ExtractAsFile implements the Process interface. |
Contributor
Author
There was a problem hiding this comment.
This follows style of the file. Would it make sense to fixup the whole file in a follow up PR?
christos68k
approved these changes
Apr 3, 2025
This was referenced Jul 8, 2025
This was referenced Aug 14, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For live processes a direct filename to /proc is returned, and for coredump cases a temporary file is created with the data extracted.
This is a last resort method to access the contets and mainly suitable if the is inspected via 3rd party module/library which does not support Go ReaderAt interface.
prerequisite for #408