Skip to content

Commit ff4905b

Browse files
KrisSimonclaude
andcommitted
Add GET /metrics endpoint with Prometheus output
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2456e70 commit ff4905b

File tree

2 files changed

+39
-23
lines changed

2 files changed

+39
-23
lines changed

api.aro

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,47 @@
11
(* HTTP Route Handlers *)
22

33
(serveStatic: StatusPost API) {
4-
<Extract> the <file> from the <pathParameters: file>.
5-
<Create> the <template-path> with "static/" ++ <file>.
6-
<Transform> the <content> from the <template: template-path>.
7-
<Return> an <OK: status> with <content>.
4+
Extract the <file> from the <pathParameters: file>.
5+
Create the <template-path> with "static/" ++ <file>.
6+
Transform the <content> from the <template: template-path>.
7+
Return an <OK: status> with <content>.
88
}
99

1010
(homePage: StatusPost API) {
11-
<Retrieve> the <all-messages> from the <message-repository>.
12-
<Extract> the <recent-messages: 0-19> from the <all-messages>.
13-
<Transform> the <html> from the <template: index.html>.
14-
<Return> an <OK: status> with <html>.
11+
Retrieve the <all-messages> from the <message-repository>.
12+
Extract the <recent-messages: 0-19> from the <all-messages>.
13+
Transform the <html> from the <template: index.html>.
14+
Return an <OK: status> with <html>.
1515
}
1616

1717
(getMessages: StatusPost API) {
18-
<Retrieve> the <all-messages> from the <message-repository>.
19-
<Extract> the <recent-messages: 0-19> from the <all-messages>.
20-
<Return> an <OK: status> with <recent-messages>.
18+
Retrieve the <all-messages> from the <message-repository>.
19+
Extract the <recent-messages: 0-19> from the <all-messages>.
20+
Return an <OK: status> with <recent-messages>.
2121
}
2222

2323
(postMessage: StatusPost API) {
24-
<Extract> the <body> from the <request: body>.
25-
<Extract> the <message-text: message> from the <body>.
26-
<Create> the <message: Message> with {
24+
Extract the <body> from the <request: body>.
25+
Extract the <message-text: message> from the <body>.
26+
Create the <message: Message> with {
2727
message: <message-text>,
2828
createdAt: <now>
2929
}.
30-
<Store> the <message> into the <message-repository>.
31-
<Broadcast> the <message> to the <websocket>.
32-
<Return> a <Created: status> with <message>.
30+
Store the <message> into the <message-repository>.
31+
Broadcast the <message> to the <websocket>.
32+
Return a <Created: status> with <message>.
33+
}
34+
35+
(getMetrics: StatusPost API) {
36+
Return an <OK: status> with <metrics: prometheus>.
3337
}
3438

3539
(* Repository Observer - cleanup when message count exceeds 40 *)
3640
(Cleanup Messages: message-repository Observer) when <message-repository: count> > 40 {
37-
<Retrieve> the <all-messages> from the <message-repository>.
38-
<Extract> the <keep-messages: 0-19> from the <all-messages>.
39-
<Clear> the <all> from the <message-repository>.
40-
<Store> the <keep-messages> into the <message-repository>.
41-
<Log> "Cleaned up messages, kept last 20" to the <console>.
42-
<Return> an <OK: status> for the <cleanup>.
41+
Retrieve the <all-messages> from the <message-repository>.
42+
Extract the <keep-messages: 0-19> from the <all-messages>.
43+
Clear the <all> from the <message-repository>.
44+
Store the <keep-messages> into the <message-repository>.
45+
Log "Cleaned up messages, kept last 20" to the <console>.
46+
Return an <OK: status> for the <cleanup>.
4347
}

openapi.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ paths:
7272
schema:
7373
$ref: '#/components/schemas/Message'
7474

75+
/metrics:
76+
get:
77+
operationId: getMetrics
78+
summary: Prometheus metrics
79+
responses:
80+
'200':
81+
description: ARO runtime metrics in Prometheus text exposition format
82+
content:
83+
text/plain:
84+
schema:
85+
type: string
86+
7587
components:
7688
schemas:
7789
Message:

0 commit comments

Comments
 (0)