@djangocfg/api 1.2.18 → 1.2.19
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.cjs +1528 -709
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1020 -75
- package/dist/index.d.ts +1020 -75
- package/dist/index.mjs +1458 -646
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cfg/generated/_utils/fetchers/cfg__grpc__grpc_monitoring.ts +122 -0
- package/src/cfg/generated/_utils/fetchers/index.ts +1 -0
- package/src/cfg/generated/_utils/hooks/cfg__grpc__grpc_monitoring.ts +110 -0
- package/src/cfg/generated/_utils/hooks/index.ts +1 -0
- package/src/cfg/generated/_utils/schemas/MethodList.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/MethodStatsSerializer.schema.ts +25 -0
- package/src/cfg/generated/_utils/schemas/RecentRequests.schema.ts +23 -0
- package/src/cfg/generated/_utils/schemas/ServiceList.schema.ts +21 -0
- package/src/cfg/generated/_utils/schemas/ServiceStatsSerializer.schema.ts +24 -0
- package/src/cfg/generated/_utils/schemas/index.ts +5 -0
- package/src/cfg/generated/cfg__grpc__grpc_monitoring/client.ts +129 -0
- package/src/cfg/generated/cfg__grpc__grpc_monitoring/index.ts +2 -0
- package/src/cfg/generated/cfg__grpc__grpc_monitoring/models.ts +124 -0
- package/src/cfg/generated/client.ts +3 -0
- package/src/cfg/generated/index.ts +5 -0
- package/src/cfg/generated/schema.ts +565 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/api",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.19",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "DjangoCFG",
|
|
6
6
|
"url": "https://djangocfg.com"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@types/node": "^22.15.3",
|
|
69
69
|
"@types/react": "19.2.2",
|
|
70
70
|
"@types/react-dom": "19.2.1",
|
|
71
|
-
"@djangocfg/typescript-config": "^1.2.
|
|
71
|
+
"@djangocfg/typescript-config": "^1.2.19",
|
|
72
72
|
"react": "^19.1.0",
|
|
73
73
|
"react-dom": "^19.1.0",
|
|
74
74
|
"tsup": "^8.5.0",
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed fetchers for Grpc Monitoring
|
|
3
|
+
*
|
|
4
|
+
* Universal functions that work in any environment:
|
|
5
|
+
* - Next.js (App Router / Pages Router / Server Components)
|
|
6
|
+
* - React Native
|
|
7
|
+
* - Node.js backend
|
|
8
|
+
*
|
|
9
|
+
* These fetchers use Zod schemas for runtime validation.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // Configure API once (in your app entry point)
|
|
14
|
+
* import { configureAPI } from '../../api-instance'
|
|
15
|
+
* configureAPI({ baseUrl: 'https://api.example.com' })
|
|
16
|
+
*
|
|
17
|
+
* // Then use fetchers anywhere
|
|
18
|
+
* const users = await getUsers({ page: 1 })
|
|
19
|
+
*
|
|
20
|
+
* // With SWR
|
|
21
|
+
* const { data } = useSWR(['users', params], () => getUsers(params))
|
|
22
|
+
*
|
|
23
|
+
* // With React Query
|
|
24
|
+
* const { data } = useQuery(['users', params], () => getUsers(params))
|
|
25
|
+
*
|
|
26
|
+
* // In Server Component or SSR (pass custom client)
|
|
27
|
+
* import { API } from '../../index'
|
|
28
|
+
* const api = new API('https://api.example.com')
|
|
29
|
+
* const users = await getUsers({ page: 1 }, api)
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
import { HealthCheckSchema, type HealthCheck } from '../schemas/HealthCheck.schema'
|
|
33
|
+
import { MethodListSchema, type MethodList } from '../schemas/MethodList.schema'
|
|
34
|
+
import { OverviewStatsSchema, type OverviewStats } from '../schemas/OverviewStats.schema'
|
|
35
|
+
import { RecentRequestsSchema, type RecentRequests } from '../schemas/RecentRequests.schema'
|
|
36
|
+
import { ServiceListSchema, type ServiceList } from '../schemas/ServiceList.schema'
|
|
37
|
+
import { getAPIInstance } from '../../api-instance'
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Get gRPC health status
|
|
41
|
+
*
|
|
42
|
+
* @method GET
|
|
43
|
+
* @path /cfg/grpc/monitor/health/
|
|
44
|
+
*/
|
|
45
|
+
export async function getGrpcMonitorHealthRetrieve( client?: any
|
|
46
|
+
): Promise<HealthCheck> {
|
|
47
|
+
const api = client || getAPIInstance()
|
|
48
|
+
const response = await api.cfg_grpc_monitoring.grpcMonitorHealthRetrieve()
|
|
49
|
+
return HealthCheckSchema.parse(response)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get method statistics
|
|
55
|
+
*
|
|
56
|
+
* @method GET
|
|
57
|
+
* @path /cfg/grpc/monitor/methods/
|
|
58
|
+
*/
|
|
59
|
+
export async function getGrpcMonitorMethodsRetrieve( params?: { hours?: number; service?: string }, client?: any
|
|
60
|
+
): Promise<MethodList> {
|
|
61
|
+
const api = client || getAPIInstance()
|
|
62
|
+
const response = await api.cfg_grpc_monitoring.grpcMonitorMethodsRetrieve(params?.hours, params?.service)
|
|
63
|
+
return MethodListSchema.parse(response)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Get overview statistics
|
|
69
|
+
*
|
|
70
|
+
* @method GET
|
|
71
|
+
* @path /cfg/grpc/monitor/overview/
|
|
72
|
+
*/
|
|
73
|
+
export async function getGrpcMonitorOverviewRetrieve( params?: { hours?: number }, client?: any
|
|
74
|
+
): Promise<OverviewStats> {
|
|
75
|
+
const api = client || getAPIInstance()
|
|
76
|
+
const response = await api.cfg_grpc_monitoring.grpcMonitorOverviewRetrieve(params?.hours)
|
|
77
|
+
return OverviewStatsSchema.parse(response)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Get recent requests
|
|
83
|
+
*
|
|
84
|
+
* @method GET
|
|
85
|
+
* @path /cfg/grpc/monitor/requests/
|
|
86
|
+
*/
|
|
87
|
+
export async function getGrpcMonitorRequestsRetrieve( params?: { count?: number; method?: string; offset?: number; service?: string; status?: string }, client?: any
|
|
88
|
+
): Promise<RecentRequests> {
|
|
89
|
+
const api = client || getAPIInstance()
|
|
90
|
+
const response = await api.cfg_grpc_monitoring.grpcMonitorRequestsRetrieve(params?.count, params?.method, params?.offset, params?.service, params?.status)
|
|
91
|
+
return RecentRequestsSchema.parse(response)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Get service statistics
|
|
97
|
+
*
|
|
98
|
+
* @method GET
|
|
99
|
+
* @path /cfg/grpc/monitor/services/
|
|
100
|
+
*/
|
|
101
|
+
export async function getGrpcMonitorServicesRetrieve( params?: { hours?: number }, client?: any
|
|
102
|
+
): Promise<ServiceList> {
|
|
103
|
+
const api = client || getAPIInstance()
|
|
104
|
+
const response = await api.cfg_grpc_monitoring.grpcMonitorServicesRetrieve(params?.hours)
|
|
105
|
+
return ServiceListSchema.parse(response)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Get request timeline
|
|
111
|
+
*
|
|
112
|
+
* @method GET
|
|
113
|
+
* @path /cfg/grpc/monitor/timeline/
|
|
114
|
+
*/
|
|
115
|
+
export async function getGrpcMonitorTimelineRetrieve( params?: { hours?: number; interval?: string }, client?: any
|
|
116
|
+
): Promise<any> {
|
|
117
|
+
const api = client || getAPIInstance()
|
|
118
|
+
const response = await api.cfg_grpc_monitoring.grpcMonitorTimelineRetrieve(params?.hours, params?.interval)
|
|
119
|
+
return response
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
|
|
@@ -41,6 +41,7 @@ export * from './cfg__dashboard__dashboard_overview'
|
|
|
41
41
|
export * from './cfg__dashboard__dashboard_statistics'
|
|
42
42
|
export * from './cfg__dashboard__dashboard_system'
|
|
43
43
|
export * from './cfg__endpoints'
|
|
44
|
+
export * from './cfg__grpc__grpc_monitoring'
|
|
44
45
|
export * from './cfg__health'
|
|
45
46
|
export * from './cfg__knowbase'
|
|
46
47
|
export * from './cfg__leads'
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SWR Hooks for Grpc Monitoring
|
|
3
|
+
*
|
|
4
|
+
* React hooks powered by SWR for data fetching with automatic caching,
|
|
5
|
+
* revalidation, and optimistic updates.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* // Query hooks (GET)
|
|
10
|
+
* const { data, error, isLoading } = useUsers({ page: 1 })
|
|
11
|
+
*
|
|
12
|
+
* // Mutation hooks (POST/PUT/PATCH/DELETE)
|
|
13
|
+
* const createUser = useCreateUser()
|
|
14
|
+
* await createUser({ name: 'John', email: 'john@example.com' })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import useSWR from 'swr'
|
|
18
|
+
import { useSWRConfig } from 'swr'
|
|
19
|
+
import * as Fetchers from '../fetchers/cfg__grpc__grpc_monitoring'
|
|
20
|
+
import type { API } from '../../index'
|
|
21
|
+
import type { HealthCheck } from '../schemas/HealthCheck.schema'
|
|
22
|
+
import type { MethodList } from '../schemas/MethodList.schema'
|
|
23
|
+
import type { OverviewStats } from '../schemas/OverviewStats.schema'
|
|
24
|
+
import type { RecentRequests } from '../schemas/RecentRequests.schema'
|
|
25
|
+
import type { ServiceList } from '../schemas/ServiceList.schema'
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get gRPC health status
|
|
29
|
+
*
|
|
30
|
+
* @method GET
|
|
31
|
+
* @path /cfg/grpc/monitor/health/
|
|
32
|
+
*/
|
|
33
|
+
export function useGrpcMonitorHealthRetrieve(client?: API): ReturnType<typeof useSWR<HealthCheck>> {
|
|
34
|
+
return useSWR<HealthCheck>(
|
|
35
|
+
'cfg-grpc-monitor-health',
|
|
36
|
+
() => Fetchers.getGrpcMonitorHealthRetrieve(client)
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Get method statistics
|
|
43
|
+
*
|
|
44
|
+
* @method GET
|
|
45
|
+
* @path /cfg/grpc/monitor/methods/
|
|
46
|
+
*/
|
|
47
|
+
export function useGrpcMonitorMethodsRetrieve(params?: { hours?: number; service?: string }, client?: API): ReturnType<typeof useSWR<MethodList>> {
|
|
48
|
+
return useSWR<MethodList>(
|
|
49
|
+
params ? ['cfg-grpc-monitor-method', params] : 'cfg-grpc-monitor-method',
|
|
50
|
+
() => Fetchers.getGrpcMonitorMethodsRetrieve(params, client)
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Get overview statistics
|
|
57
|
+
*
|
|
58
|
+
* @method GET
|
|
59
|
+
* @path /cfg/grpc/monitor/overview/
|
|
60
|
+
*/
|
|
61
|
+
export function useGrpcMonitorOverviewRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<OverviewStats>> {
|
|
62
|
+
return useSWR<OverviewStats>(
|
|
63
|
+
params ? ['cfg-grpc-monitor-overview', params] : 'cfg-grpc-monitor-overview',
|
|
64
|
+
() => Fetchers.getGrpcMonitorOverviewRetrieve(params, client)
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get recent requests
|
|
71
|
+
*
|
|
72
|
+
* @method GET
|
|
73
|
+
* @path /cfg/grpc/monitor/requests/
|
|
74
|
+
*/
|
|
75
|
+
export function useGrpcMonitorRequestsRetrieve(params?: { count?: number; method?: string; offset?: number; service?: string; status?: string }, client?: API): ReturnType<typeof useSWR<RecentRequests>> {
|
|
76
|
+
return useSWR<RecentRequests>(
|
|
77
|
+
params ? ['cfg-grpc-monitor-request', params] : 'cfg-grpc-monitor-request',
|
|
78
|
+
() => Fetchers.getGrpcMonitorRequestsRetrieve(params, client)
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Get service statistics
|
|
85
|
+
*
|
|
86
|
+
* @method GET
|
|
87
|
+
* @path /cfg/grpc/monitor/services/
|
|
88
|
+
*/
|
|
89
|
+
export function useGrpcMonitorServicesRetrieve(params?: { hours?: number }, client?: API): ReturnType<typeof useSWR<ServiceList>> {
|
|
90
|
+
return useSWR<ServiceList>(
|
|
91
|
+
params ? ['cfg-grpc-monitor-service', params] : 'cfg-grpc-monitor-service',
|
|
92
|
+
() => Fetchers.getGrpcMonitorServicesRetrieve(params, client)
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Get request timeline
|
|
99
|
+
*
|
|
100
|
+
* @method GET
|
|
101
|
+
* @path /cfg/grpc/monitor/timeline/
|
|
102
|
+
*/
|
|
103
|
+
export function useGrpcMonitorTimelineRetrieve(params?: { hours?: number; interval?: string }, client?: API): ReturnType<typeof useSWR<any>> {
|
|
104
|
+
return useSWR<any>(
|
|
105
|
+
params ? ['cfg-grpc-monitor-timeline', params] : 'cfg-grpc-monitor-timeline',
|
|
106
|
+
() => Fetchers.getGrpcMonitorTimelineRetrieve(params, client)
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
@@ -46,6 +46,7 @@ export * from './cfg__accounts'
|
|
|
46
46
|
export * from './cfg__centrifugo'
|
|
47
47
|
export * from './cfg__dashboard'
|
|
48
48
|
export * from './cfg__endpoints'
|
|
49
|
+
export * from './cfg__grpc__grpc_monitoring'
|
|
49
50
|
export * from './cfg__health'
|
|
50
51
|
export * from './cfg__knowbase'
|
|
51
52
|
export * from './cfg__leads'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for MethodList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * List of gRPC methods with statistics.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import { MethodStatsSerializerSchema } from './MethodStatsSerializer.schema'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* List of gRPC methods with statistics.
|
|
12
|
+
*/
|
|
13
|
+
export const MethodListSchema = z.object({
|
|
14
|
+
methods: z.array(MethodStatsSerializerSchema),
|
|
15
|
+
total_methods: z.int(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type MethodList = z.infer<typeof MethodListSchema>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for MethodStatsSerializer
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Statistics for a single gRPC method.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Statistics for a single gRPC method.
|
|
11
|
+
*/
|
|
12
|
+
export const MethodStatsSerializerSchema = z.object({
|
|
13
|
+
method_name: z.string(),
|
|
14
|
+
service_name: z.string(),
|
|
15
|
+
total: z.int(),
|
|
16
|
+
successful: z.int(),
|
|
17
|
+
errors: z.int(),
|
|
18
|
+
avg_duration_ms: z.number(),
|
|
19
|
+
last_activity_at: z.string().nullable(),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Infer TypeScript type from Zod schema
|
|
24
|
+
*/
|
|
25
|
+
export type MethodStatsSerializer = z.infer<typeof MethodStatsSerializerSchema>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for RecentRequests
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Recent gRPC requests list.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Recent gRPC requests list.
|
|
11
|
+
*/
|
|
12
|
+
export const RecentRequestsSchema = z.object({
|
|
13
|
+
requests: z.array(z.record(z.string(), z.any())),
|
|
14
|
+
count: z.int(),
|
|
15
|
+
total_available: z.int(),
|
|
16
|
+
offset: z.int().optional(),
|
|
17
|
+
has_more: z.boolean().optional(),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Infer TypeScript type from Zod schema
|
|
22
|
+
*/
|
|
23
|
+
export type RecentRequests = z.infer<typeof RecentRequestsSchema>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for ServiceList
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * List of gRPC services with statistics.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
import { ServiceStatsSerializerSchema } from './ServiceStatsSerializer.schema'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* List of gRPC services with statistics.
|
|
12
|
+
*/
|
|
13
|
+
export const ServiceListSchema = z.object({
|
|
14
|
+
services: z.array(ServiceStatsSerializerSchema),
|
|
15
|
+
total_services: z.int(),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Infer TypeScript type from Zod schema
|
|
20
|
+
*/
|
|
21
|
+
export type ServiceList = z.infer<typeof ServiceListSchema>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Zod schema for ServiceStatsSerializer
|
|
3
|
+
*
|
|
4
|
+
* This schema provides runtime validation and type inference.
|
|
5
|
+
* * Statistics for a single gRPC service.
|
|
6
|
+
* */
|
|
7
|
+
import { z } from 'zod'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Statistics for a single gRPC service.
|
|
11
|
+
*/
|
|
12
|
+
export const ServiceStatsSerializerSchema = z.object({
|
|
13
|
+
service_name: z.string(),
|
|
14
|
+
total: z.int(),
|
|
15
|
+
successful: z.int(),
|
|
16
|
+
errors: z.int(),
|
|
17
|
+
avg_duration_ms: z.number(),
|
|
18
|
+
last_activity_at: z.string().nullable(),
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Infer TypeScript type from Zod schema
|
|
23
|
+
*/
|
|
24
|
+
export type ServiceStatsSerializer = z.infer<typeof ServiceStatsSerializerSchema>
|
|
@@ -105,6 +105,8 @@ export * from './Message.schema'
|
|
|
105
105
|
export * from './MessageCreate.schema'
|
|
106
106
|
export * from './MessageCreateRequest.schema'
|
|
107
107
|
export * from './MessageRequest.schema'
|
|
108
|
+
export * from './MethodList.schema'
|
|
109
|
+
export * from './MethodStatsSerializer.schema'
|
|
108
110
|
export * from './Newsletter.schema'
|
|
109
111
|
export * from './NewsletterCampaign.schema'
|
|
110
112
|
export * from './NewsletterCampaignRequest.schema'
|
|
@@ -155,10 +157,13 @@ export * from './PublishTestResponse.schema'
|
|
|
155
157
|
export * from './QuickAction.schema'
|
|
156
158
|
export * from './QuickHealth.schema'
|
|
157
159
|
export * from './RecentPublishes.schema'
|
|
160
|
+
export * from './RecentRequests.schema'
|
|
158
161
|
export * from './RecentUser.schema'
|
|
159
162
|
export * from './SendCampaignRequest.schema'
|
|
160
163
|
export * from './SendCampaignResponse.schema'
|
|
161
164
|
export * from './Sender.schema'
|
|
165
|
+
export * from './ServiceList.schema'
|
|
166
|
+
export * from './ServiceStatsSerializer.schema'
|
|
162
167
|
export * from './StatCard.schema'
|
|
163
168
|
export * from './SubscribeRequest.schema'
|
|
164
169
|
export * from './SubscribeResponse.schema'
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import * as Models from "./models";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* API endpoints for Grpc Monitoring.
|
|
6
|
+
*/
|
|
7
|
+
export class CfgGrpcMonitoring {
|
|
8
|
+
private client: any;
|
|
9
|
+
|
|
10
|
+
constructor(client: any) {
|
|
11
|
+
this.client = client;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get gRPC health status
|
|
16
|
+
*
|
|
17
|
+
* Returns the current health status of the gRPC server.
|
|
18
|
+
*/
|
|
19
|
+
async grpcMonitorHealthRetrieve(): Promise<Models.HealthCheck> {
|
|
20
|
+
const response = await this.client.request('GET', "/cfg/grpc/monitor/health/");
|
|
21
|
+
return response;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async grpcMonitorMethodsRetrieve(hours?: number, service?: string): Promise<Models.MethodList[]>;
|
|
25
|
+
async grpcMonitorMethodsRetrieve(params?: { hours?: number; service?: string }): Promise<Models.MethodList[]>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Get method statistics
|
|
29
|
+
*
|
|
30
|
+
* Returns statistics grouped by method.
|
|
31
|
+
*/
|
|
32
|
+
async grpcMonitorMethodsRetrieve(...args: any[]): Promise<Models.MethodList[]> {
|
|
33
|
+
const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
|
|
34
|
+
|
|
35
|
+
let params;
|
|
36
|
+
if (isParamsObject) {
|
|
37
|
+
params = args[0];
|
|
38
|
+
} else {
|
|
39
|
+
params = { hours: args[0], service: args[1] };
|
|
40
|
+
}
|
|
41
|
+
const response = await this.client.request('GET', "/cfg/grpc/monitor/methods/", { params });
|
|
42
|
+
return (response as any).results || [];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async grpcMonitorOverviewRetrieve(hours?: number): Promise<Models.OverviewStats>;
|
|
46
|
+
async grpcMonitorOverviewRetrieve(params?: { hours?: number }): Promise<Models.OverviewStats>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Get overview statistics
|
|
50
|
+
*
|
|
51
|
+
* Returns overview statistics for gRPC requests.
|
|
52
|
+
*/
|
|
53
|
+
async grpcMonitorOverviewRetrieve(...args: any[]): Promise<Models.OverviewStats> {
|
|
54
|
+
const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
|
|
55
|
+
|
|
56
|
+
let params;
|
|
57
|
+
if (isParamsObject) {
|
|
58
|
+
params = args[0];
|
|
59
|
+
} else {
|
|
60
|
+
params = { hours: args[0] };
|
|
61
|
+
}
|
|
62
|
+
const response = await this.client.request('GET', "/cfg/grpc/monitor/overview/", { params });
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async grpcMonitorRequestsRetrieve(count?: number, method?: string, offset?: number, service?: string, status?: string): Promise<Models.RecentRequests>;
|
|
67
|
+
async grpcMonitorRequestsRetrieve(params?: { count?: number; method?: string; offset?: number; service?: string; status?: string }): Promise<Models.RecentRequests>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Get recent requests
|
|
71
|
+
*
|
|
72
|
+
* Returns a list of recent gRPC requests with their details.
|
|
73
|
+
*/
|
|
74
|
+
async grpcMonitorRequestsRetrieve(...args: any[]): Promise<Models.RecentRequests> {
|
|
75
|
+
const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
|
|
76
|
+
|
|
77
|
+
let params;
|
|
78
|
+
if (isParamsObject) {
|
|
79
|
+
params = args[0];
|
|
80
|
+
} else {
|
|
81
|
+
params = { count: args[0], method: args[1], offset: args[2], service: args[3], status: args[4] };
|
|
82
|
+
}
|
|
83
|
+
const response = await this.client.request('GET', "/cfg/grpc/monitor/requests/", { params });
|
|
84
|
+
return response;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async grpcMonitorServicesRetrieve(hours?: number): Promise<Models.ServiceList[]>;
|
|
88
|
+
async grpcMonitorServicesRetrieve(params?: { hours?: number }): Promise<Models.ServiceList[]>;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get service statistics
|
|
92
|
+
*
|
|
93
|
+
* Returns statistics grouped by service.
|
|
94
|
+
*/
|
|
95
|
+
async grpcMonitorServicesRetrieve(...args: any[]): Promise<Models.ServiceList[]> {
|
|
96
|
+
const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
|
|
97
|
+
|
|
98
|
+
let params;
|
|
99
|
+
if (isParamsObject) {
|
|
100
|
+
params = args[0];
|
|
101
|
+
} else {
|
|
102
|
+
params = { hours: args[0] };
|
|
103
|
+
}
|
|
104
|
+
const response = await this.client.request('GET', "/cfg/grpc/monitor/services/", { params });
|
|
105
|
+
return (response as any).results || [];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async grpcMonitorTimelineRetrieve(hours?: number, interval?: string): Promise<any>;
|
|
109
|
+
async grpcMonitorTimelineRetrieve(params?: { hours?: number; interval?: string }): Promise<any>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Get request timeline
|
|
113
|
+
*
|
|
114
|
+
* Returns hourly or daily breakdown of request counts for charts.
|
|
115
|
+
*/
|
|
116
|
+
async grpcMonitorTimelineRetrieve(...args: any[]): Promise<any> {
|
|
117
|
+
const isParamsObject = args.length === 1 && typeof args[0] === 'object' && args[0] !== null && !Array.isArray(args[0]);
|
|
118
|
+
|
|
119
|
+
let params;
|
|
120
|
+
if (isParamsObject) {
|
|
121
|
+
params = args[0];
|
|
122
|
+
} else {
|
|
123
|
+
params = { hours: args[0], interval: args[1] };
|
|
124
|
+
}
|
|
125
|
+
const response = await this.client.request('GET', "/cfg/grpc/monitor/timeline/", { params });
|
|
126
|
+
return response;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Health check response.
|
|
3
|
+
*
|
|
4
|
+
* Response model (includes read-only fields).
|
|
5
|
+
*/
|
|
6
|
+
export interface HealthCheck {
|
|
7
|
+
/** Health status: healthy or unhealthy */
|
|
8
|
+
status: string;
|
|
9
|
+
/** Configured wrapper URL */
|
|
10
|
+
wrapper_url: string;
|
|
11
|
+
/** Whether API key is configured */
|
|
12
|
+
has_api_key: boolean;
|
|
13
|
+
/** Current timestamp */
|
|
14
|
+
timestamp: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* List of gRPC methods with statistics.
|
|
19
|
+
*
|
|
20
|
+
* Response model (includes read-only fields).
|
|
21
|
+
*/
|
|
22
|
+
export interface MethodList {
|
|
23
|
+
/** Method statistics */
|
|
24
|
+
methods: Array<MethodStatsSerializer>;
|
|
25
|
+
/** Total number of methods */
|
|
26
|
+
total_methods: number;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Overview statistics for Centrifugo publishes.
|
|
31
|
+
*
|
|
32
|
+
* Response model (includes read-only fields).
|
|
33
|
+
*/
|
|
34
|
+
export interface OverviewStats {
|
|
35
|
+
/** Total publishes in period */
|
|
36
|
+
total: number;
|
|
37
|
+
/** Successful publishes */
|
|
38
|
+
successful: number;
|
|
39
|
+
/** Failed publishes */
|
|
40
|
+
failed: number;
|
|
41
|
+
/** Timeout publishes */
|
|
42
|
+
timeout: number;
|
|
43
|
+
/** Success rate percentage */
|
|
44
|
+
success_rate: number;
|
|
45
|
+
/** Average duration in milliseconds */
|
|
46
|
+
avg_duration_ms: number;
|
|
47
|
+
/** Average ACKs received */
|
|
48
|
+
avg_acks_received: number;
|
|
49
|
+
/** Statistics period in hours */
|
|
50
|
+
period_hours: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Recent gRPC requests list.
|
|
55
|
+
*
|
|
56
|
+
* Response model (includes read-only fields).
|
|
57
|
+
*/
|
|
58
|
+
export interface RecentRequests {
|
|
59
|
+
/** List of recent requests */
|
|
60
|
+
requests: Array<Record<string, any>>;
|
|
61
|
+
/** Number of requests returned */
|
|
62
|
+
count: number;
|
|
63
|
+
/** Total requests available */
|
|
64
|
+
total_available: number;
|
|
65
|
+
/** Current offset for pagination */
|
|
66
|
+
offset?: number;
|
|
67
|
+
/** Whether more results are available */
|
|
68
|
+
has_more?: boolean;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* List of gRPC services with statistics.
|
|
73
|
+
*
|
|
74
|
+
* Response model (includes read-only fields).
|
|
75
|
+
*/
|
|
76
|
+
export interface ServiceList {
|
|
77
|
+
/** Service statistics */
|
|
78
|
+
services: Array<ServiceStatsSerializer>;
|
|
79
|
+
/** Total number of services */
|
|
80
|
+
total_services: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Statistics for a single gRPC method.
|
|
85
|
+
*
|
|
86
|
+
* Response model (includes read-only fields).
|
|
87
|
+
*/
|
|
88
|
+
export interface MethodStatsSerializer {
|
|
89
|
+
/** Method name */
|
|
90
|
+
method_name: string;
|
|
91
|
+
/** Service name */
|
|
92
|
+
service_name: string;
|
|
93
|
+
/** Total requests */
|
|
94
|
+
total: number;
|
|
95
|
+
/** Successful requests */
|
|
96
|
+
successful: number;
|
|
97
|
+
/** Error requests */
|
|
98
|
+
errors: number;
|
|
99
|
+
/** Average duration */
|
|
100
|
+
avg_duration_ms: number;
|
|
101
|
+
/** Last activity timestamp */
|
|
102
|
+
last_activity_at: string | null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Statistics for a single gRPC service.
|
|
107
|
+
*
|
|
108
|
+
* Response model (includes read-only fields).
|
|
109
|
+
*/
|
|
110
|
+
export interface ServiceStatsSerializer {
|
|
111
|
+
/** Service name */
|
|
112
|
+
service_name: string;
|
|
113
|
+
/** Total requests */
|
|
114
|
+
total: number;
|
|
115
|
+
/** Successful requests */
|
|
116
|
+
successful: number;
|
|
117
|
+
/** Error requests */
|
|
118
|
+
errors: number;
|
|
119
|
+
/** Average duration */
|
|
120
|
+
avg_duration_ms: number;
|
|
121
|
+
/** Last activity timestamp */
|
|
122
|
+
last_activity_at: string | null;
|
|
123
|
+
}
|
|
124
|
+
|