Skip to content

Commit eb0aa6f

Browse files
committed
feat(process_exporter): add support for recheck-with-time-limit
This CLI flag is useful to prevent process_exporter from putting processes in the wrong groups if it happens to scan them for the first time before they change their command line. This can happen for processes which call exec(3) for example. The default setting is 0, which leaves the feature disabled. Note that setting a non-zero value for --recheck-with-time-limit automatically also sets --recheck so there's no need to set the two CLI flags. Signed-off-by: François HORTA <[email protected]>
1 parent 8bb8ea4 commit eb0aa6f

File tree

4 files changed

+13
-0
lines changed

4 files changed

+13
-0
lines changed

roles/process_exporter/defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ process_exporter_names: |
2525
- '.+'
2626
{% endraw %}
2727
28+
process_exporter_recheck_time_limit: 0
29+
2830
process_exporter_binary_install_dir: "/usr/local/bin"
2931
process_exporter_system_group: "process-exp"
3032
process_exporter_system_user: "{{ process_exporter_system_group }}"

roles/process_exporter/meta/argument_specs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ argument_specs:
4040
- "Syntax is the same as in"
4141
- "L(using-a-config-file Default is consistent with deb/rpm packages,https://github.com/ncabatoff/process-exporter#using-a-config-file Default is consistent with deb/rpm packages)"
4242
default: !unsafe "[{name: '{{.Comm}}', cmdline: [.+]}]"
43+
process_exporter_recheck_time_limit:
44+
description:
45+
- "Enable process rechecking: process names are re-evaluated only this much time after their start, but no longer."
46+
- "See L(the time.ParseDuration documentation,https://pkg.go.dev/time#ParseDuration) for the supported duration formats."
47+
- "This setting can be useful to make sure processes are grouped correctly if their name changes shortly after they start."
48+
- "The default value leaves this feature disabled."
49+
default: 0
4350
process_exporter_binary_install_dir:
4451
description:
4552
- "I(Advanced)"

roles/process_exporter/molecule/alternative/molecule.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ provisioner:
2727
cmdline:
2828
- crond
2929
{% endraw %}
30+
process_exporter_recheck_time_limit: 180s
3031
process_exporter_binary_url: "https://github.com/ncabatoff/process-exporter/releases/download/v{{\
3132
\ process_exporter_version }}/process-exporter-{{ process_exporter_version }}.linux-amd64.tar.gz"

roles/process_exporter/templates/process_exporter.service.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ ExecStart={{ process_exporter_binary_install_dir }}/process-exporter \
1414
{% endif -%}
1515
{% if process_exporter_tls_server_config | length > 0 or process_exporter_http_server_config | length > 0 or process_exporter_basic_auth_users | length > 0 %}
1616
'--web.config.file={{ process_exporter_config_dir }}/web_config.yml' \
17+
{% endif %}
18+
{% if process_exporter_recheck_time_limit != 0 %}
19+
'--recheck-with-time-limit={{ process_exporter_recheck_time_limit }}' \
1720
{% endif %}
1821
'--web.listen-address={{ process_exporter_web_listen_address }}' \
1922
'--web.telemetry-path={{ process_exporter_web_telemetry_path }}'

0 commit comments

Comments
 (0)