Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/tracer/src/Tracer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,6 @@ class Tracer extends Utility implements TracerInterface {

if (this.#envConfig.captureHTTPsRequests.toLowerCase() === 'false') {
this.captureHTTPsRequests = false;
return;
}
}

Expand Down Expand Up @@ -868,7 +867,7 @@ class Tracer extends Utility implements TracerInterface {
*
* @param options - Configuration passed to the tracer
*/
private setOptions(options: TracerOptions): Tracer {
private setOptions(options: TracerOptions): this {
const { enabled, serviceName, captureHTTPsRequests, customConfigService } =
options;

Expand Down
32 changes: 9 additions & 23 deletions packages/tracer/tests/unit/Tracer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,7 @@ describe('Class: Tracer', () => {
.mockImplementation(() => ({}));

// Act
const newSubsegment: Segment | Subsegment | undefined = new Subsegment(
'## foo.bar'
);
const newSubsegment = new Subsegment('## foo.bar');
tracer.setSegment(newSubsegment);

// Assess
Expand Down Expand Up @@ -961,9 +959,7 @@ describe('Class: Tracer', () => {
it('awaits async methods correctly', async () => {
// Prepare
const tracer: Tracer = new Tracer();
const newSubsegment: Segment | Subsegment | undefined = new Subsegment(
'### dummyMethod'
);
const newSubsegment = new Subsegment('### dummyMethod');

vi.spyOn(tracer.provider, 'getSegment').mockImplementation(
() => newSubsegment
Expand All @@ -975,7 +971,7 @@ describe('Class: Tracer', () => {
createCaptureAsyncFuncMock(tracer.provider, newSubsegment);

class Lambda implements LambdaInterface {
private memberVariable: string;
private readonly memberVariable: string;

public constructor(memberVariable: string) {
this.memberVariable = memberVariable;
Expand Down Expand Up @@ -1021,8 +1017,7 @@ describe('Class: Tracer', () => {
it('catches the error and logs a warning when a segment fails to close/serialize', async () => {
// Prepare
const tracer: Tracer = new Tracer();
const handlerSubsegment: Segment | Subsegment | undefined =
new Subsegment('### dummyMethod');
const handlerSubsegment = new Subsegment('### dummyMethod');
vi.spyOn(tracer.provider, 'getSegment').mockImplementation(
() => handlerSubsegment
);
Expand Down Expand Up @@ -1192,9 +1187,7 @@ describe('Class: Tracer', () => {
it('captures the exception correctly', async () => {
// Prepare
const tracer: Tracer = new Tracer();
const newSubsegment: Segment | Subsegment | undefined = new Subsegment(
'### dummyMethod'
);
const newSubsegment = new Subsegment('### dummyMethod');
vi.spyOn(tracer.provider, 'getSegment').mockImplementation(
() => newSubsegment
);
Expand Down Expand Up @@ -1237,9 +1230,7 @@ describe('Class: Tracer', () => {
it('preserves the this scope correctly when used as decorator', async () => {
// Prepare
const tracer: Tracer = new Tracer();
const newSubsegment: Segment | Subsegment | undefined = new Subsegment(
'### dummyMethod'
);
const newSubsegment = new Subsegment('### dummyMethod');
vi.spyOn(tracer.provider, 'getSegment').mockImplementation(
() => newSubsegment
);
Expand Down Expand Up @@ -1274,9 +1265,7 @@ describe('Class: Tracer', () => {
it('awaits the async method correctly when used as decorator', async () => {
// Prepare
const tracer: Tracer = new Tracer();
const newSubsegment: Segment | Subsegment | undefined = new Subsegment(
'### dummyMethod'
);
const newSubsegment = new Subsegment('### dummyMethod');

vi.spyOn(tracer.provider, 'getSegment').mockImplementation(
() => newSubsegment
Expand Down Expand Up @@ -1375,9 +1364,7 @@ describe('Class: Tracer', () => {
it('sets the correct name for the subsegment when used as decorator and with a custom subSegmentName', async () => {
// Prepare
const tracer: Tracer = new Tracer();
const newSubsegment: Segment | Subsegment | undefined = new Subsegment(
'### dummyMethod'
);
const newSubsegment = new Subsegment('### dummyMethod');
vi.spyOn(newSubsegment, 'flush').mockImplementation(() => null);
vi.spyOn(tracer.provider, 'getSegment').mockImplementation(
() => newSubsegment
Expand Down Expand Up @@ -1412,8 +1399,7 @@ describe('Class: Tracer', () => {
it('catches the error and logs a warning when a segment fails to close/serialize', async () => {
// Prepare
const tracer: Tracer = new Tracer();
const handlerSubsegment: Segment | Subsegment | undefined =
new Subsegment('### dummyMethod');
const handlerSubsegment = new Subsegment('### dummyMethod');
vi.spyOn(tracer.provider, 'getSegment').mockImplementation(
() => handlerSubsegment
);
Expand Down