dodopizza/kubectl-shovel

Don't hard code PID and --duration

rcny opened this issue · 5 comments

rcny commented

Hello.

Thanks for the nice project! Is it truly necessary to hard code PID of the .NET runtime? There are many cases where containerized application's PID can be something except 1. For example, there can be dumb-init/tini as the parent process of the runtime process.
Same goes for the --duration. Is there any reason why is it hard coded to 10 seconds?

Hello @rcny.

Thanks for your suggestion. First of all about --duration. Would be great to make it customizable and pass it from cli to final command as well as other available for gcdump/trace flags that makes sense. It is on features shortlist. However PRs are also welcome.

I'm not sure if there is any reliable way to get correct PID for dotnet process. It is not case for us so need to investigate a bit. As I understand there are some plans for dotnet diagnostics tools to make it possible to provide socket not PID as target, it can help.

rcny commented

I discovered that diagnostics tools are available without the .NET SDK since the release of .NET 5. Microsoft now provides single-file distributions that only require a 3.1+ runtime. I went with the small and simple wrapper script that uploads a needed diagnostics tool into a pod's container, finds the runtime's PID, executes the collection, and downloads the trace or the dump back.

Thanks for your tool though. It just wasn't suited for my case.

@rcny Hi! Would you mind sharing it (script)?

Hello.
I've released v0.4.0 that support passing --duration flag and lot of others. Also it support overriding PID via --process-id as temporary solution.

This can be closed, with release v0.4.0