Skip to content

Add Process.ExtractAsFile interface#427

Merged
fabled merged 2 commits intoopen-telemetry:mainfrom
fabled:process-extract-as-file
Apr 4, 2025
Merged

Add Process.ExtractAsFile interface#427
fabled merged 2 commits intoopen-telemetry:mainfrom
fabled:process-extract-as-file

Conversation

@fabled
Copy link
Copy Markdown
Contributor

@fabled fabled commented Apr 3, 2025

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

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.
@fabled fabled requested review from a team as code owners April 3, 2025 04:10
Copy link
Copy Markdown
Contributor

@rockdaboot rockdaboot left a comment

Choose a reason for hiding this comment

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

LGTM, just some nits

Comment thread tools/coredump/new.go
}

func (tc *trackedCoredump) ExtractAsFile(fileName string) (string, error) {
prefixedFileName := tc.prefix + fileName
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ideally, we should use path.Join here and at other places, as tc.prefix is a path part.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'd also then fix the whole in follow up PR if ok?

Comment thread process/coredump.go

// ExtractAsFile implements the Process interface
func (cd *CoredumpProcess) ExtractAsFile(_ string) (string, error) {
// No filesystem level backing file in coredumps
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// No filesystem level backing file in coredumps
// There is no filesystem level backing file in coredumps.

Comment thread process/coredump.go
return nil, fmt.Errorf("ELF file `%s` not found", path)
}

// ExtractAsFile implements the Process interface
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
// ExtractAsFile implements the Process interface
// ExtractAsFile implements the Process interface.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This follows style of the file. Would it make sense to fixup the whole file in a follow up PR?

Comment thread interpreter/loaderinfo.go Outdated
Comment thread process/types.go Outdated
Comment thread tools/coredump/storecoredump.go Outdated
@fabled fabled merged commit 3d27fe5 into open-telemetry:main Apr 4, 2025
26 checks passed
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