-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CON-181 Add prometheus metrics to CN #3166
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
a20877f
Add prometheus to CN + duration metrics to all requests
SidSethi c16d74d
Merge branch 'master' into ss-cn-prom
SidSethi bde9f32
Merge branch 'master' into ss-cn-prom
SidSethi f74288b
Merge branch 'master' into ss-cn-prom
SidSethi 5925bc2
wip
SidSethi 4a42a01
moar
SidSethi 1e2c073
Merge branch 'master' into ss-cn-prom
SidSethi c5612b0
wip fixes
SidSethi ca32678
Merge branch 'master' into ss-cn-prom
SidSethi eae7556
wip
SidSethi 5287be5
testwip
SidSethi 7cffbcb
Working test
SidSethi e424700
Merge branch 'master' into ss-cn-prom
SidSethi a7f5b67
code review
SidSethi c00fe48
more fixes + docs
SidSethi 1a9570f
more code cleanup
SidSethi 147ae52
README
SidSethi 608b26d
Fix tests
SidSethi 40bbc50
docs
SidSethi e707ca5
Fix prometheus test
SidSethi 3392174
Merge branch 'master' into ss-cn-prom
SidSethi 1d3e768
README
SidSethi 3bb00a2
Code review
SidSethi 5516909
code review
SidSethi 551548f
Merge branch 'master' into ss-cn-prom
SidSethi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/** | ||
* Exposes Prometheus metrics at `GET /prometheus_metrics` | ||
*/ | ||
module.exports = function (app) { | ||
app.get('/prometheus_metrics', async (req, res) => { | ||
const prometheusRegistry = req.app.get('serviceRegistry').prometheusRegistry | ||
const metricData = await prometheusRegistry.getAllMetricData() | ||
|
||
res.setHeader('Content-Type', prometheusRegistry.registry.contentType) | ||
return res.end(metricData) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
const { createBullBoard } = require('@bull-board/api') | ||
const { BullAdapter } = require('@bull-board/api/bullAdapter') | ||
const { ExpressAdapter } = require('@bull-board/express') | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just moved lines from below |
||
const { libs: AudiusLibs } = require('@audius/sdk') | ||
const redisClient = require('./redis') | ||
const BlacklistManager = require('./blacklistManager') | ||
|
@@ -6,10 +10,6 @@ const config = require('./config') | |
const URSMRegistrationManager = require('./services/URSMRegistrationManager') | ||
const { logger } = require('./logging') | ||
const utils = require('./utils') | ||
const { createBullBoard } = require('@bull-board/api') | ||
const { BullAdapter } = require('@bull-board/api/bullAdapter') | ||
const { ExpressAdapter } = require('@bull-board/express') | ||
|
||
const MonitoringQueue = require('./monitors/MonitoringQueue') | ||
const SyncQueue = require('./services/sync/syncQueue') | ||
const SkippedCIDsRetryQueue = require('./services/sync/skippedCIDsRetryService') | ||
|
@@ -19,6 +19,7 @@ const TrustedNotifierManager = require('./services/TrustedNotifierManager') | |
const ImageProcessingQueue = require('./ImageProcessingQueue') | ||
const TranscodingQueue = require('./TranscodingQueue') | ||
const StateMachineManager = require('./services/stateMachineManager') | ||
const PrometheusRegistry = require('./services/prometheusMonitoring/prometheusRegistry') | ||
|
||
/** | ||
* `ServiceRegistry` is a container responsible for exposing various | ||
|
@@ -45,6 +46,7 @@ class ServiceRegistry { | |
this.blacklistManager = BlacklistManager | ||
this.monitoringQueue = new MonitoringQueue() | ||
this.sessionExpirationQueue = new SessionExpirationQueue() | ||
this.prometheusRegistry = new PrometheusRegistry() | ||
|
||
// below services are initialized separately in below functions `initServices()` and `initServicesThatRequireServer()` | ||
this.libs = null | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i just used this as an example of a Gauge metric - the previous example in Monitors was actually broken