Skip to content

Commit 99529e9

Browse files
committed
MEDIUM: Add info endpoint
1 parent 9789e14 commit 99529e9

File tree

4 files changed

+148
-14
lines changed

4 files changed

+148
-14
lines changed

build/haproxy_spec.yaml

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2388,9 +2388,6 @@ definitions:
23882388
properties:
23892389
haproxy:
23902390
properties:
2391-
address:
2392-
description: The address of the replying server
2393-
type: string
23942391
pid:
23952392
description: Process id of the replying worker process
23962393
type: integer
@@ -2403,10 +2400,6 @@ definitions:
24032400
description: HAProxy version release date
24042401
format: date
24052402
type: string
2406-
time:
2407-
description: Current time in milliseconds since Epoch.
2408-
format: date-time
2409-
type: string
24102403
uptime:
24112404
description: HAProxy uptime in s
24122405
type: integer
@@ -2443,6 +2436,54 @@ definitions:
24432436
type: array
24442437
items:
24452438
$ref: "#/definitions/transaction"
2439+
info:
2440+
description: General API, OS and hardware information
2441+
properties:
2442+
api:
2443+
properties:
2444+
build_date:
2445+
description: HAProxy Dataplane API build date
2446+
format: date-time
2447+
type: string
2448+
version:
2449+
description: HAProxy Dataplane API version string
2450+
type: string
2451+
type: object
2452+
system:
2453+
properties:
2454+
cpu_info:
2455+
properties:
2456+
model:
2457+
type: string
2458+
num_cpus:
2459+
description: Number of logical CPUs
2460+
type: integer
2461+
type: object
2462+
hostname:
2463+
description: Hostname where the HAProxy is running
2464+
type: string
2465+
mem_info:
2466+
properties:
2467+
dataplaneapi_memory:
2468+
type: integer
2469+
free_memory:
2470+
type: integer
2471+
total_memory:
2472+
type: integer
2473+
type: object
2474+
os_string:
2475+
description: OS string
2476+
type: string
2477+
time:
2478+
description: Current time in milliseconds since Epoch.
2479+
type: integer
2480+
uptime:
2481+
description: System uptime
2482+
type: integer
2483+
x-nullable: true
2484+
type: object
2485+
title: Information
2486+
type: object
24462487
reload:
24472488
description: HAProxy reload
24482489
example:
@@ -2740,6 +2781,22 @@ paths:
27402781
summary: Data Plane API Specification
27412782
tags:
27422783
- Specification
2784+
/info:
2785+
get:
2786+
description: Return API, hardware and OS information
2787+
operationId: getInfo
2788+
produces:
2789+
- application/json
2790+
responses:
2791+
"200":
2792+
description: Success
2793+
schema:
2794+
$ref: '#/definitions/info'
2795+
default:
2796+
$ref: '#/responses/DefaultError'
2797+
summary: Return API, hardware and OS information
2798+
tags:
2799+
- Information
27432800
/services:
27442801
get:
27452802
description: Returns a list of API managed services endpoints.

haproxy-spec.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ definitions:
166166
type: array
167167
items:
168168
$ref: "#/definitions/transaction"
169+
info:
170+
$ref: "models/general.yaml#/info"
169171
reload:
170172
$ref: "models/general.yaml#/reload"
171173
reloads:
@@ -317,6 +319,8 @@ paths:
317319
$ref: "paths/general.yaml#/root"
318320
/specification:
319321
$ref: "paths/general.yaml#/specification"
322+
/info:
323+
$ref: "paths/general.yaml#/info"
320324
/services:
321325
$ref: "paths/general.yaml#/services"
322326
/services/haproxy:

models/general.yaml

Lines changed: 64 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,70 @@ endpoint:
1212
description:
1313
type: string
1414
description: Endpoint description
15+
info:
16+
title: Information
17+
description: General API, OS and hardware information
18+
type: object
19+
properties:
20+
api:
21+
type: object
22+
properties:
23+
version:
24+
type: string
25+
description: HAProxy Dataplane API version string
26+
build_date:
27+
type: string
28+
format: date-time
29+
description: HAProxy Dataplane API build date
30+
system:
31+
type: object
32+
properties:
33+
hostname:
34+
type: string
35+
description: Hostname where the HAProxy is running
36+
cpu_info:
37+
type: object
38+
properties:
39+
model:
40+
type: string
41+
num_cpus:
42+
type: integer
43+
description: Number of logical CPUs
44+
os_string:
45+
type: string
46+
description: OS string
47+
mem_info:
48+
type: object
49+
properties:
50+
total_memory:
51+
type: integer
52+
free_memory:
53+
type: integer
54+
dataplaneapi_memory:
55+
type: integer
56+
time:
57+
type: integer
58+
description: Current time in milliseconds since Epoch.
59+
uptime:
60+
type: integer
61+
description: System uptime
62+
x-nullable: true
63+
example:
64+
api:
65+
build_date: "2019-08-21T17:31:56.000Z"
66+
version: v1.2.1 45a3288.dev
67+
system:
68+
hostname: test
69+
os_string: "Linux 4.15.0-58-generic #64-Ubuntu SMP Tue Aug 6 11:12:41 UTC 2019"
70+
time: 1566401525
71+
uptime: 87340
72+
cpu_info:
73+
model: Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz
74+
num_cpus: 4
75+
mem_info:
76+
total_memory: 16681517056
77+
free_memory: 5790642176
78+
dataplaneapi_memory: 44755536
1579
process_info:
1680
title: HAProxy Information
1781
description: General HAProxy process information
@@ -27,13 +91,6 @@ process_info:
2791
type: string
2892
format: date
2993
description: HAProxy version release date
30-
address:
31-
type: string
32-
description: The address of the replying server
33-
time:
34-
type: string
35-
format: date-time
36-
description: Current time in milliseconds since Epoch.
3794
processes:
3895
type: integer
3996
description: Number of spawned processes

paths/general.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,22 @@ configuration:
7878
$ref: '#/definitions/endpoints'
7979
'default':
8080
$ref: '#/responses/DefaultError'
81+
info:
82+
get:
83+
tags:
84+
- Information
85+
summary: Return API, hardware and OS information
86+
description: Return API, hardware and OS information
87+
operationId: getInfo
88+
produces:
89+
- application/json
90+
responses:
91+
'200':
92+
description: Success
93+
schema:
94+
$ref: '#/definitions/info'
95+
'default':
96+
$ref: '#/responses/DefaultError'
8197
process_info:
8298
get:
8399
tags:

0 commit comments

Comments
 (0)