[pull] master from DataDog:master#503
Merged
Merged
Conversation
* Add lparstats check (AIX only) Port the lparstats check from datadog-unix-agent to integrations-core, updated for Python 3 and datadog-checks-base. This check collects IBM POWER LPAR performance metrics on AIX via the `lparstat` command: - Memory statistics (system.lpar.memory.*) - Hypervisor call statistics (system.lpar.hypervisor.*) - I/O memory entitlements (system.lpar.memory.entitlement.*) - SPURR processor utilization (system.lpar.spurr.*) The manifest explicitly declares "Supported OS::AIX" as this check relies on lparstat which is exclusive to IBM AIX on POWER hardware. * Fix validation issues: license headers, CHANGELOG, metadata sort, spec.yaml, labeler, ci * Generate config models, sync conf.yaml.example, sync CI, fix lint * Add missing [project.optional-dependencies] section to pyproject.toml * Add basic unit tests with mocked lparstat output * Fix test: remove dd_environment fixture (no Docker needed) * Remove unused pytest import * Fix test: remove assert_all_metrics_covered, check key metrics only * Add dd_environment fixture and rebase onto master * Fix manifest: remove invalid Supported OS::AIX tag, add auto_install and source_type_id * Apply review nits: f-strings, x.split(), hypervisor guard, dev status 5, remove setup.cfg, skip e2e on non-AIX * lparstats: declare SPURR .pct metrics as fraction not percent Values emitted by collect_spurr are in the [0,1] range (e.g. 0.015), not [0,100], so unit_name=percent was incorrect. * lparstats: set curated_metric=core for system.lpar.memory.physb This is the manifest's primary check metric; marking it as core aligns with the convention used by other integrations. * lparstats: always apply DEFAULT_TIMEOUT, not only under sudo A hung lparstat call can block the check regardless of whether sudo is in use; unconditionally setting the timeout is the safer default. * lparstats: strip % from field names in collect_memory_entitlements collect_memory already strips % from its fields; apply the same treatment in collect_memory_entitlements so a %-suffixed column in lparstat -m -eR output produces a valid metric name. * lparstats: add type hints to all callables * lparstats: replace HYPERVISOR_IDX_METRIC_MAP dict with a tuple Contiguous integer keys 0..4 are just positional indices; a tuple is simpler and removes the need for a dict-lookup pattern. * lparstats: patch subprocess.run in tests instead of private _run_cmd Coupling tests to the internal _run_cmd helper is fragile; patching the public subprocess.run interface is more stable and matches the project testing guidelines. * lparstats: use dd_run_check fixture instead of check.check(instance) * lparstats: add tests for hypervisor and memory-entitlements collectors Both collectors had zero coverage because the default instance fixture disables them. Add a dedicated test that enables both and asserts that expected metrics are emitted. * lparstats: add tag assertions for all collectors Assert that memory/SPURR metrics carry no tags and that hypervisor (call:<name>) and entitlement (iompn:<name>) tags are present. * lparstats: guard os.getuid() with hasattr check os.getuid() does not exist on Windows; wrap it so the module can be imported on non-Unix platforms without raising AttributeError. * lparstats: check returncode in all collectors, add lparstats.can_collect service check Each collector now inspects the lparstat return code and skips metric emission (with a warning) on failure instead of silently parsing empty output. A new lparstats.can_collect service check is emitted OK when all enabled collectors succeed and CRITICAL if any lparstat invocation exits non-zero. * lparstats: fix fragile SPURR actual-vs-normalized column split The previous split used idx > len(fields)/2, which silently breaks if lparstat -E ever changes its column count. Split at the freq column instead (it reliably separates actual from normalized), with a fallback warning if freq is absent. * lparstats: extract _lparstat_rows helper to deduplicate parsing prefix All four collectors shared the same _run_cmd → splitlines → filter → slice pattern. _lparstat_rows(cmd, start_idx, ...) centralises it and returns (rows, stderr, returncode) so callers can still inspect the exit code. * lparstats: fix curated_metric value for system.lpar.memory.physb Valid values are cpu and memory; core is not accepted by the validator. * lparstats: disable e2e env, remove dd_environment fixture Set e2e-env = false in hatch.toml so CI does not try to spin up an e2e environment for an AIX-only check that can never run on Linux CI. Remove the now-redundant dd_environment fixture from conftest.py. * lparstats: set owner to agent-integrations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )