Summary
The New Relic integration CLI commands were implemented with incorrect parameters and endpoints that don't match the actual Cortex API specification.
Issues Found
1. Wrong Parameters in add Command
File: cortexapps_cli/commands/integrations_commands/newrelic.py:12,30
- Missing required parameter:
accountId is required by API but not present in CLI
- Wrong parameter name: CLI uses
--api-key flag and sends apiKey in JSON payload
- API expects:
personalKey
- CLI sends:
apiKey
- Wrong parameter: CLI has
--host parameter
- API expects:
region (values: "US" or "EU")
- CLI has:
host (free-form string)
2. Wrong HTTP Method for add_multiple
File: cortexapps_cli/commands/integrations_commands/newrelic.py:54
- CLI uses:
client.put("api/v1/newrelic/configurations")
- API expects:
POST /api/v1/newrelic/configurations
- Note: Test file correctly expects POST, but implementation uses PUT
3. Wrong Endpoint for validate Command
File: cortexapps_cli/commands/integrations_commands/newrelic.py:156
- CLI uses:
client.post("api/v1/newrelic/configurations/validate" + alias)
- Missing slash before alias
- Wrong path structure
- API expects:
POST /api/v1/newrelic/configuration/validate/{alias} (singular "configuration")
4. Wrong Endpoint for validate_all Command
File: cortexapps_cli/commands/integrations_commands/newrelic.py:169
- CLI uses:
client.post("api/v1/newrelic/configurations")
- API expects:
POST /api/v1/newrelic/configuration/validate (singular, with /validate)
Test File Issues
File: tests/test_integrations_newrelic.py
- Line 18: Expects POST (correct) but implementation uses PUT
- Line 53: Wrong endpoint - expects
/configuration/validate/test should be /configuration/validate/{alias}
- Line 58: Endpoint is correct
Root Cause
The New Relic integration commands appear to have been copied from another integration without proper adaptation to the New Relic API specification.
API Documentation Reference
https://docs.cortex.io/api/readme/integrations/new-relic
Required Fixes
- Update
add command to include --account-id parameter
- Rename
--api-key to --personal-key and update JSON payload key
- Replace
--host with --region parameter (with US/EU validation)
- Change
add_multiple from PUT to POST
- Fix
validate endpoint path
- Fix
validate_all endpoint path
- Update all corresponding test expectations
Summary
The New Relic integration CLI commands were implemented with incorrect parameters and endpoints that don't match the actual Cortex API specification.
Issues Found
1. Wrong Parameters in
addCommandFile:
cortexapps_cli/commands/integrations_commands/newrelic.py:12,30accountIdis required by API but not present in CLI--api-keyflag and sendsapiKeyin JSON payloadpersonalKeyapiKey--hostparameterregion(values: "US" or "EU")host(free-form string)2. Wrong HTTP Method for
add_multipleFile:
cortexapps_cli/commands/integrations_commands/newrelic.py:54client.put("api/v1/newrelic/configurations")POST /api/v1/newrelic/configurations3. Wrong Endpoint for
validateCommandFile:
cortexapps_cli/commands/integrations_commands/newrelic.py:156client.post("api/v1/newrelic/configurations/validate" + alias)POST /api/v1/newrelic/configuration/validate/{alias}(singular "configuration")4. Wrong Endpoint for
validate_allCommandFile:
cortexapps_cli/commands/integrations_commands/newrelic.py:169client.post("api/v1/newrelic/configurations")POST /api/v1/newrelic/configuration/validate(singular, with /validate)Test File Issues
File:
tests/test_integrations_newrelic.py/configuration/validate/testshould be/configuration/validate/{alias}Root Cause
The New Relic integration commands appear to have been copied from another integration without proper adaptation to the New Relic API specification.
API Documentation Reference
https://docs.cortex.io/api/readme/integrations/new-relic
Required Fixes
addcommand to include--account-idparameter--api-keyto--personal-keyand update JSON payload key--hostwith--regionparameter (with US/EU validation)add_multiplefrom PUT to POSTvalidateendpoint pathvalidate_allendpoint path