Skip to content

fix: New Relic integration commands have incorrect parameters and endpoints #191

@jeff-schnitter

Description

@jeff-schnitter

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

  1. Update add command to include --account-id parameter
  2. Rename --api-key to --personal-key and update JSON payload key
  3. Replace --host with --region parameter (with US/EU validation)
  4. Change add_multiple from PUT to POST
  5. Fix validate endpoint path
  6. Fix validate_all endpoint path
  7. Update all corresponding test expectations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions