-
Notifications
You must be signed in to change notification settings - Fork 606
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 reload logic to collector container start script. #4099
base: main
Are you sure you want to change the base?
Conversation
Issue: PGO-2196
} | ||
|
||
var startScript = fmt.Sprintf(` | ||
OTEL_PIDFILE=/tmp/otel.pid |
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.
Does the otelcontrib
process have a name? Or did we want the PID to check if it's running (without recourse to pgrep
)?
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.
I'm honestly not sure of the best way to do this. I used some prior art in our codebase as a starting point
|
||
exec {fd}<> <(:||:) | ||
while read -r -t 5 -u "${fd}" ||:; do | ||
logrotate -s /tmp/logrotate.status /etc/logrotate.d/logrotate.conf | ||
%s | ||
if [[ "${directory}" -nt "/proc/self/fd/${fd}" ]] && kill -HUP $(head -1 ${OTEL_PIDFILE?}); |
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.
🤔 What happens if Bash is terminated? Is the entire container torn down, including the collector?
If so, we can keep the collector pid in a variable in memory.
# start
otel ... &
OTEL_PID=$!
# here
kill -HUP ${OTEL_PID}
# below
[[ ! -e /proc/${OTEL_PID} ]]
logrotate -s /tmp/logrotate.status /etc/logrotate.d/logrotate.conf | ||
%s |
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.
🌱 Perhaps this could always be [[ -r /etc/logrotate.d/logrotate.conf ]] && logrotate ...
and the choice to rotate or not would be at the mounting of the config.
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.
it works!
Issue: PGO-2196
Checklist:
Type of Changes:
What is the current behavior (link to any open issues here)?
The OTel Collector process does not reload when changes are made to its configuration.
What is the new behavior (if this is a feature change)?
The OTel Collector process will now be sent a SIGHUP signal to reload its configuration when a change is made to the config directory.
Other Information: