Skip to content

Commit fd8c0e4

Browse files
committed
feat: fix New Relic integration and resolve build infra cache issues
Signed-off-by: Teshome Birhanu <teshomebirhanu393@gmail.com>
1 parent ebda765 commit fd8c0e4

15 files changed

Lines changed: 1533 additions & 558 deletions

docker-compose.dev.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ services:
2525
# Ensure Go build cache initializes in a writable, persisted location
2626
# This fixes: "failed to initialize build cache at /.cache/go-build: permission denied"
2727
# and keeps the cache across container restarts (since /app is bind-mounted)
28-
GOMODCACHE: "/app/tmp/go/pkg/mod"
29-
GOCACHE: "/app/tmp/go-build"
28+
GOMODCACHE: "/app/tmp/.go/pkg/mod"
29+
GOCACHE: "/app/tmp/.go-build"
3030
XDG_CACHE_HOME: "/app/tmp"
3131
# Lock Playwright browsers location so install and runtime match
3232
PLAYWRIGHT_BROWSERS_PATH: "/app/tmp/ms-playwright"
Lines changed: 49 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: "New Relic"
2+
title: "Newrelic"
33
---
44

55
Monitor and manage your New Relic resources
@@ -24,21 +24,16 @@ import { CardGrid, LinkCard } from "@astrojs/starlight/components";
2424
To set up New Relic integration:
2525

2626
1. **Select Region**: Choose your New Relic region (US or EU)
27-
2. **Get API Key**: In New Relic, go to Account Settings > API Keys
28-
3. **Create API Key**: Click "Create API key" and give it a name
29-
4. **Copy API Key**: Copy the generated API key (you won't be able to see it again)
30-
5. **Paste API Key**: Paste the API key in the field below
27+
2. **Provide API Keys**: You can provide one or both keys depending on which components you need.
3128

32-
## Usage
29+
## API Keys
3330

34-
- **Report Metric**: Use this action to send custom telemetry (Gauge, Count, Summary) to New Relic.
35-
- **Run NRQL Query**: Use this action to fetch data from New Relic for decision making or reporting.
31+
New Relic uses two different types of API keys for different purposes:
3632

37-
## Note
33+
- **User API Key** (starts with NRAK-): Required for **Run NRQL Query** and **On Issue** trigger. Get it from New Relic > Account Settings > API Keys > Create User Key.
34+
- **License Key** (Ingest - License): Required for **Report Metric** action. Get it from New Relic > Account Settings > API Keys > Create Ingest License Key.
3835

39-
The **Report Metric** action requires a **License Key** (Ingest - License) or an **API Key** (User) with ingest permissions.
40-
If you use a User API Key, it must have the necessary permissions. A License Key is generally recommended for metric ingestion.
41-
The **Run NRQL Query** action requires a **User API Key** (NRAK-) with query permissions.
36+
You may provide both keys to enable all components, or just the key(s) for the components you need.
4237

4338
<a id="on-issue"></a>
4439

@@ -77,16 +72,12 @@ This trigger generates a webhook URL. You must configure a **Workflow** in New R
7772

7873
```json
7974
{
80-
"impacted_entities": [
81-
"infra-host-1"
82-
],
8375
"issue_id": "12345678-abcd-efgh-ijkl-1234567890ab",
8476
"issue_url": "https://one.newrelic.com/launcher/nrai.launcher?pane=eyJuZXJkbGV0SWQiOiJhbGVydGluZy11aS1jbGFzc2ljLmluY2lkZW50cyIsInNlbGVjdGVkSW5jaWRlbnRJZCI6IjEyMzQ1Njc4In0=",
8577
"owner": "Team SRE",
8678
"priority": "CRITICAL",
8779
"state": "ACTIVATED",
88-
"title": "High CPU Usage",
89-
"total_incidents": 1
80+
"title": "High CPU Usage"
9081
}
9182
```
9283

@@ -102,6 +93,7 @@ The Report Metric component allows you to send custom metrics (Gauge, Count, Sum
10293
- **Metric Type**: The type of metric (Gauge, Count, or Summary)
10394
- **Value**: The numeric value of the metric
10495
- **Timestamp**: Optional Unix timestamp (milliseconds). Defaults to now.
96+
- **Interval (ms)**: Required for Count and Summary metrics. The duration of the measurement window in milliseconds.
10597
- **Attributes**: Optional JSON object with additional attributes
10698

10799
### Output
@@ -112,13 +104,11 @@ Returns the sent metric payload.
112104

113105
```json
114106
{
115-
"attributes": {
116-
"environment": "production",
117-
"host": "server1.example.com"
118-
},
119-
"metricName": "server.cpu.usage",
120-
"metricType": "gauge",
107+
"intervalMs": 0,
108+
"name": "server.cpu.usage",
109+
"status": "202 Accepted",
121110
"timestamp": 1707552000000,
111+
"type": "gauge",
122112
"value": 75.5
123113
}
124114
```
@@ -138,9 +128,17 @@ The Run NRQL Query component allows you to execute NRQL queries via New Relic's
138128

139129
### Configuration
140130

141-
- **Account ID**: The New Relic account ID to query against (required)
131+
- **Account**: The New Relic account to query (select from dropdown)
142132
- **Query**: The NRQL query string to execute (required)
143-
- **Timeout**: Query timeout in seconds (optional, default: 10, max: 120)
133+
134+
### How It Works
135+
136+
Queries use New Relic's asynchronous query API:
137+
138+
1. The query is submitted via NerdGraph.
139+
2. If results are available within the internal API timeout, they are emitted immediately.
140+
3. If the query takes longer, the component polls for results automatically.
141+
4. Polling intervals respect the "Retry-After" suggestion from New Relic API, falling back to 10 seconds if not provided.
144142

145143
### Output
146144

@@ -163,3 +161,29 @@ Returns query results including:
163161
- Queries are subject to New Relic's NRQL query limits
164162
- Invalid NRQL syntax will return an error from the API
165163

164+
### Example Output
165+
166+
```json
167+
{
168+
"accountId": "1234567",
169+
"metadata": {
170+
"eventTypes": [
171+
"Transaction"
172+
],
173+
"facets": null,
174+
"messages": [],
175+
"timeWindow": {
176+
"begin": 1707559740000,
177+
"end": 1707563340000
178+
}
179+
},
180+
"query": "SELECT count(*) FROM Transaction SINCE 1 hour ago",
181+
"results": [
182+
{
183+
"count": 1523
184+
}
185+
],
186+
"totalResult": null
187+
}
188+
```
189+

0 commit comments

Comments
 (0)