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

Use a separate daemonized process to send data to AppSignal #6

Open
unflxw opened this issue Oct 28, 2024 · 3 comments
Open

Use a separate daemonized process to send data to AppSignal #6

unflxw opened this issue Oct 28, 2024 · 3 comments

Comments

@unflxw
Copy link
Contributor

unflxw commented Oct 28, 2024

As currently implemented, appsignal-wrap sends data to AppSignal on the background, while concurrently passing through the process' standard output and error. However, when the process it wraps exits, it must still continue to run for a while, in order to send the last log lines and/or the last cron check-ins to AppSignal.

Ideally, appsignal-wrap would exit as soon as the process it wraps exits (allowing, for example, for its usage in shell scripts to not slow down the overall shell script run) while the data related to its execution is sent to AppSignal by a separate daemonized process.

In the integrations, we implement this sort of behaviour through the extension, the agent and an UNIX socket. But in this case, we might be able to have the appsignal-wrap process spawn a fork of itself that is daemonized, and to communicate with that fork by writing to its standard input.

@tombruijn
Copy link
Member

This approach will also introduce the same issues we have in our current integrations, like the agent on containers not being able to send the data before exiting the container itself.

Is the overhead or delay so much we should consider implementing this already?

@unflxw
Copy link
Contributor Author

unflxw commented Nov 1, 2024

@tombruijn

This approach will also introduce the same issues we have in our current integrations, like the agent on containers not being able to send the data before exiting the container itself.

True! Though, unlike in the integrations, here we could have a --wait flag to ask the process to wait for the data to be sent.

Is the overhead or delay so much we should consider implementing this already?

Probably not, at least not on my local tests -- though, at the end of the day, it depends on the public API's response time and the amount of data to send.

Making it non-blocking would improve certain use-cases. You might want to call the wrapper in a for loop, for example:

for file in *.log; do
  appsignal-wrap -- grep 'ERROR' file
done

(this is a contrived example, as you could appsignal-wrap -- grep 'ERROR' *.log instead, but you see the point)

@tombruijn
Copy link
Member

tombruijn commented Nov 4, 2024

I'd be okay with having a bit of delay. That's the cost of instrumentation. I wouldn't expect it to take up to 30 seconds like it does in our current agent setup. We can start testing without, so the project is a bit simpler, and see if it becomes an issue in the future.

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

No branches or pull requests

2 participants