-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add options for configurations rabbitmq and open-telemetry module
- Loading branch information
1 parent
2df865b
commit dd15ba0
Showing
39 changed files
with
331 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 12 additions & 1 deletion
13
src/building-blocks/openTelemetry/open-telemetry-tracer.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
import { OnModuleInit } from '@nestjs/common'; | ||
import { NodeSDK } from '@opentelemetry/sdk-node'; | ||
import { Tracer } from '@opentelemetry/api'; | ||
export declare class OpenTelemetryOptions { | ||
jaegerEndpoint: string; | ||
zipkinEndpoint: string; | ||
serviceName: string; | ||
constructor(partial?: Partial<OpenTelemetryOptions>); | ||
} | ||
export interface IOpenTelemetryTracer { | ||
createTracer(tracerName: string): Tracer; | ||
} | ||
export declare const otelSDK: NodeSDK; | ||
export declare class OpenTelemetryTracer implements OnModuleInit { | ||
export declare class OpenTelemetryTracer implements IOpenTelemetryTracer, OnModuleInit { | ||
private readonly options?; | ||
constructor(options?: OpenTelemetryOptions); | ||
onModuleInit(): void; | ||
createTracer(tracerName: string): Tracer; | ||
} |
45 changes: 38 additions & 7 deletions
45
src/building-blocks/openTelemetry/open-telemetry-tracer.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
import { DynamicModule } from '@nestjs/common'; | ||
import { OpenTelemetryOptions } from './open-telemetry-tracer'; | ||
export declare class OpenTelemetryModule { | ||
static forRoot(options?: OpenTelemetryOptions): DynamicModule; | ||
} |
12 changes: 10 additions & 2 deletions
12
src/building-blocks/openTelemetry/open-telemetry.module.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
15 changes: 11 additions & 4 deletions
15
src/building-blocks/openTelemetry/open-telemetry.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { OpenTelemetryTracer } from './open-telemetry-tracer'; | ||
|
||
import {DynamicModule, Global, Module} from '@nestjs/common'; | ||
import {OpenTelemetryOptions, OpenTelemetryTracer} from './open-telemetry-tracer'; | ||
@Global() | ||
@Module({ | ||
providers: [OpenTelemetryTracer], | ||
exports: [OpenTelemetryTracer] | ||
}) | ||
export class OpenTelemetryModule {} | ||
export class OpenTelemetryModule { | ||
static forRoot(options?: OpenTelemetryOptions): DynamicModule { | ||
return { | ||
module: OpenTelemetryModule, | ||
providers: [OpenTelemetryTracer, { provide: OpenTelemetryOptions, useValue: options }] | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
import { OnModuleInit } from '@nestjs/common'; | ||
import * as amqp from 'amqplib'; | ||
export interface RabbitmqOptions { | ||
export declare class RabbitmqOptions { | ||
host: string; | ||
port: number; | ||
username: string; | ||
password: string; | ||
exchange: string; | ||
username: string; | ||
constructor(partial?: Partial<RabbitmqOptions>); | ||
} | ||
export interface IRabbitmqConnection { | ||
createConnection(options?: RabbitmqOptions): Promise<amqp.Connection>; | ||
getChannel(): Promise<amqp.Channel>; | ||
closeChanel(): Promise<void>; | ||
closeConnection(): Promise<void>; | ||
} | ||
export declare class RabbitmqConnection implements OnModuleInit, IRabbitmqConnection { | ||
private connection; | ||
private channel; | ||
private readonly options?; | ||
constructor(options?: RabbitmqOptions); | ||
onModuleInit(): Promise<void>; | ||
createConnection(options?: RabbitmqOptions): Promise<amqp.Connection>; | ||
getChannel(): Promise<amqp.Channel>; | ||
closeChanel(): Promise<void>; | ||
closeConnection(): Promise<void>; | ||
private initializeConnection; | ||
} |
Oops, something went wrong.