@rainbow-o23/n1 0.1.7 → 0.1.9

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/index.cjs CHANGED
@@ -546,14 +546,15 @@ class AbstractPipelineExecution {
546
546
  isPerformanceLogEnabled() {
547
547
  return this._performanceLogEnabled;
548
548
  }
549
- debugPerformance(message) {
549
+ debugPerformance(message, context) {
550
550
  if (this.isPerformanceLogEnabled()) {
551
- this.getLogger().debug(message(), this.constructor.name);
551
+ this.getLogger().debug(message(), context || this.constructor.name);
552
552
  }
553
553
  }
554
- measurePerformance(traceId, exec) {
554
+ measurePerformance(traceId, exec, context) {
555
555
  return new PerformanceExecution({
556
- exec, traceId, start: process.hrtime.bigint(), print: (message) => this.debugPerformance(message)
556
+ exec, traceId, start: process.hrtime.bigint(),
557
+ print: (message) => this.debugPerformance(message, context)
557
558
  });
558
559
  }
559
560
  returnOrContinueOrClear(request, response) {
@@ -662,7 +663,7 @@ class AbstractPipeline extends AbstractPipelineExecution {
662
663
  const steps = await this.createSteps();
663
664
  const data = await steps.reduce(async (promise, step) => {
664
665
  const request = await promise;
665
- return await this.measurePerformance(traceId, 'STEP')
666
+ return await this.measurePerformance(traceId, 'STEP', step.constructor.name)
666
667
  .execute(async () => {
667
668
  this.traceStepIn(traceId, step, request);
668
669
  const response = await step.perform({
package/index.js CHANGED
@@ -544,14 +544,15 @@ class AbstractPipelineExecution {
544
544
  isPerformanceLogEnabled() {
545
545
  return this._performanceLogEnabled;
546
546
  }
547
- debugPerformance(message) {
547
+ debugPerformance(message, context) {
548
548
  if (this.isPerformanceLogEnabled()) {
549
- this.getLogger().debug(message(), this.constructor.name);
549
+ this.getLogger().debug(message(), context || this.constructor.name);
550
550
  }
551
551
  }
552
- measurePerformance(traceId, exec) {
552
+ measurePerformance(traceId, exec, context) {
553
553
  return new PerformanceExecution({
554
- exec, traceId, start: process.hrtime.bigint(), print: (message) => this.debugPerformance(message)
554
+ exec, traceId, start: process.hrtime.bigint(),
555
+ print: (message) => this.debugPerformance(message, context)
555
556
  });
556
557
  }
557
558
  returnOrContinueOrClear(request, response) {
@@ -660,7 +661,7 @@ class AbstractPipeline extends AbstractPipelineExecution {
660
661
  const steps = await this.createSteps();
661
662
  const data = await steps.reduce(async (promise, step) => {
662
663
  const request = await promise;
663
- return await this.measurePerformance(traceId, 'STEP')
664
+ return await this.measurePerformance(traceId, 'STEP', step.constructor.name)
664
665
  .execute(async () => {
665
666
  this.traceStepIn(traceId, step, request);
666
667
  const response = await step.perform({
@@ -32,7 +32,7 @@ export declare class AbstractPipelineExecution {
32
32
  protected traceStepIn(traceId: string, step: PipelineStep, data: any): void;
33
33
  protected traceStepOut(traceId: string, step: PipelineStep, data: any): void;
34
34
  protected isPerformanceLogEnabled(): boolean;
35
- protected debugPerformance(message: () => any): void;
36
- protected measurePerformance(traceId: string, exec: 'PIPELINE' | 'STEP'): PerformanceExecution;
35
+ protected debugPerformance(message: () => any, context?: string): void;
36
+ protected measurePerformance(traceId: string, exec: 'PIPELINE' | 'STEP', context?: string): PerformanceExecution;
37
37
  protected returnOrContinueOrClear(request: PipelineStepData, response: PipelineStepData): PipelineStepData;
38
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainbow-o23/n1",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "description": "o23 interfaces",
5
5
  "main": "index.cjs",
6
6
  "module": "index.js",
@@ -106,16 +106,17 @@ export class AbstractPipelineExecution {
106
106
  }
107
107
 
108
108
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
109
- protected debugPerformance(message: () => any): void {
109
+ protected debugPerformance(message: () => any, context?: string): void {
110
110
  if (this.isPerformanceLogEnabled()) {
111
- this.getLogger().debug(message(), this.constructor.name);
111
+ this.getLogger().debug(message(), context || this.constructor.name);
112
112
  }
113
113
  }
114
114
 
115
- protected measurePerformance(traceId: string, exec: 'PIPELINE' | 'STEP'): PerformanceExecution {
115
+ protected measurePerformance(traceId: string, exec: 'PIPELINE' | 'STEP', context?: string): PerformanceExecution {
116
116
  return new PerformanceExecution({
117
+ exec, traceId, start: process.hrtime.bigint(),
117
118
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
118
- exec, traceId, start: process.hrtime.bigint(), print: (message: () => any) => this.debugPerformance(message)
119
+ print: (message: () => any) => this.debugPerformance(message, context)
119
120
  });
120
121
  }
121
122
 
@@ -107,7 +107,7 @@ export abstract class AbstractPipeline<In = any, Out = any> extends AbstractPipe
107
107
  const steps = await this.createSteps();
108
108
  const data = await steps.reduce(async (promise, step) => {
109
109
  const request = await promise;
110
- return await this.measurePerformance(traceId, 'STEP')
110
+ return await this.measurePerformance(traceId, 'STEP', step.constructor.name)
111
111
  .execute(async () => {
112
112
  this.traceStepIn(traceId, step, request);
113
113
  const response = await step.perform({