Skip to content
This repository has been archived by the owner on Jul 10, 2023. It is now read-only.

Commit

Permalink
Change customSampler config to Sampler instead of function returning …
Browse files Browse the repository at this point in the history
…a Sampler
  • Loading branch information
İbrahim Gürses committed Mar 14, 2019
1 parent 3e1baf9 commit a68315d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/plugins/Trace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ export class Trace {

const spanList = this.tracer.getRecorder().getSpanList();
const sampled = (this.config && this.config.samplerConfig) ? this.config.samplerConfig.isSampled(this.rootSpan) : true;
const customSampler = (this.config && this.config.samplerConfig) ?
this.config.samplerConfig.createCustomSampler() : false;
const customSampler = (this.config && this.config.samplerConfig && this.config.samplerConfig.customSampler) ?
this.config.samplerConfig.customSampler : false;

if (sampled) {
for (const span of spanList) {
Expand Down
10 changes: 1 addition & 9 deletions src/plugins/config/TraceSamplerConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class TraceSamplerConfig {
errorAwareSamplerConfig: ErrorAwareSamplerConfig;
durationAwareSampler: DurationAwareSampler;
errorAwareSampler: ErrorAwareSampler;
customSampler: () => Sampler<ThundraSpan>;
customSampler: Sampler<ThundraSpan>;

constructor(options: any) {
options = options ? options : {};
Expand Down Expand Up @@ -46,14 +46,6 @@ class TraceSamplerConfig {

return isSampled;
}

createCustomSampler(): Sampler<ThundraSpan> {
if (this.customSampler &&
typeof this.customSampler === 'function') {

return this.customSampler();
}
}
}

export default TraceSamplerConfig;

0 comments on commit a68315d

Please sign in to comment.