22
33# Monitor Service
44
5- Manage HTTP, TCP, and DNS monitors. The Monitor Service provides 12 RPC methods for creating, updating, listing, triggering, deleting, and querying monitor status and metrics.
5+ Manage HTTP, TCP, and DNS monitors. The Monitor Service provides 12 RPC methods
6+ for creating, updating, listing, triggering, deleting, and querying monitor
7+ status and metrics.
68
79All examples assume you have created a client:
810
@@ -88,26 +90,26 @@ const { monitor } = await client.monitor.v1.MonitorService.updateHTTPMonitor({
8890
8991### HTTP Monitor Options
9092
91- | Option | Type | Required | Description |
92- | --------| ------| ----------| -------------|
93- | ` name ` | string | Yes | Monitor name (max 256 chars) |
94- | ` url ` | string | Yes | URL to monitor (max 2048 chars) |
95- | ` periodicity ` | Periodicity | Yes | Check interval |
96- | ` method ` | HTTPMethod | No | HTTP method (default: GET) |
97- | ` body ` | string | No | Request body |
98- | ` headers ` | Headers[ ] | No | Custom headers ` { key, value }[] ` |
99- | ` timeout ` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
100- | ` retry ` | bigint | No | Retry attempts (default: 3, max: 10) |
101- | ` followRedirects ` | boolean | No | Follow redirects (default: true) |
102- | ` regions ` | Region[ ] | No | Regions for checks |
103- | ` active ` | boolean | No | Enable monitoring (default: false) |
104- | ` public ` | boolean | No | Public visibility (default: false) |
105- | ` degradedAt ` | bigint | No | Latency threshold (ms) for degraded status |
106- | ` description ` | string | No | Monitor description (max 1024 chars) |
107- | ` statusCodeAssertions ` | StatusCodeAssertion[ ] | No | Status code assertions |
108- | ` bodyAssertions ` | BodyAssertion[ ] | No | Body assertions |
109- | ` headerAssertions ` | HeaderAssertion[ ] | No | Header assertions |
110- | ` openTelemetry ` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
93+ | Option | Type | Required | Description |
94+ | ---------------------- | --------------------- | -------- | ------------------------------------------- |
95+ | ` name ` | string | Yes | Monitor name (max 256 chars) |
96+ | ` url ` | string | Yes | URL to monitor (max 2048 chars) |
97+ | ` periodicity ` | Periodicity | Yes | Check interval |
98+ | ` method ` | HTTPMethod | No | HTTP method (default: GET) |
99+ | ` body ` | string | No | Request body |
100+ | ` headers ` | Headers[ ] | No | Custom headers ` { key, value }[] ` |
101+ | ` timeout ` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
102+ | ` retry ` | bigint | No | Retry attempts (default: 3, max: 10) |
103+ | ` followRedirects ` | boolean | No | Follow redirects (default: true) |
104+ | ` regions ` | Region[ ] | No | Regions for checks |
105+ | ` active ` | boolean | No | Enable monitoring (default: false) |
106+ | ` public ` | boolean | No | Public visibility (default: false) |
107+ | ` degradedAt ` | bigint | No | Latency threshold (ms) for degraded status |
108+ | ` description ` | string | No | Monitor description (max 1024 chars) |
109+ | ` statusCodeAssertions ` | StatusCodeAssertion[ ] | No | Status code assertions |
110+ | ` bodyAssertions ` | BodyAssertion[ ] | No | Body assertions |
111+ | ` headerAssertions ` | HeaderAssertion[ ] | No | Header assertions |
112+ | ` openTelemetry ` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
111113
112114## TCP Monitors
113115
@@ -148,19 +150,19 @@ const { monitor } = await client.monitor.v1.MonitorService.updateTCPMonitor({
148150
149151### TCP Monitor Options
150152
151- | Option | Type | Required | Description |
152- | --------| ------| ----------| -------------|
153- | ` name ` | string | Yes | Monitor name (max 256 chars) |
154- | ` uri ` | string | Yes | ` host:port ` to monitor (max 2048 chars) |
155- | ` periodicity ` | Periodicity | Yes | Check interval |
156- | ` timeout ` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
157- | ` retry ` | bigint | No | Retry attempts (default: 3, max: 10) |
158- | ` regions ` | Region[ ] | No | Regions for checks |
159- | ` active ` | boolean | No | Enable monitoring (default: false) |
160- | ` public ` | boolean | No | Public visibility (default: false) |
161- | ` degradedAt ` | bigint | No | Latency threshold (ms) for degraded status |
162- | ` description ` | string | No | Monitor description (max 1024 chars) |
163- | ` openTelemetry ` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
153+ | Option | Type | Required | Description |
154+ | --------------- | ------------------- | -------- | ------------------------------------------- |
155+ | ` name ` | string | Yes | Monitor name (max 256 chars) |
156+ | ` uri ` | string | Yes | ` host:port ` to monitor (max 2048 chars) |
157+ | ` periodicity ` | Periodicity | Yes | Check interval |
158+ | ` timeout ` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
159+ | ` retry ` | bigint | No | Retry attempts (default: 3, max: 10) |
160+ | ` regions ` | Region[ ] | No | Regions for checks |
161+ | ` active ` | boolean | No | Enable monitoring (default: false) |
162+ | ` public ` | boolean | No | Public visibility (default: false) |
163+ | ` degradedAt ` | bigint | No | Latency threshold (ms) for degraded status |
164+ | ` description ` | string | No | Monitor description (max 1024 chars) |
165+ | ` openTelemetry ` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
164166
165167## DNS Monitors
166168
@@ -214,28 +216,29 @@ const { monitor } = await client.monitor.v1.MonitorService.updateDNSMonitor({
214216
215217### DNS Monitor Options
216218
217- | Option | Type | Required | Description |
218- | --------| ------| ----------| -------------|
219- | ` name ` | string | Yes | Monitor name (max 256 chars) |
220- | ` uri ` | string | Yes | Domain to resolve (max 2048 chars) |
221- | ` periodicity ` | Periodicity | Yes | Check interval |
222- | ` timeout ` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
223- | ` retry ` | bigint | No | Retry attempts (default: 3, max: 10) |
224- | ` regions ` | Region[ ] | No | Regions for checks |
225- | ` active ` | boolean | No | Enable monitoring (default: false) |
226- | ` public ` | boolean | No | Public visibility (default: false) |
227- | ` degradedAt ` | bigint | No | Latency threshold (ms) for degraded status |
228- | ` description ` | string | No | Monitor description (max 1024 chars) |
229- | ` recordAssertions ` | RecordAssertion[ ] | No | DNS record assertions |
230- | ` openTelemetry ` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
219+ | Option | Type | Required | Description |
220+ | ------------------ | ------------------- | -------- | ------------------------------------------- |
221+ | ` name ` | string | Yes | Monitor name (max 256 chars) |
222+ | ` uri ` | string | Yes | Domain to resolve (max 2048 chars) |
223+ | ` periodicity ` | Periodicity | Yes | Check interval |
224+ | ` timeout ` | bigint | No | Timeout in ms (default: 45000, max: 120000) |
225+ | ` retry ` | bigint | No | Retry attempts (default: 3, max: 10) |
226+ | ` regions ` | Region[ ] | No | Regions for checks |
227+ | ` active ` | boolean | No | Enable monitoring (default: false) |
228+ | ` public ` | boolean | No | Public visibility (default: false) |
229+ | ` degradedAt ` | bigint | No | Latency threshold (ms) for degraded status |
230+ | ` description ` | string | No | Monitor description (max 1024 chars) |
231+ | ` recordAssertions ` | RecordAssertion[ ] | No | DNS record assertions |
232+ | ` openTelemetry ` | OpenTelemetryConfig | No | OpenTelemetry export configuration |
231233
232234## List Monitors
233235
234- List all monitors with offset-based pagination. Returns monitors grouped by type.
236+ List all monitors with offset-based pagination. Returns monitors grouped by
237+ type.
235238
236239``` typescript
237- const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } =
238- await client .monitor .v1 .MonitorService .listMonitors ({
240+ const { httpMonitors, tcpMonitors, dnsMonitors, totalSize } = await client
241+ .monitor .v1 .MonitorService .listMonitors ({
239242 limit: 10 ,
240243 offset: 0 ,
241244 });
@@ -248,26 +251,33 @@ console.log(`DNS: ${dnsMonitors.length}`);
248251
249252Pagination parameters:
250253
251- | Parameter | Type | Description |
252- | ----------- | ------| -------------|
253- | ` limit ` | number (optional) | Max results to return (1–100, default 50) |
254- | ` offset ` | number (optional) | Number of results to skip (default 0) |
254+ | Parameter | Type | Description |
255+ | --------- | -- --------------- | ----------------------------------------- |
256+ | ` limit ` | number (optional) | Max results to return (1–100, default 50) |
257+ | ` offset ` | number (optional) | Number of results to skip (default 0) |
255258
256259## Get Monitor
257260
258- Get a single monitor by ID. The response uses a ` MonitorConfig ` oneof type that contains one of HTTP, TCP, or DNS configuration.
261+ Get a single monitor by ID. The response uses a ` MonitorConfig ` oneof type that
262+ contains one of HTTP, TCP, or DNS configuration.
259263
260264``` typescript
261265const { monitor } = await client .monitor .v1 .MonitorService .getMonitor ({
262266 id: " mon_123" ,
263267});
264268
265269if (monitor ?.config .case === " http" ) {
266- console .log (` HTTP Monitor: ${monitor .config .value .name } — ${monitor .config .value .url } ` );
270+ console .log (
271+ ` HTTP Monitor: ${monitor .config .value .name } — ${monitor .config .value .url } ` ,
272+ );
267273} else if (monitor ?.config .case === " tcp" ) {
268- console .log (` TCP Monitor: ${monitor .config .value .name } — ${monitor .config .value .uri } ` );
274+ console .log (
275+ ` TCP Monitor: ${monitor .config .value .name } — ${monitor .config .value .uri } ` ,
276+ );
269277} else if (monitor ?.config .case === " dns" ) {
270- console .log (` DNS Monitor: ${monitor .config .value .name } — ${monitor .config .value .uri } ` );
278+ console .log (
279+ ` DNS Monitor: ${monitor .config .value .name } — ${monitor .config .value .uri } ` ,
280+ );
271281}
272282```
273283
@@ -343,4 +353,7 @@ console.log(`P95: ${summary.p95}ms`);
343353console .log (` P99: ${summary .p99 }ms ` );
344354```
345355
346- The latency fields (` p50 ` , ` p75 ` , ` p90 ` , ` p95 ` , ` p99 ` ) and count fields (` totalSuccessful ` , ` totalDegraded ` , ` totalFailed ` ) are ` bigint ` values. The ` regions ` parameter is optional — pass an empty array to get metrics across all regions.
356+ The latency fields (` p50 ` , ` p75 ` , ` p90 ` , ` p95 ` , ` p99 ` ) and count fields
357+ (` totalSuccessful ` , ` totalDegraded ` , ` totalFailed ` ) are ` bigint ` values. The
358+ ` regions ` parameter is optional — pass an empty array to get metrics across all
359+ regions.
0 commit comments