Compare commits

...

4 Commits

46 changed files with 305 additions and 77 deletions

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
## [2.30.2](https://github.com/standardnotes/server/compare/@standardnotes/analytics@2.30.1...@standardnotes/analytics@2.30.2) (2023-10-11)
**Note:** Version bump only for package @standardnotes/analytics

View File

@@ -1,6 +1,6 @@
{
"name": "@standardnotes/analytics",
"version": "2.30.2",
"version": "2.31.0",
"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,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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
## [1.79.3](https://github.com/standardnotes/api-gateway/compare/@standardnotes/api-gateway@1.79.2...@standardnotes/api-gateway@1.79.3) (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.3",
"version": "1.79.5",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
## [1.157.2](https://github.com/standardnotes/server/compare/@standardnotes/auth-server@1.157.1...@standardnotes/auth-server@1.157.2) (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.2",
"version": "1.158.0",
"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,18 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
* **domain-events-infra:** logs severity ([1d28002](https://github.com/standardnotes/server/commit/1d280028a65b7ba1925e27b471d98961e16b0974))
## [1.18.1](https://github.com/standardnotes/server/compare/@standardnotes/domain-events-infra@1.18.0...@standardnotes/domain-events-infra@1.18.1) (2023-10-11)
**Note:** Version bump only for package @standardnotes/domain-events-infra

View File

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

View File

@@ -0,0 +1,17 @@
import * as OpenTelemetryApi from '@opentelemetry/api'
export class OpenTelemetryPropagation {
inject(): { traceparent?: string; tracestate?: string } {
const output = {}
OpenTelemetryApi.propagation.inject(OpenTelemetryApi.context.active(), output)
return output as { traceparent?: string; tracestate?: string }
}
extract(input: { traceparent?: string; tracestate?: 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(): { traceparent?: string; tracestate?: string }
extract(input: { traceparent?: string; tracestate?: 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,48 @@
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()
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,16 @@ export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHa
return
}
this.logger.debug(`Received event: ${domainEvent.type}`)
this.logger.info(`Received event: ${domainEvent.type}`)
this.tracer = new OpenTelemetryTracer()
this.tracer.startSpan(this.serviceName, domainEvent.type)
let activeContext = undefined
if (domainEvent.meta.trace) {
activeContext = this.propagator.extract(domainEvent.meta.trace)
}
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,12 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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.0",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -9,6 +9,10 @@ export interface DomainEventInterface {
userIdentifier: string
userIdentifierType: 'uuid' | 'email' | 'shared-vault-uuid'
}
trace?: {
traceparent?: string
tracestate?: string
}
origin: DomainEventService
target?: DomainEventService
}

View File

@@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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
## [1.13.3](https://github.com/standardnotes/server/compare/@standardnotes/event-store@1.13.2...@standardnotes/event-store@1.13.3) (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.3",
"version": "1.13.5",
"description": "Event Store Service",
"private": true,
"main": "dist/src/index.js",

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
## [1.29.3](https://github.com/standardnotes/files/compare/@standardnotes/files-server@1.29.2...@standardnotes/files-server@1.29.3) (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.3",
"version": "1.30.0",
"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,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
## [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
## [1.17.4](https://github.com/standardnotes/server/compare/@standardnotes/home-server@1.17.3...@standardnotes/home-server@1.17.4) (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.4",
"version": "1.17.6",
"engines": {
"node": ">=18.0.0 <21.0.0"
},

View File

@@ -3,6 +3,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
## [1.44.3](https://github.com/standardnotes/server/compare/@standardnotes/revisions-server@1.44.2...@standardnotes/revisions-server@1.44.3) (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.3",
"version": "1.45.0",
"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,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
## [1.24.2](https://github.com/standardnotes/server/compare/@standardnotes/scheduler-server@1.24.1...@standardnotes/scheduler-server@1.24.2) (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.2",
"version": "1.25.0",
"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,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
## [1.116.4](https://github.com/standardnotes/syncing-server-js/compare/@standardnotes/syncing-server@1.116.3...@standardnotes/syncing-server@1.116.4) (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.4",
"version": "1.117.0",
"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,16 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
# [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
## [1.15.3](https://github.com/standardnotes/server/compare/@standardnotes/websockets-server@1.15.2...@standardnotes/websockets-server@1.15.3) (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.3",
"version": "1.16.0",
"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),
),