pmlogger: Implement zeroconf defaults using an additional env file#1462
Conversation
Earlier, a new way provide zeroconf values for pmlogger was implemented in d19714e and 9859201. This solution worked on systems with systemd but not others. This caused problem for the piuparts test which apparently does not start under systemd during the test[1]. To implement the solution in a more consistent way across all systems (with and without systemd), the earlier solution is reverted with a new solution that drops an additional defaults file with pcp-zeroconf package. Tests: - Install on a machine with non-systemd Debian based distribution. When pmlogger is started, the PMLOGGER_INTERNAL is part in the pmlogger process environment with value 10. - Install on a Debian machine with systemd. When pmlogger is started, the PMLOGGER_INTERNAL is part in the pmlogger process environment with value 10. - Update /etc/default/pmlogger with a value for PMLOGGER_INTERNAL. That value is used. - Install without pcp-zeroconf. When pmlogger is started, the PMLOGGER_INTERNAL is not part of pmlogger process environment. - The file /etc/defaults/pmlogger_zeroconf is part of the pcp-zeroconf package. Links: 1) https://piuparts.debian.org/sid/fail/pcp-zeroconf_5.3.4-1.log Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
|
Thanks for the updated solution Sunil and for considering portability for non-systemd platforms. The changes in pmlogger_check.sh aren't quite right - we would want the zeroconf environment variables to take precedence over the standard values, right? So this line:
So later on when $envs is eval'd (when pmlogger is launched), we'll get the zeroconf values if that file has been installed. Also it would help to add a comment in each file explaining the precedence rules, e.g. in the zeroconf file, state that it overrides the standard environment (and in the $PMLOGGERENVS file, state that it will be overridden by the zeroconf file, if present. If you'd like to make these additional changes and update the PR that would be great, otherwise I'll do so in the morning (my morning in Australia). Also note: these settings are only applied for the primary logger - do you have any thoughts on that? This has come up for discussion before but we decided to leave it as is because otherwise existing pmlogger "farms" may get an unexpected increase in log volumes when they upgrade. |
|
Hi Sunil, I went ahead and made the additional changes (mentioned above), and have now merged this into main branch for pcp-5.3.5. Thanks |
|
@goodwinos , thank you for the review and comments.
In my patch, I assumed that /etc/default/pmlogger is the file that user will want to edit. User is not expected to touch the pmlogger_zeroconf at all. Also, I assumed that the order of priority should be User configuration > Zeroconf value > Unconfigured default. Reasoning:
It is a bit of confusion for the user to see two files instead one. To address this problem and to make sure that users don't ever edit the zeroconf file, we can add a comment asking them to edit the other file or, better yet, we can consider putting the zeroconf file in /usr/. This way, the user won't ever consider editing the zeroconf file.
I shall now make the changes to add comments reflecting the above viewpoint. However, if you think zeroconf settings should get the highest priority instead, let me know and I will make the changes accordingly tomorrow. If you wish to avoid the round trip with to US West :), please feel free to make the changes (either by editing my commits or adding new ones).
I haven't dug into pcp enough to make a well considered response. However, I can pass an opinion from a generic view point: It really depends on the true purpose of zeroconf package and what users expect out of it.
|
Aha, thanks. Never mind my comments. |
+1
Good suggestion - I agree this is a better solution than having two side-by-side files with conflicting (duplicate) variable names in a sysadmin-editable location. Somewhere below /usr it's really clear that this is not something a user would normally be editing. |
Follow up on suggestion in performancecopilot#1462 and relocate the zeroconf primary logger default sampling interval setting to a read-only location. This file does not belong in any user-configurable location - the clue is in the name '*zero*conf' - it's not *some*conf. ;-) This is a more FHS-compliant location for this file and makes it very, very clear this is not a file that should ever be edited.
Follow up on suggestion in performancecopilot#1462 and relocate the zeroconf primary logger default sampling interval setting to a read-only location. This file does not belong in any user-configurable location - the clue is in the name '*zero*conf' - it's not *some*conf. ;-) This is a more FHS-compliant location for this file and makes it very, very clear this is not a file that should ever be edited.
Follow up on suggestion in #1462 and relocate the zeroconf primary logger default sampling interval setting to a read-only location. This file does not belong in any user-configurable location - the clue is in the name '*zero*conf' - it's not *some*conf. ;-) This is a more FHS-compliant location for this file and makes it very, very clear this is not a file that should ever be edited.
|
@SunilMohanAdapa @goodwinos I believe these changes have accidentally caused a regression in ansible-pcp which modifies PMLOGGER_INTERVAL in /etc/sysconfig. When pcp-zeroconf is installed this setting is now ignored and pcp-zeroconf setting "wins" (however, ansible-pcp also installs zeroconf). :( Not sure on our best option here right now, but we need to consider this one further. |
|
@natoscott , @goodwinos I believe that the solution is straight forward. That is to say that the configuration installed by zeroconf (in /usr 638e426) should have lower precedence compared to user set values in /etc/sysconfig/ (more arguments for this in my previous comment #1462 (comment)). This was the intention of my patch (3020052). However, the priority was reversed later (2c17ba0). If we undo this change, it should be sufficient:
|
|
@SunilMohanAdapa sounds promising. However, since we ship /etc/sysconfig/pmlogger (and with a value for PMLOGGER_INTERVAL), I don't understand how you differentiate between this (our shipped default value outside zeroconf) and something the user has set...? Oh, I see it now :) ... we don't set a value for PMLOGGER_INTERVAL there, its commented out by default. OK - your plan sounds good then! |
|
@SunilMohanAdapa any chance you have some spare cycles to put together a PR for this change? We'd like to put a bug-fix only pcp-5.3.6 out within the next week and this feels like something we should fix ASAP. I'm working on other issues at the moment, but can circle back to this one if you're out of time currently. |
|
I shall try to create a PR in a day or two. |
|
@SunilMohanAdapa awesome, thanks! |
In 2c17ba0, zeroconf provided defaults (/usr/share/pcp/zeroconf/pmlogger, which was actually /etc/sysconf/pmlogger_zeroconf at the time of the change) were prioritized over user configuration (/etc/sysconf/pmlogger). This lead to regression in clients which edited the user configuration and expected the changes to be given priority over zeroconf configuration. This was identified at least in ansible-pcp[1]. Undo the changes in this commit so that the final priority is as follows: User configuration (/etc/sysconfig/pmlogger) (priority over) Zeroconf defaults (/usr/share/pcp/zeroconf/pmlogger) (priority over) Code defaults (pmlogger.c) Links: 1) performancecopilot#1462 (comment) Tests: - Install pcp. Ensure pmlogger is running. Notice that there is no PMLOGGER_INTERVAL set in the pmlogger daemon's environment. - Install pcp-zeroconf. Restart pmlogger. Notice that PMLOGGER_INTERVAL environment is set in the pmlogger daemon's environment. The value is 10. - Edit /etc/sysconfig/pmlogger and set the value of PMLOGGER_INTERVAL to 15. Restart pmlogger and notice that PMLOGGER_INTERVAL is set to 15 in pmlogger daemon's environment. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
In 2c17ba0, zeroconf provided defaults (/usr/share/pcp/zeroconf/pmlogger, which was actually /etc/sysconf/pmlogger_zeroconf at the time of the change) were prioritized over user configuration (/etc/sysconf/pmlogger). This lead to regression in clients which edited the user configuration and expected the changes to be given priority over zeroconf configuration. This was identified at least in ansible-pcp[1]. Undo the changes in this commit so that the final priority is as follows: User configuration (/etc/sysconfig/pmlogger) (priority over) Zeroconf defaults (/usr/share/pcp/zeroconf/pmlogger) (priority over) Code defaults (pmlogger.c) Links: 1) performancecopilot#1462 (comment) Tests: - Install pcp. Ensure pmlogger is running. Notice that there is no PMLOGGER_INTERVAL set in the pmlogger daemon's environment. - Install pcp-zeroconf. Restart pmlogger. Notice that PMLOGGER_INTERVAL environment is set in the pmlogger daemon's environment. The value is 10. - Edit /etc/sysconfig/pmlogger and set the value of PMLOGGER_INTERVAL to 15. Restart pmlogger and notice that PMLOGGER_INTERVAL is set to 15 in pmlogger daemon's environment. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
|
@natoscott @goodwinos #1525 addresses the regression in ansible-pcp by prioritizing user configuration over zeroconf configuration. |
In 2c17ba0, zeroconf provided defaults (/usr/share/pcp/zeroconf/pmlogger, which was actually /etc/sysconf/pmlogger_zeroconf at the time of the change) were prioritized over user configuration (/etc/sysconf/pmlogger). This lead to regression in clients which edited the user configuration and expected the changes to be given priority over zeroconf configuration. This was identified at least in ansible-pcp[1]. Undo the changes in this commit so that the final priority is as follows: User configuration (/etc/sysconfig/pmlogger) (priority over) Zeroconf defaults (/usr/share/pcp/zeroconf/pmlogger) (priority over) Code defaults (pmlogger.c) Links: 1) #1462 (comment) Tests: - Install pcp. Ensure pmlogger is running. Notice that there is no PMLOGGER_INTERVAL set in the pmlogger daemon's environment. - Install pcp-zeroconf. Restart pmlogger. Notice that PMLOGGER_INTERVAL environment is set in the pmlogger daemon's environment. The value is 10. - Edit /etc/sysconfig/pmlogger and set the value of PMLOGGER_INTERVAL to 15. Restart pmlogger and notice that PMLOGGER_INTERVAL is set to 15 in pmlogger daemon's environment. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
Earlier, a new way provide zeroconf values for pmlogger was implemented in
d19714e and
9859201. This solution worked on systems with
systemd but not others. This caused problem for the piuparts test which
apparently does not start under systemd during the test[1].
To implement the solution in a more consistent way across all systems (with and
without systemd), the earlier solution is reverted with a new solution that
drops an additional defaults file with pcp-zeroconf package.
Tests:
Install on a machine with non-systemd Debian based distribution. When pmlogger
is started, the PMLOGGER_INTERNAL is part in the pmlogger process environment
with value 10.
Install on a Debian machine with systemd. When pmlogger is started, the
PMLOGGER_INTERNAL is part in the pmlogger process environment with value 10.
Update /etc/default/pmlogger with a value for PMLOGGER_INTERNAL. That value is
used.
Install without pcp-zeroconf. When pmlogger is started, the PMLOGGER_INTERNAL
is not part of pmlogger process environment.
The file /etc/defaults/pmlogger_zeroconf is part of the pcp-zeroconf package.
Links:
Signed-off-by: Sunil Mohan Adapa sunil@medhas.org