@datalayer/core 1.0.2 → 1.0.3

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 (76) hide show
  1. package/README.md +1 -1
  2. package/lib/api/constants.d.ts +3 -0
  3. package/lib/api/constants.js +3 -0
  4. package/lib/api/index.d.ts +1 -0
  5. package/lib/api/index.js +1 -0
  6. package/lib/api/otel/index.d.ts +12 -0
  7. package/lib/api/otel/index.js +16 -0
  8. package/lib/api/otel/logs.d.ts +19 -0
  9. package/lib/api/otel/logs.js +43 -0
  10. package/lib/api/otel/metrics.d.ts +31 -0
  11. package/lib/api/otel/metrics.js +65 -0
  12. package/lib/api/otel/query.d.ts +16 -0
  13. package/lib/api/otel/query.js +37 -0
  14. package/lib/api/otel/services.d.ts +39 -0
  15. package/lib/api/otel/services.js +81 -0
  16. package/lib/api/otel/traces.d.ts +24 -0
  17. package/lib/api/otel/traces.js +53 -0
  18. package/lib/api/otel/types.d.ts +112 -0
  19. package/lib/api/otel/types.js +5 -0
  20. package/lib/config/Configuration.d.ts +4 -0
  21. package/lib/hooks/useCache.d.ts +14 -9
  22. package/lib/hooks/useCache.js +28 -0
  23. package/lib/index.d.ts +2 -0
  24. package/lib/index.js +4 -0
  25. package/lib/otel/OtelLive.d.ts +12 -0
  26. package/lib/otel/OtelLive.js +354 -0
  27. package/lib/otel/OtelLogsList.d.ts +11 -0
  28. package/lib/otel/OtelLogsList.js +137 -0
  29. package/lib/otel/OtelMetricsChart.d.ts +22 -0
  30. package/lib/otel/OtelMetricsChart.js +300 -0
  31. package/lib/otel/OtelMetricsList.d.ts +15 -0
  32. package/lib/otel/OtelMetricsList.js +213 -0
  33. package/lib/otel/OtelSearchBar.d.ts +11 -0
  34. package/lib/otel/OtelSearchBar.js +22 -0
  35. package/lib/otel/OtelSpanDetail.d.ts +11 -0
  36. package/lib/otel/OtelSpanDetail.js +172 -0
  37. package/lib/otel/OtelSpanTree.d.ts +11 -0
  38. package/lib/otel/OtelSpanTree.js +176 -0
  39. package/lib/otel/OtelSqlView.d.ts +16 -0
  40. package/lib/otel/OtelSqlView.js +239 -0
  41. package/lib/otel/OtelSystemView.d.ts +15 -0
  42. package/lib/otel/OtelSystemView.js +75 -0
  43. package/lib/otel/OtelTimeline.d.ts +11 -0
  44. package/lib/otel/OtelTimeline.js +101 -0
  45. package/lib/otel/OtelTimelineRangeSlider.d.ts +16 -0
  46. package/lib/otel/OtelTimelineRangeSlider.js +338 -0
  47. package/lib/otel/OtelTracesList.d.ts +13 -0
  48. package/lib/otel/OtelTracesList.js +199 -0
  49. package/lib/otel/hooks.d.ts +172 -0
  50. package/lib/otel/hooks.js +490 -0
  51. package/lib/otel/index.d.ts +25 -0
  52. package/lib/otel/index.js +19 -0
  53. package/lib/otel/types.d.ts +190 -0
  54. package/lib/otel/types.js +5 -0
  55. package/lib/otel/utils.d.ts +33 -0
  56. package/lib/otel/utils.js +181 -0
  57. package/lib/state/storage/IAMStorage.d.ts +2 -1
  58. package/lib/state/substates/CoreState.js +1 -0
  59. package/lib/utils/Jwt.d.ts +42 -0
  60. package/lib/utils/Jwt.js +44 -0
  61. package/lib/utils/index.d.ts +1 -0
  62. package/lib/utils/index.js +1 -0
  63. package/lib/views/iam/SignInSimple.d.ts +38 -0
  64. package/lib/views/iam/SignInSimple.js +80 -0
  65. package/lib/views/iam/index.d.ts +2 -0
  66. package/lib/views/iam/index.js +5 -0
  67. package/lib/views/iam-tokens/IAMTokenEdit.js +53 -4
  68. package/lib/views/iam-tokens/IAMTokens.js +65 -33
  69. package/lib/views/iam-tokens/Tokens.js +63 -31
  70. package/lib/views/index.d.ts +2 -1
  71. package/lib/views/index.js +2 -1
  72. package/lib/views/profile/UserBadge.d.ts +18 -0
  73. package/lib/views/profile/UserBadge.js +101 -0
  74. package/lib/views/profile/index.d.ts +2 -0
  75. package/lib/views/profile/index.js +5 -0
  76. package/package.json +27 -3
package/README.md CHANGED
@@ -165,7 +165,7 @@ Available at http://localhost:3000/:
165
165
  A complete Next.js application demonstrating platform integration:
166
166
 
167
167
  ```bash
168
- cd examples/nextjs-notebook
168
+ cd examples/nextjj
169
169
  npm install
170
170
  npm run dev
171
171
  ```
@@ -3,6 +3,7 @@
3
3
  */
4
4
  export declare const API_BASE_PATHS: {
5
5
  readonly IAM: "/api/iam/v1";
6
+ readonly OTEL: "/api/otel/v1";
6
7
  readonly RUNTIMES: "/api/runtimes/v1";
7
8
  readonly SPACER: "/api/spacer/v1";
8
9
  };
@@ -12,6 +13,8 @@ export declare const API_BASE_PATHS: {
12
13
  export declare const DEFAULT_SERVICE_URLS: {
13
14
  /** Default URL for IAM (Identity and Access Management) service */
14
15
  readonly IAM: "https://prod1.datalayer.run";
16
+ /** Default URL for OTEL (OpenTelemetry observability) service */
17
+ readonly OTEL: "https://prod1.datalayer.run";
15
18
  /** Default URL for Runtimes service */
16
19
  readonly RUNTIMES: "https://prod1.datalayer.run";
17
20
  /** Default URL for Spacer (workspaces and collaboration) service */
@@ -7,6 +7,7 @@
7
7
  */
8
8
  export const API_BASE_PATHS = {
9
9
  IAM: '/api/iam/v1',
10
+ OTEL: '/api/otel/v1',
10
11
  RUNTIMES: '/api/runtimes/v1',
11
12
  SPACER: '/api/spacer/v1',
12
13
  };
@@ -16,6 +17,8 @@ export const API_BASE_PATHS = {
16
17
  export const DEFAULT_SERVICE_URLS = {
17
18
  /** Default URL for IAM (Identity and Access Management) service */
18
19
  IAM: 'https://prod1.datalayer.run',
20
+ /** Default URL for OTEL (OpenTelemetry observability) service */
21
+ OTEL: 'https://prod1.datalayer.run',
19
22
  /** Default URL for Runtimes service */
20
23
  RUNTIMES: 'https://prod1.datalayer.run',
21
24
  /** Default URL for Spacer (workspaces and collaboration) service */
@@ -9,6 +9,7 @@
9
9
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './DatalayerApi';
10
10
  export type { IRequestDatalayerAPIOptions } from './DatalayerApi';
11
11
  export * as iam from './iam';
12
+ export * as otel from './otel';
12
13
  export * as runtimes from './runtimes';
13
14
  export * as spacer from './spacer';
14
15
  /**
package/lib/api/index.js CHANGED
@@ -14,6 +14,7 @@
14
14
  export { requestDatalayerAPI, RunResponseError, NetworkError, } from './DatalayerApi';
15
15
  // Domain-organized API exports
16
16
  export * as iam from './iam';
17
+ export * as otel from './otel';
17
18
  export * as runtimes from './runtimes';
18
19
  export * as spacer from './spacer';
19
20
  /**
@@ -0,0 +1,12 @@
1
+ /**
2
+ * OTEL API exports.
3
+ *
4
+ * Provides organized access to OpenTelemetry observability functionality.
5
+ *
6
+ * @module api/otel
7
+ */
8
+ export * as traces from './traces';
9
+ export * as metrics from './metrics';
10
+ export * as logs from './logs';
11
+ export * as services from './services';
12
+ export * as query from './query';
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * OTEL API exports.
7
+ *
8
+ * Provides organized access to OpenTelemetry observability functionality.
9
+ *
10
+ * @module api/otel
11
+ */
12
+ export * as traces from './traces';
13
+ export * as metrics from './metrics';
14
+ export * as logs from './logs';
15
+ export * as services from './services';
16
+ export * as query from './query';
@@ -0,0 +1,19 @@
1
+ import type { ListLogsResponse } from './types';
2
+ /**
3
+ * Query log records.
4
+ *
5
+ * @param token - Authentication token
6
+ * @param options - Query options
7
+ * @param options.serviceName - Filter by service name
8
+ * @param options.severity - Filter by severity (INFO, WARN, ERROR, etc.)
9
+ * @param options.traceId - Filter by trace ID
10
+ * @param options.limit - Maximum number of log records
11
+ * @param baseUrl - Base URL for the OTEL service
12
+ * @returns Promise resolving to a list of log records
13
+ */
14
+ export declare const queryLogs: (token: string, options?: {
15
+ serviceName?: string;
16
+ severity?: string;
17
+ traceId?: string;
18
+ limit?: number;
19
+ }, baseUrl?: string) => Promise<ListLogsResponse>;
@@ -0,0 +1,43 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Logs API functions for the Datalayer OTEL service.
7
+ *
8
+ * @module api/otel/logs
9
+ */
10
+ import { requestDatalayerAPI } from '../DatalayerApi';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { validateToken } from '../utils/validation';
13
+ /**
14
+ * Query log records.
15
+ *
16
+ * @param token - Authentication token
17
+ * @param options - Query options
18
+ * @param options.serviceName - Filter by service name
19
+ * @param options.severity - Filter by severity (INFO, WARN, ERROR, etc.)
20
+ * @param options.traceId - Filter by trace ID
21
+ * @param options.limit - Maximum number of log records
22
+ * @param baseUrl - Base URL for the OTEL service
23
+ * @returns Promise resolving to a list of log records
24
+ */
25
+ export const queryLogs = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
26
+ validateToken(token);
27
+ const params = new URLSearchParams();
28
+ if (options.serviceName)
29
+ params.set('service_name', options.serviceName);
30
+ if (options.severity)
31
+ params.set('severity', options.severity);
32
+ if (options.traceId)
33
+ params.set('trace_id', options.traceId);
34
+ if (options.limit)
35
+ params.set('limit', String(options.limit));
36
+ const queryString = params.toString();
37
+ const url = `${baseUrl}${API_BASE_PATHS.OTEL}/logs${queryString ? `?${queryString}` : ''}`;
38
+ return requestDatalayerAPI({
39
+ url,
40
+ method: 'GET',
41
+ token,
42
+ });
43
+ };
@@ -0,0 +1,31 @@
1
+ import type { ListMetricsResponse } from './types';
2
+ /**
3
+ * List available metric names.
4
+ *
5
+ * @param token - Authentication token
6
+ * @param options - Query options
7
+ * @param options.serviceName - Filter by service name
8
+ * @param options.limit - Maximum number of results
9
+ * @param baseUrl - Base URL for the OTEL service
10
+ * @returns Promise resolving to a list of metrics
11
+ */
12
+ export declare const listMetrics: (token: string, options?: {
13
+ serviceName?: string;
14
+ limit?: number;
15
+ }, baseUrl?: string) => Promise<ListMetricsResponse>;
16
+ /**
17
+ * Query metric data points with filters.
18
+ *
19
+ * @param token - Authentication token
20
+ * @param options - Query options
21
+ * @param options.metricName - Filter by metric name
22
+ * @param options.serviceName - Filter by service name
23
+ * @param options.limit - Maximum number of data points
24
+ * @param baseUrl - Base URL for the OTEL service
25
+ * @returns Promise resolving to metric data points
26
+ */
27
+ export declare const queryMetrics: (token: string, options?: {
28
+ metricName?: string;
29
+ serviceName?: string;
30
+ limit?: number;
31
+ }, baseUrl?: string) => Promise<ListMetricsResponse>;
@@ -0,0 +1,65 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Metrics API functions for the Datalayer OTEL service.
7
+ *
8
+ * @module api/otel/metrics
9
+ */
10
+ import { requestDatalayerAPI } from '../DatalayerApi';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { validateToken } from '../utils/validation';
13
+ /**
14
+ * List available metric names.
15
+ *
16
+ * @param token - Authentication token
17
+ * @param options - Query options
18
+ * @param options.serviceName - Filter by service name
19
+ * @param options.limit - Maximum number of results
20
+ * @param baseUrl - Base URL for the OTEL service
21
+ * @returns Promise resolving to a list of metrics
22
+ */
23
+ export const listMetrics = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
24
+ validateToken(token);
25
+ const params = new URLSearchParams();
26
+ if (options.limit)
27
+ params.set('limit', String(options.limit));
28
+ if (options.serviceName)
29
+ params.set('service_name', options.serviceName);
30
+ const queryString = params.toString();
31
+ const url = `${baseUrl}${API_BASE_PATHS.OTEL}/metrics${queryString ? `?${queryString}` : ''}`;
32
+ return requestDatalayerAPI({
33
+ url,
34
+ method: 'GET',
35
+ token,
36
+ });
37
+ };
38
+ /**
39
+ * Query metric data points with filters.
40
+ *
41
+ * @param token - Authentication token
42
+ * @param options - Query options
43
+ * @param options.metricName - Filter by metric name
44
+ * @param options.serviceName - Filter by service name
45
+ * @param options.limit - Maximum number of data points
46
+ * @param baseUrl - Base URL for the OTEL service
47
+ * @returns Promise resolving to metric data points
48
+ */
49
+ export const queryMetrics = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
50
+ validateToken(token);
51
+ const params = new URLSearchParams();
52
+ if (options.metricName)
53
+ params.set('name', options.metricName);
54
+ if (options.serviceName)
55
+ params.set('service_name', options.serviceName);
56
+ if (options.limit)
57
+ params.set('limit', String(options.limit));
58
+ const queryString = params.toString();
59
+ const url = `${baseUrl}${API_BASE_PATHS.OTEL}/metrics/query${queryString ? `?${queryString}` : ''}`;
60
+ return requestDatalayerAPI({
61
+ url,
62
+ method: 'GET',
63
+ token,
64
+ });
65
+ };
@@ -0,0 +1,16 @@
1
+ import type { QueryResponse } from './types';
2
+ /**
3
+ * Execute an ad-hoc SQL query via the SQL Engine engine.
4
+ *
5
+ * @param token - Authentication token
6
+ * @param sql - SQL query string
7
+ * @param baseUrl - Base URL for the OTEL service
8
+ * @returns Promise resolving to query results
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const result = await executeSql(token, 'SELECT * FROM spans LIMIT 10');
13
+ * console.log(result.data);
14
+ * ```
15
+ */
16
+ export declare const executeSql: (token: string, sql: string, baseUrl?: string) => Promise<QueryResponse>;
@@ -0,0 +1,37 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * SQL query API functions for the Datalayer OTEL service.
7
+ *
8
+ * Executes ad-hoc SQL queries via the SQL Engine engine.
9
+ *
10
+ * @module api/otel/query
11
+ */
12
+ import { requestDatalayerAPI } from '../DatalayerApi';
13
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
14
+ import { validateToken } from '../utils/validation';
15
+ /**
16
+ * Execute an ad-hoc SQL query via the SQL Engine engine.
17
+ *
18
+ * @param token - Authentication token
19
+ * @param sql - SQL query string
20
+ * @param baseUrl - Base URL for the OTEL service
21
+ * @returns Promise resolving to query results
22
+ *
23
+ * @example
24
+ * ```ts
25
+ * const result = await executeSql(token, 'SELECT * FROM spans LIMIT 10');
26
+ * console.log(result.data);
27
+ * ```
28
+ */
29
+ export const executeSql = async (token, sql, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
30
+ validateToken(token);
31
+ return requestDatalayerAPI({
32
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/query`,
33
+ method: 'POST',
34
+ body: { sql },
35
+ token,
36
+ });
37
+ };
@@ -0,0 +1,39 @@
1
+ import type { ListServicesResponse, OtelStats, PingResponse, VersionResponse, FlushResponse } from './types';
2
+ /**
3
+ * List all observed service names.
4
+ *
5
+ * @param token - Authentication token
6
+ * @param baseUrl - Base URL for the OTEL service
7
+ * @returns Promise resolving to a list of service names
8
+ */
9
+ export declare const listServices: (token: string, baseUrl?: string) => Promise<ListServicesResponse>;
10
+ /**
11
+ * Check service health (no auth required).
12
+ *
13
+ * @param baseUrl - Base URL for the OTEL service
14
+ * @returns Promise resolving to ping response
15
+ */
16
+ export declare const ping: (baseUrl?: string) => Promise<PingResponse>;
17
+ /**
18
+ * Get service version.
19
+ *
20
+ * @param baseUrl - Base URL for the OTEL service
21
+ * @returns Promise resolving to version info
22
+ */
23
+ export declare const version: (baseUrl?: string) => Promise<VersionResponse>;
24
+ /**
25
+ * Get storage statistics.
26
+ *
27
+ * @param token - Authentication token
28
+ * @param baseUrl - Base URL for the OTEL service
29
+ * @returns Promise resolving to storage statistics
30
+ */
31
+ export declare const getStats: (token: string, baseUrl?: string) => Promise<OtelStats>;
32
+ /**
33
+ * Force-flush all buffered telemetry data.
34
+ *
35
+ * @param token - Authentication token
36
+ * @param baseUrl - Base URL for the OTEL service
37
+ * @returns Promise resolving to flush result
38
+ */
39
+ export declare const flush: (token: string, baseUrl?: string) => Promise<FlushResponse>;
@@ -0,0 +1,81 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Services API functions for the Datalayer OTEL service.
7
+ *
8
+ * @module api/otel/services
9
+ */
10
+ import { requestDatalayerAPI } from '../DatalayerApi';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { validateToken } from '../utils/validation';
13
+ /**
14
+ * List all observed service names.
15
+ *
16
+ * @param token - Authentication token
17
+ * @param baseUrl - Base URL for the OTEL service
18
+ * @returns Promise resolving to a list of service names
19
+ */
20
+ export const listServices = async (token, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
21
+ validateToken(token);
22
+ return requestDatalayerAPI({
23
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/traces/services/list`,
24
+ method: 'GET',
25
+ token,
26
+ });
27
+ };
28
+ /**
29
+ * Check service health (no auth required).
30
+ *
31
+ * @param baseUrl - Base URL for the OTEL service
32
+ * @returns Promise resolving to ping response
33
+ */
34
+ export const ping = async (baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
35
+ return requestDatalayerAPI({
36
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/ping`,
37
+ method: 'GET',
38
+ });
39
+ };
40
+ /**
41
+ * Get service version.
42
+ *
43
+ * @param baseUrl - Base URL for the OTEL service
44
+ * @returns Promise resolving to version info
45
+ */
46
+ export const version = async (baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
47
+ return requestDatalayerAPI({
48
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/version`,
49
+ method: 'GET',
50
+ });
51
+ };
52
+ /**
53
+ * Get storage statistics.
54
+ *
55
+ * @param token - Authentication token
56
+ * @param baseUrl - Base URL for the OTEL service
57
+ * @returns Promise resolving to storage statistics
58
+ */
59
+ export const getStats = async (token, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
60
+ validateToken(token);
61
+ return requestDatalayerAPI({
62
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/stats`,
63
+ method: 'GET',
64
+ token,
65
+ });
66
+ };
67
+ /**
68
+ * Force-flush all buffered telemetry data.
69
+ *
70
+ * @param token - Authentication token
71
+ * @param baseUrl - Base URL for the OTEL service
72
+ * @returns Promise resolving to flush result
73
+ */
74
+ export const flush = async (token, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
75
+ validateToken(token);
76
+ return requestDatalayerAPI({
77
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/flush`,
78
+ method: 'POST',
79
+ token,
80
+ });
81
+ };
@@ -0,0 +1,24 @@
1
+ import type { ListTracesResponse, GetTraceResponse } from './types';
2
+ /**
3
+ * List recent traces.
4
+ *
5
+ * @param token - Authentication token
6
+ * @param options - Query options
7
+ * @param options.serviceName - Filter by service name
8
+ * @param options.limit - Maximum number of traces (default: 20)
9
+ * @param baseUrl - Base URL for the OTEL service
10
+ * @returns Promise resolving to a list of trace spans
11
+ */
12
+ export declare const listTraces: (token: string, options?: {
13
+ serviceName?: string;
14
+ limit?: number;
15
+ }, baseUrl?: string) => Promise<ListTracesResponse>;
16
+ /**
17
+ * Get all spans for a specific trace.
18
+ *
19
+ * @param token - Authentication token
20
+ * @param traceId - The trace ID to retrieve
21
+ * @param baseUrl - Base URL for the OTEL service
22
+ * @returns Promise resolving to the trace's spans
23
+ */
24
+ export declare const getTrace: (token: string, traceId: string, baseUrl?: string) => Promise<GetTraceResponse>;
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ /**
6
+ * Traces API functions for the Datalayer OTEL service.
7
+ *
8
+ * @module api/otel/traces
9
+ */
10
+ import { requestDatalayerAPI } from '../DatalayerApi';
11
+ import { API_BASE_PATHS, DEFAULT_SERVICE_URLS } from '../constants';
12
+ import { validateToken } from '../utils/validation';
13
+ /**
14
+ * List recent traces.
15
+ *
16
+ * @param token - Authentication token
17
+ * @param options - Query options
18
+ * @param options.serviceName - Filter by service name
19
+ * @param options.limit - Maximum number of traces (default: 20)
20
+ * @param baseUrl - Base URL for the OTEL service
21
+ * @returns Promise resolving to a list of trace spans
22
+ */
23
+ export const listTraces = async (token, options = {}, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
24
+ validateToken(token);
25
+ const params = new URLSearchParams();
26
+ if (options.limit)
27
+ params.set('limit', String(options.limit));
28
+ if (options.serviceName)
29
+ params.set('service_name', options.serviceName);
30
+ const queryString = params.toString();
31
+ const url = `${baseUrl}${API_BASE_PATHS.OTEL}/traces${queryString ? `?${queryString}` : ''}`;
32
+ return requestDatalayerAPI({
33
+ url,
34
+ method: 'GET',
35
+ token,
36
+ });
37
+ };
38
+ /**
39
+ * Get all spans for a specific trace.
40
+ *
41
+ * @param token - Authentication token
42
+ * @param traceId - The trace ID to retrieve
43
+ * @param baseUrl - Base URL for the OTEL service
44
+ * @returns Promise resolving to the trace's spans
45
+ */
46
+ export const getTrace = async (token, traceId, baseUrl = DEFAULT_SERVICE_URLS.OTEL) => {
47
+ validateToken(token);
48
+ return requestDatalayerAPI({
49
+ url: `${baseUrl}${API_BASE_PATHS.OTEL}/traces/${traceId}`,
50
+ method: 'GET',
51
+ token,
52
+ });
53
+ };
@@ -0,0 +1,112 @@
1
+ /**
2
+ * TypeScript DTOs for the OTEL API.
3
+ *
4
+ * @module api/otel/types
5
+ */
6
+ /** A single span in a trace. */
7
+ export interface OtelSpan {
8
+ trace_id: string;
9
+ span_id: string;
10
+ parent_span_id?: string;
11
+ span_name: string;
12
+ service_name: string;
13
+ kind: string;
14
+ start_time: string;
15
+ end_time: string;
16
+ duration_ms: number;
17
+ status_code?: string;
18
+ status_message?: string;
19
+ otel_scope_name?: string;
20
+ attributes?: Record<string, unknown>;
21
+ events?: OtelSpanEvent[];
22
+ links?: OtelSpanLink[];
23
+ }
24
+ /** An event attached to a span. */
25
+ export interface OtelSpanEvent {
26
+ name: string;
27
+ timestamp: string;
28
+ attributes?: Record<string, unknown>;
29
+ }
30
+ /** A link between spans. */
31
+ export interface OtelSpanLink {
32
+ trace_id: string;
33
+ span_id: string;
34
+ attributes?: Record<string, unknown>;
35
+ }
36
+ /** Response from list traces endpoint. */
37
+ export interface ListTracesResponse {
38
+ data: OtelSpan[];
39
+ total?: number;
40
+ }
41
+ /** Response from get single trace endpoint. */
42
+ export interface GetTraceResponse {
43
+ data: OtelSpan[];
44
+ trace_id: string;
45
+ }
46
+ /** A metric data point. */
47
+ export interface OtelMetric {
48
+ metric_name: string;
49
+ service_name: string;
50
+ value: number;
51
+ unit?: string;
52
+ timestamp: string;
53
+ attributes?: Record<string, unknown>;
54
+ metric_type?: string;
55
+ }
56
+ /** Response from list/query metrics endpoint. */
57
+ export interface ListMetricsResponse {
58
+ data: OtelMetric[];
59
+ total?: number;
60
+ }
61
+ /** A log record. */
62
+ export interface OtelLog {
63
+ timestamp: string;
64
+ severity_text: string;
65
+ severity_number?: number;
66
+ body: string;
67
+ service_name: string;
68
+ trace_id?: string;
69
+ span_id?: string;
70
+ attributes?: Record<string, unknown>;
71
+ }
72
+ /** Response from query logs endpoint. */
73
+ export interface ListLogsResponse {
74
+ data: OtelLog[];
75
+ total?: number;
76
+ }
77
+ /** Storage statistics. */
78
+ export interface OtelStats {
79
+ spans_count?: number;
80
+ metrics_count?: number;
81
+ logs_count?: number;
82
+ spans_files?: number;
83
+ metrics_files?: number;
84
+ logs_files?: number;
85
+ data_dir?: string;
86
+ [key: string]: unknown;
87
+ }
88
+ /** Response from SQL query endpoint. */
89
+ export interface QueryResponse {
90
+ data: Record<string, unknown>[];
91
+ columns?: string[];
92
+ row_count?: number;
93
+ }
94
+ /** Ping/health response. */
95
+ export interface PingResponse {
96
+ status: string;
97
+ [key: string]: unknown;
98
+ }
99
+ /** Version response. */
100
+ export interface VersionResponse {
101
+ version: string;
102
+ [key: string]: unknown;
103
+ }
104
+ /** Flush response. */
105
+ export interface FlushResponse {
106
+ flushed: boolean;
107
+ [key: string]: unknown;
108
+ }
109
+ /** List services response. */
110
+ export interface ListServicesResponse {
111
+ services: string[];
112
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ * Copyright (c) 2023-2025 Datalayer, Inc.
3
+ * Distributed under the terms of the Modified BSD License.
4
+ */
5
+ export {};
@@ -71,6 +71,10 @@ export type IDatalayerCoreConfig = {
71
71
  * MCP Servers API URL.
72
72
  */
73
73
  mcpserversRunUrl: string;
74
+ /**
75
+ * OTEL (OpenTelemetry) API URL.
76
+ */
77
+ otelRunUrl: string;
74
78
  /**
75
79
  * Growth API URL.
76
80
  */