Conversation
… binary Replace the vendored `gstatus` wrapper with direct `gluster --xml` calls and a new stdlib-only XML parser (`gluster_xml.py`). The check now runs `gluster volume info`, `gluster volume status all detail`, `gluster pool list`, `gluster volume heal <vol> info`, and `gluster --version` itself, removing the dependency on the GPL-licensed gstatus/glustercli/glusterlib stack that is shipped with the Agent. This is a prerequisite for dropping `deps/gstatus/` from the datadog-agent repo (the bundled binary and its vendored GPL sources) in a follow-up change. The emitted metric names, tags, and service checks are unchanged. Behavior changes: - New `gluster_command` instance option (list, default `["gluster"]`) replaces the `gstatus_path` init_config option, which is now deprecated and ignored (a warning is logged if it is still set). `gluster_command` supports custom paths and wrappers such as `["docker", "exec", "<container>", "gluster"]`. - `glusterfs.volume.used.percent` is now a numeric gauge computed by the parser, replacing the human-readable "v_size"/"v_size_used" strings and the `PARSE_METRICS` re-parse hack in `metrics.py`. The metric name is unchanged. - Node count and active nodes now come from `gluster pool list` (which includes the local node) instead of gstatus's `peer.pool()` indirection. - Quota and snapshot sub-commands are no longer collected; no metrics depended on them (`snapshot_count` comes from `volume info`). Tests now feed XML fixtures (`tests/fixtures/gluster/`) through a mock of `_run_gluster` instead of the gstatus JSON fixture. The E2E docker-compose setup drops the gstatus binary download from its Dockerfile and polls `gluster --xml volume status all detail` for readiness.
|
|
evalya-impact-summaryevalya impact analysis |
|
Disk usage changeCommit Uncompressed
Details
Compressed
Details
|
| - template: instances | ||
| options: | ||
| - name: use_sudo | ||
| - name: gluster_command |
There was a problem hiding this comment.
How did gstatus originally determine where to call gluster, wasn't it shelling out to it? Ideally we would not add this configuration as it implies that some currently-working customer installs would break without setting this. Is it possible to determine the gluster location the same way gstatus is? Or maybe it just relies on it being in the PATH?
|
|
||
| The XML schema parsed here is Gluster's own documented ``--xml`` output format; | ||
| the parsing implementation is original and does not derive from the upstream | ||
| GPL-licensed ``gstatus`` sources. |
There was a problem hiding this comment.
Remove this last paragraph in the comment, unnecessary
…meout
A hung or unresponsive self-heal daemon (gluster volume heal <vol> info)
must not suppress the cluster/volume/brick metrics or hang the agent. Each
gluster call now has a 30s timeout, and heal collection is wrapped so a
per-volume heal failure logs a warning and yields an empty heal list instead
of aborting the whole check. This mirrors how the upstream gstatus treated
heal as best-effort ("Note: Unable to get self-heal status for one or more
volumes").
Validated against a live 2-node GlusterFS 7.1 cluster: the check emits all
cluster/volume/brick/subvol metrics and service checks even when
volume heal info hangs. Added a unit test covering the heal-failure
graceful-degradation path. The E2E readiness check now also waits for
self-heal info to respond before running.
✅ Dispatcher tests · passed
Batches
b4020fc — GitHub Run.
|
Validation Report
Run Passed validations (19)
|
|
Closing this as the alternative implementation in DataDog/datadog-agent#56202 won't cause any customer breakages, assuming we can get it past OSPO review |
What does this PR do?
Rewrites the
glusterfsintegration to call theglusterCLI's native--xmloutput directly, removing the dependency on the bundledgstatusbinary (and the vendoredglustercli/glusterlibGPL sources) that the Datadog Agent currently ships indeps/gstatus/.A new stdlib-only module
datadog_checks/glusterfs/gluster_xml.pyparsesgluster --xml volume info,gluster --xml volume status all detail,gluster --xml pool list,gluster --xml volume heal <vol> info, andgluster --versioninto the same intermediate dict shapemetrics.pyalready consumes. The emitted metric names, tags, and service checks are unchanged.This is the integrations-core half of removing
gstatusentirely. A follow-up PR indatadog-agentwill deletedeps/gstatus/and its Bazel/renovate references once this version of the integration is pinned.Motivation
glusterlibis GPLv3, not the GPLv2 thedeps/gstatusLICENSE claims).gstatusbinary shipped with the Agent (previously an 8 MiB frozen PyInstaller bundle; more recently a vendored Python wrapper script). Either way it is dead weight the Agent no longer needs to ship.glusterCLI is already a prerequisite (glusterfs-server) on any node running this check, and the vendoredglusterclialready assumedglusterwas onPATH.Behavior changes
gluster_commandinstance option (list, default["gluster"]) replaces thegstatus_pathinit_config option.gstatus_pathis now deprecated and ignored (a warning is logged if it is still set).gluster_commandsupports custom paths and wrappers such as["docker", "exec", "<container>", "gluster"].glusterfs.volume.used.percentis now a numeric gauge computed by the parser, replacing the human-readablev_size/v_size_usedstrings and thePARSE_METRICSre-parse hack inmetrics.py. The metric name is unchanged.gluster pool list(which includes the local node) rather than gstatus'speer.pool()indirection.snapshot_countcomes fromvolume info).glustercall has a 30s timeout so a hung command cannot block the agent.volume heal <vol> infofails or times out for a volume, the check logs a warning and yields an empty heal list for that volume instead of aborting. This mirrors how the bundledgstatustreated heal ("Note: Unable to get self-heal status for one or more volumes"). Cluster/volume/brick metrics still emit.Validation
Validated against a live 2-node GlusterFS 7.1 cluster (the same docker-compose the E2E tests use) by running the actual
GlusterfsCheckagainst it viadocker exec gluster-node-1 gluster:volume info,volume status all detail,pool list, andgluster --versionparsing all verified against real XML output.volume heal infohangs under local arm64 emulation (a known gluster-on-QEMU issue; works on native amd64 in CI), and the check still emits every metric exceptglusterfs.heal_info.entries.count, exactly as designed. A unit test (test_check_emits_metrics_when_heal_fails) covers this path.Unit tests (3) and lint pass locally. Integration and E2E tests run against the same docker-compose cluster in CI; the E2E readiness check now also waits for self-heal info to respond before running.
Review checklist (to be filled by reviewers)
qa/requiredif this PR needs QA validation, orqa/skip-qaif it does not. Exactly one of the two is required.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged