Skip to content

Commit 85dc25a

Browse files
committed
Changed TracerInterface
1 parent 3c449ea commit 85dc25a

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

packages/tracing/src/Tracer.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import { ClassThatTraces, HandlerMethodDecorator, TracerOptions, MethodDecorator } from '../types';
1+
import { TracerInterface } from '.';
2+
import { HandlerMethodDecorator, TracerOptions, MethodDecorator } from '../types';
23
import { ConfigServiceInterface, EnvironmentVariablesService } from './config';
34
import { ProviderService, ProviderServiceInterface } from './provider';
45
import { Segment, Subsegment } from 'aws-xray-sdk-core';
56

6-
class Tracer implements ClassThatTraces {
7+
class Tracer implements TracerInterface {
78
public static coldStart: boolean = true;
89

910
public provider: ProviderServiceInterface;
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { HandlerMethodDecorator, MethodDecorator } from '../types';
2+
import { Segment, Subsegment } from 'aws-xray-sdk-core';
3+
4+
interface TracerInterface {
5+
getSegment(): Segment | Subsegment | undefined
6+
setSegment(segment: Segment | Subsegment): void
7+
putAnnotation: (key: string, value: string | number | boolean) => void
8+
putMetadata: (key: string, value: unknown, namespace?: string | undefined) => void
9+
captureLambdaHanlder(): HandlerMethodDecorator
10+
captureMethod(): MethodDecorator
11+
captureAWS<T>(aws: T): void | T
12+
captureAWSv3Client<T>(service: T): void | T
13+
captureAWSClient<T>(service: T): void | T
14+
}
15+
16+
export {
17+
TracerInterface
18+
};

packages/tracing/src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './helpers';
2-
export * from './Tracer';
2+
export * from './Tracer';
3+
export * from './TracerInterface';

packages/tracing/types/Tracer.ts

-14
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,6 @@
11
import { ConfigServiceInterface } from '../src/config';
22
import { Handler } from 'aws-lambda';
33
import { LambdaInterface } from '../examples/utils/lambda';
4-
import { Segment, Subsegment } from 'aws-xray-sdk-core';
5-
6-
type ClassThatTraces = {
7-
getSegment(): Segment | Subsegment | undefined
8-
setSegment(segment: Segment | Subsegment): void
9-
putAnnotation: (key: string, value: string | number | boolean) => void
10-
putMetadata: (key: string, value: unknown, namespace?: string | undefined) => void
11-
captureLambdaHanlder(): HandlerMethodDecorator
12-
captureAWS<T>(aws: T): void | T
13-
captureAWSv3Client<T>(service: T): void | T
14-
captureAWSClient<T>(service: T): void | T
15-
16-
};
174

185
type TracerOptions = {
196
enabled?: boolean
@@ -27,7 +14,6 @@ type HandlerMethodDecorator = (target: LambdaInterface, propertyKey: string | sy
2714
type MethodDecorator = (target: any, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<any>) => any;
2815

2916
export {
30-
ClassThatTraces,
3117
TracerOptions,
3218
HandlerMethodDecorator,
3319
MethodDecorator

0 commit comments

Comments
 (0)