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

[pull] master from netdata:master #279

Merged
merged 14 commits into from
Jan 9, 2025
Merged

Conversation

pull[bot]
Copy link

@pull pull bot commented Jan 8, 2025

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.1)

Can you help keep this open source service alive? 💖 Please sponsor : )

Summary by Sourcery

Update memory allocation error messages to include available system memory. Add an option to check auto-update status. Include the alert version in the ACLK alert status.

New Features:

  • Add --auto-update-status option to the updater script to check the status of automatic updates.
  • Add alert version to the ACLK alert status.

Bug Fixes:

  • Fix an issue where Netdata would not shut down cleanly when Sentry was enabled.

Enhancements:

  • Improve the pidof command compatibility.
  • Improve systemd detection logic.
  • Add available system memory information to memory allocation error messages.

vkalintiris and others added 5 commits January 8, 2025 11:15
…es. (#19332)

* Abort on non-zero rc when we have sentry.

* Abort on recursive-fatals when sentry is enabled

* Add function that returns last reported system memory.

* Provide available memory in fatal message.

* Update system_memory.c

---------

Co-authored-by: Costa Tsaousis <[email protected]>
Add current alert version to aclk-state
…#19248)

* Add option to updater to report status of auto-updates on the system.

* Improve systemd detection.

The _official_ way to check if a system is running systemd is to call
`systemctl is-system-running` and check the output. This adds that
checking to places where we are otherwise looking for systemd.

* Remove pointless subshell.
* Add instructions for Docker Compose

* update link

* add missing dot (.)

* add changes to metadata.yaml

* remove changes from README.md

---------

Co-authored-by: Fotis Voutsas <[email protected]>
@pull pull bot added the ⤵️ pull label Jan 8, 2025
Copy link

sourcery-ai bot commented Jan 8, 2025

Reviewer's Guide by Sourcery

This pull request introduces several changes related to systemd detection, memory allocation error handling, and auto-update functionality. It also includes improvements to email notifications for Docker Compose users and updates the handling of fatal errors.

Sequence diagram for improved systemd detection flow

sequenceDiagram
    participant S as System
    participant D as Netdata Daemon
    participant Systemd as Systemd Service

    D->>Systemd: Check systemd directories
    alt Directories not found
        Systemd-->>D: Not systemd
    else Directories found
        D->>Systemd: systemctl is-system-running
        alt Response is 'offline'
            Systemd-->>D: Not systemd
        else Response is 'unknown' or empty
            D->>S: Check PID 1
            S-->>D: Return process info
        else Any other response
            Systemd-->>D: Is systemd
        end
    end
Loading

Sequence diagram for enhanced memory allocation error handling

sequenceDiagram
    participant App as Application
    participant Mem as Memory Allocator
    participant SM as System Memory

    App->>Mem: Request memory allocation
    alt Allocation fails
        Mem->>SM: Query available system memory
        SM-->>Mem: Return memory stats
        Mem-->>App: Fatal error with memory info
    else Allocation succeeds
        Mem-->>App: Return allocated memory
    end
Loading

State diagram for auto-update status checks

stateDiagram-v2
    [*] --> CheckScheduler
    CheckScheduler --> SystemdCheck: if systemd
    CheckScheduler --> CrontabCheck: if crontab
    CheckScheduler --> IntervalCheck: if interval

    SystemdCheck --> Enabled: timer unit found & enabled
    SystemdCheck --> Disabled: timer unit found & disabled
    SystemdCheck --> NotSupported: unit files missing

    CrontabCheck --> Enabled: crontab entry exists
    CrontabCheck --> Disabled: no crontab entry
    CrontabCheck --> NotSupported: cron.d missing

    IntervalCheck --> Enabled: periodic script exists
    IntervalCheck --> Disabled: no periodic script
    IntervalCheck --> NotSupported: directory missing
Loading

File-Level Changes

Change Details Files
Improved systemd detection logic in multiple scripts.
  • Added a check for the "systemctl is-system-running" command output to enhance systemd detection.
  • Refactored the systemd detection logic to improve accuracy and efficiency.
packaging/installer/netdata-updater.sh
packaging/installer/functions.sh
packaging/installer/netdata-uninstaller.sh
Enhanced memory allocation error handling.
  • Included available system memory information in fatal error messages related to memory allocation failures using "os_last_reported_system_memory()".
  • Updated memory allocation functions (strdupz, strndupz, mallocz, callocz, reallocz) to provide more informative error messages.
src/libnetdata/libnetdata.c
Added an auto-update status check.
  • Implemented the "auto_update_status" function to check and report the status of various auto-update methods (systemd timers, cron jobs, periodic scripts).
  • Added a "--auto-update-status" option to the netdata-updater.sh script to trigger the status check.
packaging/installer/netdata-updater.sh
Improved email notifications for Docker Compose users.
  • Added documentation and configuration instructions for using msmtp to send email notifications in Docker Compose environments.
src/health/notifications/email/metadata.yaml
src/health/notifications/email/README.md
Updated fatal error handling.
  • Modified the behavior of fatal errors to call "abort()" when using Sentry for improved error reporting.
  • Ensured that "nd_sentry_fini()" is called before exiting when not using Sentry.
src/daemon/daemon-shutdown.c
src/libnetdata/log/nd_log.c
Added alert versioning.
  • Introduced a new "alert-version" field in the alert status JSON output.
  • Implemented a function to calculate the node alert version.
  • Exposed the "calculate_node_alert_version" function in the sqlite_aclk_alert.h header file.
src/aclk/aclk.c
src/database/sqlite/sqlite_aclk_alert.c
src/database/sqlite/sqlite_aclk_alert.h
Added a function to retrieve the last reported system memory information.
  • Implemented the "os_last_reported_system_memory" function to provide access to the last reported system memory status.
  • Added a declaration for the new function in the system_memory.h header file.
src/libnetdata/os/system_memory.c
src/libnetdata/os/system_memory.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Ferroin and others added 9 commits January 8, 2025 08:37
Assorted systemd detection fixes:

- Properly scope `set -e` changes to only affect `systemctl
  is-system-running` invocation.
- Skip checking for hard-coded unit file paths. Other paths may
  technically be used for unit files instead of what we hard-code, and
  the presence or abscence of any specific unit file path _does not_
  reliably indicate the presence or abscence of systemd.
* fix wanted cache size calculation to always have an absolute minimum

* add chart for out of memory protection
reformatted the metadata report, to provide the complete picture
* annotate logs with stack trace when libunwind is available

* Update CMakeLists.txt

Co-authored-by: Austin S. Hemmelgarn <[email protected]>

* fix error when libunwind is not available

---------

Co-authored-by: Austin S. Hemmelgarn <[email protected]>
* log the last sample in the database together with the node connected message

* fix libuwind annotator
@pull pull bot merged commit c04b58c into webfutureiorepo:master Jan 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants