diff --git a/packages/logging/src/analytics-helpers.spec.ts b/packages/logging/src/analytics-helpers.spec.ts index e83c20c24..9efda4e1e 100644 --- a/packages/logging/src/analytics-helpers.spec.ts +++ b/packages/logging/src/analytics-helpers.spec.ts @@ -260,9 +260,11 @@ describe('analytics helpers', function () { }; it('should send the event forward when sampled', function () { - const analytics = SampledAnalytics.enabledForAll( - target - ) as SampledAnalytics; + const analytics = new SampledAnalytics({ + target, + sampling: () => true, + }); + expect(analytics.enabled).to.be.true; analytics.identify(iEvt); @@ -272,9 +274,11 @@ describe('analytics helpers', function () { }); it('should not send the event forward when not sampled', function () { - const analytics = SampledAnalytics.disabledForAll( - target - ) as SampledAnalytics; + const analytics = new SampledAnalytics({ + target, + sampling: () => false, + }); + expect(analytics.enabled).to.be.false; analytics.identify(iEvt); diff --git a/packages/logging/src/analytics-helpers.ts b/packages/logging/src/analytics-helpers.ts index b5f8b7f73..390287146 100644 --- a/packages/logging/src/analytics-helpers.ts +++ b/packages/logging/src/analytics-helpers.ts @@ -393,20 +393,6 @@ export class SampledAnalytics implements MongoshAnalytics { this.target = configuration.target || new NoopAnalytics(); } - static enabledForAll(target?: MongoshAnalytics): MongoshAnalytics { - return new SampledAnalytics({ - target, - sampling: () => true, - }); - } - - static disabledForAll(target?: MongoshAnalytics): MongoshAnalytics { - return new SampledAnalytics({ - target, - sampling: () => false, - }); - } - get enabled(): boolean { return this.isEnabled; }