Compare commits

...

33 Commits

Author SHA1 Message Date
standardci
78b13261bf chore(release): publish new version
- @standardnotes/analytics@2.30.0
 - @standardnotes/api-gateway@1.79.1
 - @standardnotes/auth-server@1.157.0
 - @standardnotes/domain-core@1.36.0
 - @standardnotes/domain-events-infra@1.18.0
 - @standardnotes/event-store@1.13.1
 - @standardnotes/files-server@1.29.1
 - @standardnotes/home-server@1.17.2
 - @standardnotes/revisions-server@1.44.1
 - @standardnotes/scheduler-server@1.24.0
 - @standardnotes/settings@1.21.44
 - @standardnotes/syncing-server@1.116.2
 - @standardnotes/websockets-server@1.15.1
2023-10-11 08:02:07 +00:00
Karol Sójko
6356fcaeed feat(domain-core): add email bounce processor service identifier 2023-10-11 09:44:25 +02:00
Karol Sójko
443235a861 feat: add opentelemetry for scheduled tasks 2023-10-11 09:42:45 +02:00
standardci
95fccb0822 chore(release): publish new version
- @standardnotes/home-server@1.17.1
 - @standardnotes/syncing-server@1.116.1
2023-10-11 06:11:35 +00:00
Karol Sójko
1fa476d1f9 fix(syncing-server): reduce the amount of select queries for items 2023-10-11 07:55:43 +02:00
standardci
88b888cd25 chore(release): publish new version
- @standardnotes/analytics@2.29.0
 - @standardnotes/api-gateway@1.79.0
 - @standardnotes/auth-server@1.156.0
 - @standardnotes/domain-events-infra@1.17.0
 - @standardnotes/event-store@1.13.0
 - @standardnotes/files-server@1.29.0
 - @standardnotes/home-server@1.17.0
 - @standardnotes/revisions-server@1.44.0
 - @standardnotes/scheduler-server@1.23.0
 - @standardnotes/syncing-server@1.116.0
 - @standardnotes/websockets-server@1.15.0
2023-10-10 13:27:05 +00:00
Karol Sójko
e3eede72cf fix(syncing-server): logs about cleanup 2023-10-10 15:08:36 +02:00
Karol Sójko
efb341eb99 feat: remove newrelic integration (#862) 2023-10-10 15:07:38 +02:00
standardci
dae7dc9541 chore(release): publish new version
- @standardnotes/home-server@1.16.48
 - @standardnotes/revisions-server@1.43.5
 - @standardnotes/syncing-server@1.115.4
2023-10-10 12:48:35 +00:00
Karol Sójko
29e573e9b5 fix(syncing-server): order by for identical created at date 2023-10-10 14:31:37 +02:00
Karol Sójko
3df14149f0 fix(revisions): log messages 2023-10-10 14:31:37 +02:00
standardci
6ba1867781 chore(release): publish new version
- @standardnotes/home-server@1.16.47
 - @standardnotes/revisions-server@1.43.4
 - @standardnotes/syncing-server@1.115.3
2023-10-10 12:30:01 +00:00
Karol Sójko
1026ce383c fix: add transition keyword to logs for better searching 2023-10-10 14:11:46 +02:00
standardci
2795cefc1b chore(release): publish new version
- @standardnotes/analytics@2.28.9
 - @standardnotes/api-gateway@1.78.6
 - @standardnotes/auth-server@1.155.1
 - @standardnotes/files-server@1.28.5
 - @standardnotes/home-server@1.16.46
 - @standardnotes/revisions-server@1.43.3
 - @standardnotes/scheduler-server@1.22.9
 - @standardnotes/websockets-server@1.14.5
2023-10-10 11:49:13 +00:00
Karol Sójko
637593c1bc fix(revisions): order by for identical created at date 2023-10-10 13:26:18 +02:00
Karol Sójko
08f7c5447b fix: opentelemetry instantiation 2023-10-10 13:19:51 +02:00
standardci
051b6e3093 chore(release): publish new version
- @standardnotes/home-server@1.16.45
 - @standardnotes/revisions-server@1.43.2
 - @standardnotes/syncing-server@1.115.2
2023-10-10 10:53:45 +00:00
Karol Sójko
250c1f069b fix(syncing-server): elevate otel sdk before the winston import 2023-10-10 12:32:20 +02:00
Karol Sójko
3e4a1e9645 fix(syncing-server): elevate otel sdk before the container starts 2023-10-10 12:25:09 +02:00
Karol Sójko
4629580650 fix(revisions): check for duplicates during transition 2023-10-10 12:10:45 +02:00
standardci
c29f6b9c6f chore(release): publish new version
- @standardnotes/home-server@1.16.44
 - @standardnotes/revisions-server@1.43.1
 - @standardnotes/syncing-server@1.115.1
2023-10-10 09:02:09 +00:00
Karol Sójko
036317e333 fix: transition logs to be more verbose 2023-10-10 10:44:58 +02:00
standardci
4afe32650f chore(release): publish new version
- @standardnotes/analytics@2.28.8
 - @standardnotes/api-gateway@1.78.5
 - @standardnotes/auth-server@1.155.0
 - @standardnotes/domain-events-infra@1.16.4
 - @standardnotes/event-store@1.12.18
 - @standardnotes/files-server@1.28.4
 - @standardnotes/home-server@1.16.43
 - @standardnotes/revisions-server@1.43.0
 - @standardnotes/scheduler-server@1.22.8
 - @standardnotes/syncing-server@1.115.0
 - @standardnotes/websockets-server@1.14.4
2023-10-10 06:32:17 +00:00
Karol Sójko
c021bb3d7c fix(syncing-server): add option to define otel ratio 2023-10-10 08:16:00 +02:00
Karol Sójko
783fd9e2c6 feat: add more logs to transition 2023-10-10 08:16:00 +02:00
standardci
d789c67649 chore(release): publish new version
- @standardnotes/analytics@2.28.7
 - @standardnotes/api-gateway@1.78.4
 - @standardnotes/auth-server@1.154.3
 - @standardnotes/domain-events-infra@1.16.3
 - @standardnotes/event-store@1.12.17
 - @standardnotes/files-server@1.28.3
 - @standardnotes/home-server@1.16.42
 - @standardnotes/revisions-server@1.42.3
 - @standardnotes/scheduler-server@1.22.7
 - @standardnotes/syncing-server@1.114.3
 - @standardnotes/websockets-server@1.14.3
2023-10-09 18:10:27 +00:00
Karol Sójko
3ab29569db fix(syncing-server): add opentelemetry starting info in logs 2023-10-09 19:50:02 +02:00
Karol Sójko
099c6e10c6 fix(domain-events-infra): add parent context on internal span 2023-10-09 19:38:35 +02:00
Karol Sójko
76ae6f5a88 Revert "Revert "fix: setting parent span on workers""
This reverts commit 3fc07a5b60.
2023-10-09 19:13:43 +02:00
standardci
9bd2b0c953 chore(release): publish new version
- @standardnotes/analytics@2.28.6
 - @standardnotes/api-gateway@1.78.3
 - @standardnotes/auth-server@1.154.2
 - @standardnotes/domain-events-infra@1.16.2
 - @standardnotes/event-store@1.12.16
 - @standardnotes/files-server@1.28.2
 - @standardnotes/home-server@1.16.41
 - @standardnotes/revisions-server@1.42.2
 - @standardnotes/scheduler-server@1.22.6
 - @standardnotes/syncing-server@1.114.2
 - @standardnotes/websockets-server@1.14.2
2023-10-09 14:04:36 +00:00
Karol Sójko
3fc07a5b60 Revert "fix: setting parent span on workers"
This reverts commit 1c54d18c3c.
2023-10-09 15:46:10 +02:00
standardci
94e18ab36b chore(release): publish new version
- @standardnotes/analytics@2.28.5
 - @standardnotes/api-gateway@1.78.2
 - @standardnotes/auth-server@1.154.1
 - @standardnotes/domain-events-infra@1.16.1
 - @standardnotes/event-store@1.12.15
 - @standardnotes/files-server@1.28.1
 - @standardnotes/home-server@1.16.40
 - @standardnotes/revisions-server@1.42.1
 - @standardnotes/scheduler-server@1.22.5
 - @standardnotes/syncing-server@1.114.1
 - @standardnotes/websockets-server@1.14.1
2023-10-09 13:30:07 +00:00
Karol Sójko
1c54d18c3c fix: setting parent span on workers 2023-10-09 15:13:07 +02:00
191 changed files with 1005 additions and 3167 deletions

View File

@@ -20,19 +20,3 @@ jobs:
deploy_web: false
package_path: packages/analytics
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_ANALYTICS_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

View File

@@ -20,17 +20,3 @@ jobs:
deploy_worker: false
package_path: packages/api-gateway
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Web
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_API_GATEWAY_WEB_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

View File

@@ -19,27 +19,3 @@ jobs:
workspace_name: "@standardnotes/auth-server"
package_path: packages/auth
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Web
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_AUTH_WEB_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_AUTH_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

View File

@@ -19,27 +19,3 @@ jobs:
workspace_name: "@standardnotes/files-server"
package_path: packages/files
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Web
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_FILES_WEB_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_FILES_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

View File

@@ -19,27 +19,3 @@ jobs:
workspace_name: "@standardnotes/revisions-server"
package_path: packages/revisions
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Web
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_REVISIONS_WEB_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_REVISIONS_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

View File

@@ -20,19 +20,3 @@ jobs:
deploy_web: false
package_path: packages/scheduler
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_SCHEDULER_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

View File

@@ -19,27 +19,3 @@ jobs:
workspace_name: "@standardnotes/syncing-server"
package_path: packages/syncing-server
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Web
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_SYNCING_SERVER_WEB_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_SYNCING_SERVER_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

View File

@@ -19,27 +19,3 @@ jobs:
workspace_name: "@standardnotes/websockets-server"
package_path: packages/websockets
secrets: inherit
newrelic:
needs: call_server_application_workflow
runs-on: ubuntu-latest
steps:
- name: Create New Relic deployment marker for Web
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_WEBSOCKETS_WEB_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"
- name: Create New Relic deployment marker for Worker
uses: newrelic/deployment-marker-action@v1
with:
accountId: ${{ secrets.NEW_RELIC_ACCOUNT_ID }}
apiKey: ${{ secrets.NEW_RELIC_API_KEY }}
applicationId: ${{ secrets.NEW_RELIC_APPLICATION_ID_WEBSOCKETS_WORKER_PROD }}
revision: "${{ github.sha }}"
description: "Automated Deployment via Github Actions"
user: "${{ github.actor }}"

1
.gitignore vendored
View File

@@ -4,7 +4,6 @@
dist
coverage
.env
newrelic_agent.log
.yarn/*
!.yarn/cache

1110
.pnp.cjs generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,6 @@ services:
SNS_SECRET_ACCESS_KEY: x
SNS_ACCESS_KEY_ID: x
SNS_AWS_REGION: us-east-1
NEW_RELIC_ENABLED: false
networks:
- standardnotes_self_hosted

View File

@@ -24,14 +24,6 @@ if [ -z "$REVISIONS_SERVER_PORT" ]; then
export REVISIONS_SERVER_PORT=3105
fi
#############
# NEW RELIC #
#############
if [ -z "$NEW_RELIC_ENABLED" ]; then
export NEW_RELIC_ENABLED=false
fi
######
# DB #
######
@@ -119,10 +111,6 @@ fi
export AUTH_SERVER_JWT_SECRET=$AUTH_JWT_SECRET
export AUTH_SERVER_LEGACY_JWT_SECRET=$(openssl rand -hex 32)
export AUTH_SERVER_NEW_RELIC_ENABLED=false
export AUTH_SERVER_NEW_RELIC_APP_NAME=Auth
export AUTH_SERVER_NEW_RELIC_NO_CONFIG_FILE=true
if [ -z "$AUTH_SERVER_DISABLE_USER_REGISTRATION" ]; then
export AUTH_SERVER_DISABLE_USER_REGISTRATION=false
fi
@@ -260,10 +248,6 @@ if [ -z "$SYNCING_SERVER_REVISIONS_FREQUENCY" ]; then
export SYNCING_SERVER_REVISIONS_FREQUENCY=300
fi
export SYNCING_SERVER_NEW_RELIC_ENABLED=false
export SYNCING_SERVER_NEW_RELIC_APP_NAME="Syncing Server JS"
export SYNCING_SERVER_NEW_RELIC_NO_CONFIG_FILE=true
export SYNCING_SERVER_FILE_UPLOAD_PATH="/opt/shared/uploads"
printenv | grep SYNCING_SERVER_ | sed 's/SYNCING_SERVER_//g' > /opt/server/packages/syncing-server/.env
@@ -283,8 +267,6 @@ if [ -z "$FILES_SERVER_MAX_CHUNK_BYTES" ]; then
export FILES_SERVER_MAX_CHUNK_BYTES=100000000
fi
export FILES_SERVER_NEW_RELIC_ENABLED=false
if [ -z "$FILES_SERVER_SNS_TOPIC_ARN" ]; then
export FILES_SERVER_SNS_TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:files-local-topic"
fi
@@ -329,8 +311,6 @@ fi
export REVISIONS_SERVER_NODE_ENV="production"
export REVISIONS_SERVER_VERSION="local"
export REVISIONS_SERVER_NEW_RELIC_ENABLED=false
if [ -z "$REVISIONS_SERVER_SNS_TOPIC_ARN" ]; then
export REVISIONS_SERVER_SNS_TOPIC_ARN="arn:aws:sns:us-east-1:000000000000:revisions-server-local-topic"
fi
@@ -374,10 +354,6 @@ fi
export API_GATEWAY_NODE_ENV=production
export API_GATEWAY_VERSION=local
export API_GATEWAY_NEW_RELIC_ENABLED=false
export API_GATEWAY_NEW_RELIC_APP_NAME="API Gateway"
export API_GATEWAY_NEW_RELIC_NO_CONFIG_FILE=true
export API_GATEWAY_SYNCING_SERVER_JS_URL=http://localhost:$SYNCING_SERVER_PORT
export API_GATEWAY_AUTH_SERVER_URL=http://localhost:$AUTH_SERVER_PORT
export API_GATEWAY_REVISIONS_SERVER_URL=http://localhost:$REVISIONS_SERVER_PORT

View File

@@ -39,9 +39,5 @@
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"packageManager": "yarn@4.0.0-rc.51",
"optionalDependencies": {
"@types/newrelic": "^9.14.0",
"newrelic": "^11.0.0"
}
"packageManager": "yarn@4.0.0-rc.51"
}

View File

@@ -19,14 +19,5 @@ SNS_AWS_REGION=
SQS_QUEUE_URL=
SQS_AWS_REGION=
# (Optional) New Relic Setup
NEW_RELIC_ENABLED=false
NEW_RELIC_APP_NAME=Analytics
NEW_RELIC_LICENSE_KEY=
NEW_RELIC_NO_CONFIG_FILE=true
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
NEW_RELIC_LOG_ENABLED=false
NEW_RELIC_LOG_LEVEL=info
# (Optional) Mixpanel
MIXPANEL_TOKEN=

View File

@@ -3,6 +3,40 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [2.30.0](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.29.0...@standardnotes/analytics@2.30.0) (2023-10-11)
### Features
* add opentelemetry for scheduled tasks ([443235a](https://github.com/standardnotes/server/commit/443235a861181acf708d98fba25ce6d79f198b56))
# [2.29.0](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.28.9...@standardnotes/analytics@2.29.0) (2023-10-10)
### Features
* remove newrelic integration ([#862](https://github.com/standardnotes/server/issues/862)) ([efb341e](https://github.com/standardnotes/server/commit/efb341eb991d37efab7c1efce035ee07ad0a101e))
## [2.28.9](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.28.8...@standardnotes/analytics@2.28.9) (2023-10-10)
### Bug Fixes
* opentelemetry instantiation ([08f7c54](https://github.com/standardnotes/server/commit/08f7c5447b020fee71a1e49d382db32082bb9044))
## [2.28.8](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.28.7...@standardnotes/analytics@2.28.8) (2023-10-10)
**Note:** Version bump only for package @standardnotes/analytics
## [2.28.7](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.28.6...@standardnotes/analytics@2.28.7) (2023-10-09)
**Note:** Version bump only for package @standardnotes/analytics
## [2.28.6](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.28.5...@standardnotes/analytics@2.28.6) (2023-10-09)
**Note:** Version bump only for package @standardnotes/analytics
## [2.28.5](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.28.4...@standardnotes/analytics@2.28.5) (2023-10-09)
**Note:** Version bump only for package @standardnotes/analytics
## [2.28.4](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.28.3...@standardnotes/analytics@2.28.4) (2023-10-09)
**Note:** Version bump only for package @standardnotes/analytics

View File

@@ -1,8 +1,13 @@
import 'reflect-metadata'
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
import { EmailLevel, ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AnalyticsScheduledTask)
sdk.start()
import { Logger } from 'winston'
import { EmailLevel } from '@standardnotes/domain-core'
import { DomainEventPublisherInterface } from '@standardnotes/domain-events'
import { AnalyticsActivity } from '../src/Domain/Analytics/AnalyticsActivity'
import { Period } from '../src/Domain/Time/Period'
@@ -270,6 +275,9 @@ void container.load().then((container) => {
logger.info(`Sending report to following admins: ${adminEmails}`)
const tracer = new OpenTelemetryTracer()
tracer.startSpan(ServiceIdentifier.NAMES.AnalyticsScheduledTask, 'report')
Promise.resolve(
requestReport(
analyticsStore,
@@ -285,11 +293,15 @@ void container.load().then((container) => {
.then(() => {
logger.info('Usage report generation complete')
tracer.stopSpan()
process.exit(0)
})
.catch((error) => {
logger.error(`Could not finish usage report generation: ${error.message}`)
tracer.stopSpanWithError(error)
process.exit(1)
})
})

View File

@@ -1,5 +1,11 @@
import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AnalyticsWorker)
sdk.start()
import { Logger } from 'winston'
import { DomainEventSubscriberFactoryInterface } from '@standardnotes/domain-events'
import * as dayjs from 'dayjs'

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.28.4",
"version": "2.30.0",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
@@ -55,10 +55,5 @@
"reflect-metadata": "^0.1.13",
"typeorm": "^0.3.17",
"winston": "^3.8.1"
},
"optionalDependencies": {
"@newrelic/winston-enricher": "^4.0.1",
"@types/newrelic": "^9.14.0",
"newrelic": "^11.0.0"
}
}

View File

@@ -6,7 +6,7 @@ import {
DomainEventMessageHandlerInterface,
DomainEventSubscriberFactoryInterface,
} from '@standardnotes/domain-events'
import { MapperInterface } from '@standardnotes/domain-core'
import { MapperInterface, ServiceIdentifier } from '@standardnotes/domain-core'
// eslint-disable-next-line @typescript-eslint/no-var-requires
const Mixpanel = require('mixpanel')
@@ -17,7 +17,7 @@ import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
import {
SNSDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryEventMessageHandler,
} from '@standardnotes/domain-events-infra'
import { Timer, TimerInterface } from '@standardnotes/time'
import { PeriodKeyGeneratorInterface } from '../Domain/Time/PeriodKeyGeneratorInterface'
@@ -78,13 +78,6 @@ export class ContainerConfigLoader {
container.bind(TYPES.Redis).toConstantValue(redis)
const winstonFormatters = [winston.format.splat(), winston.format.json()]
if (env.get('NEW_RELIC_ENABLED', true) === 'true') {
await import('newrelic')
// eslint-disable-next-line @typescript-eslint/no-var-requires
const newrelicFormatter = require('@newrelic/winston-enricher')
const newrelicWinstonFormatter = newrelicFormatter(winston)
winstonFormatters.push(newrelicWinstonFormatter())
}
const logger = winston.createLogger({
level: env.get('LOG_LEVEL', true) || 'info',
@@ -129,7 +122,6 @@ export class ContainerConfigLoader {
container.bind(TYPES.SNS_TOPIC_ARN).toConstantValue(env.get('SNS_TOPIC_ARN'))
container.bind(TYPES.SNS_AWS_REGION).toConstantValue(env.get('SNS_AWS_REGION', true))
container.bind(TYPES.SQS_QUEUE_URL).toConstantValue(env.get('SQS_QUEUE_URL'))
container.bind(TYPES.NEW_RELIC_ENABLED).toConstantValue(env.get('NEW_RELIC_ENABLED', true))
container.bind(TYPES.ADMIN_EMAILS).toConstantValue(env.get('ADMIN_EMAILS').split(','))
container.bind(TYPES.MIXPANEL_TOKEN).toConstantValue(env.get('MIXPANEL_TOKEN', true))
@@ -243,7 +235,13 @@ export class ContainerConfigLoader {
container
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
.toConstantValue(
new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.AnalyticsWorker,
eventHandlers,
container.get(TYPES.Logger),
),
)
container
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
.toConstantValue(

View File

@@ -9,7 +9,6 @@ const TYPES = {
SNS_AWS_REGION: Symbol.for('SNS_AWS_REGION'),
SQS_QUEUE_URL: Symbol.for('SQS_QUEUE_URL'),
SQS_AWS_REGION: Symbol.for('SQS_AWS_REGION'),
NEW_RELIC_ENABLED: Symbol.for('NEW_RELIC_ENABLED'),
ADMIN_EMAILS: Symbol.for('ADMIN_EMAILS'),
MIXPANEL_TOKEN: Symbol.for('MIXPANEL_TOKEN'),
// Repositories

View File

@@ -17,15 +17,6 @@ HTTP_CALL_TIMEOUT=60000
AUTH_JWT_SECRET=auth_jwt_secret
# (Optional) New Relic Setup
NEW_RELIC_ENABLED=false
NEW_RELIC_APP_NAME=API Gateway
NEW_RELIC_LICENSE_KEY=
NEW_RELIC_NO_CONFIG_FILE=true
NEW_RELIC_DISTRIBUTED_TRACING_ENABLED=false
NEW_RELIC_LOG_ENABLED=false
NEW_RELIC_LOG_LEVEL=info
CACHE_TYPE=redis
REDIS_URL=redis://cache

Some files were not shown because too many files have changed in this diff Show More