@types/k6 0.54.1 → 0.57.0

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.
@@ -1,208 +0,0 @@
1
- /**
2
- * This module provides ways to instrument k6 scripts HTTP calls with tracing information.
3
- *
4
- * It most notably exposes an `instrumentHTTP` function that can be used to wrap the `http` module's
5
- * function calls with tracing information. It also exposes a `Client` class that can be used to
6
- * instrument HTTP calls in a more fine-grained way.
7
- *
8
- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/tracing/
9
- */
10
-
11
- import { RefinedParams, RefinedResponse, RequestBody, ResponseType } from "../../http/index.js";
12
-
13
- /**
14
- * The instrumentHTTP function instruments the k6 http module
15
- * with tracing capabilities. It will transparently replace each
16
- * of the k6 http module functions with its instrumented
17
- * counterpart, in place.
18
- *
19
- * instrumentHTTP can only be called in the init context of the script.
20
- *
21
- * @param options - The options to use when instrumenting the http module.
22
- */
23
- export function instrumentHTTP(options: Options): void;
24
-
25
- /**
26
- * Client is an HTTP client class that attaches tracing information
27
- * to its requests.
28
- *
29
- * It lets users include a tracing context in their HTTP requests
30
- * so that tracing backends (such as Grafana Tempo) can incorporate
31
- * their results.
32
- *
33
- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/tracing/client/
34
- */
35
- export class Client {
36
- protected __brand: never;
37
-
38
- /**
39
- * Instantiates a new tracing Client.
40
- *
41
- * @param options - The options to use for this Client.
42
- */
43
- constructor(options: Options);
44
-
45
- /**
46
- * Performs a DELETE request instrumented with trace context
47
- * headers.
48
- *
49
- * @param url - Request URL.
50
- * @param body - Discouraged. Request body. Object form encoded.
51
- * @param params - Request parameters.
52
- * @returns Resulting response.
53
- */
54
- del<RT extends ResponseType | undefined>(
55
- url: string | HttpURL,
56
- body?: RequestBody | null,
57
- params?: RefinedParams<RT> | null,
58
- ): RefinedResponse<RT>;
59
-
60
- /**
61
- * Performs a HEAD request instrumented with trace context headers.
62
- *
63
- * @param url - Request URL.
64
- * @param params - Request parameters.
65
- * @returns Resulting response.
66
- */
67
- head<RT extends ResponseType | undefined>(
68
- url: string | HttpURL,
69
- params?: RefinedParams<RT> | null,
70
- ): RefinedResponse<RT>;
71
-
72
- /**
73
- * Performs a GET request instrumented with trace context headers.
74
- *
75
- * @param url - Request URL.
76
- * @param params - Request parameters.
77
- * @returns Resulting response.
78
- */
79
- get<RT extends ResponseType | undefined>(
80
- url: string | HttpURL,
81
- params?: RefinedParams<RT> | null,
82
- ): RefinedResponse<RT>;
83
-
84
- /**
85
- * Performs an OPTIONS request instrumented with trace context headers.
86
- *
87
- * @param url - Request URL.
88
- * @param body - Request body. Object form encoded.
89
- * @param params - Request parameters.
90
- * @returns Resulting response.
91
- */
92
- options<RT extends ResponseType | undefined>(
93
- url: string | HttpURL,
94
- body?: RequestBody | null,
95
- params?: RefinedParams<RT> | null,
96
- ): RefinedResponse<RT>;
97
-
98
- /**
99
- * Performs a PATCH request instrumented with trace context headers.
100
- *
101
- * @param url - Request URL.
102
- * @param body - Request body. Object form encoded.
103
- * @param params - Request parameters.
104
- * @returns Resulting response.
105
- */
106
- patch<RT extends ResponseType | undefined>(
107
- url: string | HttpURL,
108
- body?: RequestBody | null,
109
- params?: RefinedParams<RT> | null,
110
- ): RefinedResponse<RT>;
111
-
112
- /**
113
- * Performs a POST request instrumented with trace context headers.
114
- *
115
- * @param url - Request URL.
116
- * @param body - Request body. Object form encoded.
117
- * @param params - Request parameters.
118
- * @returns Resulting response.
119
- */
120
- post<RT extends ResponseType | undefined>(
121
- url: string | HttpURL,
122
- body?: RequestBody | null,
123
- params?: RefinedParams<RT> | null,
124
- ): RefinedResponse<RT>;
125
-
126
- /**
127
- * Performs a PUT request instrumented with trace context headers.
128
- *
129
- * @param url - Request URL.
130
- * @param body - Request body. Object form encoded.
131
- * @param params - Request parameters.
132
- * @returns Resulting response.
133
- */
134
- put<RT extends ResponseType | undefined>(
135
- url: string | HttpURL,
136
- body?: RequestBody | null,
137
- params?: RefinedParams<RT> | null,
138
- ): RefinedResponse<RT>;
139
-
140
- /**
141
- * Performs a HTTP request instrumented with trace context headers.
142
- *
143
- * @param method - HTTP method.
144
- * @param url - Request URL.
145
- * @param body - Request body. Object form encoded.
146
- * @param params - Request parameters.
147
- * @returns Resulting response.
148
- */
149
- request<RT extends ResponseType | undefined>(
150
- method: string,
151
- url: string | HttpURL,
152
- body?: RequestBody | null,
153
- params?: RefinedParams<RT> | null,
154
- ): RefinedResponse<RT>;
155
-
156
- /**
157
- * The asyncRequest method starts the process of performing a HTTP request
158
- * asynchronously, returning a promise which is fulfilled once the response
159
- * is available. The performed request is instrumented with trace context
160
- * headers.
161
- *
162
- * @param method - HTTP method.
163
- * @param url - Request URL.
164
- * @param body - Request body. Object form encoded.
165
- * @param params - Request parameters.
166
- * @returns Resulting response.
167
- */
168
- asyncRequest<RT extends ResponseType | undefined>(
169
- method: string,
170
- url: string | HttpURL,
171
- body?: RequestBody | null,
172
- params?: RefinedParams<RT> | null,
173
- ): Promise<RefinedResponse<RT>>;
174
- }
175
-
176
- /**
177
- * The Options object allows configuring the tracing instrumentation behavior.
178
- *
179
- * https://grafana.com/docs/k6/latest/javascript-api/k6-experimental/tracing/options/
180
- */
181
- export interface Options {
182
- /**
183
- * The trace context propagation format.
184
- *
185
- * Currently supported: `w3c` and `jaeger`.
186
- *
187
- * Defaults to `w3c`.
188
- */
189
- propagator: "w3c" | "jaeger";
190
-
191
- /**
192
- * The probability of each request having
193
- * its `sampled` flag set to true.
194
- * Its value should be within the `0 <= n <= 100` bounds.
195
- *
196
- * Defaults to `100`.
197
- */
198
- sampling?: number;
199
- }
200
-
201
- /**
202
- * Returned value from http.url method.
203
- */
204
- export interface HttpURL {
205
- __brand: "http-url";
206
- }
207
-
208
- export * as default from "k6/experimental/tracing";