fix(revisions): instrumenting opentelemetry on non production

This commit is contained in:
Karol Sójko 2023-10-09 11:36:40 +02:00
parent cb23506c1f
commit 0c89d8bd2d
No known key found for this signature in database
GPG key ID: C2F813669419D05F
3 changed files with 11 additions and 2 deletions

View file

@ -46,8 +46,10 @@ void container.load().then((container) => {
const serverInstance = server.build()
const openTelemetrySDK = container.get<NodeSDK>(TYPES.Revisions_OpenTelemetrySDK)
openTelemetrySDK.start()
if (!container.get<boolean>(TYPES.Revisions_IS_CONFIGURED_FOR_HOME_SERVER_OR_SELF_HOSTING)) {
const openTelemetrySDK = container.get<NodeSDK>(TYPES.Revisions_OpenTelemetrySDK)
openTelemetrySDK.start()
}
serverInstance.listen(env.get('PORT'))

View file

@ -112,6 +112,10 @@ export class ContainerConfigLoader {
defaultScope: 'Singleton',
})
container
.bind<boolean>(TYPES.Revisions_IS_CONFIGURED_FOR_HOME_SERVER_OR_SELF_HOSTING)
.toConstantValue(isConfiguredForHomeServerOrSelfHosting)
if (!isConfiguredForInMemoryCache) {
const redisUrl = env.get('REDIS_URL')
const isRedisInClusterMode = redisUrl.indexOf(',') > 0

View file

@ -40,6 +40,9 @@ const TYPES = {
Revisions_SNS_AWS_REGION: Symbol.for('Revisions_SNS_AWS_REGION'),
Revisions_NEW_RELIC_ENABLED: Symbol.for('Revisions_NEW_RELIC_ENABLED'),
Revisions_VERSION: Symbol.for('Revisions_VERSION'),
Revisions_IS_CONFIGURED_FOR_HOME_SERVER_OR_SELF_HOSTING: Symbol.for(
'Revisions_IS_CONFIGURED_FOR_HOME_SERVER_OR_SELF_HOSTING',
),
// use cases
Revisions_GetRevisionsMetada: Symbol.for('Revisions_GetRevisionsMetada'),
Revisions_GetRevision: Symbol.for('Revisions_GetRevision'),