@rely-net/sdk 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +57 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -5,6 +5,7 @@ Official SDK for [rely.net](https://rely.net) — monitor your application from
5
5
  ## What it does
6
6
 
7
7
  - Sends health check results from inside your app to rely.net
8
+ - Attributes outgoing HTTP calls to vendors (Stripe, OpenAI, etc.) with per-vendor p95 + error rates
8
9
  - Tracks custom metrics alongside vendor status
9
10
  - Marks deployments on your monitoring charts
10
11
  - Captures request telemetry (error rate, response times)
@@ -16,6 +17,46 @@ Official SDK for [rely.net](https://rely.net) — monitor your application from
16
17
  npm install @rely-net/sdk
17
18
  ```
18
19
 
20
+ ## Install with a coding agent
21
+
22
+ Paste the prompt below into Claude Code, Codex, Cursor, or your agent of choice. It will install the SDK, wire up health checks for the services your app actually depends on, and integrate the Next.js middleware.
23
+
24
+ ```
25
+ Install the @rely-net/sdk package to monitor this Next.js app.
26
+
27
+ Do the following:
28
+
29
+ 1. Install the package:
30
+ npm install @rely-net/sdk
31
+
32
+ 2. Create /instrumentation.ts at the project root with:
33
+ - A Rely client initialized from process.env.RELY_API_KEY
34
+ - One healthCheck() for each external service this app depends on.
35
+ Look through the codebase for env vars like SUPABASE_*, STRIPE_*,
36
+ ANTHROPIC_API_KEY, OPENAI_*, and add a health check for each.
37
+ Use the patterns in the README below.
38
+
39
+ 3. Update middleware.ts to wrap the existing middleware with
40
+ withRelyMiddleware(rely, existingMiddleware). If there is no existing
41
+ middleware, export withRelyMiddleware(rely) directly. Keep the matcher
42
+ excluding _next/static, _next/image, and favicon.ico.
43
+
44
+ 4. Add RELY_API_KEY= to .env.local and mention that the user needs to
45
+ get their API key from rely.net/settings/api-keys and add it to
46
+ production env vars as well.
47
+
48
+ 5. Run a build to verify nothing is broken.
49
+
50
+ Reference README with health check snippets for common services:
51
+ https://github.com/mdicarlo-scaled/rely-net
52
+
53
+ The SDK automatically wraps global fetch to track outgoing vendor
54
+ calls (Stripe, Anthropic, Supabase, etc.) with p50/p95/p99 latency and
55
+ error rates, so no additional code is needed beyond the above steps.
56
+ ```
57
+
58
+ For non-Next.js frameworks, drop step 3 (the middleware integration).
59
+
19
60
  ## Quick start (Next.js)
20
61
 
21
62
  ### 1. Get your API key
@@ -145,6 +186,21 @@ export const config = {
145
186
  }
146
187
  ```
147
188
 
189
+ ## Outgoing vendor calls
190
+
191
+ The SDK wraps the global `fetch` on init to bucket outgoing HTTP calls by hostname and report p50/p95/p99 + error rates per vendor. rely.net matches hostnames to known vendors (Stripe, OpenAI, Supabase, etc.) so you see vendor latency from your app's perspective — the answer to "is it me or is it Stripe?" without writing any code.
192
+
193
+ Enabled by default. Disable with:
194
+
195
+ ```ts
196
+ new Rely({
197
+ apiKey: process.env.RELY_API_KEY!,
198
+ instrumentFetch: false,
199
+ })
200
+ ```
201
+
202
+ Self-calls to the rely.net ingest endpoint are always skipped.
203
+
148
204
  ## Deployment markers
149
205
 
150
206
  Deployment markers are sent automatically when the SDK initializes. They appear as vertical lines on your charts in rely.net, making it easy to correlate issues with deploys.
@@ -167,6 +223,7 @@ new Rely({
167
223
  environment?: string, // default: process.env.NODE_ENV
168
224
  flushInterval?: number, // default: 60000 (ms)
169
225
  sanitizeErrors?: boolean, // default: true (recommended)
226
+ instrumentFetch?: boolean,// default: true (wraps global fetch)
170
227
  debug?: boolean, // default: false
171
228
  })
172
229
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rely-net/sdk",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Official SDK for rely.net — monitor your app from the inside",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",