fix: remove open telemetry from code (#903)
This commit is contained in:
parent
11514e3836
commit
751f3b2547
28 changed files with 66 additions and 208 deletions
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
|
||||||
import { EmailLevel, ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AnalyticsScheduledTask })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
|
||||||
|
@ -22,6 +16,7 @@ import { CalculateMonthlyRecurringRevenue } from '../src/Domain/UseCase/Calculat
|
||||||
import { getBody, getSubject } from '../src/Domain/Email/DailyAnalyticsReport'
|
import { getBody, getSubject } from '../src/Domain/Email/DailyAnalyticsReport'
|
||||||
import { TimerInterface } from '@standardnotes/time'
|
import { TimerInterface } from '@standardnotes/time'
|
||||||
import { StatisticMeasureName } from '../src/Domain/Statistics/StatisticMeasureName'
|
import { StatisticMeasureName } from '../src/Domain/Statistics/StatisticMeasureName'
|
||||||
|
import { EmailLevel } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const requestReport = async (
|
const requestReport = async (
|
||||||
analyticsStore: AnalyticsStoreInterface,
|
analyticsStore: AnalyticsStoreInterface,
|
||||||
|
@ -275,9 +270,6 @@ void container.load().then((container) => {
|
||||||
|
|
||||||
logger.info(`Sending report to following admins: ${adminEmails}`)
|
logger.info(`Sending report to following admins: ${adminEmails}`)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.AnalyticsScheduledTask, 'report')
|
|
||||||
|
|
||||||
Promise.resolve(
|
Promise.resolve(
|
||||||
requestReport(
|
requestReport(
|
||||||
analyticsStore,
|
analyticsStore,
|
||||||
|
@ -293,15 +285,11 @@ void container.load().then((container) => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info('Usage report generation complete')
|
logger.info('Usage report generation complete')
|
||||||
|
|
||||||
tracer.stopSpan()
|
|
||||||
|
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
logger.error(`Could not finish usage report generation: ${error.message}`)
|
logger.error(`Could not finish usage report generation: ${error.message}`)
|
||||||
|
|
||||||
tracer.stopSpanWithError(error)
|
|
||||||
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AnalyticsWorker })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
|
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
|
||||||
import * as dayjs from 'dayjs'
|
import * as dayjs from 'dayjs'
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
DomainEventPublisherInterface,
|
DomainEventPublisherInterface,
|
||||||
DomainEventSubscriberInterface,
|
DomainEventSubscriberInterface,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { MapperInterface, ServiceIdentifier } from '@standardnotes/domain-core'
|
import { MapperInterface } from '@standardnotes/domain-core'
|
||||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const Mixpanel = require('mixpanel')
|
const Mixpanel = require('mixpanel')
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ import TYPES from './Types'
|
||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
|
SQSDomainEventSubscriber,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryDomainEventSubscriber,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { Timer, TimerInterface } from '@standardnotes/time'
|
import { Timer, TimerInterface } from '@standardnotes/time'
|
||||||
import { PeriodKeyGeneratorInterface } from '../Domain/Time/PeriodKeyGeneratorInterface'
|
import { PeriodKeyGeneratorInterface } from '../Domain/Time/PeriodKeyGeneratorInterface'
|
||||||
|
@ -139,9 +139,7 @@ export class ContainerConfigLoader {
|
||||||
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
||||||
.toConstantValue(
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
new SNSOpenTelemetryDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)),
|
|
||||||
)
|
|
||||||
if (env.get('MIXPANEL_TOKEN', true)) {
|
if (env.get('MIXPANEL_TOKEN', true)) {
|
||||||
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(env.get('MIXPANEL_TOKEN', true)))
|
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(env.get('MIXPANEL_TOKEN', true)))
|
||||||
}
|
}
|
||||||
|
@ -242,8 +240,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
|
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryDomainEventSubscriber(
|
new SQSDomainEventSubscriber(
|
||||||
ServiceIdentifier.NAMES.AnalyticsWorker,
|
|
||||||
container.get<SQSClient>(TYPES.SQS),
|
container.get<SQSClient>(TYPES.SQS),
|
||||||
container.get<string>(TYPES.SQS_QUEUE_URL),
|
container.get<string>(TYPES.SQS_QUEUE_URL),
|
||||||
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
|
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.ApiGateway })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import '../src/Controller/LegacyController'
|
import '../src/Controller/LegacyController'
|
||||||
import '../src/Controller/HealthCheckController'
|
import '../src/Controller/HealthCheckController'
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
import { SettingName } from '@standardnotes/domain-core'
|
||||||
import { ServiceIdentifier, SettingName } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Stream } from 'stream'
|
import { Stream } from 'stream'
|
||||||
|
|
||||||
|
@ -106,24 +102,17 @@ void container.load().then((container) => {
|
||||||
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
||||||
const getUserKeyParamsUseCase: GetUserKeyParams = container.get(TYPES.Auth_GetUserKeyParams)
|
const getUserKeyParamsUseCase: GetUserKeyParams = container.get(TYPES.Auth_GetUserKeyParams)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'backup')
|
|
||||||
|
|
||||||
Promise.resolve(
|
Promise.resolve(
|
||||||
requestBackups(settingRepository, roleService, domainEventFactory, domainEventPublisher, getUserKeyParamsUseCase),
|
requestBackups(settingRepository, roleService, domainEventFactory, domainEventPublisher, getUserKeyParamsUseCase),
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`${backupFrequency} ${backupProvider} backup requesting complete`)
|
logger.info(`${backupFrequency} ${backupProvider} backup requesting complete`)
|
||||||
|
|
||||||
tracer.stopSpan()
|
|
||||||
|
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
logger.error(`Could not finish ${backupFrequency} ${backupProvider} backup requesting: ${error.message}`)
|
logger.error(`Could not finish ${backupFrequency} ${backupProvider} backup requesting: ${error.message}`)
|
||||||
|
|
||||||
tracer.stopSpanWithError(error)
|
|
||||||
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
||||||
|
@ -36,22 +30,15 @@ void container.load().then((container) => {
|
||||||
const cleanupSessionTraces: CleanupSessionTraces = container.get(TYPES.Auth_CleanupSessionTraces)
|
const cleanupSessionTraces: CleanupSessionTraces = container.get(TYPES.Auth_CleanupSessionTraces)
|
||||||
const cleanupExpiredSessions: CleanupExpiredSessions = container.get(TYPES.Auth_CleanupExpiredSessions)
|
const cleanupExpiredSessions: CleanupExpiredSessions = container.get(TYPES.Auth_CleanupExpiredSessions)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'cleanup')
|
|
||||||
|
|
||||||
Promise.resolve(cleanup(cleanupSessionTraces, cleanupExpiredSessions))
|
Promise.resolve(cleanup(cleanupSessionTraces, cleanupExpiredSessions))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info('Expired sessions and session traces cleaned.')
|
logger.info('Expired sessions and session traces cleaned.')
|
||||||
|
|
||||||
tracer.stopSpan()
|
|
||||||
|
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
logger.error(`Could not clean sessions and session traces: ${error.message}`)
|
logger.error(`Could not clean sessions and session traces: ${error.message}`)
|
||||||
|
|
||||||
tracer.stopSpanWithError(error)
|
|
||||||
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Auth })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthController'
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthenticatorsController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthenticatorsController'
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedSessionsController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedSessionsController'
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { TimerInterface } from '@standardnotes/time'
|
import { TimerInterface } from '@standardnotes/time'
|
||||||
|
|
||||||
|
@ -26,9 +20,6 @@ void container.load().then((container) => {
|
||||||
const persistStats: PersistStatistics = container.get(TYPES.Auth_PersistStatistics)
|
const persistStats: PersistStatistics = container.get(TYPES.Auth_PersistStatistics)
|
||||||
const timer: TimerInterface = container.get(TYPES.Auth_Timer)
|
const timer: TimerInterface = container.get(TYPES.Auth_Timer)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'stats')
|
|
||||||
|
|
||||||
Promise.resolve(
|
Promise.resolve(
|
||||||
persistStats.execute({
|
persistStats.execute({
|
||||||
sessionsInADay: timer.getUTCDateNDaysAgo(1),
|
sessionsInADay: timer.getUTCDateNDaysAgo(1),
|
||||||
|
@ -37,15 +28,11 @@ void container.load().then((container) => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info('Stats persisted.')
|
logger.info('Stats persisted.')
|
||||||
|
|
||||||
tracer.stopSpan()
|
|
||||||
|
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
logger.error(`Could not persist stats: ${error.message}`)
|
logger.error(`Could not persist stats: ${error.message}`)
|
||||||
|
|
||||||
tracer.stopSpanWithError(error)
|
|
||||||
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
|
||||||
import { Email, ServiceIdentifier, SettingName } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import * as dayjs from 'dayjs'
|
import * as dayjs from 'dayjs'
|
||||||
import * as utc from 'dayjs/plugin/utc'
|
import * as utc from 'dayjs/plugin/utc'
|
||||||
|
@ -21,6 +15,7 @@ import { RoleServiceInterface } from '../src/Domain/Role/RoleServiceInterface'
|
||||||
import { PermissionName } from '@standardnotes/features'
|
import { PermissionName } from '@standardnotes/features'
|
||||||
import { UserRepositoryInterface } from '../src/Domain/User/UserRepositoryInterface'
|
import { UserRepositoryInterface } from '../src/Domain/User/UserRepositoryInterface'
|
||||||
import { GetUserKeyParams } from '../src/Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
|
import { GetUserKeyParams } from '../src/Domain/UseCase/GetUserKeyParams/GetUserKeyParams'
|
||||||
|
import { Email, SettingName } from '@standardnotes/domain-core'
|
||||||
|
|
||||||
const inputArgs = process.argv.slice(2)
|
const inputArgs = process.argv.slice(2)
|
||||||
const backupEmail = inputArgs[0]
|
const backupEmail = inputArgs[0]
|
||||||
|
@ -94,9 +89,6 @@ void container.load().then((container) => {
|
||||||
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
const domainEventPublisher: DomainEventPublisherInterface = container.get(TYPES.Auth_DomainEventPublisher)
|
||||||
const getUserKeyParamsUseCase: GetUserKeyParams = container.get(TYPES.Auth_GetUserKeyParams)
|
const getUserKeyParamsUseCase: GetUserKeyParams = container.get(TYPES.Auth_GetUserKeyParams)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.AuthScheduledTask, 'user_email_backup')
|
|
||||||
|
|
||||||
Promise.resolve(
|
Promise.resolve(
|
||||||
requestBackups(
|
requestBackups(
|
||||||
userRepository,
|
userRepository,
|
||||||
|
@ -110,15 +102,11 @@ void container.load().then((container) => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info(`Email backup requesting complete for ${backupEmail}`)
|
logger.info(`Email backup requesting complete for ${backupEmail}`)
|
||||||
|
|
||||||
tracer.stopSpan()
|
|
||||||
|
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
logger.error(`Could not finish email backup requesting for ${backupEmail}: ${error.message}`)
|
logger.error(`Could not finish email backup requesting for ${backupEmail}: ${error.message}`)
|
||||||
|
|
||||||
tracer.stopSpanWithError(error)
|
|
||||||
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthWorker })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
||||||
|
|
|
@ -79,9 +79,9 @@ import { ExtensionKeyGrantedEventHandler } from '../Domain/Handler/ExtensionKeyG
|
||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
|
SQSDomainEventSubscriber,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryDomainEventSubscriber,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { GetUserSubscription } from '../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
import { GetUserSubscription } from '../Domain/UseCase/GetUserSubscription/GetUserSubscription'
|
||||||
import { ChangeCredentials } from '../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
import { ChangeCredentials } from '../Domain/UseCase/ChangeCredentials/ChangeCredentials'
|
||||||
|
@ -170,7 +170,6 @@ import {
|
||||||
ControllerContainer,
|
ControllerContainer,
|
||||||
ControllerContainerInterface,
|
ControllerContainerInterface,
|
||||||
MapperInterface,
|
MapperInterface,
|
||||||
ServiceIdentifier,
|
|
||||||
SharedVaultUser,
|
SharedVaultUser,
|
||||||
} from '@standardnotes/domain-core'
|
} from '@standardnotes/domain-core'
|
||||||
import { SessionTracePersistenceMapper } from '../Mapping/SessionTracePersistenceMapper'
|
import { SessionTracePersistenceMapper } from '../Mapping/SessionTracePersistenceMapper'
|
||||||
|
@ -379,10 +378,7 @@ export class ContainerConfigLoader {
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
isConfiguredForHomeServer
|
isConfiguredForHomeServer
|
||||||
? directCallDomainEventPublisher
|
? directCallDomainEventPublisher
|
||||||
: new SNSOpenTelemetryDomainEventPublisher(
|
: new SNSDomainEventPublisher(container.get(TYPES.Auth_SNS), container.get(TYPES.Auth_SNS_TOPIC_ARN)),
|
||||||
container.get(TYPES.Auth_SNS),
|
|
||||||
container.get(TYPES.Auth_SNS_TOPIC_ARN),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Mapping
|
// Mapping
|
||||||
|
@ -1514,8 +1510,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberInterface>(TYPES.Auth_DomainEventSubscriber)
|
.bind<DomainEventSubscriberInterface>(TYPES.Auth_DomainEventSubscriber)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryDomainEventSubscriber(
|
new SQSDomainEventSubscriber(
|
||||||
ServiceIdentifier.NAMES.AuthWorker,
|
|
||||||
container.get<SQSClient>(TYPES.Auth_SQS),
|
container.get<SQSClient>(TYPES.Auth_SQS),
|
||||||
container.get<string>(TYPES.Auth_SQS_QUEUE_URL),
|
container.get<string>(TYPES.Auth_SQS_QUEUE_URL),
|
||||||
container.get<DomainEventMessageHandlerInterface>(TYPES.Auth_DomainEventMessageHandler),
|
container.get<DomainEventMessageHandlerInterface>(TYPES.Auth_DomainEventMessageHandler),
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
import { Consumer } from 'sqs-consumer'
|
||||||
|
import { Message, SQSClient } from '@aws-sdk/client-sqs'
|
||||||
|
import { DomainEventSubscriberInterface, DomainEventMessageHandlerInterface } from '@standardnotes/domain-events'
|
||||||
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
|
export class SQSDomainEventSubscriber implements DomainEventSubscriberInterface {
|
||||||
|
constructor(
|
||||||
|
private sqs: SQSClient,
|
||||||
|
private queueUrl: string,
|
||||||
|
private domainEventMessageHandler: DomainEventMessageHandlerInterface,
|
||||||
|
private logger: Logger,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
start(): void {
|
||||||
|
const sqsConsumer = Consumer.create({
|
||||||
|
attributeNames: ['All'],
|
||||||
|
messageAttributeNames: ['All'],
|
||||||
|
queueUrl: this.queueUrl,
|
||||||
|
sqs: this.sqs,
|
||||||
|
handleMessage: this.handleMessage.bind(this),
|
||||||
|
})
|
||||||
|
|
||||||
|
sqsConsumer.on('error', this.handleError.bind(this))
|
||||||
|
sqsConsumer.on('processing_error', this.handleError.bind(this))
|
||||||
|
|
||||||
|
sqsConsumer.start()
|
||||||
|
}
|
||||||
|
|
||||||
|
async handleMessage(message: Message): Promise<void> {
|
||||||
|
await this.domainEventMessageHandler.handleMessage(<string>message.Body)
|
||||||
|
}
|
||||||
|
|
||||||
|
handleError(error: Error): void {
|
||||||
|
this.logger.error('Error occured while handling SQS message: %O', error)
|
||||||
|
}
|
||||||
|
}
|
|
@ -15,6 +15,7 @@ export * from './SNS/SNSDomainEventPublisher'
|
||||||
export * from './SNS/SNSOpenTelemetryDomainEventPublisher'
|
export * from './SNS/SNSOpenTelemetryDomainEventPublisher'
|
||||||
|
|
||||||
export * from './SQS/SQSBounceNotificiationHandler'
|
export * from './SQS/SQSBounceNotificiationHandler'
|
||||||
|
export * from './SQS/SQSDomainEventSubscriber'
|
||||||
export * from './SQS/SQSDomainEventSubscriberFactory'
|
export * from './SQS/SQSDomainEventSubscriberFactory'
|
||||||
export * from './SQS/SQSEventMessageHandler'
|
export * from './SQS/SQSEventMessageHandler'
|
||||||
export * from './SQS/SQSOpenTelemetryDomainEventSubscriber'
|
export * from './SQS/SQSOpenTelemetryDomainEventSubscriber'
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Files })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import * as busboy from 'connect-busboy'
|
import * as busboy from 'connect-busboy'
|
||||||
|
|
||||||
import '../src/Infra/InversifyExpress/AnnotatedFallbackController'
|
import '../src/Infra/InversifyExpress/AnnotatedFallbackController'
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.FilesWorker })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
||||||
|
|
|
@ -16,9 +16,9 @@ import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
|
SQSDomainEventSubscriber,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryDomainEventSubscriber,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { StreamDownloadFile } from '../Domain/UseCase/StreamDownloadFile/StreamDownloadFile'
|
import { StreamDownloadFile } from '../Domain/UseCase/StreamDownloadFile/StreamDownloadFile'
|
||||||
import { FileDownloaderInterface } from '../Domain/Services/FileDownloaderInterface'
|
import { FileDownloaderInterface } from '../Domain/Services/FileDownloaderInterface'
|
||||||
|
@ -52,7 +52,6 @@ import { S3FileMover } from '../Infra/S3/S3FileMover'
|
||||||
import { FSFileMover } from '../Infra/FS/FSFileMover'
|
import { FSFileMover } from '../Infra/FS/FSFileMover'
|
||||||
import { MoveFile } from '../Domain/UseCase/MoveFile/MoveFile'
|
import { MoveFile } from '../Domain/UseCase/MoveFile/MoveFile'
|
||||||
import { SharedVaultValetTokenAuthMiddleware } from '../Infra/InversifyExpress/Middleware/SharedVaultValetTokenAuthMiddleware'
|
import { SharedVaultValetTokenAuthMiddleware } from '../Infra/InversifyExpress/Middleware/SharedVaultValetTokenAuthMiddleware'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
export class ContainerConfigLoader {
|
export class ContainerConfigLoader {
|
||||||
async load(configuration?: {
|
async load(configuration?: {
|
||||||
|
@ -175,10 +174,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.Files_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Files_DomainEventPublisher)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SNSOpenTelemetryDomainEventPublisher(
|
new SNSDomainEventPublisher(container.get(TYPES.Files_SNS), container.get(TYPES.Files_SNS_TOPIC_ARN)),
|
||||||
container.get(TYPES.Files_SNS),
|
|
||||||
container.get(TYPES.Files_SNS_TOPIC_ARN),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,8 +297,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberInterface>(TYPES.Files_DomainEventSubscriber)
|
.bind<DomainEventSubscriberInterface>(TYPES.Files_DomainEventSubscriber)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryDomainEventSubscriber(
|
new SQSDomainEventSubscriber(
|
||||||
ServiceIdentifier.NAMES.FilesWorker,
|
|
||||||
container.get<SQSClient>(TYPES.Files_SQS),
|
container.get<SQSClient>(TYPES.Files_SQS),
|
||||||
container.get<string>(TYPES.Files_SQS_QUEUE_URL),
|
container.get<string>(TYPES.Files_SQS_QUEUE_URL),
|
||||||
container.get<DomainEventMessageHandlerInterface>(TYPES.Files_DomainEventMessageHandler),
|
container.get<DomainEventMessageHandlerInterface>(TYPES.Files_DomainEventMessageHandler),
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Revisions })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import * as cors from 'cors'
|
import * as cors from 'cors'
|
||||||
import { urlencoded, json, Request, Response, NextFunction } from 'express'
|
import { urlencoded, json, Request, Response, NextFunction } from 'express'
|
||||||
import * as winston from 'winston'
|
import * as winston from 'winston'
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.RevisionsWorker })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import TYPES from '../src/Bootstrap/Types'
|
import TYPES from '../src/Bootstrap/Types'
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
import {
|
import { ControllerContainer, ControllerContainerInterface, MapperInterface } from '@standardnotes/domain-core'
|
||||||
ControllerContainer,
|
|
||||||
ControllerContainerInterface,
|
|
||||||
MapperInterface,
|
|
||||||
ServiceIdentifier,
|
|
||||||
} from '@standardnotes/domain-core'
|
|
||||||
import { Container, interfaces } from 'inversify'
|
import { Container, interfaces } from 'inversify'
|
||||||
import { Repository } from 'typeorm'
|
import { Repository } from 'typeorm'
|
||||||
import * as winston from 'winston'
|
import * as winston from 'winston'
|
||||||
|
@ -34,7 +29,7 @@ import {
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
SQSOpenTelemetryDomainEventSubscriber,
|
SQSDomainEventSubscriber,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
|
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
|
||||||
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
||||||
|
@ -342,8 +337,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberInterface>(TYPES.Revisions_DomainEventSubscriber)
|
.bind<DomainEventSubscriberInterface>(TYPES.Revisions_DomainEventSubscriber)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryDomainEventSubscriber(
|
new SQSDomainEventSubscriber(
|
||||||
ServiceIdentifier.NAMES.RevisionsWorker,
|
|
||||||
container.get<SQSClient>(TYPES.Revisions_SQS),
|
container.get<SQSClient>(TYPES.Revisions_SQS),
|
||||||
container.get<string>(TYPES.Revisions_SQS_QUEUE_URL),
|
container.get<string>(TYPES.Revisions_SQS_QUEUE_URL),
|
||||||
container.get<DomainEventMessageHandlerInterface>(TYPES.Revisions_DomainEventMessageHandler),
|
container.get<DomainEventMessageHandlerInterface>(TYPES.Revisions_DomainEventMessageHandler),
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SchedulerScheduledTask })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import * as dayjs from 'dayjs'
|
import * as dayjs from 'dayjs'
|
||||||
import * as utc from 'dayjs/plugin/utc'
|
import * as utc from 'dayjs/plugin/utc'
|
||||||
|
@ -35,22 +29,15 @@ void container.load().then((container) => {
|
||||||
|
|
||||||
const verifyPredicates: VerifyPredicates = container.get(TYPES.VerifyPredicates)
|
const verifyPredicates: VerifyPredicates = container.get(TYPES.VerifyPredicates)
|
||||||
|
|
||||||
const tracer = new OpenTelemetryTracer()
|
|
||||||
tracer.startSpan(ServiceIdentifier.NAMES.SchedulerScheduledTask, 'verify')
|
|
||||||
|
|
||||||
Promise.resolve(verifyJobs(now, verifyPredicates))
|
Promise.resolve(verifyJobs(now, verifyPredicates))
|
||||||
.then(() => {
|
.then(() => {
|
||||||
logger.info('Verification of overdue jobs complete.')
|
logger.info('Verification of overdue jobs complete.')
|
||||||
|
|
||||||
tracer.stopSpan()
|
|
||||||
|
|
||||||
process.exit(0)
|
process.exit(0)
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
logger.error(`Could not finish verification of overdue jobs: ${error.message}`)
|
logger.error(`Could not finish verification of overdue jobs: ${error.message}`)
|
||||||
|
|
||||||
tracer.stopSpanWithError(error)
|
|
||||||
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SchedulerWorker })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
|
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
|
||||||
import * as dayjs from 'dayjs'
|
import * as dayjs from 'dayjs'
|
||||||
|
|
|
@ -15,9 +15,9 @@ import TYPES from './Types'
|
||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
|
SQSDomainEventSubscriber,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryDomainEventSubscriber,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { Timer, TimerInterface } from '@standardnotes/time'
|
import { Timer, TimerInterface } from '@standardnotes/time'
|
||||||
import { PredicateRepositoryInterface } from '../Domain/Predicate/PredicateRepositoryInterface'
|
import { PredicateRepositoryInterface } from '../Domain/Predicate/PredicateRepositoryInterface'
|
||||||
|
@ -35,7 +35,6 @@ import { VerifyPredicates } from '../Domain/UseCase/VerifyPredicates/VerifyPredi
|
||||||
import { UserRegisteredEventHandler } from '../Domain/Handler/UserRegisteredEventHandler'
|
import { UserRegisteredEventHandler } from '../Domain/Handler/UserRegisteredEventHandler'
|
||||||
import { SubscriptionCancelledEventHandler } from '../Domain/Handler/SubscriptionCancelledEventHandler'
|
import { SubscriptionCancelledEventHandler } from '../Domain/Handler/SubscriptionCancelledEventHandler'
|
||||||
import { ExitDiscountAppliedEventHandler } from '../Domain/Handler/ExitDiscountAppliedEventHandler'
|
import { ExitDiscountAppliedEventHandler } from '../Domain/Handler/ExitDiscountAppliedEventHandler'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
export class ContainerConfigLoader {
|
export class ContainerConfigLoader {
|
||||||
async load(): Promise<Container> {
|
async load(): Promise<Container> {
|
||||||
|
@ -136,9 +135,7 @@ export class ContainerConfigLoader {
|
||||||
|
|
||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
||||||
.toConstantValue(
|
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
||||||
new SNSOpenTelemetryDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)),
|
|
||||||
)
|
|
||||||
|
|
||||||
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
||||||
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
|
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
|
||||||
|
@ -153,8 +150,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
|
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryDomainEventSubscriber(
|
new SQSDomainEventSubscriber(
|
||||||
ServiceIdentifier.NAMES.SchedulerWorker,
|
|
||||||
container.get<SQSClient>(TYPES.SQS),
|
container.get<SQSClient>(TYPES.SQS),
|
||||||
container.get<string>(TYPES.SQS_QUEUE_URL),
|
container.get<string>(TYPES.SQS_QUEUE_URL),
|
||||||
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
|
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SyncingServer })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedFallbackController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedFallbackController'
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedItemsController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedItemsController'
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SyncingServerWorker })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import TYPES from '../src/Bootstrap/Types'
|
import TYPES from '../src/Bootstrap/Types'
|
||||||
|
|
|
@ -11,9 +11,9 @@ import { Item } from '../Domain/Item/Item'
|
||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
SNSOpenTelemetryDomainEventPublisher,
|
SNSDomainEventPublisher,
|
||||||
|
SQSDomainEventSubscriber,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryDomainEventSubscriber,
|
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
import { DomainEventFactoryInterface } from '../Domain/Event/DomainEventFactoryInterface'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
|
@ -58,7 +58,6 @@ import {
|
||||||
ControllerContainer,
|
ControllerContainer,
|
||||||
ControllerContainerInterface,
|
ControllerContainerInterface,
|
||||||
MapperInterface,
|
MapperInterface,
|
||||||
ServiceIdentifier,
|
|
||||||
SharedVaultUser,
|
SharedVaultUser,
|
||||||
} from '@standardnotes/domain-core'
|
} from '@standardnotes/domain-core'
|
||||||
import { BaseItemsController } from '../Infra/InversifyExpressUtils/Base/BaseItemsController'
|
import { BaseItemsController } from '../Infra/InversifyExpressUtils/Base/BaseItemsController'
|
||||||
|
@ -252,7 +251,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher)
|
||||||
.toDynamicValue((context: interfaces.Context) => {
|
.toDynamicValue((context: interfaces.Context) => {
|
||||||
return new SNSOpenTelemetryDomainEventPublisher(
|
return new SNSDomainEventPublisher(
|
||||||
context.container.get(TYPES.Sync_SNS),
|
context.container.get(TYPES.Sync_SNS),
|
||||||
context.container.get(TYPES.Sync_SNS_TOPIC_ARN),
|
context.container.get(TYPES.Sync_SNS_TOPIC_ARN),
|
||||||
)
|
)
|
||||||
|
@ -1022,8 +1021,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberInterface>(TYPES.Sync_DomainEventSubscriber)
|
.bind<DomainEventSubscriberInterface>(TYPES.Sync_DomainEventSubscriber)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryDomainEventSubscriber(
|
new SQSDomainEventSubscriber(
|
||||||
ServiceIdentifier.NAMES.SyncingServerWorker,
|
|
||||||
container.get<SQSClient>(TYPES.Sync_SQS),
|
container.get<SQSClient>(TYPES.Sync_SQS),
|
||||||
container.get<string>(TYPES.Sync_SQS_QUEUE_URL),
|
container.get<string>(TYPES.Sync_SQS_QUEUE_URL),
|
||||||
container.get<DomainEventMessageHandlerInterface>(TYPES.Sync_DomainEventMessageHandler),
|
container.get<DomainEventMessageHandlerInterface>(TYPES.Sync_DomainEventMessageHandler),
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Websockets })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'
|
||||||
import '../src/Infra/InversifyExpressUtils/AnnotatedWebSocketsController'
|
import '../src/Infra/InversifyExpressUtils/AnnotatedWebSocketsController'
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
import 'reflect-metadata'
|
import 'reflect-metadata'
|
||||||
|
|
||||||
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
|
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.WebsocketsWorker })
|
|
||||||
sdk.start()
|
|
||||||
|
|
||||||
import { Logger } from 'winston'
|
import { Logger } from 'winston'
|
||||||
|
|
||||||
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
|
||||||
|
|
|
@ -18,7 +18,7 @@ import { RedisWebSocketsConnectionRepository } from '../Infra/Redis/RedisWebSock
|
||||||
import { AddWebSocketsConnection } from '../Domain/UseCase/AddWebSocketsConnection/AddWebSocketsConnection'
|
import { AddWebSocketsConnection } from '../Domain/UseCase/AddWebSocketsConnection/AddWebSocketsConnection'
|
||||||
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
||||||
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
||||||
import { SQSEventMessageHandler, SQSOpenTelemetryDomainEventSubscriber } from '@standardnotes/domain-events-infra'
|
import { SQSDomainEventSubscriber, SQSEventMessageHandler } from '@standardnotes/domain-events-infra'
|
||||||
import { ApiGatewayAuthMiddleware } from '../Controller/ApiGatewayAuthMiddleware'
|
import { ApiGatewayAuthMiddleware } from '../Controller/ApiGatewayAuthMiddleware'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -34,7 +34,6 @@ import { WebSocketsController } from '../Controller/WebSocketsController'
|
||||||
import { WebSocketServerInterface } from '@standardnotes/api'
|
import { WebSocketServerInterface } from '@standardnotes/api'
|
||||||
import { ClientMessengerInterface } from '../Client/ClientMessengerInterface'
|
import { ClientMessengerInterface } from '../Client/ClientMessengerInterface'
|
||||||
import { WebSocketMessageRequestedEventHandler } from '../Domain/Handler/WebSocketMessageRequestedEventHandler'
|
import { WebSocketMessageRequestedEventHandler } from '../Domain/Handler/WebSocketMessageRequestedEventHandler'
|
||||||
import { ServiceIdentifier } from '@standardnotes/domain-core'
|
|
||||||
|
|
||||||
export class ContainerConfigLoader {
|
export class ContainerConfigLoader {
|
||||||
async load(): Promise<Container> {
|
async load(): Promise<Container> {
|
||||||
|
@ -145,8 +144,7 @@ export class ContainerConfigLoader {
|
||||||
container
|
container
|
||||||
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
|
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
|
||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryDomainEventSubscriber(
|
new SQSDomainEventSubscriber(
|
||||||
ServiceIdentifier.NAMES.WebsocketsWorker,
|
|
||||||
container.get<SQSClient>(TYPES.SQS),
|
container.get<SQSClient>(TYPES.SQS),
|
||||||
container.get<string>(TYPES.SQS_QUEUE_URL),
|
container.get<string>(TYPES.SQS_QUEUE_URL),
|
||||||
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
|
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
|
||||||
|
|
Loading…
Reference in a new issue