Skip to content

Commit 9c5a7b1

Browse files
feat: Add customer-facing OTLP destination CRUD API
Stainless-Generated-From: f3471e525bb7006b1991b78ccc41e1805f0048c9
1 parent aee68a1 commit 9c5a7b1

10 files changed

Lines changed: 351 additions & 2 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 134
1+
configured_endpoints: 139

api.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,22 @@ Methods:
303303
- <code title="post /auth/connections/{id}/submit">client.auth.connections.<a href="./src/resources/auth/connections.ts">submit</a>(id, { ...params }) -> SubmitFieldsResponse</code>
304304
- <code title="get /auth/connections/{id}/timeline">client.auth.connections.<a href="./src/resources/auth/connections.ts">timeline</a>(id, { ...params }) -> ManagedAuthTimelineEventsOffsetPagination</code>
305305

306+
# Telemetry
307+
308+
## Destinations
309+
310+
Types:
311+
312+
- <code><a href="./src/resources/telemetry/destinations.ts">OtlpDestination</a></code>
313+
314+
Methods:
315+
316+
- <code title="post /telemetry/destinations">client.telemetry.destinations.<a href="./src/resources/telemetry/destinations.ts">create</a>({ ...params }) -> OtlpDestination</code>
317+
- <code title="get /telemetry/destinations/{id_or_name}">client.telemetry.destinations.<a href="./src/resources/telemetry/destinations.ts">retrieve</a>(idOrName) -> OtlpDestination</code>
318+
- <code title="patch /telemetry/destinations/{id_or_name}">client.telemetry.destinations.<a href="./src/resources/telemetry/destinations.ts">update</a>(idOrName, { ...params }) -> OtlpDestination</code>
319+
- <code title="get /telemetry/destinations">client.telemetry.destinations.<a href="./src/resources/telemetry/destinations.ts">list</a>({ ...params }) -> OtlpDestinationsOffsetPagination</code>
320+
- <code title="delete /telemetry/destinations/{id_or_name}">client.telemetry.destinations.<a href="./src/resources/telemetry/destinations.ts">delete</a>(idOrName) -> void</code>
321+
306322
# Proxies
307323

308324
Types:

src/client.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ import {
180180
ProjectsOffsetPagination,
181181
UpdateProjectRequest,
182182
} from './resources/projects/projects';
183+
import { Telemetry } from './resources/telemetry/telemetry';
183184
import { type Fetch } from './internal/builtin-types';
184185
import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
185186
import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -1020,6 +1021,7 @@ export class Kernel {
10201021
*/
10211022
profiles: API.Profiles = new API.Profiles(this);
10221023
auth: API.Auth = new API.Auth(this);
1024+
telemetry: API.Telemetry = new API.Telemetry(this);
10231025
/**
10241026
* Create and manage proxy configurations for routing browser traffic.
10251027
*/
@@ -1064,6 +1066,7 @@ Kernel.Invocations = Invocations;
10641066
Kernel.Browsers = Browsers;
10651067
Kernel.Profiles = Profiles;
10661068
Kernel.Auth = Auth;
1069+
Kernel.Telemetry = Telemetry;
10671070
Kernel.Proxies = Proxies;
10681071
Kernel.Extensions = Extensions;
10691072
Kernel.BrowserPools = BrowserPools;
@@ -1161,6 +1164,8 @@ export declare namespace Kernel {
11611164

11621165
export { Auth as Auth };
11631166

1167+
export { Telemetry as Telemetry };
1168+
11641169
export {
11651170
Proxies as Proxies,
11661171
type ProxyCreateResponse as ProxyCreateResponse,

src/resources/browsers/telemetry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { RequestOptions } from '../../internal/request-options';
1010
import { path } from '../../internal/utils/path';
1111

1212
/**
13-
* Stream live telemetry events from a browser session.
13+
* Stream live telemetry events from a browser session, and manage the destinations sessions export them to.
1414
*/
1515
export class Telemetry extends APIResource {
1616
/**

src/resources/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,3 +156,4 @@ export {
156156
type ProxyCheckParams,
157157
type ProxyListResponsesOffsetPagination,
158158
} from './proxies';
159+
export { Telemetry } from './telemetry/telemetry';

src/resources/telemetry.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
export * from './telemetry/index';
Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../../core/resource';
4+
import { APIPromise } from '../../core/api-promise';
5+
import { OffsetPagination, type OffsetPaginationParams, PagePromise } from '../../core/pagination';
6+
import { buildHeaders } from '../../internal/headers';
7+
import { RequestOptions } from '../../internal/request-options';
8+
import { path } from '../../internal/utils/path';
9+
10+
/**
11+
* Stream live telemetry events from a browser session, and manage the destinations sessions export them to.
12+
*/
13+
export class Destinations extends APIResource {
14+
/**
15+
* Create an OTLP export destination in the resolved project. Names must be unique
16+
* within the project.
17+
*/
18+
create(body: DestinationCreateParams, options?: RequestOptions): APIPromise<OtlpDestination> {
19+
return this._client.post('/telemetry/destinations', { body, ...options });
20+
}
21+
22+
/**
23+
* Retrieve a single OTLP destination in the resolved project by its ID or name.
24+
*/
25+
retrieve(idOrName: string, options?: RequestOptions): APIPromise<OtlpDestination> {
26+
return this._client.get(path`/telemetry/destinations/${idOrName}`, options);
27+
}
28+
29+
/**
30+
* Update an OTLP destination. Sessions already exporting to it pick up the new
31+
* values without restarting, which makes this the way to rotate credentials
32+
* without interrupting export.
33+
*
34+
* Names must be unique within the project. Renaming is refused with a 409 while a
35+
* managed auth connection selects this destination by name, since that connection
36+
* resolves the name on every login. Every other field, including `headers`, stays
37+
* editable.
38+
*/
39+
update(
40+
idOrName: string,
41+
body: DestinationUpdateParams,
42+
options?: RequestOptions,
43+
): APIPromise<OtlpDestination> {
44+
return this._client.patch(path`/telemetry/destinations/${idOrName}`, { body, ...options });
45+
}
46+
47+
/**
48+
* List OTLP export destinations in the resolved project.
49+
*/
50+
list(
51+
query: DestinationListParams | null | undefined = {},
52+
options?: RequestOptions,
53+
): PagePromise<OtlpDestinationsOffsetPagination, OtlpDestination> {
54+
return this._client.getAPIList('/telemetry/destinations', OffsetPagination<OtlpDestination>, {
55+
query,
56+
...options,
57+
});
58+
}
59+
60+
/**
61+
* Delete an OTLP destination. Sessions bound to it are still exporting, so the
62+
* delete is refused with a 409 while any exist; either wait for those sessions to
63+
* end or delete them first. It is refused the same way while a managed auth
64+
* connection still selects it, because that connection re-resolves the destination
65+
* on every login, and while a managed auth login using it is still in progress.
66+
*/
67+
delete(idOrName: string, options?: RequestOptions): APIPromise<void> {
68+
return this._client.delete(path`/telemetry/destinations/${idOrName}`, {
69+
...options,
70+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
71+
});
72+
}
73+
}
74+
75+
export type OtlpDestinationsOffsetPagination = OffsetPagination<OtlpDestination>;
76+
77+
/**
78+
* An OTLP endpoint to export browser session telemetry to. Reference one from
79+
* `telemetry.export.otlp.destination` when creating a browser to export that
80+
* session's captured telemetry to it.
81+
*/
82+
export interface OtlpDestination {
83+
id: string;
84+
85+
created_at: string;
86+
87+
/**
88+
* OTLP/HTTP endpoint telemetry is sent to.
89+
*/
90+
endpoint: string;
91+
92+
/**
93+
* Headers sent with each export request. Names are returned in canonical form
94+
* (`Authorization`, not `authorization`). Values are returned redacted as empty
95+
* strings, so the keys are visible but the credentials are not.
96+
*/
97+
headers: { [key: string]: string };
98+
99+
/**
100+
* Unique within the project. Usable in place of the ID when selecting a
101+
* destination, so it cannot be shaped like an ID.
102+
*/
103+
name: string;
104+
105+
updated_at: string;
106+
107+
description?: string;
108+
}
109+
110+
export interface DestinationCreateParams {
111+
/**
112+
* Base endpoint of the OTLP/HTTP collector, without a signal path. Kernel appends
113+
* the signal path itself, so pass `https://api.honeycomb.io` rather than
114+
* `https://api.honeycomb.io/v1/logs`. If your provider's docs give you a
115+
* signal-specific URL, drop the trailing `/v1/logs`, `/v1/traces`, or
116+
* `/v1/metrics` — an endpoint that already carries one is rejected.
117+
*
118+
* Must be http or https, must resolve to a public address, and must carry no query
119+
* string or fragment. Examples: `https://api.honeycomb.io`,
120+
* `https://otlp-gateway-prod-us-east-0.grafana.net/otlp`,
121+
* `https://otlp.datadoghq.com` (Datadog's OTLP intake for US1, not its logs
122+
* intake).
123+
*/
124+
endpoint: string;
125+
126+
/**
127+
* Unique within the project.
128+
*/
129+
name: string;
130+
131+
description?: string;
132+
133+
/**
134+
* Headers sent with each export request, typically an ingestion key. Encrypted at
135+
* rest and returned redacted. Names and values must be valid HTTP header tokens,
136+
* and the names and values together cannot exceed 8192 bytes. Names are matched
137+
* case-insensitively and stored canonicalized, so supplying two spellings of one
138+
* header is rejected.
139+
*/
140+
headers?: { [key: string]: string };
141+
}
142+
143+
export interface DestinationUpdateParams {
144+
description?: string;
145+
146+
/**
147+
* Base endpoint of the OTLP/HTTP collector, without a signal path. Same rules as
148+
* on create.
149+
*/
150+
endpoint?: string;
151+
152+
/**
153+
* Edits stored headers key by key rather than replacing the map. A string value
154+
* adds or replaces that header, `null` deletes it, and any key you omit is left as
155+
* it is. Names are matched case-insensitively, so `authorization` replaces a
156+
* stored `Authorization` rather than adding a second entry. This is the credential
157+
* rotation path; sessions already exporting pick up the new values without
158+
* restarting. Names and values must be valid HTTP header tokens, and the names and
159+
* values together cannot exceed 8192 bytes.
160+
*/
161+
headers?: { [key: string]: string | null };
162+
163+
name?: string;
164+
}
165+
166+
export interface DestinationListParams extends OffsetPaginationParams {
167+
/**
168+
* Exact-match filter on destination name using the database collation. In
169+
* production, matching is case- and accent-insensitive.
170+
*/
171+
name?: string;
172+
173+
/**
174+
* Case-insensitive substring match against destination name or endpoint. IDs match
175+
* by exact value.
176+
*/
177+
query?: string;
178+
}
179+
180+
export declare namespace Destinations {
181+
export {
182+
type OtlpDestination as OtlpDestination,
183+
type OtlpDestinationsOffsetPagination as OtlpDestinationsOffsetPagination,
184+
type DestinationCreateParams as DestinationCreateParams,
185+
type DestinationUpdateParams as DestinationUpdateParams,
186+
type DestinationListParams as DestinationListParams,
187+
};
188+
}

src/resources/telemetry/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
export {
4+
Destinations,
5+
type OtlpDestination,
6+
type DestinationCreateParams,
7+
type DestinationUpdateParams,
8+
type DestinationListParams,
9+
type OtlpDestinationsOffsetPagination,
10+
} from './destinations';
11+
export { Telemetry } from './telemetry';
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
import { APIResource } from '../../core/resource';
4+
import * as DestinationsAPI from './destinations';
5+
import {
6+
DestinationCreateParams,
7+
DestinationListParams,
8+
DestinationUpdateParams,
9+
Destinations,
10+
OtlpDestination,
11+
OtlpDestinationsOffsetPagination,
12+
} from './destinations';
13+
14+
export class Telemetry extends APIResource {
15+
destinations: DestinationsAPI.Destinations = new DestinationsAPI.Destinations(this._client);
16+
}
17+
18+
Telemetry.Destinations = Destinations;
19+
20+
export declare namespace Telemetry {
21+
export {
22+
Destinations as Destinations,
23+
type OtlpDestination as OtlpDestination,
24+
type OtlpDestinationsOffsetPagination as OtlpDestinationsOffsetPagination,
25+
type DestinationCreateParams as DestinationCreateParams,
26+
type DestinationUpdateParams as DestinationUpdateParams,
27+
type DestinationListParams as DestinationListParams,
28+
};
29+
}

0 commit comments

Comments
 (0)