Compare commits

...

8 Commits

Author SHA1 Message Date
standardci
63201934a5 chore(release): publish new version
- @standardnotes/analytics@2.31.3
 - @standardnotes/api-gateway@1.79.8
 - @standardnotes/auth-server@1.158.3
 - @standardnotes/domain-events-infra@1.19.3
 - @standardnotes/domain-events@2.132.1
 - @standardnotes/event-store@1.13.8
 - @standardnotes/files-server@1.30.3
 - @standardnotes/home-server@1.17.9
 - @standardnotes/revisions-server@1.45.3
 - @standardnotes/scheduler-server@1.25.3
 - @standardnotes/syncing-server@1.117.3
 - @standardnotes/websockets-server@1.16.3
2023-10-12 06:11:53 +00:00
Karol Sójko
4a6f90b95b fix: injecting opentelemetry trace into sqs/sns coms 2023-10-12 07:50:18 +02:00
standardci
a747f4fc46 chore(release): publish new version
- @standardnotes/analytics@2.31.2
 - @standardnotes/api-gateway@1.79.7
 - @standardnotes/auth-server@1.158.2
 - @standardnotes/domain-events-infra@1.19.2
 - @standardnotes/event-store@1.13.7
 - @standardnotes/files-server@1.30.2
 - @standardnotes/home-server@1.17.8
 - @standardnotes/revisions-server@1.45.2
 - @standardnotes/scheduler-server@1.25.2
 - @standardnotes/syncing-server@1.117.2
 - @standardnotes/websockets-server@1.16.2
2023-10-11 13:40:28 +00:00
Karol Sójko
b782cedc85 fix(domain-events-infra): logs severity 2023-10-11 15:22:07 +02:00
standardci
7435a7ebba chore(release): publish new version
- @standardnotes/analytics@2.31.1
 - @standardnotes/api-gateway@1.79.6
 - @standardnotes/auth-server@1.158.1
 - @standardnotes/domain-events-infra@1.19.1
 - @standardnotes/event-store@1.13.6
 - @standardnotes/files-server@1.30.1
 - @standardnotes/home-server@1.17.7
 - @standardnotes/revisions-server@1.45.1
 - @standardnotes/scheduler-server@1.25.1
 - @standardnotes/syncing-server@1.117.1
 - @standardnotes/websockets-server@1.16.1
2023-10-11 13:07:22 +00:00
Karol Sójko
48c6d97d69 fix(domain-events-infra): add info if event has trace 2023-10-11 14:47:37 +02:00
standardci
9a45aeb3e6 chore(release): publish new version
- @standardnotes/analytics@2.31.0
 - @standardnotes/api-gateway@1.79.5
 - @standardnotes/auth-server@1.158.0
 - @standardnotes/domain-events-infra@1.19.0
 - @standardnotes/domain-events@2.132.0
 - @standardnotes/event-store@1.13.5
 - @standardnotes/files-server@1.30.0
 - @standardnotes/home-server@1.17.6
 - @standardnotes/revisions-server@1.45.0
 - @standardnotes/scheduler-server@1.25.0
 - @standardnotes/syncing-server@1.117.0
 - @standardnotes/websockets-server@1.16.0
2023-10-11 12:08:57 +00:00
Karol Sójko
72c9b28ebe feat: add opentelemetry tracing in distributed system 2023-10-11 13:52:02 +02:00
46 changed files with 408 additions and 77 deletions

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.
## [2.31.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.2...@standardnotes/analytics@2.31.3) (2023-10-12)
**Note:** Version bump only for package @standardnotes/analytics
## [2.31.2](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.1...@standardnotes/analytics@2.31.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/analytics
## [2.31.1](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.31.0...@standardnotes/analytics@2.31.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/analytics
# [2.31.0](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.30.3...@standardnotes/analytics@2.31.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/server/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [2.30.3](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.30.2...@standardnotes/analytics@2.30.3) (2023-10-11)
**Note:** Version bump only for package @standardnotes/analytics

View File

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

View File

@@ -4,6 +4,7 @@ import { Container } from 'inversify'
import {
DomainEventHandlerInterface,
DomainEventMessageHandlerInterface,
DomainEventPublisherInterface,
DomainEventSubscriberFactoryInterface,
} from '@standardnotes/domain-events'
import { MapperInterface, ServiceIdentifier } from '@standardnotes/domain-core'
@@ -15,7 +16,9 @@ import TYPES from './Types'
import { AppDataSource } from './DataSource'
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
import {
SNSDomainEventPublisher,
OpenTelemetryPropagation,
OpenTelemetryPropagationInterface,
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSOpenTelemetryEventMessageHandler,
} from '@standardnotes/domain-events-infra'
@@ -86,6 +89,10 @@ export class ContainerConfigLoader {
})
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
container
.bind<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR)
.toConstantValue(new OpenTelemetryPropagation())
const snsConfig: SNSClientConfig = {
apiVersion: 'latest',
region: env.get('SNS_AWS_REGION', true),
@@ -137,8 +144,14 @@ export class ContainerConfigLoader {
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
container
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
.toConstantValue(
new SNSOpenTelemetryDomainEventPublisher(
container.get<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR),
container.get(TYPES.SNS),
container.get(TYPES.SNS_TOPIC_ARN),
),
)
if (env.get('MIXPANEL_TOKEN', true)) {
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(env.get('MIXPANEL_TOKEN', true)))
}
@@ -238,6 +251,7 @@ export class ContainerConfigLoader {
.toConstantValue(
new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.AnalyticsWorker,
container.get<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR),
eventHandlers,
container.get(TYPES.Logger),
),

View File

@@ -3,6 +3,7 @@ const TYPES = {
Redis: Symbol.for('Redis'),
SNS: Symbol.for('SNS'),
SQS: Symbol.for('SQS'),
OTEL_PROPAGATOR: Symbol.for('OTEL_PROPAGATOR'),
// env vars
REDIS_URL: Symbol.for('REDIS_URL'),
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),

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.79.8](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.7...@standardnotes/api-gateway@1.79.8) (2023-10-12)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.79.7](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.6...@standardnotes/api-gateway@1.79.7) (2023-10-11)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.79.6](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.5...@standardnotes/api-gateway@1.79.6) (2023-10-11)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.79.5](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.4...@standardnotes/api-gateway@1.79.5) (2023-10-11)
**Note:** Version bump only for package @standardnotes/api-gateway
## [1.79.4](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.3...@standardnotes/api-gateway@1.79.4) (2023-10-11)
**Note:** Version bump only for package @standardnotes/api-gateway

View File

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

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.158.3](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.2...@standardnotes/auth-server@1.158.3) (2023-10-12)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.158.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.1...@standardnotes/auth-server@1.158.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/auth-server
## [1.158.1](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.158.0...@standardnotes/auth-server@1.158.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/auth-server
# [1.158.0](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.157.3...@standardnotes/auth-server@1.158.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/server/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [1.157.3](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.157.2...@standardnotes/auth-server@1.157.3) (2023-10-11)
**Note:** Version bump only for package @standardnotes/auth-server

View File

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

View File

@@ -89,7 +89,9 @@ import { ExtensionKeyGrantedEventHandler } from '../Domain/Handler/ExtensionKeyG
import {
DirectCallDomainEventPublisher,
DirectCallEventMessageHandler,
SNSDomainEventPublisher,
OpenTelemetryPropagation,
OpenTelemetryPropagationInterface,
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryEventMessageHandler,
@@ -308,6 +310,10 @@ export class ContainerConfigLoader {
}
container.bind<winston.Logger>(TYPES.Auth_Logger).toConstantValue(logger)
container
.bind<OpenTelemetryPropagationInterface>(TYPES.Auth_OTEL_PROPAGATOR)
.toConstantValue(new OpenTelemetryPropagation())
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
await appDataSource.initialize()
@@ -725,7 +731,11 @@ export class ContainerConfigLoader {
.toConstantValue(
isConfiguredForHomeServer
? directCallDomainEventPublisher
: new SNSDomainEventPublisher(container.get(TYPES.Auth_SNS), container.get(TYPES.Auth_SNS_TOPIC_ARN)),
: new SNSOpenTelemetryDomainEventPublisher(
container.get<OpenTelemetryPropagationInterface>(TYPES.Auth_OTEL_PROPAGATOR),
container.get(TYPES.Auth_SNS),
container.get(TYPES.Auth_SNS_TOPIC_ARN),
),
)
// Middleware
@@ -1228,6 +1238,7 @@ export class ContainerConfigLoader {
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger))
: new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.AuthWorker,
container.get<OpenTelemetryPropagationInterface>(TYPES.Auth_OTEL_PROPAGATOR),
eventHandlers,
container.get(TYPES.Auth_Logger),
),

View File

@@ -3,6 +3,7 @@ const TYPES = {
Auth_Redis: Symbol.for('Auth_Redis'),
Auth_SNS: Symbol.for('Auth_SNS'),
Auth_SQS: Symbol.for('Auth_SQS'),
Auth_OTEL_PROPAGATOR: Symbol.for('Auth_OTEL_PROPAGATOR'),
// Mapping
Auth_SessionTracePersistenceMapper: Symbol.for('Auth_SessionTracePersistenceMapper'),
Auth_AuthenticatorChallengePersistenceMapper: Symbol.for('Auth_AuthenticatorChallengePersistenceMapper'),

View File

@@ -3,6 +3,30 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [1.19.3](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.2...@standardnotes/domain-events-infra@1.19.3) (2023-10-12)
### Bug Fixes
* injecting opentelemetry trace into sqs/sns coms ([4a6f90b](https://github.com/standardnotes/server/commit/4a6f90b95b39e7990b10dd4b96d549e1366383fe))
## [1.19.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.1...@standardnotes/domain-events-infra@1.19.2) (2023-10-11)
### Bug Fixes
* **domain-events-infra:** logs severity ([b782ced](https://github.com/standardnotes/server/commit/b782cedc85e0dff1f94163b908d98005b30f119e))
## [1.19.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.19.0...@standardnotes/domain-events-infra@1.19.1) (2023-10-11)
### Bug Fixes
* **domain-events-infra:** add info if event has trace ([48c6d97](https://github.com/standardnotes/server/commit/48c6d97d697a740c262495eff87c6db65ebb38d9))
# [1.19.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.18.2...@standardnotes/domain-events-infra@1.19.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/server/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [1.18.2](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.18.1...@standardnotes/domain-events-infra@1.18.2) (2023-10-11)
### Bug Fixes

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events-infra",
"version": "1.18.2",
"version": "1.19.3",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -0,0 +1,19 @@
import * as OpenTelemetryApi from '@opentelemetry/api'
import { OpenTelemetryPropagationInterface } from './OpenTelemetryPropagationInterface'
export class OpenTelemetryPropagation implements OpenTelemetryPropagationInterface {
inject(): Record<string, string> {
const output = {}
OpenTelemetryApi.propagation.inject(OpenTelemetryApi.context.active(), output)
return output
}
extract(input: Record<string, string>): OpenTelemetryApi.Context {
const activeContext = OpenTelemetryApi.propagation.extract(OpenTelemetryApi.context.active(), input)
return activeContext
}
}

View File

@@ -0,0 +1,6 @@
import { Context } from '@opentelemetry/api'
export interface OpenTelemetryPropagationInterface {
inject(): Record<string, string>
extract(input: Record<string, string>): Context
}

View File

@@ -6,11 +6,11 @@ export class OpenTelemetryTracer implements OpenTelemetryTracerInterface {
private parentSpan: OpenTelemetryApi.Span | undefined
private internalSpan: OpenTelemetryApi.Span | undefined
startSpan(parentSpanName: string, internalSpanName: string): void {
startSpan(parentSpanName: string, internalSpanName: string, activeContext?: OpenTelemetryApi.Context): void {
const tracer = OpenTelemetryApi.trace.getTracer(`${parentSpanName}-handler`)
this.parentSpan = tracer.startSpan(parentSpanName, { kind: OpenTelemetryApi.SpanKind.CONSUMER })
const ctx = OpenTelemetryApi.trace.setSpan(OpenTelemetryApi.context.active(), this.parentSpan)
this.parentSpan = tracer.startSpan(parentSpanName, { kind: OpenTelemetryApi.SpanKind.CONSUMER }, activeContext)
const ctx = OpenTelemetryApi.trace.setSpan(activeContext ?? OpenTelemetryApi.context.active(), this.parentSpan)
this.internalSpan = tracer.startSpan(internalSpanName, { kind: OpenTelemetryApi.SpanKind.INTERNAL }, ctx)
}

View File

@@ -1,5 +1,7 @@
import { Context } from '@opentelemetry/api'
export interface OpenTelemetryTracerInterface {
startSpan(parentSpanName: string, internalSpanName: string): void
startSpan(parentSpanName: string, internalSpanName: string, activeContext?: Context): void
stopSpan(): void
stopSpanWithError(error: Error): void
}

View File

@@ -1,45 +0,0 @@
import 'reflect-metadata'
import { DomainEventInterface, DomainEventService } from '@standardnotes/domain-events'
import { SNSClient } from '@aws-sdk/client-sns'
import { SNSDomainEventPublisher } from './SNSDomainEventPublisher'
describe('SNSDomainEventPublisher', () => {
let sns: SNSClient
const topicArn = 'test-topic-arn'
let event: DomainEventInterface
const createPublisher = () => new SNSDomainEventPublisher(sns, topicArn)
beforeEach(() => {
sns = {} as jest.Mocked<SNSClient>
sns.send = jest.fn()
event = {} as jest.Mocked<DomainEventInterface>
event.type = 'TEST'
event.payload = { foo: 'bar' }
event.createdAt = new Date(1)
event.meta = {
correlation: {
userIdentifier: '1-2-3',
userIdentifierType: 'uuid',
},
origin: DomainEventService.Auth,
}
})
it('should publish a domain event', async () => {
await createPublisher().publish(event)
expect(sns.send).toHaveBeenCalled()
})
it('should publish a targeted domain event', async () => {
event.meta.target = DomainEventService.SyncingServer
await createPublisher().publish(event)
expect(sns.send).toHaveBeenCalled()
})
})

View File

@@ -0,0 +1,50 @@
import * as zlib from 'zlib'
import { MessageAttributeValue, PublishCommand, PublishCommandInput, SNSClient } from '@aws-sdk/client-sns'
import { DomainEventInterface, DomainEventPublisherInterface } from '@standardnotes/domain-events'
import { OpenTelemetryPropagationInterface } from '../OpenTelemetry/OpenTelemetryPropagationInterface'
export class SNSOpenTelemetryDomainEventPublisher implements DomainEventPublisherInterface {
constructor(
private propagator: OpenTelemetryPropagationInterface,
private snsClient: SNSClient,
private topicArn: string,
) {}
async publish(event: DomainEventInterface): Promise<void> {
const trace = this.propagator.inject()
if (Object.keys(trace).length > 0) {
event.meta.trace = trace
}
const message: PublishCommandInput = {
TopicArn: this.topicArn,
MessageAttributes: {
event: {
DataType: 'String',
StringValue: event.type,
},
compression: {
DataType: 'String',
StringValue: 'true',
},
origin: {
DataType: 'String',
StringValue: event.meta.origin,
},
},
Message: zlib.deflateSync(JSON.stringify(event)).toString('base64'),
}
if (event.meta.target !== undefined) {
;(message.MessageAttributes as Record<string, MessageAttributeValue>).target = {
DataType: 'String',
StringValue: event.meta.target,
}
}
const command = new PublishCommand(message)
await this.snsClient.send(command)
}
}

View File

@@ -7,12 +7,14 @@ import {
} from '@standardnotes/domain-events'
import { OpenTelemetryTracer } from '../OpenTelemetry/OpenTelemetryTracer'
import { OpenTelemetryTracerInterface } from '../OpenTelemetry/OpenTelemetryTracerInterface'
import { OpenTelemetryPropagationInterface } from '../OpenTelemetry/OpenTelemetryPropagationInterface'
export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHandlerInterface {
private tracer: OpenTelemetryTracerInterface | undefined
constructor(
private serviceName: string,
private propagator: OpenTelemetryPropagationInterface,
private handlers: Map<string, DomainEventHandlerInterface>,
private logger: Logger,
) {}
@@ -33,11 +35,20 @@ export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHa
return
}
this.logger.info(`Received event: ${domainEvent.type}`)
this.logger.debug(`Received event: ${domainEvent.type}`)
this.tracer = new OpenTelemetryTracer()
this.tracer.startSpan(this.serviceName, domainEvent.type)
let activeContext = undefined
if (domainEvent.meta.trace) {
this.logger.debug(`Event has trace: ${JSON.stringify(domainEvent.meta.trace)}`)
activeContext = this.propagator.extract(domainEvent.meta.trace)
this.logger.info(`Injecting pre-existing active context into trace: ${JSON.stringify(activeContext)}`)
}
this.tracer.startSpan(this.serviceName, domainEvent.type, activeContext)
try {
await handler.handle(domainEvent)

View File

@@ -1,6 +1,8 @@
export * from './DirectCall/DirectCallDomainEventPublisher'
export * from './DirectCall/DirectCallEventMessageHandler'
export * from './OpenTelemetry/OpenTelemetryPropagation'
export * from './OpenTelemetry/OpenTelemetryPropagationInterface'
export * from './OpenTelemetry/OpenTelemetrySDK'
export * from './OpenTelemetry/OpenTelemetrySDKInterface'
export * from './OpenTelemetry/OpenTelemetryTracer'
@@ -12,6 +14,7 @@ export * from './Redis/RedisDomainEventSubscriberFactory'
export * from './Redis/RedisEventMessageHandler'
export * from './SNS/SNSDomainEventPublisher'
export * from './SNS/SNSOpenTelemetryDomainEventPublisher'
export * from './SQS/SQSBounceNotificiationHandler'
export * from './SQS/SQSDomainEventSubscriberFactory'

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.
## [2.132.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.132.0...@standardnotes/domain-events@2.132.1) (2023-10-12)
### Bug Fixes
* injecting opentelemetry trace into sqs/sns coms ([4a6f90b](https://github.com/standardnotes/server/commit/4a6f90b95b39e7990b10dd4b96d549e1366383fe))
# [2.132.0](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.131.1...@standardnotes/domain-events@2.132.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/server/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [2.131.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events@2.131.0...@standardnotes/domain-events@2.131.1) (2023-09-28)
**Note:** Version bump only for package @standardnotes/domain-events

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/domain-events",
"version": "2.131.1",
"version": "2.132.1",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -9,6 +9,7 @@ export interface DomainEventInterface {
userIdentifier: string
userIdentifierType: 'uuid' | 'email' | 'shared-vault-uuid'
}
trace?: Record<string, string>
origin: DomainEventService
target?: DomainEventService
}

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.13.8](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.7...@standardnotes/event-store@1.13.8) (2023-10-12)
**Note:** Version bump only for package @standardnotes/event-store
## [1.13.7](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.6...@standardnotes/event-store@1.13.7) (2023-10-11)
**Note:** Version bump only for package @standardnotes/event-store
## [1.13.6](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.5...@standardnotes/event-store@1.13.6) (2023-10-11)
**Note:** Version bump only for package @standardnotes/event-store
## [1.13.5](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.4...@standardnotes/event-store@1.13.5) (2023-10-11)
**Note:** Version bump only for package @standardnotes/event-store
## [1.13.4](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.3...@standardnotes/event-store@1.13.4) (2023-10-11)
**Note:** Version bump only for package @standardnotes/event-store

View File

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

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.30.3](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.2...@standardnotes/files-server@1.30.3) (2023-10-12)
**Note:** Version bump only for package @standardnotes/files-server
## [1.30.2](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.1...@standardnotes/files-server@1.30.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/files-server
## [1.30.1](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.30.0...@standardnotes/files-server@1.30.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/files-server
# [1.30.0](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.29.4...@standardnotes/files-server@1.30.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/files/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [1.29.4](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.29.3...@standardnotes/files-server@1.29.4) (2023-10-11)
**Note:** Version bump only for package @standardnotes/files-server

View File

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

View File

@@ -16,7 +16,9 @@ import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
import {
DirectCallDomainEventPublisher,
DirectCallEventMessageHandler,
SNSDomainEventPublisher,
OpenTelemetryPropagation,
OpenTelemetryPropagationInterface,
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryEventMessageHandler,
@@ -98,6 +100,10 @@ export class ContainerConfigLoader {
container.bind<TimerInterface>(TYPES.Files_Timer).toConstantValue(new Timer())
container
.bind<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR)
.toConstantValue(new OpenTelemetryPropagation())
// services
container
.bind<TokenDecoderInterface<ValetTokenData>>(TYPES.Files_ValetTokenDecoder)
@@ -176,7 +182,11 @@ export class ContainerConfigLoader {
container
.bind<DomainEventPublisherInterface>(TYPES.Files_DomainEventPublisher)
.toConstantValue(
new SNSDomainEventPublisher(container.get(TYPES.Files_SNS), container.get(TYPES.Files_SNS_TOPIC_ARN)),
new SNSOpenTelemetryDomainEventPublisher(
container.get<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR),
container.get(TYPES.Files_SNS),
container.get(TYPES.Files_SNS_TOPIC_ARN),
),
)
}
@@ -300,6 +310,7 @@ export class ContainerConfigLoader {
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Files_Logger))
: new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.FilesWorker,
container.get<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR),
eventHandlers,
container.get(TYPES.Files_Logger),
),

View File

@@ -5,6 +5,7 @@ const TYPES = {
Files_S3: Symbol.for('Files_S3'),
Files_SNS: Symbol.for('Files_SNS'),
Files_SQS: Symbol.for('Files_SQS'),
Files_OTEL_PROPAGATOR: Symbol.for('Files_OTEL_PROPAGATOR'),
// use cases
Files_UploadFileChunk: Symbol.for('Files_UploadFileChunk'),

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.17.9](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.8...@standardnotes/home-server@1.17.9) (2023-10-12)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.8](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.7...@standardnotes/home-server@1.17.8) (2023-10-11)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.7](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.6...@standardnotes/home-server@1.17.7) (2023-10-11)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.6](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.5...@standardnotes/home-server@1.17.6) (2023-10-11)
**Note:** Version bump only for package @standardnotes/home-server
## [1.17.5](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.4...@standardnotes/home-server@1.17.5) (2023-10-11)
**Note:** Version bump only for package @standardnotes/home-server

View File

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

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.45.3](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.2...@standardnotes/revisions-server@1.45.3) (2023-10-12)
**Note:** Version bump only for package @standardnotes/revisions-server
## [1.45.2](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.1...@standardnotes/revisions-server@1.45.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/revisions-server
## [1.45.1](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.45.0...@standardnotes/revisions-server@1.45.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/revisions-server
# [1.45.0](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.44.4...@standardnotes/revisions-server@1.45.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/server/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [1.44.4](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.44.3...@standardnotes/revisions-server@1.44.4) (2023-10-11)
**Note:** Version bump only for package @standardnotes/revisions-server

View File

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

View File

@@ -39,8 +39,10 @@ import {
SQSDomainEventSubscriberFactory,
DirectCallEventMessageHandler,
DirectCallDomainEventPublisher,
SNSDomainEventPublisher,
SQSOpenTelemetryEventMessageHandler,
OpenTelemetryPropagation,
SNSOpenTelemetryDomainEventPublisher,
OpenTelemetryPropagationInterface,
} from '@standardnotes/domain-events-infra'
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
@@ -140,6 +142,10 @@ export class ContainerConfigLoader {
container.bind<TimerInterface>(TYPES.Revisions_Timer).toDynamicValue(() => new Timer())
container
.bind<OpenTelemetryPropagationInterface>(TYPES.Revisions_OTEL_PROPAGATOR)
.toConstantValue(new OpenTelemetryPropagation())
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
await appDataSource.initialize()
@@ -180,7 +186,8 @@ export class ContainerConfigLoader {
container
.bind<DomainEventPublisherInterface>(TYPES.Revisions_DomainEventPublisher)
.toDynamicValue((context: interfaces.Context) => {
return new SNSDomainEventPublisher(
return new SNSOpenTelemetryDomainEventPublisher(
context.container.get<OpenTelemetryPropagationInterface>(TYPES.Revisions_OTEL_PROPAGATOR),
context.container.get(TYPES.Revisions_SNS),
context.container.get(TYPES.Revisions_SNS_TOPIC_ARN),
)
@@ -515,6 +522,7 @@ export class ContainerConfigLoader {
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger))
: new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.RevisionsWorker,
container.get<OpenTelemetryPropagationInterface>(TYPES.Revisions_OTEL_PROPAGATOR),
eventHandlers,
container.get(TYPES.Revisions_Logger),
),

View File

@@ -6,6 +6,7 @@ const TYPES = {
Revisions_SNS: Symbol.for('Revisions_SNS'),
Revisions_S3: Symbol.for('Revisions_S3'),
Revisions_Env: Symbol.for('Revisions_Env'),
Revisions_OTEL_PROPAGATOR: Symbol.for('Revisions_OTEL_PROPAGATOR'),
// Map
Revisions_SQLLegacyRevisionMetadataPersistenceMapper: Symbol.for(
'Revisions_SQLLegacyRevisionMetadataPersistenceMapper',

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.25.3](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.2...@standardnotes/scheduler-server@1.25.3) (2023-10-12)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.25.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.1...@standardnotes/scheduler-server@1.25.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/scheduler-server
## [1.25.1](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.25.0...@standardnotes/scheduler-server@1.25.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/scheduler-server
# [1.25.0](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.24.3...@standardnotes/scheduler-server@1.25.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/server/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [1.24.3](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.24.2...@standardnotes/scheduler-server@1.24.3) (2023-10-11)
**Note:** Version bump only for package @standardnotes/scheduler-server

View File

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

View File

@@ -6,6 +6,7 @@ import { Container } from 'inversify'
import {
DomainEventHandlerInterface,
DomainEventMessageHandlerInterface,
DomainEventPublisherInterface,
DomainEventSubscriberFactoryInterface,
} from '@standardnotes/domain-events'
@@ -14,7 +15,9 @@ import TYPES from './Types'
import { AppDataSource } from './DataSource'
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
import {
SNSDomainEventPublisher,
OpenTelemetryPropagation,
OpenTelemetryPropagationInterface,
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSOpenTelemetryEventMessageHandler,
} from '@standardnotes/domain-events-infra'
@@ -65,6 +68,10 @@ export class ContainerConfigLoader {
})
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
container
.bind<OpenTelemetryPropagationInterface>(TYPES.Scheduler_OTEL_PROPAGATOR)
.toConstantValue(new OpenTelemetryPropagation())
if (env.get('SNS_TOPIC_ARN', true)) {
const snsConfig: SNSClientConfig = {
apiVersion: 'latest',
@@ -134,8 +141,14 @@ export class ContainerConfigLoader {
container.bind<JobDoneInterpreterInterface>(TYPES.JobDoneInterpreter).to(JobDoneInterpreter)
container
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
.toConstantValue(
new SNSOpenTelemetryDomainEventPublisher(
container.get<OpenTelemetryPropagationInterface>(TYPES.Scheduler_OTEL_PROPAGATOR),
container.get(TYPES.SNS),
container.get(TYPES.SNS_TOPIC_ARN),
),
)
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
@@ -149,6 +162,7 @@ export class ContainerConfigLoader {
.toConstantValue(
new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.SchedulerWorker,
container.get<OpenTelemetryPropagationInterface>(TYPES.Scheduler_OTEL_PROPAGATOR),
eventHandlers,
container.get(TYPES.Logger),
),

View File

@@ -3,6 +3,7 @@ const TYPES = {
Redis: Symbol.for('Redis'),
SNS: Symbol.for('SNS'),
SQS: Symbol.for('SQS'),
Scheduler_OTEL_PROPAGATOR: Symbol.for('Scheduler_OTEL_PROPAGATOR'),
// env vars
REDIS_URL: Symbol.for('REDIS_URL'),
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),

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.117.3](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.2...@standardnotes/syncing-server@1.117.3) (2023-10-12)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.117.2](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.1...@standardnotes/syncing-server@1.117.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/syncing-server
## [1.117.1](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.117.0...@standardnotes/syncing-server@1.117.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/syncing-server
# [1.117.0](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.116.5...@standardnotes/syncing-server@1.117.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/syncing-server-js/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [1.116.5](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.116.4...@standardnotes/syncing-server@1.116.5) (2023-10-11)
**Note:** Version bump only for package @standardnotes/syncing-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/syncing-server",
"version": "1.116.5",
"version": "1.117.3",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -13,7 +13,9 @@ import { Item } from '../Domain/Item/Item'
import {
DirectCallDomainEventPublisher,
DirectCallEventMessageHandler,
SNSDomainEventPublisher,
OpenTelemetryPropagation,
OpenTelemetryPropagationInterface,
SNSOpenTelemetryDomainEventPublisher,
SQSDomainEventSubscriberFactory,
SQSEventMessageHandler,
SQSOpenTelemetryEventMessageHandler,
@@ -216,6 +218,10 @@ export class ContainerConfigLoader {
}
container.bind<winston.Logger>(TYPES.Sync_Logger).toConstantValue(logger)
container
.bind<OpenTelemetryPropagationInterface>(TYPES.Sync_OTEL_PROPAGATOR)
.toConstantValue(new OpenTelemetryPropagation())
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
await appDataSource.initialize()
@@ -286,7 +292,8 @@ export class ContainerConfigLoader {
container
.bind<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher)
.toDynamicValue((context: interfaces.Context) => {
return new SNSDomainEventPublisher(
return new SNSOpenTelemetryDomainEventPublisher(
context.container.get<OpenTelemetryPropagationInterface>(TYPES.Sync_OTEL_PROPAGATOR),
context.container.get(TYPES.Sync_SNS),
context.container.get(TYPES.Sync_SNS_TOPIC_ARN),
)
@@ -1157,6 +1164,7 @@ export class ContainerConfigLoader {
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Sync_Logger))
: new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.SyncingServerWorker,
container.get<OpenTelemetryPropagationInterface>(TYPES.Sync_OTEL_PROPAGATOR),
eventHandlers,
container.get(TYPES.Sync_Logger),
),

View File

@@ -6,6 +6,7 @@ const TYPES = {
Sync_SQS: Symbol.for('Sync_SQS'),
Sync_S3: Symbol.for('Sync_S3'),
Sync_Env: Symbol.for('Sync_Env'),
Sync_OTEL_PROPAGATOR: Symbol.for('Sync_OTEL_PROPAGATOR'),
// Repositories
Sync_ItemRepositoryResolver: Symbol.for('Sync_ItemRepositoryResolver'),
Sync_SQLItemRepository: Symbol.for('Sync_SQLItemRepository'),

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.16.3](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.2...@standardnotes/websockets-server@1.16.3) (2023-10-12)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.16.2](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.1...@standardnotes/websockets-server@1.16.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/websockets-server
## [1.16.1](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.16.0...@standardnotes/websockets-server@1.16.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/websockets-server
# [1.16.0](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.15.4...@standardnotes/websockets-server@1.16.0) (2023-10-11)
### Features
* add opentelemetry tracing in distributed system ([72c9b28](https://github.com/standardnotes/server/commit/72c9b28ebe108a2011d1a598fd4682132a533126))
## [1.15.4](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.15.3...@standardnotes/websockets-server@1.15.4) (2023-10-11)
**Note:** Version bump only for package @standardnotes/websockets-server

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/websockets-server",
"version": "1.15.4",
"version": "1.16.3",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -19,6 +19,7 @@ import { AddWebSocketsConnection } from '../Domain/UseCase/AddWebSocketsConnecti
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
import {
OpenTelemetryPropagation,
SQSDomainEventSubscriberFactory,
SQSOpenTelemetryEventMessageHandler,
} from '@standardnotes/domain-events-infra'
@@ -147,6 +148,7 @@ export class ContainerConfigLoader {
.toConstantValue(
new SQSOpenTelemetryEventMessageHandler(
ServiceIdentifier.NAMES.WebsocketsWorker,
new OpenTelemetryPropagation(),
eventHandlers,
container.get(TYPES.Logger),
),