Log stats with the username bound

This commit is contained in:
Daniel García Aubert 2020-07-23 11:58:52 +02:00
parent df604adc2a
commit 1eae4ee41f
3 changed files with 6 additions and 4 deletions

View File

@ -31,9 +31,9 @@ module.exports = class CopyController {
const copyFromMiddlewares = endpointGroup => { const copyFromMiddlewares = endpointGroup => {
return [ return [
initLogger({ logger: this.logger }), initLogger({ logger: this.logger }),
user(this.metadataBackend),
profiler({ statsClient: this.statsdClient }), profiler({ statsClient: this.statsdClient }),
tag({ tags: ['ingestion', 'copyfrom'] }), tag({ tags: ['ingestion', 'copyfrom'] }),
user(this.metadataBackend),
rateLimits(this.userLimitsService, endpointGroup), rateLimits(this.userLimitsService, endpointGroup),
authorization(this.metadataBackend), authorization(this.metadataBackend),
connectionParams(this.userDatabaseService), connectionParams(this.userDatabaseService),
@ -47,10 +47,10 @@ module.exports = class CopyController {
const copyToMiddlewares = endpointGroup => { const copyToMiddlewares = endpointGroup => {
return [ return [
initLogger({ logger: this.logger, logOnEvent: 'log' }), initLogger({ logger: this.logger, logOnEvent: 'log' }),
user(this.metadataBackend),
profiler({ statsClient: this.statsdClient, logOnEvent: 'log' }), profiler({ statsClient: this.statsdClient, logOnEvent: 'log' }),
tag({ tags: ['ingestion', 'copyto'], logOnEvent: 'log' }), tag({ tags: ['ingestion', 'copyto'], logOnEvent: 'log' }),
bodyParser(), bodyParser(),
user(this.metadataBackend),
rateLimits(this.userLimitsService, endpointGroup), rateLimits(this.userLimitsService, endpointGroup),
authorization(this.metadataBackend), authorization(this.metadataBackend),
connectionParams(this.userDatabaseService), connectionParams(this.userDatabaseService),

View File

@ -34,6 +34,7 @@ module.exports = class JobController {
sqlRouter.post('/job', [ sqlRouter.post('/job', [
initLogger({ logger: this.logger }), initLogger({ logger: this.logger }),
user(this.metadataBackend),
profiler({ statsClient: this.statsdClient }), profiler({ statsClient: this.statsdClient }),
tag({ tags: ['job', 'create'] }), tag({ tags: ['job', 'create'] }),
bodyParser(), bodyParser(),
@ -44,6 +45,7 @@ module.exports = class JobController {
sqlRouter.get('/job/:job_id', [ sqlRouter.get('/job/:job_id', [
initLogger({ logger: this.logger }), initLogger({ logger: this.logger }),
user(this.metadataBackend),
profiler({ statsClient: this.statsdClient }), profiler({ statsClient: this.statsdClient }),
tag({ tags: ['job', 'retrieve'] }), tag({ tags: ['job', 'retrieve'] }),
bodyParser(), bodyParser(),
@ -52,6 +54,7 @@ module.exports = class JobController {
sqlRouter.delete('/job/:job_id', [ sqlRouter.delete('/job/:job_id', [
initLogger({ logger: this.logger }), initLogger({ logger: this.logger }),
user(this.metadataBackend),
profiler({ statsClient: this.statsdClient }), profiler({ statsClient: this.statsdClient }),
tag({ tags: ['job', 'cancel'] }), tag({ tags: ['job', 'cancel'] }),
bodyParser(), bodyParser(),
@ -65,7 +68,6 @@ function composeJobMiddlewares (metadataBackend, userDatabaseService, jobService
const forceToBeMaster = true; const forceToBeMaster = true;
return [ return [
user(metadataBackend),
rateLimits(userLimitsService, endpointGroup), rateLimits(userLimitsService, endpointGroup),
authorization(metadataBackend, forceToBeMaster), authorization(metadataBackend, forceToBeMaster),
connectionParams(userDatabaseService), connectionParams(userDatabaseService),

View File

@ -40,10 +40,10 @@ module.exports = class QueryController {
const queryMiddlewares = () => { const queryMiddlewares = () => {
return [ return [
initLogger({ logger: this.logger }), initLogger({ logger: this.logger }),
user(this.metadataBackend),
profiler({ statsClient: this.statsdClient }), profiler({ statsClient: this.statsdClient }),
tag({ tags: ['query'] }), tag({ tags: ['query'] }),
bodyParser(), bodyParser(),
user(this.metadataBackend),
rateLimits(this.userLimitsService, RATE_LIMIT_ENDPOINTS_GROUPS.QUERY), rateLimits(this.userLimitsService, RATE_LIMIT_ENDPOINTS_GROUPS.QUERY),
authorization(this.metadataBackend, forceToBeMaster), authorization(this.metadataBackend, forceToBeMaster),
connectionParams(this.userDatabaseService), connectionParams(this.userDatabaseService),