add prometheus metrics



git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-aggregator-portal/trunk@55839 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
argiro.kokogiannaki 2019-05-28 13:27:12 +00:00
parent f773e0ca7e
commit a2daeed004
2 changed files with 79 additions and 75 deletions

View File

@ -46,31 +46,31 @@ export class Prometheus {
help: 'organization Landing Page Counter', help: 'organization Landing Page Counter',
registers: [this.register] registers: [this.register]
})], })],
["/participate/deposit-datasets", new prom.Counter({ // ["/participate/deposit-datasets", new prom.Counter({
name: 'participate_deposit_datasets', // name: 'participate_deposit_datasets',
help: 'Participate Deposit Datasets Page Counter', // help: 'Participate Deposit Datasets Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/participate/deposit-datasets-result", new prom.Counter({ // ["/participate/deposit-datasets-result", new prom.Counter({
name: 'participate_deposit_datasets_result', // name: 'participate_deposit_datasets_result',
help: 'Participate Deposit Datasets Result Page Counter', // help: 'Participate Deposit Datasets Result Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/participate/deposit-subject-result", new prom.Counter({ // ["/participate/deposit-subject-result", new prom.Counter({
name: 'participate_deposit_subject_result', // name: 'participate_deposit_subject_result',
help: 'Participate Deposit Subject Result Page Counter', // help: 'Participate Deposit Subject Result Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/participate/deposit-publications", new prom.Counter({ // ["/participate/deposit-publications", new prom.Counter({
name: 'participate_deposit_publications', // name: 'participate_deposit_publications',
help: 'Participate Deposit Publications Page Counter', // help: 'Participate Deposit Publications Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/participate/deposit-publications-result", new prom.Counter({ // ["/participate/deposit-publications-result", new prom.Counter({
name: 'participate_deposit_publications_result', // name: 'participate_deposit_publications_result',
help: 'Participate Deposit Publications Result Page Counter', // help: 'Participate Deposit Publications Result Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/search/find", new prom.Counter({ ["/search/find", new prom.Counter({
name: 'search_find', name: 'search_find',
help: 'Main Search Page Counter', help: 'Main Search Page Counter',
@ -111,36 +111,36 @@ export class Prometheus {
help: 'Organizations Search Page Counter', help: 'Organizations Search Page Counter',
registers: [this.register] registers: [this.register]
})], })],
["/search/content-providers", new prom.Counter({ // ["/search/content-providers", new prom.Counter({
name: 'search_content_providers', // name: 'search_content_providers',
help: 'Repositories Search Page Counter', // help: 'Repositories Search Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/search/content-providers-table", new prom.Counter({ // ["/search/content-providers-table", new prom.Counter({
name: 'search_content_providers_table', // name: 'search_content_providers_table',
help: 'Repositories Search Page Table Counter', // help: 'Repositories Search Page Table Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/search/entity-registries", new prom.Counter({ // ["/search/entity-registries", new prom.Counter({
name: 'search_entity_registries', // name: 'search_entity_registries',
help: 'Registries Search Page Counter', // help: 'Registries Search Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/search/entity-registries-table", new prom.Counter({ // ["/search/entity-registries-table", new prom.Counter({
name: 'search_entity_registries_table', // name: 'search_entity_registries_table',
help: 'Registries Search Page Table Counter', // help: 'Registries Search Page Table Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/search/journals", new prom.Counter({ // ["/search/journals", new prom.Counter({
name: 'search_journals', // name: 'search_journals',
help: 'Journals Search Page Counter', // help: 'Journals Search Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/search/journals-table", new prom.Counter({ // ["/search/journals-table", new prom.Counter({
name: 'search_journals_table', // name: 'search_journals_table',
help: 'Journals Search Page Table Counter', // help: 'Journals Search Page Table Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/search/advanced/publications", new prom.Counter({ ["/search/advanced/publications", new prom.Counter({
name: 'search_advanced_publications', name: 'search_advanced_publications',
help: 'Publications Advanced Search Page Counter', help: 'Publications Advanced Search Page Counter',
@ -176,25 +176,25 @@ export class Prometheus {
help: 'Organizations Advanced Search Page Counter', help: 'Organizations Advanced Search Page Counter',
registers: [this.register] registers: [this.register]
})], })],
["/myclaims", new prom.Counter({ // ["/myclaims", new prom.Counter({
name: 'my_claims', // name: 'my_claims',
help: 'My Claims Page Counter', // help: 'My Claims Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/claims", new prom.Counter({ // ["/claims", new prom.Counter({
name: 'claims', // name: 'claims',
help: 'Admin Claims Page Counter', // help: 'Admin Claims Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/participate/claim", new prom.Counter({ // ["/participate/claim", new prom.Counter({
name: 'participate_claim', // name: 'participate_claim',
help: 'Linking Page Counter', // help: 'Linking Page Counter',
registers: [this.register] // registers: [this.register]
})], // })],
["/participate/direct-claim", new prom.Counter({ // ["/participate/direct-claim", new prom.Counter({
name: 'participate_direct_claim', // name: 'participate_direct_claim',
help: 'Direct Linking Page Counter', // help: 'Direct Linking Page Counter',
registers: [this.register] // registers: [this.register]
})] // })]
]); ]);
} }

View File

@ -65,6 +65,10 @@ app.get('*.*', express.static(join(DIST_FOLDER, 'browser'), {
maxAge: '1y' maxAge: '1y'
})); }));
app.get('/metrics', (req, res) => {
res.set('Content-Type', prometheus.register.contentType);
res.end(prometheus.register.metrics());
});
// All regular routes use the Universal engine // All regular routes use the Universal engine
app.get('*', (req, res) => { app.get('*', (req, res) => {
let start = new Date(); let start = new Date();