Skip to content

Commit

Permalink
Merge pull request #4586 from UniversityOfHelsinkiCS/OOD-13-no-winsto…
Browse files Browse the repository at this point in the history
…nGelf-for-fd

OOD-13: no winston gelf for fd
  • Loading branch information
valtterikantanen authored Jul 30, 2024
2 parents 9aa1bdf + 0966a04 commit 24579c2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions docker-compose.fd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ services:
volumes:
- ./environments/ha:/opt/app-root/src/src/environment
- ./services/backend/src:/opt/app-root/src/src

frontend:
<<: *defaults
build:
Expand Down Expand Up @@ -124,6 +125,7 @@ services:
SIS_IMPORTER_USER: dev
SIS_NATS_TOKEN: dev
SIS_NATS_URI: sis-updater-nats://sis-updater-nats:4222
SERVICE_PROVIDER: fd
ports:
- 8082:8082
volumes:
Expand Down Expand Up @@ -155,6 +157,7 @@ services:
SIS_NATS_TOKEN: dev
SIS_NATS_URI: sis-updater-nats://sis-updater-nats:4222
ROOT_ORG_ID: ${ROOT_ORG_ID}
SERVICE_PROVIDER: fd
volumes:
- ./updater/sis-updater-worker/:/opt/app-root/src

Expand Down
4 changes: 2 additions & 2 deletions services/backend/src/util/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const os = require('os')
const winston = require('winston')
const { WinstonGelfTransporter } = require('winston-gelf-transporter')

const { isProduction } = require('../config')
const { isProduction, serviceProvider } = require('../config')

const { colorize, combine, timestamp, printf } = winston.format

const transports = [new winston.transports.Console()]

if (isProduction) {
if (isProduction && serviceProvider !== 'Fd') {
transports.push(
new WinstonGelfTransporter({
handleExceptions: true,
Expand Down
1 change: 1 addition & 0 deletions updater/sis-updater-scheduler/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ module.exports.SCHEDULE_IMMEDIATE = process.env.SCHEDULE_IMMEDIATE?.split(',') |
module.exports.ENABLE_WORKER_REPORTING =
module.exports.EXIT_AFTER_IMMEDIATES || process.env.ENABLE_WORKER_REPORTING === 'yes'
module.exports.SLACK_WEBHOOK = process.env.SLACK_WEBHOOK
module.exports.serviceProvider = process.env.SERVICE_PROVIDER || ''

// Sentry
module.exports.sentryRelease = process.env.SENTRY_RELEASE || ''
Expand Down
3 changes: 2 additions & 1 deletion updater/sis-updater-scheduler/src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
sentryEnvironment,
sentryDSN,
runningInCI,
serviceProvider,
} = require('../config')

const { combine, timestamp, printf, splat } = winston.format
Expand Down Expand Up @@ -64,7 +65,7 @@ if (isDev) {

transports.push(new winston.transports.Console({ format: combine(splat(), timestamp(), prodFormat) }))

if (isProduction && !isStaging) {
if (isProduction && !isStaging && serviceProvider !== 'fd') {
transports.push(
new WinstonGelfTransporter({
handleExceptions: true,
Expand Down
1 change: 1 addition & 0 deletions updater/sis-updater-worker/src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports.REDIS_TOTAL_STUDENTS_DONE_KEY = 'TOTAL_STUDENTS_DONE'
module.exports.REDIS_LATEST_MESSAGE_RECEIVED = 'LATEST_MESSAGE_RECEIVED'
module.exports.REDIS_LAST_COMPLETED_SCHEDULE = 'LAST_COMPLETED_SCHEDULE'
module.exports.rootOrgId = process.env.ROOT_ORG_ID || 'hy-university-root-id'
module.exports.serviceProvider = process.env.SERVICE_PROVIDER || ''

// Sentry
module.exports.sentryRelease = process.env.SENTRY_RELEASE || ''
Expand Down
3 changes: 2 additions & 1 deletion updater/sis-updater-worker/src/utils/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const {
sentryEnvironment,
sentryDSN,
runningInCI,
serviceProvider,
} = require('../config')

const { colorize, combine, timestamp, printf, uncolorize } = winston.format
Expand Down Expand Up @@ -54,7 +55,7 @@ transports.push(
})
)

if (isProduction && !isStaging) {
if (isProduction && !isStaging && serviceProvider !== 'fd') {
transports.push(
new WinstonGelfTransporter({
handleExceptions: true,
Expand Down

0 comments on commit 24579c2

Please sign in to comment.