feat: add datamanagement and pruningrules packages#1407
feat: add datamanagement and pruningrules packages#1407pranav-new-relic wants to merge 7 commits into
Conversation
67540bf to
6d0f6e2
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1407 +/- ##
==========================================
- Coverage 32.70% 32.32% -0.38%
==========================================
Files 141 146 +5
Lines 6691 6774 +83
==========================================
+ Hits 2188 2190 +2
- Misses 4292 4373 +81
Partials 211 211
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a57c2d7 to
ce4d312
Compare
…d data source
Adds two new top-level identifiers for managing dimensional metric
cardinality limit overrides in a New Relic account:
newrelic_account_cardinality_limit (resource)
- mode = "DEFAULT": sets the account-wide per-metric cardinality
default (applies to all metrics not individually overridden)
- mode = "PER_METRIC": overrides the limit for a single named metric
(metric_name required)
- CustomizeDiff enforces mode/metric_name compatibility at plan time
- Create/Update both call the upsert mutation (idempotent)
- Delete is a state-only removal; the NerdGraph API has no delete
operation for cardinality overrides
- Resource ID format: <accountId>:<metricName> (trailing colon for DEFAULT)
newrelic_account_cardinality_limits (data source)
- Reads all current account limits via dataManagement.limits and
returns cardinality-related entries as a structured list
Depends on newrelic/newrelic-client-go#1407 (datamanagement package).
go.mod pinned to wip/datamanagement branch commit.
818e3b3 to
ed62bb7
Compare
❌ Invalid Conventional Commits DetectedThe following commits do not follow the Conventional Commits format: 3dec7d6 - test(datamanagement,pruningrules): add integration tests for both packages Please update these commit messages to follow the format: Valid types: build, chore, ci, docs, feat, fix, perf, refactor, revert, style, test |
315874c to
5af5cf7
Compare
|
|
Adds a new datamanagement package generated via tutone, exposing: - DataManagementCreateAccountLimit mutation — upserts a per-account limit override (supports both account-wide default and per-metric qualifier overrides via the Qualifier field) - GetLimits query — returns all current limits for an account, including the dimensional metric per-metric cardinality limit This package is the client-go foundation for the newrelic_account_cardinality_limit Terraform resource.
…ning Adds a dedicated pruningrules package as the long-term replacement for DROP_ATTRIBUTES_FROM_METRIC_AGGREGATES usage in nrqldroprules, which is scheduled for EOL on June 30 2026. Only DROP_ATTRIBUTES_FROM_METRIC_AGGREGATES is exposed; DROP_ATTRIBUTES and DROP_DATA are intentionally excluded since this package is purpose-built for metric attribute pruning. Also wires Pruningrules into the top-level NewRelic client struct.
…in newrelic.go - Restore accidentally-commented-out SyntheticsAutomatedTest* struct_tags entries in .tutone.yml that were dropped in the pruningrules commit - Fix import, struct field, and initializer ordering in newrelic.go: Dashboards before DataManagement, Pipelinecontrol before Pruningrules
- Move pruningrules import after plugins (alphabetical: pl < pr) - Replace `for _, _ = range` with `for range` in nrqldroprules integration test
…ion test The API returns INVALID_INPUT when the rule ID fails format validation before the lookup, rather than RULE_NOT_FOUND. Accept either reason.
5af5cf7 to
124c60b
Compare
Summary
Adds two new packages to support metric cardinality management in New Relic:
pkg/datamanagement— exposes the NerdGraphdataManagementAPI for managing account-level cardinality limit overrides:DataManagementCreateAccountLimitmutation — upserts a limit override, supporting both an account-wide default (emptyQualifier) and a per-metric override (Qualifier= metric name)GetLimitsquery — returns all current limits for an account; used to read back the cardinality default after applypkg/pruningrules— a purpose-built client for metric attribute pruning rules, using thenrqlDropRulesNerdGraph API scoped exclusively toDROP_ATTRIBUTES_FROM_METRIC_AGGREGATES. This replaces direct use of the general-purposenrqldroprulespackage for metric pruning, which is EOL June 30 2026:NRQLDropRulesCreate/NRQLDropRulesDeletemutationsGetListquery +GetPruningRuleByIDhelperNRQLDropRulesActionTypesrestricted toDROP_ATTRIBUTES_FROM_METRIC_AGGREGATESonly —DROP_ATTRIBUTESandDROP_DATAare intentionally excluded to prevent misuseBoth packages are wired into the top-level
NewRelicstruct innewrelic/newrelic.go.Context
These packages are the client-go foundation for two Terraform resources being added in terraform-provider-newrelic#3091:
newrelic_account_cardinality_limit— usesdatamanagementnewrelic_metric_pruning_rule— usespruningrulesTesting
Integration tests cover create/list/get-by-ID/delete happy paths, invalid input failure cases, and not-found handling. Tests have been verified against a live account via the Terraform provider CI.