|
@@ -3,6 +3,7 @@ import Redis from 'ioredis'
|
|
|
import { Container, interfaces } from 'inversify'
|
|
|
import { MongoRepository, Repository } from 'typeorm'
|
|
|
import * as winston from 'winston'
|
|
|
+import { captureAWSv3Client } from 'aws-xray-sdk'
|
|
|
import { SNSClient, SNSClientConfig } from '@aws-sdk/client-sns'
|
|
|
|
|
|
import { Revision } from '../Domain/Revision/Revision'
|
|
@@ -30,12 +31,12 @@ import {
|
|
|
DomainEventPublisherInterface,
|
|
|
} from '@standardnotes/domain-events'
|
|
|
import {
|
|
|
- SQSNewRelicEventMessageHandler,
|
|
|
SQSEventMessageHandler,
|
|
|
SQSDomainEventSubscriberFactory,
|
|
|
DirectCallEventMessageHandler,
|
|
|
DirectCallDomainEventPublisher,
|
|
|
SNSDomainEventPublisher,
|
|
|
+ SQSXRayEventMessageHandler,
|
|
|
} from '@standardnotes/domain-events-infra'
|
|
|
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
|
|
|
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
|
@@ -90,6 +91,7 @@ export class ContainerConfigLoader {
|
|
|
|
|
|
const isConfiguredForHomeServer = env.get('MODE', true) === 'home-server'
|
|
|
const isConfiguredForSelfHosting = env.get('MODE', true) === 'self-hosted'
|
|
|
+ const isConfiguredForAWSProduction = !isConfiguredForHomeServer && !isConfiguredForSelfHosting
|
|
|
const isConfiguredForHomeServerOrSelfHosting = isConfiguredForHomeServer || isConfiguredForSelfHosting
|
|
|
const isSecondaryDatabaseEnabled = env.get('SECONDARY_DB_ENABLED', true) === 'true'
|
|
|
const isConfiguredForInMemoryCache = env.get('CACHE_TYPE', true) === 'memory'
|
|
@@ -173,6 +175,10 @@ export class ContainerConfigLoader {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (isConfiguredForAWSProduction) {
|
|
|
+ return captureAWSv3Client(new SNSClient(snsConfig))
|
|
|
+ }
|
|
|
+
|
|
|
return new SNSClient(snsConfig)
|
|
|
})
|
|
|
|
|
@@ -201,6 +207,10 @@ export class ContainerConfigLoader {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ if (isConfiguredForAWSProduction) {
|
|
|
+ return captureAWSv3Client(new SQSClient(sqsConfig))
|
|
|
+ }
|
|
|
+
|
|
|
return new SQSClient(sqsConfig)
|
|
|
})
|
|
|
|
|
@@ -213,6 +223,10 @@ export class ContainerConfigLoader {
|
|
|
apiVersion: 'latest',
|
|
|
region: env.get('S3_AWS_REGION', true),
|
|
|
})
|
|
|
+
|
|
|
+ if (isConfiguredForAWSProduction) {
|
|
|
+ return captureAWSv3Client(s3Client)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return s3Client
|
|
@@ -511,7 +525,7 @@ export class ContainerConfigLoader {
|
|
|
.bind<DomainEventMessageHandlerInterface>(TYPES.Revisions_DomainEventMessageHandler)
|
|
|
.toConstantValue(
|
|
|
env.get('NEW_RELIC_ENABLED', true) === 'true'
|
|
|
- ? new SQSNewRelicEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger))
|
|
|
+ ? new SQSXRayEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger))
|
|
|
: new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger)),
|
|
|
)
|
|
|
|