Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit f77b794

Browse files
committed
Move sampler.ts from model to config
1 parent c1482fe commit f77b794

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

examples/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Successfully connected to the database
5252

5353
## Add opencensus instrumentation
5454

55-
To add opencensus instrumetation, follow the step below:
55+
To add opencensus instrumetation, follow the steps below:
5656

5757
1. Navigate to the `node_modules` folder inside the EasyNotes application and create a link to OpenCensus Node project folder with:
5858
```bash
@@ -66,8 +66,7 @@ cd ..
6666
var tracing = require("opencensus-nodejs").start()
6767
...
6868
var express = require('express');
69-
```
70-
69+
```
7170

7271
## Running the Instrumented Application
7372

packages/opencensus-core/src/trace/model/root-span.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import * as uuid from 'uuid';
2020
import { debug } from '../../internal/util'
2121
import { SpanBaseModel, TraceOptions, TraceContext, OnEndSpanEventListener } from '../types/tracetypes'
2222
import { Tracer } from './tracer'
23-
import { Sampler } from './sampler'
2423

2524
export class RootSpan extends SpanBaseModel implements OnEndSpanEventListener {
2625

packages/opencensus-core/src/trace/model/tracer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { Stackdriver } from '../../exporters/stackdriver/stackdriver'
2222
import { StackdriverOptions } from '../../exporters/stackdriver/options'
2323
import { TraceContext, TraceOptions, OnEndSpanEventListener } from '../types/tracetypes';
2424
import { TracerConfig, defaultConfig } from '../tracing';
25-
import { Sampler } from './sampler'
25+
import { Sampler } from '../config/sampler'
2626

2727
export type Func<T> = (...args: any[]) => T;
2828

packages/opencensus-core/src/trace/sampler/sampler.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,17 @@ export class Sampler{
4444

4545
}
4646

47-
public always():Sampler{
47+
public always(): Sampler{
4848
this.idUpperBound = maxNumber;
4949
return this;
5050
}
5151

52-
public never():Sampler{
52+
public never(): Sampler{
5353
this.idUpperBound = minNumber;
5454
return this;
5555
}
5656

57-
public probability(probability:number):Sampler{
57+
public probability(probability:number): Sampler{
5858
if(probability < minNumber){
5959
return this.never();
6060

packages/opencensus-core/src/trace/types/tracetypes.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import { Clock } from '../../internal/clock'
1818
import { debug, randomSpanId } from '../../internal/util'
19-
import { Sampler } from '../model/sampler'
19+
import { Sampler } from '../config/sampler'
2020

2121

2222
export interface MapLabels { [propName: string]: string; }
@@ -38,6 +38,14 @@ export interface OnEndSpanEventListener {
3838
onEndSpan(span: SpanBaseModel): void;
3939
}
4040

41+
export interface SpanData {
42+
labels: {[key: string]: string};
43+
name: string;
44+
spanId: string;
45+
parentSpanId?: string;
46+
}
47+
48+
4149
export abstract class SpanBaseModel {
4250

4351
protected _className: string;

0 commit comments

Comments
 (0)