Skip to content

Commit

Permalink
config: Add Prometheus config
Browse files Browse the repository at this point in the history
The application now features a [/metrics endpoint][1] for Prometheus to
scrape. Since merging, the configuration file structure has been updated
since through [another PR][2].

This change requires both changes to be in the application and
afterwards allows enabling the endpoint and an engineer to configure
scraping of the data.

[1]: FlowFuse/flowfuse#2889
[2]: FlowFuse/flowfuse#2893
  • Loading branch information
ZJvandeWeg committed Oct 5, 2023
1 parent 8190f89 commit 3ac5e86
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions helm/flowforge/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ Enables FlowForge Telemetry
- `forge.telemetry.sentry.frontend_dsn` enables sentry reporting if set
- `forge.telemetry.sentry.backend_dsn` enables sentry reporting if set
- `forge.telemetry.sentry.production_mode` rate limit reporting (default `true`)
- `forge.telemetry.prometheus.enabled` enables the `/metrics` endpoint on the forge app for scraping by Prometheus

### Support

Expand Down
2 changes: 2 additions & 0 deletions helm/flowforge/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ data:
backend:
sentry:
dsn: {{ .Values.forge.telemetry.sentry.backend_dsn}}
prometheus:
enabled: {{ .Values.forge.telemetry.prometheus.enabled }}
{{ end -}}
{{- if .Values.forge.support.enabled }}
support:
Expand Down
8 changes: 8 additions & 0 deletions helm/flowforge/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,14 @@
"type": "boolean"
}
}
},
"prometheus": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
}
}
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions test/customizations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ forge:
production_mode: false
frontend_dsn: 'https://sentry.io/flowforge/flowforge-frontend'
backend_dsn: 'https://sentry.io/flowforge/flowforge-backend'
prometheus:
enabled: true
support:
enabled: true
hubspot: 12345678
Expand Down
8 changes: 7 additions & 1 deletion test/unit/configmap_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ describe('Examine Config Maps', function () {
const d = configMaps.filter(doc => doc.metadata.name === 'flowforge-config')[0]
yml = yaml.parse(d.data['flowforge.yml'])
})

it('has sentry telemetry', function () {
console.log(yml.telemetry)
yml.telemetry.frontend.sentry.should.have.property('production_mode')
yml.telemetry.frontend.sentry.production_mode.should.equal(false)

Expand All @@ -127,5 +127,11 @@ describe('Examine Config Maps', function () {
yml.telemetry.backend.sentry.should.have.property('dsn')
yml.telemetry.backend.sentry.dsn.should.equal('https://sentry.io/flowforge/flowforge-backend')
})

describe('using Prometheus', function () {
it('has prometheus enabled', function() {
yml.telemetry.prometheus.enabled.should.equal(true)
})
})
})
})

0 comments on commit 3ac5e86

Please sign in to comment.