mirror of
https://github.com/standardnotes/server
synced 2026-05-12 15:57:16 -04:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9a45aeb3e6 | |||
| 72c9b28ebe |
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/analytics
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/analytics",
|
"name": "@standardnotes/analytics",
|
||||||
"version": "2.30.3",
|
"version": "2.31.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { Container } from 'inversify'
|
|||||||
import {
|
import {
|
||||||
DomainEventHandlerInterface,
|
DomainEventHandlerInterface,
|
||||||
DomainEventMessageHandlerInterface,
|
DomainEventMessageHandlerInterface,
|
||||||
|
DomainEventPublisherInterface,
|
||||||
DomainEventSubscriberFactoryInterface,
|
DomainEventSubscriberFactoryInterface,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { MapperInterface, ServiceIdentifier } from '@standardnotes/domain-core'
|
import { MapperInterface, ServiceIdentifier } from '@standardnotes/domain-core'
|
||||||
@@ -15,7 +16,9 @@ import TYPES from './Types'
|
|||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
SNSDomainEventPublisher,
|
OpenTelemetryPropagation,
|
||||||
|
OpenTelemetryPropagationInterface,
|
||||||
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSOpenTelemetryEventMessageHandler,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
@@ -86,6 +89,10 @@ export class ContainerConfigLoader {
|
|||||||
})
|
})
|
||||||
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
||||||
|
|
||||||
|
container
|
||||||
|
.bind<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR)
|
||||||
|
.toConstantValue(new OpenTelemetryPropagation())
|
||||||
|
|
||||||
const snsConfig: SNSClientConfig = {
|
const snsConfig: SNSClientConfig = {
|
||||||
apiVersion: 'latest',
|
apiVersion: 'latest',
|
||||||
region: env.get('SNS_AWS_REGION', true),
|
region: env.get('SNS_AWS_REGION', true),
|
||||||
@@ -137,8 +144,14 @@ export class ContainerConfigLoader {
|
|||||||
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
container.bind<TimerInterface>(TYPES.Timer).toConstantValue(new Timer())
|
||||||
|
|
||||||
container
|
container
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
.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)) {
|
if (env.get('MIXPANEL_TOKEN', true)) {
|
||||||
container.bind<Mixpanel>(TYPES.MixpanelClient).toConstantValue(Mixpanel.init(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(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryEventMessageHandler(
|
new SQSOpenTelemetryEventMessageHandler(
|
||||||
ServiceIdentifier.NAMES.AnalyticsWorker,
|
ServiceIdentifier.NAMES.AnalyticsWorker,
|
||||||
|
container.get<OpenTelemetryPropagationInterface>(TYPES.OTEL_PROPAGATOR),
|
||||||
eventHandlers,
|
eventHandlers,
|
||||||
container.get(TYPES.Logger),
|
container.get(TYPES.Logger),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const TYPES = {
|
|||||||
Redis: Symbol.for('Redis'),
|
Redis: Symbol.for('Redis'),
|
||||||
SNS: Symbol.for('SNS'),
|
SNS: Symbol.for('SNS'),
|
||||||
SQS: Symbol.for('SQS'),
|
SQS: Symbol.for('SQS'),
|
||||||
|
OTEL_PROPAGATOR: Symbol.for('OTEL_PROPAGATOR'),
|
||||||
// env vars
|
// env vars
|
||||||
REDIS_URL: Symbol.for('REDIS_URL'),
|
REDIS_URL: Symbol.for('REDIS_URL'),
|
||||||
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/api-gateway
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/api-gateway",
|
"name": "@standardnotes/api-gateway",
|
||||||
"version": "1.79.4",
|
"version": "1.79.5",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/auth-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/auth-server",
|
"name": "@standardnotes/auth-server",
|
||||||
"version": "1.157.3",
|
"version": "1.158.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -89,7 +89,9 @@ import { ExtensionKeyGrantedEventHandler } from '../Domain/Handler/ExtensionKeyG
|
|||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
SNSDomainEventPublisher,
|
OpenTelemetryPropagation,
|
||||||
|
OpenTelemetryPropagationInterface,
|
||||||
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSOpenTelemetryEventMessageHandler,
|
||||||
@@ -308,6 +310,10 @@ export class ContainerConfigLoader {
|
|||||||
}
|
}
|
||||||
container.bind<winston.Logger>(TYPES.Auth_Logger).toConstantValue(logger)
|
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' })
|
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
||||||
await appDataSource.initialize()
|
await appDataSource.initialize()
|
||||||
|
|
||||||
@@ -725,7 +731,11 @@ export class ContainerConfigLoader {
|
|||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
isConfiguredForHomeServer
|
isConfiguredForHomeServer
|
||||||
? directCallDomainEventPublisher
|
? 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
|
// Middleware
|
||||||
@@ -1228,6 +1238,7 @@ export class ContainerConfigLoader {
|
|||||||
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger))
|
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Auth_Logger))
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
: new SQSOpenTelemetryEventMessageHandler(
|
||||||
ServiceIdentifier.NAMES.AuthWorker,
|
ServiceIdentifier.NAMES.AuthWorker,
|
||||||
|
container.get<OpenTelemetryPropagationInterface>(TYPES.Auth_OTEL_PROPAGATOR),
|
||||||
eventHandlers,
|
eventHandlers,
|
||||||
container.get(TYPES.Auth_Logger),
|
container.get(TYPES.Auth_Logger),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const TYPES = {
|
|||||||
Auth_Redis: Symbol.for('Auth_Redis'),
|
Auth_Redis: Symbol.for('Auth_Redis'),
|
||||||
Auth_SNS: Symbol.for('Auth_SNS'),
|
Auth_SNS: Symbol.for('Auth_SNS'),
|
||||||
Auth_SQS: Symbol.for('Auth_SQS'),
|
Auth_SQS: Symbol.for('Auth_SQS'),
|
||||||
|
Auth_OTEL_PROPAGATOR: Symbol.for('Auth_OTEL_PROPAGATOR'),
|
||||||
// Mapping
|
// Mapping
|
||||||
Auth_SessionTracePersistenceMapper: Symbol.for('Auth_SessionTracePersistenceMapper'),
|
Auth_SessionTracePersistenceMapper: Symbol.for('Auth_SessionTracePersistenceMapper'),
|
||||||
Auth_AuthenticatorChallengePersistenceMapper: Symbol.for('Auth_AuthenticatorChallengePersistenceMapper'),
|
Auth_AuthenticatorChallengePersistenceMapper: Symbol.for('Auth_AuthenticatorChallengePersistenceMapper'),
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
### Bug Fixes
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events-infra",
|
"name": "@standardnotes/domain-events-infra",
|
||||||
"version": "1.18.2",
|
"version": "1.19.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
import { Context } from '@opentelemetry/api'
|
||||||
|
|
||||||
|
export interface OpenTelemetryPropagationInterface {
|
||||||
|
inject(): { traceparent?: string; tracestate?: string }
|
||||||
|
extract(input: { traceparent?: string; tracestate?: string }): Context
|
||||||
|
}
|
||||||
@@ -6,11 +6,11 @@ export class OpenTelemetryTracer implements OpenTelemetryTracerInterface {
|
|||||||
private parentSpan: OpenTelemetryApi.Span | undefined
|
private parentSpan: OpenTelemetryApi.Span | undefined
|
||||||
private internalSpan: 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`)
|
const tracer = OpenTelemetryApi.trace.getTracer(`${parentSpanName}-handler`)
|
||||||
|
|
||||||
this.parentSpan = tracer.startSpan(parentSpanName, { kind: OpenTelemetryApi.SpanKind.CONSUMER })
|
this.parentSpan = tracer.startSpan(parentSpanName, { kind: OpenTelemetryApi.SpanKind.CONSUMER }, activeContext)
|
||||||
const ctx = OpenTelemetryApi.trace.setSpan(OpenTelemetryApi.context.active(), this.parentSpan)
|
const ctx = OpenTelemetryApi.trace.setSpan(activeContext ?? OpenTelemetryApi.context.active(), this.parentSpan)
|
||||||
|
|
||||||
this.internalSpan = tracer.startSpan(internalSpanName, { kind: OpenTelemetryApi.SpanKind.INTERNAL }, ctx)
|
this.internalSpan = tracer.startSpan(internalSpanName, { kind: OpenTelemetryApi.SpanKind.INTERNAL }, ctx)
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-1
@@ -1,5 +1,7 @@
|
|||||||
|
import { Context } from '@opentelemetry/api'
|
||||||
|
|
||||||
export interface OpenTelemetryTracerInterface {
|
export interface OpenTelemetryTracerInterface {
|
||||||
startSpan(parentSpanName: string, internalSpanName: string): void
|
startSpan(parentSpanName: string, internalSpanName: string, activeContext?: Context): void
|
||||||
stopSpan(): void
|
stopSpan(): void
|
||||||
stopSpanWithError(error: Error): void
|
stopSpanWithError(error: Error): void
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,12 +7,14 @@ import {
|
|||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
import { OpenTelemetryTracer } from '../OpenTelemetry/OpenTelemetryTracer'
|
import { OpenTelemetryTracer } from '../OpenTelemetry/OpenTelemetryTracer'
|
||||||
import { OpenTelemetryTracerInterface } from '../OpenTelemetry/OpenTelemetryTracerInterface'
|
import { OpenTelemetryTracerInterface } from '../OpenTelemetry/OpenTelemetryTracerInterface'
|
||||||
|
import { OpenTelemetryPropagationInterface } from '../OpenTelemetry/OpenTelemetryPropagationInterface'
|
||||||
|
|
||||||
export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHandlerInterface {
|
export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHandlerInterface {
|
||||||
private tracer: OpenTelemetryTracerInterface | undefined
|
private tracer: OpenTelemetryTracerInterface | undefined
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private serviceName: string,
|
private serviceName: string,
|
||||||
|
private propagator: OpenTelemetryPropagationInterface,
|
||||||
private handlers: Map<string, DomainEventHandlerInterface>,
|
private handlers: Map<string, DomainEventHandlerInterface>,
|
||||||
private logger: Logger,
|
private logger: Logger,
|
||||||
) {}
|
) {}
|
||||||
@@ -37,7 +39,12 @@ export class SQSOpenTelemetryEventMessageHandler implements DomainEventMessageHa
|
|||||||
|
|
||||||
this.tracer = new OpenTelemetryTracer()
|
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 {
|
try {
|
||||||
await handler.handle(domainEvent)
|
await handler.handle(domainEvent)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
export * from './DirectCall/DirectCallDomainEventPublisher'
|
export * from './DirectCall/DirectCallDomainEventPublisher'
|
||||||
export * from './DirectCall/DirectCallEventMessageHandler'
|
export * from './DirectCall/DirectCallEventMessageHandler'
|
||||||
|
|
||||||
|
export * from './OpenTelemetry/OpenTelemetryPropagation'
|
||||||
|
export * from './OpenTelemetry/OpenTelemetryPropagationInterface'
|
||||||
export * from './OpenTelemetry/OpenTelemetrySDK'
|
export * from './OpenTelemetry/OpenTelemetrySDK'
|
||||||
export * from './OpenTelemetry/OpenTelemetrySDKInterface'
|
export * from './OpenTelemetry/OpenTelemetrySDKInterface'
|
||||||
export * from './OpenTelemetry/OpenTelemetryTracer'
|
export * from './OpenTelemetry/OpenTelemetryTracer'
|
||||||
@@ -12,6 +14,7 @@ export * from './Redis/RedisDomainEventSubscriberFactory'
|
|||||||
export * from './Redis/RedisEventMessageHandler'
|
export * from './Redis/RedisEventMessageHandler'
|
||||||
|
|
||||||
export * from './SNS/SNSDomainEventPublisher'
|
export * from './SNS/SNSDomainEventPublisher'
|
||||||
|
export * from './SNS/SNSOpenTelemetryDomainEventPublisher'
|
||||||
|
|
||||||
export * from './SQS/SQSBounceNotificiationHandler'
|
export * from './SQS/SQSBounceNotificiationHandler'
|
||||||
export * from './SQS/SQSDomainEventSubscriberFactory'
|
export * from './SQS/SQSDomainEventSubscriberFactory'
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/domain-events
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/domain-events",
|
"name": "@standardnotes/domain-events",
|
||||||
"version": "2.131.1",
|
"version": "2.132.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -9,6 +9,10 @@ export interface DomainEventInterface {
|
|||||||
userIdentifier: string
|
userIdentifier: string
|
||||||
userIdentifierType: 'uuid' | 'email' | 'shared-vault-uuid'
|
userIdentifierType: 'uuid' | 'email' | 'shared-vault-uuid'
|
||||||
}
|
}
|
||||||
|
trace?: {
|
||||||
|
traceparent?: string
|
||||||
|
tracestate?: string
|
||||||
|
}
|
||||||
origin: DomainEventService
|
origin: DomainEventService
|
||||||
target?: DomainEventService
|
target?: DomainEventService
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/event-store
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/event-store",
|
"name": "@standardnotes/event-store",
|
||||||
"version": "1.13.4",
|
"version": "1.13.5",
|
||||||
"description": "Event Store Service",
|
"description": "Event Store Service",
|
||||||
"private": true,
|
"private": true,
|
||||||
"main": "dist/src/index.js",
|
"main": "dist/src/index.js",
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/files-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/files-server",
|
"name": "@standardnotes/files-server",
|
||||||
"version": "1.29.4",
|
"version": "1.30.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
|||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
SNSDomainEventPublisher,
|
OpenTelemetryPropagation,
|
||||||
|
OpenTelemetryPropagationInterface,
|
||||||
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSOpenTelemetryEventMessageHandler,
|
||||||
@@ -98,6 +100,10 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container.bind<TimerInterface>(TYPES.Files_Timer).toConstantValue(new Timer())
|
container.bind<TimerInterface>(TYPES.Files_Timer).toConstantValue(new Timer())
|
||||||
|
|
||||||
|
container
|
||||||
|
.bind<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR)
|
||||||
|
.toConstantValue(new OpenTelemetryPropagation())
|
||||||
|
|
||||||
// services
|
// services
|
||||||
container
|
container
|
||||||
.bind<TokenDecoderInterface<ValetTokenData>>(TYPES.Files_ValetTokenDecoder)
|
.bind<TokenDecoderInterface<ValetTokenData>>(TYPES.Files_ValetTokenDecoder)
|
||||||
@@ -176,7 +182,11 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.Files_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Files_DomainEventPublisher)
|
||||||
.toConstantValue(
|
.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 SQSEventMessageHandler(eventHandlers, container.get(TYPES.Files_Logger))
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
: new SQSOpenTelemetryEventMessageHandler(
|
||||||
ServiceIdentifier.NAMES.FilesWorker,
|
ServiceIdentifier.NAMES.FilesWorker,
|
||||||
|
container.get<OpenTelemetryPropagationInterface>(TYPES.Files_OTEL_PROPAGATOR),
|
||||||
eventHandlers,
|
eventHandlers,
|
||||||
container.get(TYPES.Files_Logger),
|
container.get(TYPES.Files_Logger),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const TYPES = {
|
|||||||
Files_S3: Symbol.for('Files_S3'),
|
Files_S3: Symbol.for('Files_S3'),
|
||||||
Files_SNS: Symbol.for('Files_SNS'),
|
Files_SNS: Symbol.for('Files_SNS'),
|
||||||
Files_SQS: Symbol.for('Files_SQS'),
|
Files_SQS: Symbol.for('Files_SQS'),
|
||||||
|
Files_OTEL_PROPAGATOR: Symbol.for('Files_OTEL_PROPAGATOR'),
|
||||||
|
|
||||||
// use cases
|
// use cases
|
||||||
Files_UploadFileChunk: Symbol.for('Files_UploadFileChunk'),
|
Files_UploadFileChunk: Symbol.for('Files_UploadFileChunk'),
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/home-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/home-server",
|
"name": "@standardnotes/home-server",
|
||||||
"version": "1.17.5",
|
"version": "1.17.6",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/revisions-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/revisions-server",
|
"name": "@standardnotes/revisions-server",
|
||||||
"version": "1.44.4",
|
"version": "1.45.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -39,8 +39,10 @@ import {
|
|||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
SNSDomainEventPublisher,
|
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSOpenTelemetryEventMessageHandler,
|
||||||
|
OpenTelemetryPropagation,
|
||||||
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
|
OpenTelemetryPropagationInterface,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
|
import { DumpRepositoryInterface } from '../Domain/Dump/DumpRepositoryInterface'
|
||||||
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
import { AccountDeletionRequestedEventHandler } from '../Domain/Handler/AccountDeletionRequestedEventHandler'
|
||||||
@@ -140,6 +142,10 @@ export class ContainerConfigLoader {
|
|||||||
|
|
||||||
container.bind<TimerInterface>(TYPES.Revisions_Timer).toDynamicValue(() => new Timer())
|
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' })
|
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
||||||
await appDataSource.initialize()
|
await appDataSource.initialize()
|
||||||
|
|
||||||
@@ -180,7 +186,8 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.Revisions_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Revisions_DomainEventPublisher)
|
||||||
.toDynamicValue((context: interfaces.Context) => {
|
.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),
|
||||||
context.container.get(TYPES.Revisions_SNS_TOPIC_ARN),
|
context.container.get(TYPES.Revisions_SNS_TOPIC_ARN),
|
||||||
)
|
)
|
||||||
@@ -515,6 +522,7 @@ export class ContainerConfigLoader {
|
|||||||
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger))
|
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Revisions_Logger))
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
: new SQSOpenTelemetryEventMessageHandler(
|
||||||
ServiceIdentifier.NAMES.RevisionsWorker,
|
ServiceIdentifier.NAMES.RevisionsWorker,
|
||||||
|
container.get<OpenTelemetryPropagationInterface>(TYPES.Revisions_OTEL_PROPAGATOR),
|
||||||
eventHandlers,
|
eventHandlers,
|
||||||
container.get(TYPES.Revisions_Logger),
|
container.get(TYPES.Revisions_Logger),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const TYPES = {
|
|||||||
Revisions_SNS: Symbol.for('Revisions_SNS'),
|
Revisions_SNS: Symbol.for('Revisions_SNS'),
|
||||||
Revisions_S3: Symbol.for('Revisions_S3'),
|
Revisions_S3: Symbol.for('Revisions_S3'),
|
||||||
Revisions_Env: Symbol.for('Revisions_Env'),
|
Revisions_Env: Symbol.for('Revisions_Env'),
|
||||||
|
Revisions_OTEL_PROPAGATOR: Symbol.for('Revisions_OTEL_PROPAGATOR'),
|
||||||
// Map
|
// Map
|
||||||
Revisions_SQLLegacyRevisionMetadataPersistenceMapper: Symbol.for(
|
Revisions_SQLLegacyRevisionMetadataPersistenceMapper: Symbol.for(
|
||||||
'Revisions_SQLLegacyRevisionMetadataPersistenceMapper',
|
'Revisions_SQLLegacyRevisionMetadataPersistenceMapper',
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/scheduler-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/scheduler-server",
|
"name": "@standardnotes/scheduler-server",
|
||||||
"version": "1.24.3",
|
"version": "1.25.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { Container } from 'inversify'
|
|||||||
import {
|
import {
|
||||||
DomainEventHandlerInterface,
|
DomainEventHandlerInterface,
|
||||||
DomainEventMessageHandlerInterface,
|
DomainEventMessageHandlerInterface,
|
||||||
|
DomainEventPublisherInterface,
|
||||||
DomainEventSubscriberFactoryInterface,
|
DomainEventSubscriberFactoryInterface,
|
||||||
} from '@standardnotes/domain-events'
|
} from '@standardnotes/domain-events'
|
||||||
|
|
||||||
@@ -14,7 +15,9 @@ import TYPES from './Types'
|
|||||||
import { AppDataSource } from './DataSource'
|
import { AppDataSource } from './DataSource'
|
||||||
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
import { DomainEventFactory } from '../Domain/Event/DomainEventFactory'
|
||||||
import {
|
import {
|
||||||
SNSDomainEventPublisher,
|
OpenTelemetryPropagation,
|
||||||
|
OpenTelemetryPropagationInterface,
|
||||||
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSOpenTelemetryEventMessageHandler,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
@@ -65,6 +68,10 @@ export class ContainerConfigLoader {
|
|||||||
})
|
})
|
||||||
container.bind<winston.Logger>(TYPES.Logger).toConstantValue(logger)
|
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)) {
|
if (env.get('SNS_TOPIC_ARN', true)) {
|
||||||
const snsConfig: SNSClientConfig = {
|
const snsConfig: SNSClientConfig = {
|
||||||
apiVersion: 'latest',
|
apiVersion: 'latest',
|
||||||
@@ -134,8 +141,14 @@ export class ContainerConfigLoader {
|
|||||||
container.bind<JobDoneInterpreterInterface>(TYPES.JobDoneInterpreter).to(JobDoneInterpreter)
|
container.bind<JobDoneInterpreterInterface>(TYPES.JobDoneInterpreter).to(JobDoneInterpreter)
|
||||||
|
|
||||||
container
|
container
|
||||||
.bind<SNSDomainEventPublisher>(TYPES.DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.DomainEventPublisher)
|
||||||
.toConstantValue(new SNSDomainEventPublisher(container.get(TYPES.SNS), container.get(TYPES.SNS_TOPIC_ARN)))
|
.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([
|
const eventHandlers: Map<string, DomainEventHandlerInterface> = new Map([
|
||||||
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
|
['PREDICATE_VERIFIED', container.get(TYPES.PredicateVerifiedEventHandler)],
|
||||||
@@ -149,6 +162,7 @@ export class ContainerConfigLoader {
|
|||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryEventMessageHandler(
|
new SQSOpenTelemetryEventMessageHandler(
|
||||||
ServiceIdentifier.NAMES.SchedulerWorker,
|
ServiceIdentifier.NAMES.SchedulerWorker,
|
||||||
|
container.get<OpenTelemetryPropagationInterface>(TYPES.Scheduler_OTEL_PROPAGATOR),
|
||||||
eventHandlers,
|
eventHandlers,
|
||||||
container.get(TYPES.Logger),
|
container.get(TYPES.Logger),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ const TYPES = {
|
|||||||
Redis: Symbol.for('Redis'),
|
Redis: Symbol.for('Redis'),
|
||||||
SNS: Symbol.for('SNS'),
|
SNS: Symbol.for('SNS'),
|
||||||
SQS: Symbol.for('SQS'),
|
SQS: Symbol.for('SQS'),
|
||||||
|
Scheduler_OTEL_PROPAGATOR: Symbol.for('Scheduler_OTEL_PROPAGATOR'),
|
||||||
// env vars
|
// env vars
|
||||||
REDIS_URL: Symbol.for('REDIS_URL'),
|
REDIS_URL: Symbol.for('REDIS_URL'),
|
||||||
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
SNS_TOPIC_ARN: Symbol.for('SNS_TOPIC_ARN'),
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/syncing-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/syncing-server",
|
"name": "@standardnotes/syncing-server",
|
||||||
"version": "1.116.5",
|
"version": "1.117.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import { Item } from '../Domain/Item/Item'
|
|||||||
import {
|
import {
|
||||||
DirectCallDomainEventPublisher,
|
DirectCallDomainEventPublisher,
|
||||||
DirectCallEventMessageHandler,
|
DirectCallEventMessageHandler,
|
||||||
SNSDomainEventPublisher,
|
OpenTelemetryPropagation,
|
||||||
|
OpenTelemetryPropagationInterface,
|
||||||
|
SNSOpenTelemetryDomainEventPublisher,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSEventMessageHandler,
|
SQSEventMessageHandler,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSOpenTelemetryEventMessageHandler,
|
||||||
@@ -216,6 +218,10 @@ export class ContainerConfigLoader {
|
|||||||
}
|
}
|
||||||
container.bind<winston.Logger>(TYPES.Sync_Logger).toConstantValue(logger)
|
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' })
|
const appDataSource = new AppDataSource({ env, runMigrations: this.mode === 'server' })
|
||||||
await appDataSource.initialize()
|
await appDataSource.initialize()
|
||||||
|
|
||||||
@@ -286,7 +292,8 @@ export class ContainerConfigLoader {
|
|||||||
container
|
container
|
||||||
.bind<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher)
|
.bind<DomainEventPublisherInterface>(TYPES.Sync_DomainEventPublisher)
|
||||||
.toDynamicValue((context: interfaces.Context) => {
|
.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),
|
||||||
context.container.get(TYPES.Sync_SNS_TOPIC_ARN),
|
context.container.get(TYPES.Sync_SNS_TOPIC_ARN),
|
||||||
)
|
)
|
||||||
@@ -1157,6 +1164,7 @@ export class ContainerConfigLoader {
|
|||||||
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Sync_Logger))
|
? new SQSEventMessageHandler(eventHandlers, container.get(TYPES.Sync_Logger))
|
||||||
: new SQSOpenTelemetryEventMessageHandler(
|
: new SQSOpenTelemetryEventMessageHandler(
|
||||||
ServiceIdentifier.NAMES.SyncingServerWorker,
|
ServiceIdentifier.NAMES.SyncingServerWorker,
|
||||||
|
container.get<OpenTelemetryPropagationInterface>(TYPES.Sync_OTEL_PROPAGATOR),
|
||||||
eventHandlers,
|
eventHandlers,
|
||||||
container.get(TYPES.Sync_Logger),
|
container.get(TYPES.Sync_Logger),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const TYPES = {
|
|||||||
Sync_SQS: Symbol.for('Sync_SQS'),
|
Sync_SQS: Symbol.for('Sync_SQS'),
|
||||||
Sync_S3: Symbol.for('Sync_S3'),
|
Sync_S3: Symbol.for('Sync_S3'),
|
||||||
Sync_Env: Symbol.for('Sync_Env'),
|
Sync_Env: Symbol.for('Sync_Env'),
|
||||||
|
Sync_OTEL_PROPAGATOR: Symbol.for('Sync_OTEL_PROPAGATOR'),
|
||||||
// Repositories
|
// Repositories
|
||||||
Sync_ItemRepositoryResolver: Symbol.for('Sync_ItemRepositoryResolver'),
|
Sync_ItemRepositoryResolver: Symbol.for('Sync_ItemRepositoryResolver'),
|
||||||
Sync_SQLItemRepository: Symbol.for('Sync_SQLItemRepository'),
|
Sync_SQLItemRepository: Symbol.for('Sync_SQLItemRepository'),
|
||||||
|
|||||||
@@ -3,6 +3,12 @@
|
|||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
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)
|
## [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
|
**Note:** Version bump only for package @standardnotes/websockets-server
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@standardnotes/websockets-server",
|
"name": "@standardnotes/websockets-server",
|
||||||
"version": "1.15.4",
|
"version": "1.16.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.0.0 <21.0.0"
|
"node": ">=18.0.0 <21.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import { AddWebSocketsConnection } from '../Domain/UseCase/AddWebSocketsConnecti
|
|||||||
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
import { RemoveWebSocketsConnection } from '../Domain/UseCase/RemoveWebSocketsConnection/RemoveWebSocketsConnection'
|
||||||
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
import { WebSocketsClientMessenger } from '../Infra/WebSockets/WebSocketsClientMessenger'
|
||||||
import {
|
import {
|
||||||
|
OpenTelemetryPropagation,
|
||||||
SQSDomainEventSubscriberFactory,
|
SQSDomainEventSubscriberFactory,
|
||||||
SQSOpenTelemetryEventMessageHandler,
|
SQSOpenTelemetryEventMessageHandler,
|
||||||
} from '@standardnotes/domain-events-infra'
|
} from '@standardnotes/domain-events-infra'
|
||||||
@@ -147,6 +148,7 @@ export class ContainerConfigLoader {
|
|||||||
.toConstantValue(
|
.toConstantValue(
|
||||||
new SQSOpenTelemetryEventMessageHandler(
|
new SQSOpenTelemetryEventMessageHandler(
|
||||||
ServiceIdentifier.NAMES.WebsocketsWorker,
|
ServiceIdentifier.NAMES.WebsocketsWorker,
|
||||||
|
new OpenTelemetryPropagation(),
|
||||||
eventHandlers,
|
eventHandlers,
|
||||||
container.get(TYPES.Logger),
|
container.get(TYPES.Logger),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user