Feat/legacy conditions rest fetcher#4
Merged
Conversation
added 8 commits
July 9, 2026 22:31
The NerdGraph WorkloadAccountStitchedFields.collection field takes a guid: EntityGuid! argument, not id: Int!. The audit fetcher was storing the numeric workload ID as asset_id; the cleanup deleter was trying to look up the workload by that numeric ID which failed at runtime. Fix: audit now stores wl.GUID as asset_id; cleanup passes the GUID directly to collection(guid:), eliminating the broken numeric-ID lookup step entirely.
…APIs) service_levels: Replace two-phase entitySearch+entities approach with actor.account.serviceLevels.serviceLevelIndicators. The original query used ... on ServiceLevelIndicatorEntity which is not a valid NerdGraph type — service level entities are ExternalEntity in entities(guids:) and have no SLI-specific fields. The dedicated serviceLevels API exposes entityGuid and events directly, with no inline fragment needed. legacy_conditions: Remove fetcher entirely. The NerdGraph field actor.account.alerts.conditions(policyId:) no longer exists on AlertsAccountStitchedFields. Legacy (non-NRQL) alert conditions are deprecated by New Relic and there is no NerdGraph replacement.
Since the NerdGraph API field for querying legacy (APM/Browser/Mobile metric) conditions was removed, the tool can no longer scan them. Add a static Finding per account with asset_type=legacy_condition that surfaces in both the on-screen report and the CSV, advising users to check policies manually and recreate any remaining conditions as NRQL. Skippable with --skip legacy_conditions.
Large accounts hit the per-account timeout because three fetchers independently paginate nrqlConditionsSearch (nrql_conditions, disabled_conditions, uncovered_alert_policies). This eliminates one of those redundant sweeps by merging nrql_conditions and disabled_conditions into a single pass. - Merge fetch_disabled_conditions into fetch_conditions: one scan now emits both hardcoded-ID findings and disabled-condition findings. --skip nrql_conditions suppresses both. - Increase default --timeout from 5m to 15m. - Print a "try --timeout 20m" hint in the report whenever any fetcher error contains "deadline exceeded".
…ssing NerdGraph paths actor.account.serviceLevels does not exist, and ServiceLevelIndicatorEntity is not a valid NerdGraph type. Switch to entitySearch with base tags fields and extract entityGuid from the entity tag, which SLI entities expose natively. Drop events WHERE clause scanning (not accessible via entity graph APIs).
…onfig Replace the static legacy_conditions notice with a real fetcher that: 1. Lists all policies via NerdGraph policiesSearch 2. Calls GET /v2/alerts_conditions.json per policy via REST API v2 3. Emits findings for disabled conditions and hardcoded entity IDs The same User API key (NRAK-...) works for both NerdGraph and REST v2. Add RESTURL field to Region config; wire nrRESTClient in cmd/main.go.
Policies created via NerdGraph/NRQL are not registered in the REST API v2 and return 422 'Policy with ID X not found'. Treat 404 and 422 as no-op (empty condition list) instead of an error.
…ng ones Previously the fetcher only emitted findings for disabled conditions or those with hardcoded entity IDs, silently skipping enabled conditions with no entity references. Now every legacy condition gets a migration notice (condition type + suggestion), with per-entity findings appended when entity IDs are present.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Legacy Conditions can't be moved via Nerdgraph calls, they need to be recreated. This feature flags those legacy conditions