Skip to content

feat(workloads): add intelligent workload support with dynamic flows and alert policy#1408

Open
nr-ramapuram wants to merge 1 commit into
newrelic:mainfrom
nr-ramapuram:feat/intelligent-workload-support
Open

feat(workloads): add intelligent workload support with dynamic flows and alert policy#1408
nr-ramapuram wants to merge 1 commit into
newrelic:mainfrom
nr-ramapuram:feat/intelligent-workload-support

Conversation

@nr-ramapuram
Copy link
Copy Markdown

@nr-ramapuram nr-ramapuram commented May 11, 2026

Adds support for intelligent workloads in the workloads package, enabling callers to create and update workloads anchored to a transaction entry point via dynamic flows. New Relic auto-discovers related entities using Transaction 360 distributed tracing. If dynamicFlows is set alongside entityGuids or entitySearchQueries, dynamicFlows takes precedence, others will be ignored, and an intelligent workload is created.

Changes:

types.go

  • Added WorkloadDynamicFlow, WorkloadDynamicFlowInput, WorkloadUpdateDynamicFlowInput structs
  • Added WorkloadAlertPolicy, WorkloadAlertPolicyInput, WorkloadUpdateAlertPolicyInput structs
  • Added DynamicFlows field to WorkloadCreateInput, WorkloadUpdateInput, and WorkloadCollection
  • Added AlertPolicy field to WorkloadStatusConfig, WorkloadStatusConfigInput, and WorkloadUpdateStatusConfigInput

workloads_api.go

  • Added dynamicFlows { entityGuid, id, transactionName } to all 5 GraphQL strings (WorkloadCreateMutation, WorkloadDeleteMutation, WorkloadDuplicateMutation, WorkloadUpdateMutation, getCollectionQuery)
  • Added alertPolicy { enabled } to statusConfig block in all 5 GraphQL strings

pkg/testhelpers/helpers.go

  • Added GetTestEntityGUID() — reads NEW_RELIC_TEST_ENTITY_GUID env var
  • Added GetTestTransactionName() — reads NEW_RELIC_TEST_TRANSACTION_NAME env var
  • Added private getEnvString() helper

Tests:

Integration Tests

  • TestIntegrationWorkloadCreate_IntelligentWorkload — creates an intelligent workload with DynamicFlows and AlertPolicy enabled, asserts all fields, cleans up
  • TestIntegrationWorkloadUpdate_IntelligentWorkload — creates an intelligent workload, updates name and disables AlertPolicy, asserts updated fields, cleans up

Example

  • Example_intelligentWorkload() — demonstrates full create/update/delete lifecycle with DynamicFlows and StatusConfig.AlertPolicy

Note: types.go and workloads_api.go carry a // Code generated by tutone: DO NOT EDIT header. The additions in this PR are intentional manual changes. Please do not regenerate these files without first updating the tutone configuration to include the new fields.

Follow-up: Once this PR is merged and a new version is released, a follow-up PR will be raised on https://github.com/newrelic/terraform-provider-newrelic to add dynamic_flows and status_config_alert_policy support to the newrelic_workload resource.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 11, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants