newrelic-cli icon indicating copy to clipboard operation
newrelic-cli copied to clipboard

Not possible to search for some entity types

Open abuchanan-nr opened this issue 3 years ago • 1 comments

Description

It's not possible to search for some valid entity types, such as AIOPS/CONDITION.

Go Version

go version go1.16.5 darwin/amd64 newrelic version 0.47.0

Current behavior

> newrelic entity search "accountId = 1234 and type = 'CONDITION'"
FATAL one of --name, --type, --alert-severity, or --domain are required

> newrelic entity search --domain 'AIOPS' "accountId = 1234 and type = 'CONDITION'"
FATAL Argument "queryBuilder" has invalid value $queryBuilder.
In field "domain": Expected type "EntitySearchQueryBuilderDomain", found "AIOPS".

> newrelic entity search --type CONDITION "accountId = 1234 and type = 'CONDITION'"
FATAL Argument "queryBuilder" has invalid value $queryBuilder.
In field "type": Expected type "EntitySearchQueryBuilderType", found "CONDITION".

Expected behavior

It should be possible to search for entity types that are not part of EntitySearchQueryBuilderType.

It should be possible to search without using the entitySearch.queryBuilder, but instead use entitySearch.query:

{
  actor {
    entitySearch(query: "(tags.owning_team = 'abcd' and type != 'CONTAINER') or (accountId = 1234)") {
      results {
        entities {
          name
          type
          tags {
            key
            values
          }
        }
      }
    }
  }
}

abuchanan-nr avatar May 06 '22 18:05 abuchanan-nr

This is also affecting searches for OpenTelemetry service entities. Using this query does not work as expected:

newrelic entity search --domain=EXT --type=SERVICE
FATAL Argument "queryBuilder" has invalid value $queryBuilder.
In field "type": Expected type "EntitySearchQueryBuilderType", found "SERVICE". 

Reference for entity domain and type: https://github.com/newrelic/entity-definitions/blob/main/entity-types/ext-service/definition.yml

maxlemieux avatar Feb 22 '24 03:02 maxlemieux