@unblind/react 0.1.0-alpha.2 → 0.1.0-alpha.20
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.
- package/dist/index.css +1 -2
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +184 -118
- package/dist/index.d.ts +184 -118
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +18 -7
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import { QueryClient, QueryClientConfig } from '@tanstack/react-query';
|
|
3
3
|
import React$1, { ReactNode } from 'react';
|
|
4
4
|
import { StringValue } from 'ms';
|
|
5
|
-
import uPlot from 'uplot';
|
|
5
|
+
import uPlot$1 from 'uplot';
|
|
6
6
|
|
|
7
7
|
type UnblindClientConfig = {
|
|
8
8
|
/**
|
|
@@ -18,7 +18,7 @@ type UnblindClientConfig = {
|
|
|
18
18
|
fetchImpl?: typeof fetch;
|
|
19
19
|
};
|
|
20
20
|
type UnblindClientProviderProps = {
|
|
21
|
-
children
|
|
21
|
+
children?: ReactNode;
|
|
22
22
|
/**
|
|
23
23
|
* Optional QueryClient instance. If not provided, a new one will be created.
|
|
24
24
|
* Useful if you already have a QueryClientProvider in your app and want to reuse it.
|
|
@@ -38,31 +38,6 @@ type UnblindClientProviderProps = {
|
|
|
38
38
|
*/
|
|
39
39
|
fetchImpl?: typeof fetch;
|
|
40
40
|
};
|
|
41
|
-
/**
|
|
42
|
-
* UnblindClientProvider sets up the QueryClientProvider (for React Query)
|
|
43
|
-
* and the Unblind client configuration context.
|
|
44
|
-
*
|
|
45
|
-
* @example
|
|
46
|
-
* ```tsx
|
|
47
|
-
* import { UnblindClientProvider } from '@unblind/react';
|
|
48
|
-
*
|
|
49
|
-
* function App() {
|
|
50
|
-
* return (
|
|
51
|
-
* <UnblindClientProvider apiBaseUrl="/api/unblind">
|
|
52
|
-
* <YourComponents />
|
|
53
|
-
* </UnblindClientProvider>
|
|
54
|
-
* );
|
|
55
|
-
* }
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
declare function UnblindClientProvider({ children, queryClient: providedQueryClient, queryClientConfig: providedQueryClientConfig, apiBaseUrl, fetchImpl, }: UnblindClientProviderProps): react_jsx_runtime.JSX.Element;
|
|
59
|
-
/**
|
|
60
|
-
* Access the Unblind client configuration.
|
|
61
|
-
*
|
|
62
|
-
* @throws Error if called outside of an UnblindClientProvider.
|
|
63
|
-
* This ensures that QueryClientProvider is always available for hooks.
|
|
64
|
-
*/
|
|
65
|
-
declare function useUnblindClientConfig(): UnblindClientConfig;
|
|
66
41
|
/**
|
|
67
42
|
* Hook to refresh all timeseries data.
|
|
68
43
|
* Invalidates all queries with the 'unblind' and 'timeseries' keys,
|
|
@@ -75,7 +50,7 @@ declare function useUnblindClientConfig(): UnblindClientConfig;
|
|
|
75
50
|
* return (
|
|
76
51
|
* <>
|
|
77
52
|
* <button onClick={() => refresh()}>Refresh</button>
|
|
78
|
-
* <
|
|
53
|
+
* <Timeseries metrics={["cpu"]} />
|
|
79
54
|
* </>
|
|
80
55
|
* );
|
|
81
56
|
* }
|
|
@@ -83,17 +58,13 @@ declare function useUnblindClientConfig(): UnblindClientConfig;
|
|
|
83
58
|
*/
|
|
84
59
|
declare function useRefresh(): () => Promise<void>;
|
|
85
60
|
|
|
86
|
-
interface TooltipItem {
|
|
87
|
-
metric: string | HTMLElement | undefined;
|
|
88
|
-
color: string;
|
|
89
|
-
value?: number;
|
|
90
|
-
formattedValue?: string;
|
|
91
|
-
attributes?: Record<string, any>;
|
|
92
|
-
}
|
|
93
61
|
interface TooltipProps {
|
|
94
62
|
timestamp: number;
|
|
95
|
-
|
|
63
|
+
tooltipSerieList: TooltipSerie[];
|
|
96
64
|
timeZone?: string;
|
|
65
|
+
stacked?: boolean;
|
|
66
|
+
invertSort?: boolean;
|
|
67
|
+
visibilityLimit?: number;
|
|
97
68
|
}
|
|
98
69
|
|
|
99
70
|
/**
|
|
@@ -105,13 +76,6 @@ type MetricType = "gauge" | "sum" | "histogram" | "summary" | "exphistogram";
|
|
|
105
76
|
* Aggregation operators available for metric queries.
|
|
106
77
|
*/
|
|
107
78
|
type AggregationOperator = "avg" | "sum" | "max" | "min" | "p90" | "p99" | "p50";
|
|
108
|
-
/**
|
|
109
|
-
* Attribute filter with a specific value.
|
|
110
|
-
*/
|
|
111
|
-
interface AttributeWithValue {
|
|
112
|
-
name: string;
|
|
113
|
-
value: string;
|
|
114
|
-
}
|
|
115
79
|
/**
|
|
116
80
|
* Metric metadata returned by the API.
|
|
117
81
|
*/
|
|
@@ -137,7 +101,7 @@ type MetricMetadataList = Array<MetricMetadata>;
|
|
|
137
101
|
*/
|
|
138
102
|
interface Serie {
|
|
139
103
|
metric: string;
|
|
140
|
-
attributes
|
|
104
|
+
attributes?: Record<string, string>;
|
|
141
105
|
values: Array<number>;
|
|
142
106
|
queryName?: string;
|
|
143
107
|
queryIndex: number;
|
|
@@ -156,7 +120,7 @@ interface TimeseriesQuery {
|
|
|
156
120
|
/**
|
|
157
121
|
* Chart types available
|
|
158
122
|
*/
|
|
159
|
-
type ChartType = "bar" | "line" | "area" | "step";
|
|
123
|
+
type ChartType = "bar" | "line" | "area" | "step" | "spline";
|
|
160
124
|
/**
|
|
161
125
|
* Time Range definition:
|
|
162
126
|
*
|
|
@@ -165,28 +129,32 @@ type ChartType = "bar" | "line" | "area" | "step";
|
|
|
165
129
|
type TimeRange = StringValue;
|
|
166
130
|
interface Log {
|
|
167
131
|
timestamp: number;
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
132
|
+
traceId?: string;
|
|
133
|
+
spanId?: string;
|
|
134
|
+
logId?: string;
|
|
135
|
+
severity: Severity;
|
|
171
136
|
attributes?: Record<string, string>;
|
|
172
|
-
service_name?: string;
|
|
173
137
|
body?: string;
|
|
138
|
+
serviceName?: string;
|
|
174
139
|
}
|
|
175
140
|
/**
|
|
176
141
|
* Default paginated response structure
|
|
177
142
|
*/
|
|
178
143
|
type PaginatedResponse<T> = {
|
|
179
144
|
data: Array<T>;
|
|
180
|
-
|
|
145
|
+
nextPage?: string;
|
|
181
146
|
};
|
|
182
147
|
/**
|
|
183
148
|
* Different severity values based on OTEL
|
|
184
149
|
* https://opentelemetry.io/docs/specs/otel/logs/data-model/#field-severitytext
|
|
185
150
|
*/
|
|
186
151
|
type Severity = "TRACE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "FATAL";
|
|
187
|
-
type Colors = Array<string> |
|
|
152
|
+
type Colors = Array<string> | {
|
|
153
|
+
fill: Array<string>;
|
|
154
|
+
border: Array<string>;
|
|
155
|
+
} | ((serie: Serie, index: number, type: ChartType, isFilling?: boolean) => string);
|
|
188
156
|
/**
|
|
189
|
-
* Interval expressed in
|
|
157
|
+
* Interval expressed in seconds.
|
|
190
158
|
*/
|
|
191
159
|
type Interval = number;
|
|
192
160
|
type TimeConfig = {
|
|
@@ -196,12 +164,12 @@ type TimeConfig = {
|
|
|
196
164
|
*/
|
|
197
165
|
timeRange?: TimeRange;
|
|
198
166
|
/**
|
|
199
|
-
* Optional start time (Unix timestamp in
|
|
167
|
+
* Optional start time (Unix timestamp in seconds).
|
|
200
168
|
* If provided along with endTime, takes priority over timeRange.
|
|
201
169
|
*/
|
|
202
170
|
startTime?: number;
|
|
203
171
|
/**
|
|
204
|
-
* Optional end time (Unix timestamp in
|
|
172
|
+
* Optional end time (Unix timestamp in seconds).
|
|
205
173
|
* If provided along with startTime, takes priority over timeRange.
|
|
206
174
|
*/
|
|
207
175
|
endTime?: number;
|
|
@@ -212,7 +180,7 @@ type TimeConfig = {
|
|
|
212
180
|
*/
|
|
213
181
|
type TimeseriesQueryConfig = TimeConfig & {
|
|
214
182
|
/**
|
|
215
|
-
* Optional interval in
|
|
183
|
+
* Optional interval in seconds. If not provided, will use interval from the provider.
|
|
216
184
|
*/
|
|
217
185
|
interval?: Interval;
|
|
218
186
|
/**
|
|
@@ -237,10 +205,66 @@ interface ChartVisualConfig {
|
|
|
237
205
|
*/
|
|
238
206
|
colors?: Colors;
|
|
239
207
|
/**
|
|
240
|
-
* Optional
|
|
208
|
+
* Optional to fill charts.
|
|
209
|
+
*
|
|
210
|
+
* Bar and area charts are filled by default.
|
|
211
|
+
*/
|
|
212
|
+
fill?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Optional tooltip configuration.
|
|
215
|
+
*/
|
|
216
|
+
tooltip?: TooltipConfig;
|
|
217
|
+
/**
|
|
218
|
+
* Chart type. Defaults to "line".
|
|
219
|
+
*/
|
|
220
|
+
type?: ChartType;
|
|
221
|
+
/**
|
|
222
|
+
* Optional threshold
|
|
223
|
+
*/
|
|
224
|
+
thresholds?: Array<Threshold>;
|
|
225
|
+
/**
|
|
226
|
+
* Optional min value
|
|
227
|
+
*/
|
|
228
|
+
min?: number;
|
|
229
|
+
/**
|
|
230
|
+
* Optional max value
|
|
231
|
+
*/
|
|
232
|
+
max?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Optional boolean to hide both axis
|
|
235
|
+
*/
|
|
236
|
+
hideAxis?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* Optional boolean to hide cursor
|
|
239
|
+
*/
|
|
240
|
+
hideCursor?: boolean;
|
|
241
|
+
/**
|
|
242
|
+
* Optional boolean to display relative time axis
|
|
243
|
+
*
|
|
244
|
+
* e.g. a day ago ------ a few seconds ago
|
|
245
|
+
*/
|
|
246
|
+
relativeTimeAxis?: boolean;
|
|
247
|
+
/**
|
|
248
|
+
* Unit of measurement for the value.
|
|
249
|
+
*
|
|
250
|
+
* Supports standard unit identifiers:
|
|
251
|
+
* - Data: 'bytes', 'decbytes', 'bits', 'decbits'
|
|
252
|
+
* - Time: 'ms', 's', 'm', 'h', 'd'
|
|
253
|
+
* - Throughput: 'Bps', 'Mbps', 'Gbps'
|
|
254
|
+
* - Percentage: 'percent', 'percentunit'
|
|
255
|
+
* - And many more standard units
|
|
256
|
+
*
|
|
257
|
+
*/
|
|
258
|
+
unit?: string;
|
|
259
|
+
/**
|
|
260
|
+
* Optional invert value order.
|
|
241
261
|
* Defaults to false
|
|
242
262
|
*/
|
|
243
|
-
|
|
263
|
+
invertSort?: boolean;
|
|
264
|
+
}
|
|
265
|
+
interface TooltipConfig {
|
|
266
|
+
hide?: boolean;
|
|
267
|
+
visibilityLimit?: number;
|
|
244
268
|
}
|
|
245
269
|
/**
|
|
246
270
|
* Appearance configuration for Unblind components.
|
|
@@ -248,7 +272,7 @@ interface ChartVisualConfig {
|
|
|
248
272
|
* Allows consumers to override internal UI components used for
|
|
249
273
|
* loading, empty, and error states.
|
|
250
274
|
*
|
|
251
|
-
* Overrides can be provided globally via
|
|
275
|
+
* Overrides can be provided globally via Scope or
|
|
252
276
|
* locally per component.
|
|
253
277
|
*
|
|
254
278
|
* This API customizes presentation only; component state and data
|
|
@@ -261,15 +285,33 @@ type Appearance = {
|
|
|
261
285
|
Empty?: React.ComponentType;
|
|
262
286
|
Tooltip?: React.ComponentType<TooltipProps>;
|
|
263
287
|
};
|
|
264
|
-
} & ChartVisualConfig;
|
|
265
|
-
type TimeseriesProps = TimeseriesQueryConfig & {
|
|
266
|
-
/**
|
|
267
|
-
* Array of metric names to display in the chart.
|
|
268
|
-
*/
|
|
269
|
-
metrics: Array<string>;
|
|
270
288
|
};
|
|
289
|
+
type ThresholdLevel = "info" | "warning" | "error" | "ok";
|
|
290
|
+
type ThresholdLineType = "line" | "dashed" | "bold";
|
|
291
|
+
type LineThreshold = {
|
|
292
|
+
value: number;
|
|
293
|
+
type?: ThresholdLineType;
|
|
294
|
+
level?: ThresholdLevel;
|
|
295
|
+
label?: string;
|
|
296
|
+
};
|
|
297
|
+
type RangeThreshold = {
|
|
298
|
+
from: number;
|
|
299
|
+
to?: number;
|
|
300
|
+
type?: ThresholdLineType;
|
|
301
|
+
level?: ThresholdLevel;
|
|
302
|
+
label?: string;
|
|
303
|
+
};
|
|
304
|
+
type Threshold = LineThreshold | RangeThreshold;
|
|
305
|
+
interface TooltipSerie {
|
|
306
|
+
metric: MetricMetadata;
|
|
307
|
+
serie: uPlot.Series;
|
|
308
|
+
color: string;
|
|
309
|
+
value?: number;
|
|
310
|
+
formattedValue?: string;
|
|
311
|
+
attributes?: Record<string, string>;
|
|
312
|
+
}
|
|
271
313
|
|
|
272
|
-
type
|
|
314
|
+
type ScopeConfig = TimeseriesQueryConfig & ChartVisualConfig & {
|
|
273
315
|
/**
|
|
274
316
|
* Optional appearance configuration for all components
|
|
275
317
|
* within this scope.
|
|
@@ -282,7 +324,7 @@ type UnblindScopeConfig = TimeseriesQueryConfig & {
|
|
|
282
324
|
*
|
|
283
325
|
* @example
|
|
284
326
|
* ```tsx
|
|
285
|
-
* <
|
|
327
|
+
* <Scope
|
|
286
328
|
* appearance={{
|
|
287
329
|
* components: {
|
|
288
330
|
* Loading: CustomLoading,
|
|
@@ -291,16 +333,16 @@ type UnblindScopeConfig = TimeseriesQueryConfig & {
|
|
|
291
333
|
* }}
|
|
292
334
|
* >
|
|
293
335
|
* <App />
|
|
294
|
-
* </
|
|
336
|
+
* </Scope>
|
|
295
337
|
* ```
|
|
296
338
|
*/
|
|
297
339
|
appearance?: Appearance;
|
|
298
340
|
};
|
|
299
|
-
type
|
|
300
|
-
children
|
|
341
|
+
type ScopeProps = ScopeConfig & {
|
|
342
|
+
children?: React$1.ReactNode;
|
|
301
343
|
};
|
|
302
344
|
/**
|
|
303
|
-
*
|
|
345
|
+
* Scope provides scoped configuration for all Unblind components (charts, logs, etc).
|
|
304
346
|
* This includes default time ranges, intervals, attributes, groupBy, operator, appearance, and colors.
|
|
305
347
|
*
|
|
306
348
|
* When nested, child scopes inherit defaults from parent scopes and can override specific values.
|
|
@@ -309,26 +351,26 @@ type UnblindScopeProps = UnblindScopeConfig & {
|
|
|
309
351
|
*
|
|
310
352
|
* @example
|
|
311
353
|
* ```tsx
|
|
312
|
-
* import {
|
|
354
|
+
* import { Scope } from '@unblind/react';
|
|
313
355
|
*
|
|
314
356
|
* function App() {
|
|
315
357
|
* return (
|
|
316
|
-
* <
|
|
358
|
+
* <Scope
|
|
317
359
|
* appearance={{ components: { Loading: CustomLoading } }}
|
|
318
360
|
* timeRange="24h"
|
|
319
361
|
* >
|
|
320
362
|
* // Components here use 24h and CustomLoading
|
|
321
363
|
*
|
|
322
|
-
* <
|
|
364
|
+
* <Scope timeRange="1h">
|
|
323
365
|
* // Components here use 1h but still inherit CustomLoading
|
|
324
|
-
* </
|
|
325
|
-
* </
|
|
366
|
+
* </Scope>
|
|
367
|
+
* </Scope>
|
|
326
368
|
* );
|
|
327
369
|
* }
|
|
328
370
|
* ```
|
|
329
371
|
*/
|
|
330
|
-
declare function
|
|
331
|
-
type UseScopeReturn = TimeseriesQueryConfig & {
|
|
372
|
+
declare function Scope({ children, timeRange, startTime, endTime, interval, attributes, groupBy, operator, appearance, tooltip, colors, fill, hideAxis, hideCursor, relativeTimeAxis, invertSort, }: ScopeProps): react_jsx_runtime.JSX.Element;
|
|
373
|
+
type UseScopeReturn = TimeseriesQueryConfig & ChartVisualConfig & {
|
|
332
374
|
timeRange: TimeRange;
|
|
333
375
|
appearance: {
|
|
334
376
|
components: {
|
|
@@ -337,12 +379,10 @@ type UseScopeReturn = TimeseriesQueryConfig & {
|
|
|
337
379
|
Empty: React$1.ComponentType;
|
|
338
380
|
Tooltip?: React$1.ComponentType<TooltipProps>;
|
|
339
381
|
};
|
|
340
|
-
colors: Colors;
|
|
341
|
-
orderByValues?: boolean;
|
|
342
382
|
};
|
|
343
383
|
};
|
|
344
384
|
/**
|
|
345
|
-
* Hook to access the scoped configuration from
|
|
385
|
+
* Hook to access the scoped configuration from Scope.
|
|
346
386
|
* Returns all configuration including time range, attributes,
|
|
347
387
|
* groupBy, operator, colors, and UI components.
|
|
348
388
|
*
|
|
@@ -356,13 +396,13 @@ type UseScopeReturn = TimeseriesQueryConfig & {
|
|
|
356
396
|
*/
|
|
357
397
|
declare function useScope(): UseScopeReturn;
|
|
358
398
|
|
|
359
|
-
type UnblindProviderProps = UnblindClientProviderProps &
|
|
360
|
-
children
|
|
399
|
+
type UnblindProviderProps = UnblindClientProviderProps & ScopeProps & {
|
|
400
|
+
children?: React.ReactNode;
|
|
361
401
|
};
|
|
362
402
|
/**
|
|
363
403
|
* UnblindProvider is required for all Unblind hooks to work.
|
|
364
404
|
* It sets up both the QueryClientProvider (for React Query) and the Unblind configuration context.
|
|
365
|
-
* This is a convenience wrapper around UnblindClientProvider and
|
|
405
|
+
* This is a convenience wrapper around `UnblindClientProvider` and `Scope`.
|
|
366
406
|
*
|
|
367
407
|
* @example
|
|
368
408
|
* ```tsx
|
|
@@ -377,7 +417,7 @@ type UnblindProviderProps = UnblindClientProviderProps & UnblindScopeProps & {
|
|
|
377
417
|
* }
|
|
378
418
|
* ```
|
|
379
419
|
*/
|
|
380
|
-
declare function UnblindProvider({ children, queryClient, apiBaseUrl, fetchImpl, timeRange, startTime, endTime, interval, attributes, groupBy, operator, appearance, }: UnblindProviderProps): react_jsx_runtime.JSX.Element;
|
|
420
|
+
declare function UnblindProvider({ children, queryClient, apiBaseUrl, fetchImpl, timeRange, startTime, endTime, interval, attributes, groupBy, operator, appearance, tooltip, colors, fill, hideAxis, hideCursor, relativeTimeAxis, invertSort, }: UnblindProviderProps): react_jsx_runtime.JSX.Element;
|
|
381
421
|
|
|
382
422
|
interface UseMetricsReturn {
|
|
383
423
|
metrics: MetricMetadataList | undefined;
|
|
@@ -398,12 +438,13 @@ interface UseTimeseriesParams extends Pick<TimeseriesQueryConfig, "timeRange" |
|
|
|
398
438
|
*/
|
|
399
439
|
queries: Array<TimeseriesQuery>;
|
|
400
440
|
}
|
|
441
|
+
interface UseTimeseriesData {
|
|
442
|
+
series: Serie[];
|
|
443
|
+
times: number[];
|
|
444
|
+
metadata: Record<string, MetricMetadata>;
|
|
445
|
+
}
|
|
401
446
|
interface UseTimeseriesReturn {
|
|
402
|
-
data:
|
|
403
|
-
series: Serie[];
|
|
404
|
-
times: number[];
|
|
405
|
-
metadata: Record<string, MetricMetadata>;
|
|
406
|
-
};
|
|
447
|
+
data: UseTimeseriesData;
|
|
407
448
|
isLoading: boolean;
|
|
408
449
|
isFetching: boolean;
|
|
409
450
|
hasError: boolean;
|
|
@@ -415,10 +456,13 @@ interface UseTimeseriesReturn {
|
|
|
415
456
|
* @param params - Configuration object with queries, and either timeRange or startTime/endTime, plus optional interval.
|
|
416
457
|
* @returns Object containing timeseries data, loading states, and error state.
|
|
417
458
|
*/
|
|
418
|
-
declare function useTimeseries(
|
|
459
|
+
declare function useTimeseries(params: UseTimeseriesParams): UseTimeseriesReturn;
|
|
419
460
|
|
|
420
461
|
interface Usage {
|
|
421
|
-
|
|
462
|
+
period: {
|
|
463
|
+
startTime: number;
|
|
464
|
+
endTime: number;
|
|
465
|
+
};
|
|
422
466
|
metrics: {
|
|
423
467
|
units: number;
|
|
424
468
|
};
|
|
@@ -440,13 +484,18 @@ interface UseUsageReturn {
|
|
|
440
484
|
* @param params - Configuration object with optional timeRange.
|
|
441
485
|
* @returns Object containing usage data, loading state, and error state.
|
|
442
486
|
*/
|
|
443
|
-
declare function useUsage(
|
|
487
|
+
declare function useUsage(params: UseUsageParams): UseUsageReturn;
|
|
444
488
|
|
|
445
489
|
type UseLogsParams = {
|
|
446
490
|
/**
|
|
447
491
|
* Array of filters to apply to the logs query.
|
|
448
492
|
*/
|
|
449
|
-
|
|
493
|
+
attributes?: Record<string, Array<string>>;
|
|
494
|
+
body?: Array<string>;
|
|
495
|
+
severity?: Array<string>;
|
|
496
|
+
traceId?: string;
|
|
497
|
+
spanId?: string;
|
|
498
|
+
logId?: string;
|
|
450
499
|
} & TimeConfig;
|
|
451
500
|
interface UseLogsReturn {
|
|
452
501
|
logs: Array<Log>;
|
|
@@ -463,15 +512,24 @@ interface UseLogsReturn {
|
|
|
463
512
|
* @param params - Configuration object with timeRange and filters.
|
|
464
513
|
* @returns Object containing logs data, loading states, and pagination controls.
|
|
465
514
|
*/
|
|
466
|
-
declare function useLogs(
|
|
515
|
+
declare function useLogs(props: UseLogsParams): UseLogsReturn;
|
|
467
516
|
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
type TimeseriesChartProps = TimeseriesProps & {
|
|
517
|
+
type TimeseriesProps = Exclude<TimeseriesQueryConfig, "startTime" | "endTime" | "timeRange"> & ChartVisualConfig & {
|
|
471
518
|
/**
|
|
472
|
-
*
|
|
519
|
+
* Metric name(s) to display in the chart.
|
|
520
|
+
*
|
|
521
|
+
* @example Single metric
|
|
522
|
+
* ```jsx
|
|
523
|
+
* <Timeseries metrics="nodejs.eventloop.p50" />
|
|
524
|
+
* ```
|
|
525
|
+
*
|
|
526
|
+
* @example
|
|
527
|
+
* Multiple metrics
|
|
528
|
+
* ```jsx
|
|
529
|
+
* <Timeseries metrics={["nodejs.eventloop.p50", "..."]} />
|
|
530
|
+
* ```
|
|
473
531
|
*/
|
|
474
|
-
|
|
532
|
+
metrics: Array<string> | string;
|
|
475
533
|
/**
|
|
476
534
|
* Optional className for the chart container.
|
|
477
535
|
*/
|
|
@@ -480,45 +538,53 @@ type TimeseriesChartProps = TimeseriesProps & {
|
|
|
480
538
|
* Optional appearance configuration for this chart
|
|
481
539
|
*/
|
|
482
540
|
appearance?: Appearance;
|
|
541
|
+
/**
|
|
542
|
+
* Hook to get request data
|
|
543
|
+
*/
|
|
544
|
+
onResponse?: (response: UseTimeseriesReturn) => void;
|
|
483
545
|
};
|
|
484
546
|
/**
|
|
485
|
-
*
|
|
486
|
-
*
|
|
487
|
-
*
|
|
547
|
+
* Displays a time series chart.
|
|
548
|
+
* Uses values from <UnblindProvider> or <Scope>
|
|
549
|
+
* when they are not explicitly provided as props.
|
|
488
550
|
*
|
|
489
|
-
* @example
|
|
551
|
+
* @example
|
|
490
552
|
* ```tsx
|
|
491
|
-
*
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
553
|
+
* <Timeseries
|
|
554
|
+
* metrics="host.cpu"
|
|
555
|
+
* attributes={{ "host.region": ["us-east-2"] }}
|
|
556
|
+
* groupBy={["host.name"]}
|
|
557
|
+
* />
|
|
495
558
|
* ```
|
|
496
559
|
*
|
|
497
|
-
* @example Using
|
|
560
|
+
* @example Using `<Scope>`
|
|
498
561
|
* ```tsx
|
|
499
|
-
* <
|
|
500
|
-
* <
|
|
501
|
-
* <
|
|
502
|
-
* </
|
|
562
|
+
* <Scope timeRange="1h">
|
|
563
|
+
* <Timeseries metrics="host.cpu" />
|
|
564
|
+
* <Timeseries metrics="host.memory" />
|
|
565
|
+
* </Scope>
|
|
503
566
|
* ```
|
|
504
567
|
*/
|
|
505
|
-
declare function
|
|
568
|
+
declare function Timeseries({ metrics, operator: propOperator, attributes: propAttributes, groupBy: propGroupBy, interval: propInterval, type, className, appearance: propAppearance, unit: propUnit, thresholds: propThresholds, min: propMin, max: propMax, colors: propColors, tooltip: propTooltip, fill: propFill, hideAxis: propHideAxis, hideCursor: propHideCursor, relativeTimeAxis: propRelativeTimeAxis, onResponse, invertSort: propInvertSort, }: TimeseriesProps): react_jsx_runtime.JSX.Element;
|
|
506
569
|
|
|
507
570
|
interface ChartProps extends ChartVisualConfig {
|
|
508
571
|
times: Array<number>;
|
|
509
572
|
series: Serie[];
|
|
510
573
|
metadata: Record<string, MetricMetadata>;
|
|
511
|
-
type:
|
|
574
|
+
type: ChartType;
|
|
575
|
+
invertSort?: boolean;
|
|
512
576
|
className?: string;
|
|
513
577
|
timeZone?: string;
|
|
514
|
-
options?: uPlot.Options;
|
|
515
|
-
|
|
578
|
+
options?: uPlot$1.Options;
|
|
579
|
+
tooltipComponent?: React.ComponentType<TooltipProps>;
|
|
516
580
|
}
|
|
517
581
|
/**
|
|
518
582
|
* Renders a chart for time series data
|
|
519
583
|
*/
|
|
520
584
|
declare function Chart(props: ChartProps): react_jsx_runtime.JSX.Element;
|
|
521
585
|
|
|
522
|
-
declare function
|
|
586
|
+
declare function Empty(): react_jsx_runtime.JSX.Element;
|
|
587
|
+
declare function Error(): react_jsx_runtime.JSX.Element;
|
|
588
|
+
declare function Loading(): react_jsx_runtime.JSX.Element;
|
|
523
589
|
|
|
524
|
-
export { type AggregationOperator, type Appearance,
|
|
590
|
+
export { type AggregationOperator, type Appearance, Chart, type ChartProps, type ChartType, type ChartVisualConfig, type Colors, Empty, Error, type Interval, Loading, type Log, type MetricMetadata, type MetricMetadataList, type MetricType, type PaginatedResponse, Scope, type ScopeConfig, type ScopeProps, type Serie, type Severity, type TimeConfig, type TimeRange, Timeseries, type TimeseriesProps, type TimeseriesQuery, type TimeseriesQueryConfig, type TooltipProps, type UnblindClientConfig, UnblindProvider, type UnblindProviderProps, type Usage, type UseLogsParams, type UseLogsReturn, type UseMetricsReturn, type UseScopeReturn, type UseTimeseriesParams, type UseTimeseriesReturn, type UseUsageParams, type UseUsageReturn, useLogs, useMetrics, useRefresh, useScope, useTimeseries, useUsage };
|