Compare commits

..

19 Commits

Author SHA1 Message Date
standardci
c99334889c chore(release): publish new version
- @standardnotes/analytics@2.32.1
 - @standardnotes/api-gateway@1.79.14
 - @standardnotes/auth-server@1.159.2
 - @standardnotes/domain-events-infra@1.20.1
 - @standardnotes/event-store@1.13.14
 - @standardnotes/files-server@1.31.1
 - @standardnotes/home-server@1.17.17
 - @standardnotes/revisions-server@1.46.1
 - @standardnotes/scheduler-server@1.26.1
 - @standardnotes/syncing-server@1.118.1
 - @standardnotes/websockets-server@1.17.1
2023-10-18 08:41:21 +00:00
Karol Sójko
7ce9aba517 fix: remove ip attributes in opentelemetry http instrumentation (#874) 2023-10-18 10:21:35 +02:00
Karol Sójko
46257a058b chore: allow only direct updates for dependabot: 2023-10-18 09:32:25 +02:00
dependabot[bot]
979dc35cfc chore(deps): bump actions/checkout from 3 to 4 (#817)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-17 14:02:56 +02:00
standardci
c99a447a04 chore(release): publish new version
- @standardnotes/auth-server@1.159.1
 - @standardnotes/home-server@1.17.16
2023-10-17 11:58:49 +00:00
Karol Sójko
6dd9fd5abd fix: remove secrets from e2e test suites 2023-10-17 13:40:52 +02:00
Karol Sójko
0d37cb293c fix(auth): traversing through users in transition 2023-10-17 13:25:20 +02:00
standardci
27d04c95a1 chore(release): publish new version
- @standardnotes/analytics@2.32.0
 - @standardnotes/api-gateway@1.79.13
 - @standardnotes/auth-server@1.159.0
 - @standardnotes/domain-events-infra@1.20.0
 - @standardnotes/event-store@1.13.13
 - @standardnotes/files-server@1.31.0
 - @standardnotes/home-server@1.17.15
 - @standardnotes/revisions-server@1.46.0
 - @standardnotes/scheduler-server@1.26.0
 - @standardnotes/syncing-server@1.118.0
 - @standardnotes/websockets-server@1.17.0
2023-10-17 09:03:21 +00:00
Karol Sójko
cd830cdf25 fix: allow mutable yarn install on PR for dependabot purposes 2023-10-17 10:47:32 +02:00
Karol Sójko
5b06ea94f9 fix(syncing-server): binding 2023-10-17 10:41:55 +02:00
Karol Sójko
aba4f90485 feat: add wrapping sqs receive message with open telemetry 2023-10-17 10:14:26 +02:00
Karol Sójko
350621ed52 fix: remove secondary db from docker ci setup 2023-10-16 12:26:57 +02:00
Karol Sójko
69b4324c78 fix: remove unused variables in ci 2023-10-16 12:26:07 +02:00
Karol Sójko
b2be0a7c0b fix: remove secondary db from e2e test suites 2023-10-16 12:24:17 +02:00
Karol Sójko
cab0dfba39 fix: scheduled test suite to run only base tests 2023-10-16 12:04:34 +02:00
standardci
296ca47d63 chore(release): publish new version
- @standardnotes/auth-server@1.158.8
 - @standardnotes/home-server@1.17.14
2023-10-16 06:35:52 +00:00
Karol Sójko
1cad18a681 fix(auth): logs for triggering transition 2023-10-16 08:15:53 +02:00
standardci
bdd052f90c chore(release): publish new version
- @standardnotes/analytics@2.31.7
 - @standardnotes/api-gateway@1.79.12
 - @standardnotes/auth-server@1.158.7
 - @standardnotes/domain-events-infra@1.19.7
 - @standardnotes/event-store@1.13.12
 - @standardnotes/files-server@1.30.7
 - @standardnotes/home-server@1.17.13
 - @standardnotes/revisions-server@1.45.7
 - @standardnotes/scheduler-server@1.25.7
 - @standardnotes/syncing-server@1.117.7
 - @standardnotes/websockets-server@1.16.7
2023-10-13 08:38:45 +00:00
Karol Sójko
32fe8d0a85 fix: reduce the amount of metrics gathered in telemetery 2023-10-13 10:19:33 +02:00
111 changed files with 1193 additions and 878 deletions

6
.github/ci.env vendored
View File

@@ -23,12 +23,6 @@ MYSQL_USER=std_notes_user
MYSQL_PASSWORD=changeme123
MYSQL_ROOT_PASSWORD=changeme123
MONGO_HOST=secondary_db
MONGO_PORT=27017
MONGO_USERNAME=standardnotes
MONGO_PASSWORD=standardnotes
MONGO_DATABASE=standardnotes
AUTH_JWT_SECRET=f95259c5e441f5a4646d76422cfb3df4c4488842901aa50b6c51b8be2e0040e9
AUTH_SERVER_ENCRYPTION_SERVER_KEY=1087415dfde3093797f9a7ca93a49e7d7aa1861735eb0d32aae9c303b8c3d060
VALET_TOKEN_SECRET=4b886819ebe1e908077c6cae96311b48a8416bd60cc91c03060e15bdf6b30d1f

View File

@@ -9,101 +9,141 @@ updates:
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/analytics"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/api-gateway"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/auth"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/common"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/domain-core"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/domain-events"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/domain-events-infra"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/event-store"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/files"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/home-server"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/predicates"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/revisions"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/scheduler"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/security"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/settings"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/sncrypto-node"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/syncing-server"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/time"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "npm"
directory: "/packages/websockets"
schedule:
interval: "daily"
allow:
- dependency-type: "direct"
- package-ecosystem: "github-actions"
directory: "/"

View File

@@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:

View File

@@ -11,15 +11,6 @@ on:
type: string
default: all
description: The test suite to run
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
jobs:
e2e-self-hosted:
@@ -27,11 +18,9 @@ jobs:
with:
snjs_image_tag: ${{ inputs.snjs_image_tag }}
suite: ${{ inputs.suite }}
secrets: inherit
e2e-home-server:
uses: standardnotes/server/.github/workflows/e2e-home-server.yml@main
with:
snjs_image_tag: ${{ inputs.snjs_image_tag }}
suite: ${{ inputs.suite }}
secrets: inherit

View File

@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v2

View File

@@ -11,15 +11,6 @@ on:
type: string
default: all
description: The test suite to run
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
jobs:
e2e-home-server:
@@ -29,7 +20,6 @@ jobs:
matrix:
db_type: [mysql, sqlite]
cache_type: [redis, memory]
secondary_db_enabled: [true, false]
runs-on: ubuntu-latest
@@ -51,17 +41,9 @@ jobs:
MYSQL_DATABASE: standardnotes
MYSQL_USER: standardnotes
MYSQL_PASSWORD: standardnotes
secondary_db:
image: mongo:5.0
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: standardnotes
MONGO_INITDB_ROOT_PASSWORD: standardnotes
MONGO_INITDB_DATABASE: standardnotes
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
@@ -98,12 +80,6 @@ jobs:
echo "DB_DEBUG_LEVEL=all" >> packages/home-server/.env
echo "REDIS_URL=redis://localhost:6379" >> packages/home-server/.env
echo "CACHE_TYPE=${{ matrix.cache_type }}" >> packages/home-server/.env
echo "SECONDARY_DB_ENABLED=${{ matrix.secondary_db_enabled }}" >> packages/home-server/.env
echo "MONGO_HOST=localhost" >> packages/home-server/.env
echo "MONGO_PORT=27017" >> packages/home-server/.env
echo "MONGO_DATABASE=standardnotes" >> packages/home-server/.env
echo "MONGO_USERNAME=standardnotes" >> packages/home-server/.env
echo "MONGO_PASSWORD=standardnotes" >> packages/home-server/.env
echo "FILES_SERVER_URL=http://localhost:3123" >> packages/home-server/.env
echo "E2E_TESTING=true" >> packages/home-server/.env
@@ -122,7 +98,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: home-server-failure-logs-${{ inputs.suite }}-${{ matrix.db_type }}-${{ matrix.cache_type }}-${{ matrix.secondary_db_enabled }}
name: home-server-failure-logs-${{ inputs.suite }}-${{ matrix.db_type }}-${{ matrix.cache_type }}
retention-days: 5
path: |
logs/output.log

View File

@@ -11,23 +11,12 @@ on:
type: string
default: all
description: The test suite to run
secrets:
DOCKER_USERNAME:
required: true
DOCKER_PASSWORD:
required: true
AWS_ACCESS_KEY_ID:
required: true
AWS_SECRET_ACCESS_KEY:
required: true
jobs:
e2e:
name: (Self Hosting) E2E Test Suite
strategy:
fail-fast: false
matrix:
secondary_db_enabled: [true, false]
runs-on: ubuntu-latest
services:
@@ -37,7 +26,7 @@ jobs:
- 9001:9001
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
@@ -53,7 +42,6 @@ jobs:
env:
DB_TYPE: mysql
CACHE_TYPE: redis
SECONDARY_DB_ENABLED: ${{ matrix.secondary_db_enabled }}
- name: Wait for server to start
run: docker/is-available.sh http://localhost:3123 $(pwd)/logs
@@ -65,7 +53,7 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: self-hosted-failure-logs-${{ inputs.suite }}-${{ matrix.secondary_db_enabled }}
name: self-hosted-failure-logs-${{ inputs.suite }}
retention-days: 5
path: |
logs/*.err

View File

@@ -31,4 +31,3 @@ jobs:
with:
snjs_image_tag: ${{ inputs.snjs_image_tag || 'latest' }}
suite: ${{ inputs.suite || 'all' }}
secrets: inherit

View File

@@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache build
id: cache-build
@@ -26,7 +26,7 @@ jobs:
node-version-file: '.nvmrc'
- name: Install
run: yarn install --immutable
run: yarn install
- name: Build
run: yarn build
@@ -37,7 +37,7 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache build
id: cache-build
@@ -54,7 +54,7 @@ jobs:
node-version-file: '.nvmrc'
- name: Install
run: yarn install --immutable
run: yarn install
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
@@ -69,7 +69,7 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache build
id: cache-build
@@ -86,7 +86,7 @@ jobs:
node-version-file: '.nvmrc'
- name: Install
run: yarn install --immutable
run: yarn install
- name: Build
if: steps.cache-build.outputs.cache-hit != 'true'
@@ -102,7 +102,6 @@ jobs:
with:
snjs_image_tag: 'latest'
suite: 'base'
secrets: inherit
# e2e-vaults:
# needs: build
@@ -111,4 +110,3 @@ jobs:
# with:
# snjs_image_tag: 'latest'
# suite: 'vaults'
# secrets: inherit

View File

@@ -9,7 +9,7 @@ jobs:
if: contains(github.event.head_commit.message, 'chore(release)') == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache build
id: cache-build
@@ -37,7 +37,7 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache build
id: cache-build
@@ -69,7 +69,7 @@ jobs:
needs: build
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Cache build
id: cache-build
@@ -102,7 +102,6 @@ jobs:
with:
snjs_image_tag: 'latest'
suite: 'base'
secrets: inherit
# e2e-vaults:
# needs: build
@@ -111,7 +110,6 @@ jobs:
# with:
# snjs_image_tag: 'latest'
# suite: 'vaults'
# secrets: inherit
publish-self-hosting:
needs: [ test, lint, e2e-base ]
@@ -126,7 +124,7 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.CI_PAT_TOKEN }}
fetch-depth: 0

659
.pnp.cjs generated

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -22,7 +22,6 @@ services:
environment:
DB_TYPE: "${DB_TYPE}"
CACHE_TYPE: "${CACHE_TYPE}"
SECONDARY_DB_ENABLED: "${SECONDARY_DB_ENABLED}"
container_name: server-ci
ports:
- 3123:3000
@@ -61,21 +60,6 @@ services:
networks:
- standardnotes_self_hosted
secondary_db:
image: mongo:5.0
container_name: secondary_db-ci
ports:
- 27017
restart: unless-stopped
volumes:
- ./data/mongo:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: standardnotes
MONGO_INITDB_ROOT_PASSWORD: standardnotes
MONGO_INITDB_DATABASE: standardnotes
networks:
- standardnotes_self_hosted
cache:
image: redis:6.0-alpine
container_name: cache-ci

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [2.32.1](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.32.0...@standardnotes/analytics@2.32.1) (2023-10-18)
**Note:** Version bump only for package @standardnotes/analytics
# [2.32.0](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.7...@standardnotes/analytics@2.32.0) (2023-10-17)
### Features
* add wrapping sqs receive message with open telemetry ([aba4f90](https://github.com/standardnotes/server/commit/aba4f90485e1b40baac34561321a5381945aa27e))
## [2.31.7](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.6...@standardnotes/analytics@2.31.7) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [2.31.6](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.5...@standardnotes/analytics@2.31.6) (2023-10-12)
**Note:** Version bump only for package @standardnotes/analytics

View File

@@ -3,7 +3,7 @@ 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)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AnalyticsScheduledTask })
sdk.start()
import { Logger } from 'winston'

View File

@@ -3,11 +3,11 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AnalyticsWorker)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AnalyticsWorker })
sdk.start()
import { Logger } from 'winston'
import { DomainEventSubscriberFactoryInterface } from '@standardnotes/domain-events'
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
import * as dayjs from 'dayjs'
import * as utc from 'dayjs/plugin/utc'
@@ -26,6 +26,7 @@ void container.load().then((container) => {
logger.info('Starting worker...')
const subscriberFactory: DomainEventSubscriberFactoryInterface = container.get(TYPES.DomainEventSubscriberFactory)
subscriberFactory.create().start()
const subscriber = container.get<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
subscriber.start()
})

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.31.6",
"version": "2.32.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -5,9 +5,9 @@ import {
DomainEventHandlerInterface,
DomainEventMessageHandlerInterface,
DomainEventPublisherInterface,
DomainEventSubscriberFactoryInterface,
DomainEventSubscriberInterface,
} 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,8 +17,8 @@ import { AppDataSource } from './DataSource'
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
import {
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryDomainEventSubscriber,
} from '@standardnotes/domain-events-infra'
import { Timer, TimerInterface } from '@standardnotes/time'
import { PeriodKeyGeneratorInterface } from '../Domain/Time/PeriodKeyGeneratorInterface'
@@ -240,12 +240,14 @@ export class ContainerConfigLoader {
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
container
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
.toConstantValue(
new SQSDomainEventSubscriberFactory(
container.get(TYPES.SQS),
container.get(TYPES.SQS_QUEUE_URL),
container.get(TYPES.DomainEventMessageHandler),
new SQSOpenTelemetryDomainEventSubscriber(
ServiceIdentifier.NAMES.AnalyticsWorker,
container.get<SQSClient>(TYPES.SQS),
container.get<string>(TYPES.SQS_QUEUE_URL),
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
container.get<winston.Logger>(TYPES.Logger),
),
)

View File

@@ -42,7 +42,7 @@ const TYPES = {
RevenueModificationMap: Symbol.for('RevenueModificationMap'),
// Services
DomainEventPublisher: Symbol.for('DomainEventPublisher'),
DomainEventSubscriberFactory: Symbol.for('DomainEventSubscriberFactory'),
DomainEventSubscriber: Symbol.for('DomainEventSubscriber'),
DomainEventFactory: Symbol.for('DomainEventFactory'),
DomainEventMessageHandler: Symbol.for('DomainEventMessageHandler'),
AnalyticsStore: Symbol.for('AnalyticsStore'),

View File

@@ -3,6 +3,20 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.79.14](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.13...@standardnotes/api-gateway@1.79.14) (2023-10-18)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.79.13](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.12...@standardnotes/api-gateway@1.79.13) (2023-10-17)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.79.12](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.11...@standardnotes/api-gateway@1.79.12) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/api-gateway/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [1.79.11](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.10...@standardnotes/api-gateway@1.79.11) (2023-10-12)
### Bug Fixes

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.ApiGateway)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.ApiGateway })
sdk.start()
import '../src/Controller/LegacyController'

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/api-gateway",
"version": "1.79.11",
"version": "1.79.14",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,34 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.159.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.159.1...@standardnotes/auth-server@1.159.2) (2023-10-18)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.159.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.159.0...@standardnotes/auth-server@1.159.1) (2023-10-17)
### Bug Fixes
* **auth:** traversing through users in transition ([0d37cb2](https://github.com/standardnotes/server/commit/0d37cb293c3f8c1fa798a3c847a1f76c18a8c3aa))
# [1.159.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.8...@standardnotes/auth-server@1.159.0) (2023-10-17)
### Features
* add wrapping sqs receive message with open telemetry ([aba4f90](https://github.com/standardnotes/server/commit/aba4f90485e1b40baac34561321a5381945aa27e))
## [1.158.8](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.7...@standardnotes/auth-server@1.158.8) (2023-10-16)
### Bug Fixes
* **auth:** logs for triggering transition ([1cad18a](https://github.com/standardnotes/server/commit/1cad18a681d933c67244d43dd6f3c2ec405149be))
## [1.158.7](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.6...@standardnotes/auth-server@1.158.7) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [1.158.6](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.5...@standardnotes/auth-server@1.158.6) (2023-10-12)
### Bug Fixes

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
sdk.start()
import { Stream } from 'stream'

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
sdk.start()
import { Logger } from 'winston'

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.Auth)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Auth })
sdk.start()
import '../src/Infra/InversifyExpressUtils/AnnotatedAuthController'

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
sdk.start()
import { Logger } from 'winston'

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier, RoleName, TransitionStatus } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
sdk.start()
import { Logger } from 'winston'
@@ -35,78 +35,87 @@ const requestTransition = async (
const startDate = new Date(startDateString)
const endDate = new Date(endDateString)
const users = await userRepository.findAllCreatedBetween(startDate, endDate)
const usersCount = await userRepository.countAllCreatedBetween(startDate, endDate)
const timestamp = timer.getTimestampInMicroseconds()
logger.info(
`[TRANSITION ${timestamp}] Found ${users.length} users created between ${startDateString} and ${endDateString}`,
`[TRANSITION ${timestamp}] Found ${usersCount} users created between ${startDateString} and ${endDateString}`,
)
let usersTriggered = 0
let itemTransitionsTriggered = 0
let revisionTransitionsTriggered = 0
const forceRun = forceRunParam === 'true'
for (const user of users) {
const itemsTransitionStatus = await transitionStatusRepository.getStatus(user.uuid, 'items')
const revisionsTransitionStatus = await transitionStatusRepository.getStatus(user.uuid, 'revisions')
const userRoles = await user.roles
const pageLimit = 100
const totalPages = Math.ceil(usersCount / pageLimit)
for (let currentPage = 1; currentPage <= totalPages; currentPage++) {
const users = await userRepository.findAllCreatedBetween({
start: startDate,
end: endDate,
offset: (currentPage - 1) * pageLimit,
limit: pageLimit,
})
const userHasTransitionRole = userRoles.some((role) => role.name === RoleName.NAMES.TransitionUser)
const bothTransitionStatusesAreVerified =
itemsTransitionStatus?.value === TransitionStatus.STATUSES.Verified &&
revisionsTransitionStatus?.value === TransitionStatus.STATUSES.Verified
for (const user of users) {
const itemsTransitionStatus = await transitionStatusRepository.getStatus(user.uuid, 'items')
const revisionsTransitionStatus = await transitionStatusRepository.getStatus(user.uuid, 'revisions')
if (!userHasTransitionRole && bothTransitionStatusesAreVerified) {
continue
}
const userRoles = await user.roles
let wasTransitionRequested = false
const userHasTransitionRole = userRoles.some((role) => role.name === RoleName.NAMES.TransitionUser)
const bothTransitionStatusesAreVerified =
itemsTransitionStatus?.value === TransitionStatus.STATUSES.Verified &&
revisionsTransitionStatus?.value === TransitionStatus.STATUSES.Verified
if (
itemsTransitionStatus === null ||
itemsTransitionStatus.value === TransitionStatus.STATUSES.Failed ||
(itemsTransitionStatus.value === TransitionStatus.STATUSES.InProgress && forceRun)
) {
wasTransitionRequested = true
await transitionStatusRepository.remove(user.uuid, 'items')
if (!userHasTransitionRole && bothTransitionStatusesAreVerified) {
continue
}
await domainEventPublisher.publish(
domainEventFactory.createTransitionRequestedEvent({
userUuid: user.uuid,
type: 'items',
timestamp,
}),
)
}
if (
revisionsTransitionStatus === null ||
revisionsTransitionStatus.value === TransitionStatus.STATUSES.Failed ||
(revisionsTransitionStatus.value === TransitionStatus.STATUSES.InProgress && forceRun)
) {
wasTransitionRequested = true
await transitionStatusRepository.remove(user.uuid, 'revisions')
await domainEventPublisher.publish(
domainEventFactory.createTransitionRequestedEvent({
userUuid: user.uuid,
type: 'revisions',
timestamp,
}),
)
}
usersTriggered += 1
if (wasTransitionRequested) {
logger.info(
`[TRANSITION ${timestamp}] Transition requested for user ${user.uuid} - items status: ${itemsTransitionStatus?.value}, revisions status: ${revisionsTransitionStatus?.value}, has transition role: ${userHasTransitionRole}`,
`[TRANSITION ${timestamp}] Transition status for user ${user.uuid} - items status: ${itemsTransitionStatus?.value}, revisions status: ${revisionsTransitionStatus?.value}, has transition role: ${userHasTransitionRole}`,
)
if (
itemsTransitionStatus === null ||
itemsTransitionStatus.value === TransitionStatus.STATUSES.Failed ||
(itemsTransitionStatus.value === TransitionStatus.STATUSES.InProgress && forceRun)
) {
await transitionStatusRepository.remove(user.uuid, 'items')
await domainEventPublisher.publish(
domainEventFactory.createTransitionRequestedEvent({
userUuid: user.uuid,
type: 'items',
timestamp,
}),
)
itemTransitionsTriggered++
}
if (
revisionsTransitionStatus === null ||
revisionsTransitionStatus.value === TransitionStatus.STATUSES.Failed ||
(revisionsTransitionStatus.value === TransitionStatus.STATUSES.InProgress && forceRun)
) {
await transitionStatusRepository.remove(user.uuid, 'revisions')
await domainEventPublisher.publish(
domainEventFactory.createTransitionRequestedEvent({
userUuid: user.uuid,
type: 'revisions',
timestamp,
}),
)
revisionTransitionsTriggered++
}
}
}
logger.info(
`[TRANSITION ${timestamp}] Triggered transition for ${usersTriggered} users created between ${startDateString} and ${endDateString}`,
`[TRANSITION ${timestamp}] Triggered ${itemTransitionsTriggered} item transitions and ${revisionTransitionsTriggered} revision transitions for users created between ${startDateString} and ${endDateString}`,
)
}

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
import { Email, ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthScheduledTask)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthScheduledTask })
sdk.start()
import { Logger } from 'winston'

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.AuthWorker)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.AuthWorker })
sdk.start()
import { Logger } from 'winston'
@@ -11,7 +11,7 @@ import { Logger } from 'winston'
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
import TYPES from '../src/Bootstrap/Types'
import { Env } from '../src/Bootstrap/Env'
import { DomainEventSubscriberFactoryInterface } from '@standardnotes/domain-events'
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
import * as dayjs from 'dayjs'
import * as utc from 'dayjs/plugin/utc'
@@ -26,8 +26,7 @@ void container.load().then((container) => {
logger.info('Starting worker...')
const subscriberFactory: DomainEventSubscriberFactoryInterface = container.get(
TYPES.Auth_DomainEventSubscriberFactory,
)
subscriberFactory.create().start()
const subscriber = container.get<DomainEventSubscriberInterface>(TYPES.Auth_DomainEventSubscriber)
subscriber.start()
})

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/auth-server",
"version": "1.158.6",
"version": "1.159.2",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -7,7 +7,7 @@ import {
DomainEventHandlerInterface,
DomainEventMessageHandlerInterface,
DomainEventPublisherInterface,
DomainEventSubscriberFactoryInterface,
DomainEventSubscriberInterface,
} from '@standardnotes/domain-events'
import { TimerInterface, Timer } from '@standardnotes/time'
import { UAParser } from 'ua-parser-js'
@@ -90,8 +90,8 @@ import {
DirectCallDomainEventPublisher,
DirectCallEventMessageHandler,
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryDomainEventSubscriber,
} from '@standardnotes/domain-events-infra'
import { GetUserSubscription } from '../Domain/UseCase/GetUserSubscription/GetUserSubscription'
import { ChangeCredentials } from '../Domain/UseCase/ChangeCredentials/ChangeCredentials'
@@ -188,6 +188,7 @@ import {
ControllerContainer,
ControllerContainerInterface,
MapperInterface,
ServiceIdentifier,
SharedVaultUser,
} from '@standardnotes/domain-core'
import { SessionTracePersistenceMapper } from '../Mapping/SessionTracePersistenceMapper'
@@ -1262,12 +1263,14 @@ export class ContainerConfigLoader {
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger)))
container
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Auth_DomainEventSubscriberFactory)
.bind<DomainEventSubscriberInterface>(TYPES.Auth_DomainEventSubscriber)
.toConstantValue(
new SQSDomainEventSubscriberFactory(
container.get(TYPES.Auth_SQS),
container.get(TYPES.Auth_SQS_QUEUE_URL),
container.get(TYPES.Auth_DomainEventMessageHandler),
new SQSOpenTelemetryDomainEventSubscriber(
ServiceIdentifier.NAMES.AuthWorker,
container.get<SQSClient>(TYPES.Auth_SQS),
container.get<string>(TYPES.Auth_SQS_QUEUE_URL),
container.get<DomainEventMessageHandlerInterface>(TYPES.Auth_DomainEventMessageHandler),
container.get<winston.Logger>(TYPES.Auth_Logger),
),
)
}

View File

@@ -218,7 +218,7 @@ const TYPES = {
Auth_WebSocketConnectionTokenDecoder: Symbol.for('Auth_WebSocketConnectionTokenDecoder'),
Auth_AuthenticationMethodResolver: Symbol.for('Auth_AuthenticationMethodResolver'),
Auth_DomainEventPublisher: Symbol.for('Auth_DomainEventPublisher'),
Auth_DomainEventSubscriberFactory: Symbol.for('Auth_DomainEventSubscriberFactory'),
Auth_DomainEventSubscriber: Symbol.for('Auth_DomainEventSubscriber'),
Auth_DomainEventFactory: Symbol.for('Auth_DomainEventFactory'),
Auth_DomainEventMessageHandler: Symbol.for('Auth_DomainEventMessageHandler'),
Auth_HTTPClient: Symbol.for('Auth_HTTPClient'),

View File

@@ -8,7 +8,8 @@ export interface UserRepositoryInterface {
streamTeam(memberEmail?: Email): Promise<ReadStream>
findOneByUuid(uuid: Uuid): Promise<User | null>
findOneByUsernameOrEmail(usernameOrEmail: Email | Username): Promise<User | null>
findAllCreatedBetween(start: Date, end: Date): Promise<User[]>
findAllCreatedBetween(dto: { start: Date; end: Date; offset: number; limit: number }): Promise<User[]>
countAllCreatedBetween(start: Date, end: Date): Promise<number>
save(user: User): Promise<User>
remove(user: User): Promise<User>
}

View File

@@ -14,11 +14,21 @@ export class TypeORMUserRepository implements UserRepositoryInterface {
private ormRepository: Repository<User>,
) {}
async findAllCreatedBetween(start: Date, end: Date): Promise<User[]> {
async findAllCreatedBetween(dto: { start: Date; end: Date; offset: number; limit: number }): Promise<User[]> {
return this.ormRepository
.createQueryBuilder('user')
.where('user.created_at BETWEEN :start AND :end', { start: dto.start, end: dto.end })
.orderBy('user.created_at', 'ASC')
.take(dto.limit)
.skip(dto.offset)
.getMany()
}
async countAllCreatedBetween(start: Date, end: Date): Promise<number> {
return this.ormRepository
.createQueryBuilder('user')
.where('user.created_at BETWEEN :start AND :end', { start, end })
.getMany()
.getCount()
}
async save(user: User): Promise<User> {

View File

@@ -3,6 +3,24 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.20.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.20.0...@standardnotes/domain-events-infra@1.20.1) (2023-10-18)
### Bug Fixes
* remove ip attributes in opentelemetry http instrumentation ([#874](https://github.com/standardnotes/server/issues/874)) ([7ce9aba](https://github.com/standardnotes/server/commit/7ce9aba517435034f491c9f080f671285fb91b91))
# [1.20.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.7...@standardnotes/domain-events-infra@1.20.0) (2023-10-17)
### Features
* add wrapping sqs receive message with open telemetry ([aba4f90](https://github.com/standardnotes/server/commit/aba4f90485e1b40baac34561321a5381945aa27e))
## [1.19.7](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.6...@standardnotes/domain-events-infra@1.19.7) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [1.19.6](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.5...@standardnotes/domain-events-infra@1.19.6) (2023-10-12)
**Note:** Version bump only for package @standardnotes/domain-events-infra

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.19.6",
"version": "1.20.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},
@@ -27,23 +27,23 @@
"@aws-sdk/client-sns": "^3.427.0",
"@aws-sdk/client-sqs": "^3.427.0",
"@opentelemetry/api": "^1.6.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.43.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.43.0",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.44.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.44.0",
"@opentelemetry/id-generator-aws-xray": "^1.2.1",
"@opentelemetry/instrumentation-aws-sdk": "^0.36.0",
"@opentelemetry/instrumentation-express": "^0.33.1",
"@opentelemetry/instrumentation-http": "^0.43.0",
"@opentelemetry/instrumentation-ioredis": "^0.35.1",
"@opentelemetry/instrumentation-winston": "^0.32.1",
"@opentelemetry/instrumentation-aws-sdk": "^0.36.1",
"@opentelemetry/instrumentation-express": "^0.33.2",
"@opentelemetry/instrumentation-http": "^0.44.0",
"@opentelemetry/instrumentation-ioredis": "^0.35.2",
"@opentelemetry/instrumentation-winston": "^0.32.2",
"@opentelemetry/propagator-aws-xray": "^1.3.1",
"@opentelemetry/resource-detector-aws": "^1.3.1",
"@opentelemetry/sdk-node": "^0.43.0",
"@opentelemetry/semantic-conventions": "^1.17.0",
"@opentelemetry/resource-detector-aws": "^1.3.2",
"@opentelemetry/sdk-node": "^0.44.0",
"@opentelemetry/semantic-conventions": "^1.17.1",
"@standardnotes/domain-events": "workspace:*",
"ioredis": "^5.2.4",
"opentelemetry-instrumentation-typeorm": "^0.39.1",
"reflect-metadata": "^0.1.13",
"sqs-consumer": "^7.3.0",
"sqs-consumer": "7.4.0-canary.0",
"winston": "^3.8.1"
},
"devDependencies": {

View File

@@ -1,5 +1,5 @@
import * as OpenTelemetrySDKNode from '@opentelemetry/sdk-node'
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'
import { SemanticAttributes, SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc'
import { AWSXRayIdGenerator } from '@opentelemetry/id-generator-aws-xray'
import * as AwsResourceDetectors from '@opentelemetry/resource-detector-aws'
@@ -10,16 +10,21 @@ import { AwsInstrumentation } from '@opentelemetry/instrumentation-aws-sdk'
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-proto'
import { WinstonInstrumentation } from '@opentelemetry/instrumentation-winston'
import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis'
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'
import { IncomingMessage } from 'http'
import { Attributes } from '@opentelemetry/api'
import { OpenTelemetrySDKInterface } from './OpenTelemetrySDKInterface'
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express'
export class OpenTelemetrySDK implements OpenTelemetrySDKInterface {
private declare sdk: OpenTelemetrySDKNode.NodeSDK
constructor(
private serviceName: string,
private spanRatio?: number,
private options: {
serviceName: string
spanRatio?: number
metricExportIntervalMillis?: number
},
) {
this.build()
}
@@ -27,24 +32,28 @@ export class OpenTelemetrySDK implements OpenTelemetrySDKInterface {
build(): void {
const otResource = OpenTelemetrySDKNode.resources.Resource.default().merge(
new OpenTelemetrySDKNode.resources.Resource({
[SemanticResourceAttributes.SERVICE_NAME]: this.serviceName,
[SemanticResourceAttributes.SERVICE_NAME]: this.options.serviceName,
}),
)
const traceExporter = new OTLPTraceExporter()
const spanProcessor = new OpenTelemetrySDKNode.tracing.BatchSpanProcessor(traceExporter)
const metricExportIntervalMillis = this.options.metricExportIntervalMillis ?? 300_000
const metricReader = new OpenTelemetrySDKNode.metrics.PeriodicExportingMetricReader({
exportIntervalMillis: 1_000,
exportIntervalMillis: metricExportIntervalMillis,
exporter: new OTLPMetricExporter(),
})
const serviceName = this.serviceName
const serviceName = this.options.serviceName
const winstonInstrumentation = new WinstonInstrumentation({
logHook: (_span, record) => {
record['resource.service.name'] = serviceName
},
})
const ratio = this.spanRatio ?? 0.01
const ratio = this.options.spanRatio ?? 0.01
this.sdk = new OpenTelemetrySDKNode.NodeSDK({
sampler: new OpenTelemetrySDKNode.tracing.TraceIdRatioBasedSampler(ratio),
@@ -56,6 +65,11 @@ export class OpenTelemetrySDK implements OpenTelemetrySDKInterface {
return isHealthCheckUrl
},
startIncomingSpanHook: (_request: IncomingMessage): Attributes => {
return {
[SemanticAttributes.HTTP_CLIENT_IP]: undefined,
}
},
}),
new ExpressInstrumentation(),
new AwsInstrumentation({

View File

@@ -0,0 +1,58 @@
import { Consumer } from 'sqs-consumer'
import * as OpenTelemetryApi from '@opentelemetry/api'
import { Message, SQSClient } from '@aws-sdk/client-sqs'
import { DomainEventSubscriberInterface, DomainEventMessageHandlerInterface } from '@standardnotes/domain-events'
import { Logger } from 'winston'
export class SQSOpenTelemetryDomainEventSubscriber implements DomainEventSubscriberInterface {
private currentSpan: OpenTelemetryApi.Span | undefined
constructor(
private serviceName: string,
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,
preReceiveMessageCallback: this.startParentSpan.bind(this),
handleMessage: this.handleMessage.bind(this),
})
sqsConsumer.on('error', this.handleError.bind(this))
sqsConsumer.on('processing_error', this.handleError.bind(this))
sqsConsumer.start()
}
async startParentSpan(): Promise<void> {
const tracer = OpenTelemetryApi.trace.getTracer(`${this.serviceName}-domain-event-subscriber`)
this.currentSpan = tracer.startSpan(this.serviceName, { kind: OpenTelemetryApi.SpanKind.CONSUMER })
}
async handleMessage(message: Message): Promise<void> {
await this.domainEventMessageHandler.handleMessage(<string>message.Body)
if (this.currentSpan) {
this.currentSpan.end()
this.currentSpan = undefined
}
}
handleError(error: Error): void {
this.logger.error('Error occured while handling SQS message: %O', error)
if (this.currentSpan) {
this.currentSpan.recordException(error)
this.currentSpan.end()
this.currentSpan = undefined
}
}
}

View File

@@ -1,56 +0,0 @@
import { Logger } from 'winston'
import * as zlib from 'zlib'
import {
DomainEventHandlerInterface,
DomainEventInterface,
DomainEventMessageHandlerInterface,
} from '@standardnotes/domain-events'
import { OpenTelemetryTracer } from '../OpenTelemetry/OpenTelemetryTracer'
import { OpenTelemetryTracerInterface } from '../OpenTelemetry/OpenTelemetryTracerInterface'
export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHandlerInterface {
private tracer: OpenTelemetryTracerInterface | undefined
constructor(
private serviceName: string,
private handlers: Map<string, DomainEventHandlerInterface>,
private logger: Logger,
) {}
async handleMessage(message: string): Promise<void> {
const messageParsed = JSON.parse(message)
const domainEventJson = zlib.unzipSync(Buffer.from(messageParsed.Message, 'base64')).toString()
const domainEvent: DomainEventInterface = JSON.parse(domainEventJson)
domainEvent.createdAt = new Date(domainEvent.createdAt)
const handler = this.handlers.get(domainEvent.type)
if (!handler) {
this.logger.debug(`Event handler for event type ${domainEvent.type} does not exist`)
return
}
this.logger.debug(`Received event: ${domainEvent.type}`)
this.tracer = new OpenTelemetryTracer()
this.tracer.startSpan(this.serviceName, domainEvent.type)
try {
await handler.handle(domainEvent)
} catch (error) {
this.tracer.stopSpanWithError(error as Error)
throw error
}
this.tracer.stopSpan()
}
async handleError(error: Error): Promise<void> {
this.logger.error('Error occured while handling SQS message: %O', error)
}
}

View File

@@ -17,4 +17,4 @@ export * from './SNS/SNSOpenTelemetryDomainEventPublisher'
export * from './SQS/SQSBounceNotificiationHandler'
export * from './SQS/SQSDomainEventSubscriberFactory'
export * from './SQS/SQSEventMessageHandler'
export * from './SQS/SQSOpenTelemetryEventMessageHandler'
export * from './SQS/SQSOpenTelemetryDomainEventSubscriber'

View File

@@ -3,6 +3,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.13.14](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.13...@standardnotes/event-store@1.13.14) (2023-10-18)
**Note:** Version bump only for package @standardnotes/event-store
## [1.13.13](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.12...@standardnotes/event-store@1.13.13) (2023-10-17)
**Note:** Version bump only for package @standardnotes/event-store
## [1.13.12](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.11...@standardnotes/event-store@1.13.12) (2023-10-13)
**Note:** Version bump only for package @standardnotes/event-store
## [1.13.11](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.10...@standardnotes/event-store@1.13.11) (2023-10-12)
**Note:** Version bump only for package @standardnotes/event-store

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/event-store",
"version": "1.13.11",
"version": "1.13.14",
"description": "Event Store Service",
"private": true,
"main": "dist/src/index.js",

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.31.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.31.0...@standardnotes/files-server@1.31.1) (2023-10-18)
**Note:** Version bump only for package @standardnotes/files-server
# [1.31.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.7...@standardnotes/files-server@1.31.0) (2023-10-17)
### Features
* add wrapping sqs receive message with open telemetry ([aba4f90](https://github.com/standardnotes/files/commit/aba4f90485e1b40baac34561321a5381945aa27e))
## [1.30.7](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.6...@standardnotes/files-server@1.30.7) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/files/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [1.30.6](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.5...@standardnotes/files-server@1.30.6) (2023-10-12)
**Note:** Version bump only for package @standardnotes/files-server

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.Files)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Files })
sdk.start()
import * as busboy from 'connect-busboy'

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.FilesWorker)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.FilesWorker })
sdk.start()
import { Logger } from 'winston'
@@ -11,7 +11,7 @@ import { Logger } from 'winston'
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
import TYPES from '../src/Bootstrap/Types'
import { Env } from '../src/Bootstrap/Env'
import { DomainEventSubscriberFactoryInterface } from '@standardnotes/domain-events'
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
import * as dayjs from 'dayjs'
import * as utc from 'dayjs/plugin/utc'
@@ -26,8 +26,7 @@ void container.load().then((container) => {
logger.info('Starting worker...')
const subscriberFactory: DomainEventSubscriberFactoryInterface = container.get(
TYPES.Files_DomainEventSubscriberFactory,
)
subscriberFactory.create().start()
const subscriber = container.get<DomainEventSubscriberInterface>(TYPES.Files_DomainEventSubscriber)
subscriber.start()
})

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/files-server",
"version": "1.30.6",
"version": "1.31.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -17,8 +17,8 @@ import {
DirectCallDomainEventPublisher,
DirectCallEventMessageHandler,
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryDomainEventSubscriber,
} from '@standardnotes/domain-events-infra'
import { StreamDownloadFile } from '../Domain/UseCase/StreamDownloadFile/StreamDownloadFile'
import { FileDownloaderInterface } from '../Domain/Services/FileDownloaderInterface'
@@ -40,7 +40,7 @@ import {
DomainEventHandlerInterface,
DomainEventMessageHandlerInterface,
DomainEventPublisherInterface,
DomainEventSubscriberFactoryInterface,
DomainEventSubscriberInterface,
} from '@standardnotes/domain-events'
import { MarkFilesToBeRemoved } from '../Domain/UseCase/MarkFilesToBeRemoved/MarkFilesToBeRemoved'
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
@@ -52,6 +52,7 @@ import { S3FileMover } from '../Infra/S3/S3FileMover'
import { FSFileMover } from '../Infra/FS/FSFileMover'
import { MoveFile } from '../Domain/UseCase/MoveFile/MoveFile'
import { SharedVaultValetTokenAuthMiddleware } from '../Infra/InversifyExpress/Middleware/SharedVaultValetTokenAuthMiddleware'
import { ServiceIdentifier } from '@standardnotes/domain-core'
export class ContainerConfigLoader {
async load(configuration?: {
@@ -298,12 +299,14 @@ export class ContainerConfigLoader {
.bind<DomainEventMessageHandlerInterface>(TYPES.Files_DomainEventMessageHandler)
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Files_Logger)))
container
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Files_DomainEventSubscriberFactory)
.bind<DomainEventSubscriberInterface>(TYPES.Files_DomainEventSubscriber)
.toConstantValue(
new SQSDomainEventSubscriberFactory(
container.get(TYPES.Files_SQS),
container.get(TYPES.Files_SQS_QUEUE_URL),
container.get(TYPES.Files_DomainEventMessageHandler),
new SQSOpenTelemetryDomainEventSubscriber(
ServiceIdentifier.NAMES.FilesWorker,
container.get<SQSClient>(TYPES.Files_SQS),
container.get<string>(TYPES.Files_SQS_QUEUE_URL),
container.get<DomainEventMessageHandlerInterface>(TYPES.Files_DomainEventMessageHandler),
container.get<winston.Logger>(TYPES.Files_Logger),
),
)
}

View File

@@ -52,7 +52,7 @@ const TYPES = {
// Handlers
Files_DomainEventMessageHandler: Symbol.for('Files_DomainEventMessageHandler'),
Files_DomainEventSubscriberFactory: Symbol.for('Files_DomainEventSubscriberFactory'),
Files_DomainEventSubscriber: Symbol.for('Files_DomainEventSubscriber'),
Files_AccountDeletionRequestedEventHandler: Symbol.for('Files_AccountDeletionRequestedEventHandler'),
Files_SharedSubscriptionInvitationCanceledEventHandler: Symbol.for(
'Files_SharedSubscriptionInvitationCanceledEventHandler',

View File

@@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.17.17](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.16...@standardnotes/home-server@1.17.17) (2023-10-18)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.16](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.15...@standardnotes/home-server@1.17.16) (2023-10-17)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.15](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.14...@standardnotes/home-server@1.17.15) (2023-10-17)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.14](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.13...@standardnotes/home-server@1.17.14) (2023-10-16)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.13](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.12...@standardnotes/home-server@1.17.13) (2023-10-13)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.12](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.11...@standardnotes/home-server@1.17.12) (2023-10-12)
**Note:** Version bump only for package @standardnotes/home-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/home-server",
"version": "1.17.12",
"version": "1.17.17",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.46.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.46.0...@standardnotes/revisions-server@1.46.1) (2023-10-18)
**Note:** Version bump only for package @standardnotes/revisions-server
# [1.46.0](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.7...@standardnotes/revisions-server@1.46.0) (2023-10-17)
### Features
* add wrapping sqs receive message with open telemetry ([aba4f90](https://github.com/standardnotes/server/commit/aba4f90485e1b40baac34561321a5381945aa27e))
## [1.45.7](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.6...@standardnotes/revisions-server@1.45.7) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [1.45.6](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.5...@standardnotes/revisions-server@1.45.6) (2023-10-12)
**Note:** Version bump only for package @standardnotes/revisions-server

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.Revisions)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.Revisions })
sdk.start()
import * as cors from 'cors'

View File

@@ -3,14 +3,14 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.RevisionsWorker)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.RevisionsWorker })
sdk.start()
import { Logger } from 'winston'
import TYPES from '../src/Bootstrap/Types'
import { Env } from '../src/Bootstrap/Env'
import { DomainEventSubscriberFactoryInterface } from '@standardnotes/domain-events'
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
import { ContainerConfigLoader } from '../src/Bootstrap/Container'
const container = new ContainerConfigLoader('worker')
@@ -22,8 +22,7 @@ void container.load().then((container) => {
logger.info('Starting worker...')
const subscriberFactory: DomainEventSubscriberFactoryInterface = container.get(
TYPES.Revisions_DomainEventSubscriberFactory,
)
subscriberFactory.create().start()
const subscriber = container.get<DomainEventSubscriberInterface>(TYPES.Revisions_DomainEventSubscriber)
subscriber.start()
})

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/revisions-server",
"version": "1.45.6",
"version": "1.46.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -1,4 +1,9 @@
import { ControllerContainer, ControllerContainerInterface, MapperInterface } from '@standardnotes/domain-core'
import {
ControllerContainer,
ControllerContainerInterface,
MapperInterface,
ServiceIdentifier,
} from '@standardnotes/domain-core'
import Redis from 'ioredis'
import { Container, interfaces } from 'inversify'
import { MongoRepository, Repository } from 'typeorm'
@@ -26,15 +31,15 @@ import { SQSClient, SQSClientConfig } from '@aws-sdk/client-sqs'
import {
DomainEventMessageHandlerInterface,
DomainEventHandlerInterface,
DomainEventSubscriberFactoryInterface,
DomainEventPublisherInterface,
DomainEventSubscriberInterface,
} from '@standardnotes/domain-events'
import {
SQSEventMessageHandler,
SQSDomainEventSubscriberFactory,
DirectCallEventMessageHandler,
DirectCallDomainEventPublisher,
SNSOpenTelemetryDomainEventPublisher,
SQSOpenTelemetryDomainEventSubscriber,
} from '@standardnotes/domain-events-infra'
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
@@ -507,14 +512,16 @@ export class ContainerConfigLoader {
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger)))
container
.bind<DomainEventSubscriberFactoryInterface>(TYPES.Revisions_DomainEventSubscriberFactory)
.toDynamicValue((context: interfaces.Context) => {
return new SQSDomainEventSubscriberFactory(
context.container.get(TYPES.Revisions_SQS),
context.container.get(TYPES.Revisions_SQS_QUEUE_URL),
context.container.get(TYPES.Revisions_DomainEventMessageHandler),
)
})
.bind<DomainEventSubscriberInterface>(TYPES.Revisions_DomainEventSubscriber)
.toConstantValue(
new SQSOpenTelemetryDomainEventSubscriber(
ServiceIdentifier.NAMES.RevisionsWorker,
container.get<SQSClient>(TYPES.Revisions_SQS),
container.get<string>(TYPES.Revisions_SQS_QUEUE_URL),
container.get<DomainEventMessageHandlerInterface>(TYPES.Revisions_DomainEventMessageHandler),
container.get<winston.Logger>(TYPES.Revisions_Logger),
),
)
}
// Inversify Controllers

View File

@@ -65,7 +65,7 @@ const TYPES = {
Revisions_SharedVaultRemovedEventHandler: Symbol.for('Revisions_SharedVaultRemovedEventHandler'),
// Services
Revisions_CrossServiceTokenDecoder: Symbol.for('Revisions_CrossServiceTokenDecoder'),
Revisions_DomainEventSubscriberFactory: Symbol.for('Revisions_DomainEventSubscriberFactory'),
Revisions_DomainEventSubscriber: Symbol.for('Revisions_DomainEventSubscriber'),
Revisions_DomainEventMessageHandler: Symbol.for('Revisions_DomainEventMessageHandler'),
Revisions_DomainEventPublisher: Symbol.for('Revisions_DomainEventPublisher'),
Revisions_DomainEventFactory: Symbol.for('Revisions_DomainEventFactory'),

View File

@@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.26.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.26.0...@standardnotes/scheduler-server@1.26.1) (2023-10-18)
**Note:** Version bump only for package @standardnotes/scheduler-server
# [1.26.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.7...@standardnotes/scheduler-server@1.26.0) (2023-10-17)
### Features
* add wrapping sqs receive message with open telemetry ([aba4f90](https://github.com/standardnotes/server/commit/aba4f90485e1b40baac34561321a5381945aa27e))
## [1.25.7](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.6...@standardnotes/scheduler-server@1.25.7) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/server/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [1.25.6](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.5...@standardnotes/scheduler-server@1.25.6) (2023-10-12)
**Note:** Version bump only for package @standardnotes/scheduler-server

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK, OpenTelemetryTracer } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.SchedulerScheduledTask)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SchedulerScheduledTask })
sdk.start()
import { Logger } from 'winston'

View File

@@ -3,11 +3,11 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.SchedulerWorker)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SchedulerWorker })
sdk.start()
import { Logger } from 'winston'
import { DomainEventSubscriberFactoryInterface } from '@standardnotes/domain-events'
import { DomainEventSubscriberInterface } from '@standardnotes/domain-events'
import * as dayjs from 'dayjs'
import * as utc from 'dayjs/plugin/utc'
@@ -26,6 +26,7 @@ void container.load().then((container) => {
logger.info('Starting worker...')
const subscriberFactory: DomainEventSubscriberFactoryInterface = container.get(TYPES.DomainEventSubscriberFactory)
subscriberFactory.create().start()
const subscriber = container.get<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
subscriber.start()
})

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/scheduler-server",
"version": "1.25.6",
"version": "1.26.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -7,7 +7,7 @@ import {
DomainEventHandlerInterface,
DomainEventMessageHandlerInterface,
DomainEventPublisherInterface,
DomainEventSubscriberFactoryInterface,
DomainEventSubscriberInterface,
} from '@standardnotes/domain-events'
import { Env } from './Env'
@@ -16,8 +16,8 @@ import { AppDataSource } from './DataSource'
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
import {
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryDomainEventSubscriber,
} from '@standardnotes/domain-events-infra'
import { Timer, TimerInterface } from '@standardnotes/time'
import { PredicateRepositoryInterface } from '../Domain/Predicate/PredicateRepositoryInterface'
@@ -35,6 +35,7 @@ import { VerifyPredicates } from '../Domain/UseCase/VerifyPredicates/VerifyPredi
import { UserRegisteredEventHandler } from '../Domain/Handler/UserRegisteredEventHandler'
import { SubscriptionCancelledEventHandler } from '../Domain/Handler/SubscriptionCancelledEventHandler'
import { ExitDiscountAppliedEventHandler } from '../Domain/Handler/ExitDiscountAppliedEventHandler'
import { ServiceIdentifier } from '@standardnotes/domain-core'
export class ContainerConfigLoader {
async load(): Promise<Container> {
@@ -150,12 +151,14 @@ export class ContainerConfigLoader {
.bind<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler)
.toConstantValue(new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Logger)))
container
.bind<DomainEventSubscriberFactoryInterface>(TYPES.DomainEventSubscriberFactory)
.bind<DomainEventSubscriberInterface>(TYPES.DomainEventSubscriber)
.toConstantValue(
new SQSDomainEventSubscriberFactory(
container.get(TYPES.SQS),
container.get(TYPES.SQS_QUEUE_URL),
container.get(TYPES.DomainEventMessageHandler),
new SQSOpenTelemetryDomainEventSubscriber(
ServiceIdentifier.NAMES.SchedulerWorker,
container.get<SQSClient>(TYPES.SQS),
container.get<string>(TYPES.SQS_QUEUE_URL),
container.get<DomainEventMessageHandlerInterface>(TYPES.DomainEventMessageHandler),
container.get<winston.Logger>(TYPES.Logger),
),
)

View File

@@ -25,7 +25,7 @@ const TYPES = {
ExitDiscountAppliedEventHandler: Symbol.for('ExitDiscountAppliedEventHandler'),
// Services
DomainEventPublisher: Symbol.for('DomainEventPublisher'),
DomainEventSubscriberFactory: Symbol.for('DomainEventSubscriberFactory'),
DomainEventSubscriber: Symbol.for('DomainEventSubscriber'),
DomainEventFactory: Symbol.for('DomainEventFactory'),
DomainEventMessageHandler: Symbol.for('DomainEventMessageHandler'),
Timer: Symbol.for('Timer'),

View File

@@ -3,6 +3,26 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.118.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.118.0...@standardnotes/syncing-server@1.118.1) (2023-10-18)
**Note:** Version bump only for package @standardnotes/syncing-server
# [1.118.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.7...@standardnotes/syncing-server@1.118.0) (2023-10-17)
### Bug Fixes
* **syncing-server:** binding ([5b06ea9](https://github.com/standardnotes/syncing-server-js/commit/5b06ea94f9734c1a82549235058b7f63c7665fb7))
### Features
* add wrapping sqs receive message with open telemetry ([aba4f90](https://github.com/standardnotes/syncing-server-js/commit/aba4f90485e1b40baac34561321a5381945aa27e))
## [1.117.7](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.6...@standardnotes/syncing-server@1.117.7) (2023-10-13)
### Bug Fixes
* reduce the amount of metrics gathered in telemetery ([32fe8d0](https://github.com/standardnotes/syncing-server-js/commit/32fe8d0a8523d6e1875cd0814c0cbdf27d8df7b3))
## [1.117.6](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.5...@standardnotes/syncing-server@1.117.6) (2023-10-12)
### Bug Fixes

View File

@@ -3,7 +3,7 @@ import 'reflect-metadata'
import { OpenTelemetrySDK } from '@standardnotes/domain-events-infra'
import { ServiceIdentifier } from '@standardnotes/domain-core'
const sdk = new OpenTelemetrySDK(ServiceIdentifier.NAMES.SyncingServer)
const sdk = new OpenTelemetrySDK({ serviceName: ServiceIdentifier.NAMES.SyncingServer })
sdk.start()
import '../src/Infra/InversifyExpressUtils/AnnotatedHealthCheckController'

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