Skip to content

Commit

Permalink
feat(monitoring): install prometheus and add /actuator/prometheus end…
Browse files Browse the repository at this point in the history
…point (#1714)
  • Loading branch information
SelmaBergstrand authored Oct 31, 2024
1 parent 457f178 commit 01e3206
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 1 deletion.
15 changes: 15 additions & 0 deletions tavla/app/actuator/prometheus/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import client from 'prom-client'

const collectDefaultMetrics = client.collectDefaultMetrics
const Registry = client.Registry
const register = new Registry()
collectDefaultMetrics({ register })

export async function GET() {
const metrics = await register.metrics()
return new Response(metrics, {
headers: {
'Content-Type': register.contentType,
},
})
}
4 changes: 4 additions & 0 deletions tavla/helm/tavla/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ common:
trafficType: public
service:
internalPort: 3000
deployment:
prometheus:
path: /actuator/prometheus
container:
image: <+artifacts.primary.image>
cpu: 0.3
Expand Down Expand Up @@ -46,6 +49,7 @@ common:
periodSeconds: 5
successThreshold: 1
timeoutSeconds: 1

configmap:
enabled: true
data:
Expand Down
1 change: 1 addition & 0 deletions tavla/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
"pino": "9.5.0",
"pino-pretty": "11.3.0",
"posthog-js": "1.176.0",
"prom-client": "15.1.3",
"react": "18.3.1",
"react-dom": "18.3.1",
"sharp": "0.33.5",
Expand Down
29 changes: 28 additions & 1 deletion tavla/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3302,7 +3302,7 @@ __metadata:
languageName: node
linkType: hard

"@opentelemetry/api@npm:^1.3.0, @opentelemetry/api@npm:~1.9.0":
"@opentelemetry/api@npm:^1.3.0, @opentelemetry/api@npm:^1.4.0, @opentelemetry/api@npm:~1.9.0":
version: 1.9.0
resolution: "@opentelemetry/api@npm:1.9.0"
checksum: 9e88e59d53ced668f3daaecfd721071c5b85a67dd386f1c6f051d1be54375d850016c881f656ffbe9a03bedae85f7e89c2f2b635313f9c9b195ad033cdc31020
Expand Down Expand Up @@ -4830,6 +4830,13 @@ __metadata:
languageName: node
linkType: hard

"bintrees@npm:1.0.2":
version: 1.0.2
resolution: "bintrees@npm:1.0.2"
checksum: 56a52b7d3634e30002b1eda740d2517a22fa8e9e2eb088e919f37c030a0ed86e364ab59e472fc770fc8751308054bb1c892979d150e11d9e11ac33bcc1b5d16e
languageName: node
linkType: hard

"bl@npm:^4.1.0":
version: 4.1.0
resolution: "bl@npm:4.1.0"
Expand Down Expand Up @@ -12080,6 +12087,16 @@ __metadata:
languageName: node
linkType: hard

"prom-client@npm:15.1.3":
version: 15.1.3
resolution: "prom-client@npm:15.1.3"
dependencies:
"@opentelemetry/api": ^1.4.0
tdigest: ^0.1.1
checksum: 9a57f3c16f39aa9a03da021883a4231c0bb56fc9d02f6ef9c28f913379f275640a5a33b98d9946ebf53c71011a29b580e9d2d6e3806cb1c229a3f59c65993968
languageName: node
linkType: hard

"promise-breaker@npm:^6.0.0":
version: 6.0.0
resolution: "promise-breaker@npm:6.0.0"
Expand Down Expand Up @@ -14134,6 +14151,7 @@ __metadata:
postcss: 8.4.47
posthog-js: 1.176.0
prettier: 3.3.3
prom-client: 15.1.3
react: 18.3.1
react-dom: 18.3.1
sharp: 0.33.5
Expand All @@ -14153,6 +14171,15 @@ __metadata:
languageName: node
linkType: hard

"tdigest@npm:^0.1.1":
version: 0.1.2
resolution: "tdigest@npm:0.1.2"
dependencies:
bintrees: 1.0.2
checksum: 44de8246752b6f8c2924685f969fd3d94c36949f22b0907e99bef2b2220726dd8467f4730ea96b06040b9aa2587c0866049640039d1b956952dfa962bc2075a3
languageName: node
linkType: hard

"teamcity-service-messages@npm:^0.1.14":
version: 0.1.14
resolution: "teamcity-service-messages@npm:0.1.14"
Expand Down

0 comments on commit 01e3206

Please sign in to comment.