Skip to content

Commit 78f5af3

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 78f5af3

15 files changed

Lines changed: 1554 additions & 569 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: 50 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,12 @@ 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",
110+
"statusCode": 202,
121111
"timestamp": 1707552000000,
112+
"type": "gauge",
122113
"value": 75.5
123114
}
124115
```
@@ -138,9 +129,17 @@ The Run NRQL Query component allows you to execute NRQL queries via New Relic's
138129

139130
### Configuration
140131

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

145144
### Output
146145

@@ -163,3 +162,29 @@ Returns query results including:
163162
- Queries are subject to New Relic's NRQL query limits
164163
- Invalid NRQL syntax will return an error from the API
165164

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

0 commit comments

Comments
 (0)