improvement(new-relic): validate integration against NerdGraph docs, surface more entity fields#5443
Conversation
…surface more entity fields - Audited all 4 New Relic tools (nrql_query, search_entities, get_entity, create_deployment_event) plus the block against live NerdGraph API docs; request/response shapes, auth, region endpoints, and GraphQL injection handling all confirmed correct. - Added domain, reporting, alertSeverity, and tags to get_entity and search_entities outputs — stable Entity schema fields we weren't surfacing. Purely additive, no existing fields changed. - Skipped NerdGraph's aiIssues/incidents API; New Relic marks it "unsafe experimental" and requires an opt-in header, not worth the fragility.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview The New Relic block’s Reviewed by Cursor Bugbot for commit 7729599. Configure here. |
Greptile SummaryThis PR extends the New Relic integration by surfacing four additional entity fields (
Confidence Score: 5/5Safe to merge — changes are purely additive, all new fields are null-coalesced, and both tools now share the same normalization path. The raw-entity passthrough concern raised in the previous review has been fully addressed: search_entities now maps every entity through normalizeNewRelicEntity before returning it, matching what get_entity already did. The new normalizeNewRelicEntity utility handles every nullable field consistently, the inline fragment names (AlertableEntityOutline vs AlertableEntity) are correct for their respective query contexts, and gqlString (backed by JSON.stringify) prevents GraphQL injection in the get_entity query. No existing fields or response shapes were changed. No files require special attention. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant Tool as get_entity / search_entities
participant Utils as utils.ts
participant NerdGraph as New Relic NerdGraph
Caller->>Tool: invoke(params)
Tool->>NerdGraph: POST /graphql (guid/query/cursor, new fields: domain, reporting, alertSeverity, tags)
NerdGraph-->>Tool: "GraphQLResponse<RawEntity[]>"
Tool->>Utils: parseNerdGraphResponse()
Utils-->>Tool: typed payload
Tool->>Utils: normalizeNewRelicEntity(rawEntity)
Note over Utils: null-coalesces guid, name, entityType,<br/>domain, reporting, alertSeverity, tags
Utils-->>Tool: NewRelicEntity (fully normalized)
Tool-->>Caller: "{ success, output: { entity / entities } }"
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant Tool as get_entity / search_entities
participant Utils as utils.ts
participant NerdGraph as New Relic NerdGraph
Caller->>Tool: invoke(params)
Tool->>NerdGraph: POST /graphql (guid/query/cursor, new fields: domain, reporting, alertSeverity, tags)
NerdGraph-->>Tool: "GraphQLResponse<RawEntity[]>"
Tool->>Utils: parseNerdGraphResponse()
Utils-->>Tool: typed payload
Tool->>Utils: normalizeNewRelicEntity(rawEntity)
Note over Utils: null-coalesces guid, name, entityType,<br/>domain, reporting, alertSeverity, tags
Utils-->>Tool: NewRelicEntity (fully normalized)
Tool-->>Caller: "{ success, output: { entity / entities } }"
Reviews (3): Last reviewed commit: "fix(new-relic): gate alertSeverity behin..." | Re-trigger Greptile |
…ization search_entities passed raw NerdGraph entities straight through, so tags/ domain/reporting/alertSeverity could arrive as null/undefined at runtime despite the non-nullable NewRelicEntity type contract — a .map() on a null tags array would throw. get_entity already normalized these fields correctly. Extracted the normalization into a shared normalizeNewRelicEntity() in utils.ts and reuse it from both tools, so the two can't drift again.
|
Fixed — extracted a shared |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit bf5beaa. Configure here.
…fragments
alertSeverity isn't a direct field on New Relic's Entity/EntityOutline
types — it only exists on the AlertableEntity/AlertableEntityOutline
sub-interfaces, and NerdGraph rejects the query outright without the
inline fragment. get_entity.ts (entity(guid), returns Entity) now uses
`... on AlertableEntity { alertSeverity }`; search_entities.ts
(entitySearch, returns EntityOutline) now uses
`... on AlertableEntityOutline { alertSeverity }`. Confirmed against
New Relic's live NerdGraph entities API docs.
|
Follow-up from an additional independent verification pass (re-checked every field against New Relic's live NerdGraph docs from scratch, including backwards-compat diffing against origin/staging): found that |
|
@greptile review |
|
@cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 7729599. Configure here.
Summary
domain,reporting,alertSeverity, andtagstoget_entity/search_entitiesoutputs — stable New Relic Entity schema fields we weren't surfacing. Purely additive, no existing fields changed or renamedaiIssues/incidents API but skipped it — New Relic marks it "unsafe experimental," requires an opt-in header, and can break without noticeType of Change
Testing
Tested manually: typecheck (
bun run type-check) and lint (bun run lint) both pass clean. Ran 5 independent audits (one per tool + one for block/registry wiring) against live New Relic docs to confirm alignment and backwards compatibility.Checklist