Skip to content

Commit 8c2592b

Browse files
committed
Use the real Sampler in MockSpanFactory
1 parent ca829fc commit 8c2592b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

packages/core/lib/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export * from './persistence'
1010
export * from './plugin'
1111
export * from './processor'
1212
export * from './retry-queue'
13+
export { default as Sampler } from './sampler'
1314
export * from './span'
1415
export * from './span-context'
1516
export * from './span-factory'

packages/test-utilities/lib/mock-span-factory.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { type SpanInternal, type SpanEnded, type SpanOptions, SpanFactory, DefaultSpanContextStorage } from '@bugsnag/core-performance'
1+
import {
2+
type SpanInternal,
3+
type SpanEnded,
4+
type SpanOptions,
5+
Sampler,
6+
SpanFactory,
7+
DefaultSpanContextStorage
8+
} from '@bugsnag/core-performance'
29
import StableIdGenerator from './stable-id-generator'
310
import spanAttributesSource from './span-attributes-source'
411
import IncrementingClock from './incrementing-clock'
@@ -16,13 +23,12 @@ class MockSpanFactory extends SpanFactory {
1623
public createdSpans: SpanEnded[]
1724

1825
constructor () {
19-
const sampler: any = { probability: 0.1, sample: () => true }
2026
const processor = new InMemoryProcessor()
2127
const backgroundingListener = new ControllableBackgroundingListener()
2228

2329
super(
2430
processor,
25-
sampler,
31+
new Sampler(1.0),
2632
new StableIdGenerator(),
2733
spanAttributesSource,
2834
new IncrementingClock(),

0 commit comments

Comments
 (0)