plutin 1.6.7 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -3,6 +3,7 @@ import { Express } from 'express';
3
3
  import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
4
4
  import { Logger } from '@opentelemetry/api-logs';
5
5
  import winston from 'winston';
6
+ import { NodeSDK } from '@opentelemetry/sdk-node';
6
7
 
7
8
  type AnyObject = Record<string, any>;
8
9
  type Request = {
@@ -373,6 +374,13 @@ declare class WinstonOtelFastify implements ILogger {
373
374
  child(): WinstonOtelFastify;
374
375
  }
375
376
 
377
+ declare class OpenTelemetry {
378
+ private readonly env;
379
+ sdk: NodeSDK;
380
+ constructor(env: Record<string, any>);
381
+ startSdk(): void;
382
+ }
383
+
376
384
  declare function Span(): MethodDecorator;
377
385
 
378
386
  interface ITracerGateway {
@@ -392,4 +400,4 @@ declare const logger: {
392
400
  error: (...args: any[]) => void;
393
401
  };
394
402
 
395
- export { AggregateObjectRoot, AggregateRoot, BaseController, CommonDTO, ContextError, Controller, CreateCommonDTO, DependencyContainer, DiscordNotifier, DtoResponsePagination, Entity, EntityObject, ExpressAdapter, FastifyAdapter, GlobalErrorHandler, IErrorNotifier, IHealthCheckDB, IHttp, ILogger, ITracerGateway, Inject, MethodType, MiddlewareFunction, NotPagination, NotificationErrorInMemory, NotificationFactory, Optional, Pagination, Replace, Request, RequestHttp, Response, SentryNotifier, Span, TracerGatewayOpentelemetry, UniqueEntityId, UniqueObjectId, ValueObject, WatchedList, WinstonOtelFastify, ZodSchema, baseEnvSchema, getTakeAndSkip, logger, zodValidator };
403
+ export { AggregateObjectRoot, AggregateRoot, BaseController, CommonDTO, ContextError, Controller, CreateCommonDTO, DependencyContainer, DiscordNotifier, DtoResponsePagination, Entity, EntityObject, ExpressAdapter, FastifyAdapter, GlobalErrorHandler, IErrorNotifier, IHealthCheckDB, IHttp, ILogger, ITracerGateway, Inject, MethodType, MiddlewareFunction, NotPagination, NotificationErrorInMemory, NotificationFactory, OpenTelemetry, Optional, Pagination, Replace, Request, RequestHttp, Response, SentryNotifier, Span, TracerGatewayOpentelemetry, UniqueEntityId, UniqueObjectId, ValueObject, WatchedList, WinstonOtelFastify, ZodSchema, baseEnvSchema, getTakeAndSkip, logger, zodValidator };
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ import { Express } from 'express';
3
3
  import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
4
4
  import { Logger } from '@opentelemetry/api-logs';
5
5
  import winston from 'winston';
6
+ import { NodeSDK } from '@opentelemetry/sdk-node';
6
7
 
7
8
  type AnyObject = Record<string, any>;
8
9
  type Request = {
@@ -373,6 +374,13 @@ declare class WinstonOtelFastify implements ILogger {
373
374
  child(): WinstonOtelFastify;
374
375
  }
375
376
 
377
+ declare class OpenTelemetry {
378
+ private readonly env;
379
+ sdk: NodeSDK;
380
+ constructor(env: Record<string, any>);
381
+ startSdk(): void;
382
+ }
383
+
376
384
  declare function Span(): MethodDecorator;
377
385
 
378
386
  interface ITracerGateway {
@@ -392,4 +400,4 @@ declare const logger: {
392
400
  error: (...args: any[]) => void;
393
401
  };
394
402
 
395
- export { AggregateObjectRoot, AggregateRoot, BaseController, CommonDTO, ContextError, Controller, CreateCommonDTO, DependencyContainer, DiscordNotifier, DtoResponsePagination, Entity, EntityObject, ExpressAdapter, FastifyAdapter, GlobalErrorHandler, IErrorNotifier, IHealthCheckDB, IHttp, ILogger, ITracerGateway, Inject, MethodType, MiddlewareFunction, NotPagination, NotificationErrorInMemory, NotificationFactory, Optional, Pagination, Replace, Request, RequestHttp, Response, SentryNotifier, Span, TracerGatewayOpentelemetry, UniqueEntityId, UniqueObjectId, ValueObject, WatchedList, WinstonOtelFastify, ZodSchema, baseEnvSchema, getTakeAndSkip, logger, zodValidator };
403
+ export { AggregateObjectRoot, AggregateRoot, BaseController, CommonDTO, ContextError, Controller, CreateCommonDTO, DependencyContainer, DiscordNotifier, DtoResponsePagination, Entity, EntityObject, ExpressAdapter, FastifyAdapter, GlobalErrorHandler, IErrorNotifier, IHealthCheckDB, IHttp, ILogger, ITracerGateway, Inject, MethodType, MiddlewareFunction, NotPagination, NotificationErrorInMemory, NotificationFactory, OpenTelemetry, Optional, Pagination, Replace, Request, RequestHttp, Response, SentryNotifier, Span, TracerGatewayOpentelemetry, UniqueEntityId, UniqueObjectId, ValueObject, WatchedList, WinstonOtelFastify, ZodSchema, baseEnvSchema, getTakeAndSkip, logger, zodValidator };
package/dist/index.mjs CHANGED
@@ -1563,6 +1563,46 @@ var WinstonOtelFastify = class WinstonOtelFastify2 {
1563
1563
  }
1564
1564
  };
1565
1565
 
1566
+ // src/infra/adapters/observability/otel/opentelemetry.ts
1567
+ import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-proto";
1568
+ import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-proto";
1569
+ import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto";
1570
+ import { Resource } from "@opentelemetry/resources";
1571
+ import { BatchLogRecordProcessor } from "@opentelemetry/sdk-logs";
1572
+ import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
1573
+ import { NodeSDK } from "@opentelemetry/sdk-node";
1574
+ import { SEMRESATTRS_SERVICE_NAME, SEMRESATTRS_SERVICE_VERSION } from "@opentelemetry/semantic-conventions";
1575
+ var OpenTelemetry = class OpenTelemetry2 {
1576
+ static {
1577
+ __name(this, "OpenTelemetry");
1578
+ }
1579
+ env;
1580
+ sdk;
1581
+ constructor(env) {
1582
+ this.env = env;
1583
+ this.sdk = new NodeSDK({
1584
+ resource: new Resource({
1585
+ [SEMRESATTRS_SERVICE_NAME]: this.env.OTEL_SERVICE_NAME,
1586
+ [SEMRESATTRS_SERVICE_VERSION]: this.env.OTEL_SERVICE_VERSION
1587
+ }),
1588
+ traceExporter: new OTLPTraceExporter({
1589
+ url: this.env.OTEL_OTLP_TRACES_EXPORTER_URL
1590
+ }),
1591
+ logRecordProcessor: new BatchLogRecordProcessor(new OTLPLogExporter({
1592
+ url: this.env.OTEL_OTLP_LOGS_EXPORTER_URL
1593
+ })),
1594
+ metricReader: new PeriodicExportingMetricReader({
1595
+ exporter: new OTLPMetricExporter({
1596
+ url: this.env.OTEL_OTLP_METRICS_EXPORTER_URL
1597
+ })
1598
+ })
1599
+ });
1600
+ }
1601
+ startSdk() {
1602
+ this.sdk.start();
1603
+ }
1604
+ };
1605
+
1566
1606
  // src/infra/adapters/observability/otel/span-decorator.ts
1567
1607
  import opentelemetry2, { SpanStatusCode } from "@opentelemetry/api";
1568
1608
  import "reflect-metadata";
@@ -1702,6 +1742,7 @@ export {
1702
1742
  Inject,
1703
1743
  NotificationErrorInMemory,
1704
1744
  NotificationFactory,
1745
+ OpenTelemetry,
1705
1746
  SentryNotifier,
1706
1747
  Span,
1707
1748
  TracerGatewayOpentelemetry,