[pull] master from DataDog:master#579
Merged
Merged
Conversation
* [cilium] add env-agnostic unit tests to lift mutation score The existing tests/test_cilium.py is gated by requires_new_environment, so it skips entirely under the legacy hatch env and runs only a thin slice under the modern env. This left CiliumCheckV2._parse_config, the legacy CiliumCheck __new__/__init__ routing, and construct_metrics_config's suffix stripping with 0% mutation coverage. Add tests/test_unit.py with 29 env-agnostic tests covering: - construct_metrics_config: _total / _counter suffix stripping, passthrough, empty input, iteration, substring-not-suffix. - CiliumCheckV2._parse_config: DEFAULT_METRIC_LIMIT, missing-endpoint validation, agent-only / operator-only / both scraper construction, agent-vs-operator metric set selection. - Legacy CiliumCheck: __new__ routing on use_openmetrics (truthy / falsy / absent / first-instance), __init__ validation (both / neither endpoint), first-instance endpoint selection, operator vs agent metric set, default and custom prometheus_timeout, namespace, metadata_metric_name. Local cosmic-ray run with --test-path tests/test_unit.py: 51 mutants generated, 51 killed, 0 survived (100% from 0%). * [cilium] Replace repr-based metric-set assertions with structural key iteration Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix(nutanix): normalize all ntnx_* tags to lowercase with $unknown fallback Route every enum-backed ntnx_* tag (host_type, hypervisor_type, node_status, plus the previously-handled state tags) through a single _norm_state helper so they all follow one rule: lowercase the API value, fall back to "\$unknown" when the source is missing. Picks "\$unknown" (the API spec's own sentinel) as the fallback so there's no mismatch between "value present but says \$UNKNOWN" and "value missing" — both surface as ntnx_X:\$unknown. ntnx_disk_status's "unknown" fallback is updated to "\$unknown" for the same reason. * docs(nutanix): add changelog for tag normalization * docs(nutanix): shorten changelog to one customer-facing line * refactor(nutanix): extract tag values into named variables Hoist _norm_state and get_nested calls out of f-strings in the tag-extraction helpers. Each tag computation now binds to a named local first, making the read top-down and easier to step through. * refactor(nutanix): rename _norm_state to _normalize_tag_value The helper is used for type, state, mode, and status tags — not just state — so the broader name better describes what it does. * refactor(nutanix): collapse node_status to one variable, restore tags = [] Lowercase the node-status comparison sets so the normalized tag value serves both the status_value lookup and the tag emission, removing the need for a separate node_status_tag local. Restore the tags = [] preamble in the tag-extraction helpers since it makes the building intent obvious. * fix(nutanix): normalize powerState in vm.status gauge Match what _report_host_status_metrics does: route the powerState lookup through _normalize_tag_value and lowercase the comparison literals. Removes the asymmetry where vm.status was the only metric still relying on raw uppercase API values. Addresses review feedback on PR #23609. * fix(nutanix): warn and skip entities missing the main id or name Hosts now warn-and-skip when hostName is missing (previously they emitted metrics with hostname=None, useless for correlation), VMs upgrade their existing missing-id/name skip from debug to warning, and clusters now warn-and-skip when name is missing (previously they were processed with no ntnx_cluster_name tag and weren't cached for VM/host cluster-name tagging). * docs(nutanix): add changelog for entity-validation skip * docs(nutanix): shorten changelog to one customer-facing line * refactor(nutanix): rename VM hostname locals/params to vm_name The variable was named after how it's consumed downstream (the hostname= kwarg to gauge calls), not what it actually is — the VM's "name" field from the API. Rename to vm_name for symmetry with host_name on the host side; the gauge call still passes it as hostname=vm_name. * refactor(nutanix): hoist cluster log label to a variable * Delete nutanix/changelog.d/23609.fixed * Keep collecting VMs for unnamed hosts * test(nutanix): add tests for skip behavior on missing entity fields Cover the three new skip paths added in this PR: - VM missing extId: verify vm_count decrements and metric absent - VM missing name: same invariant - Cluster missing name: verify cluster_count unchanged and warning logged Each VM test is parametrized for both batch and non-batch collection modes. Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* postgres: collect relkind (incl views/matviews) in schema metadata
- Add c.relkind to PG_TABLES_QUERY_V10_PLUS and PG_TABLES_QUERY_V9 SELECT lists
- Expand relkind filter to include views ('v') and materialized views ('m')
- Propagate relkind through get_rows_query() schema_tables CTE, final SELECT, and GROUP BY
- Add relkind: str to TableObject TypedDict
- Add relkind to _map_row() per-table payload
- Add CREATE VIEW and CREATE MATERIALIZED VIEW to test database setup SQL
- Update test assertions to verify relkind is present and correct
- Update schema snapshot fixtures: add relkind to all existing tables, add
persons_view and persons_matview entries (fixtures need regeneration in CI
with actual OIDs via test_collect_schema_snapshot auto-update)
Environment: Datadog workspace
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Maciej Obuchowski <mobuchowski@datadoghq.com>
* remove pulling (materialized) views
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
* changelog entry
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
* Tighten relkind assertion to match collector query policy
The collector query in schemas.py only returns relkind values 'r', 'p',
and 'f' (regular tables, partitioned tables, foreign tables). Tighten
the test assertion to match, removing 'v' and 'm' which were included
when views/matviews were considered but then removed.
Environment: Datadog workspace
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
---------
Signed-off-by: Maciej Obuchowski <mobuchowski@datadoghq.com>
Signed-off-by: Maciej Obuchowski <maciej.obuchowski@datadoghq.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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 : )