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

Commit eb3ac2c

Browse files
silva-fabiokjin
authored andcommitted
feat: add propagation to config and tracer
1 parent a430e08 commit eb3ac2c

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

packages/opencensus-core/src/index-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,6 @@ export * from './trace/model/types';
2020
export * from './trace/config/types';
2121
export * from './trace/sampler/types';
2222
export * from './trace/instrumentation/types';
23+
export * from './trace/propagation/types';
2324
export * from './exporters/types';
2425
export * from './common/types';

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import {Logger} from '../../common/types';
1818
import {Exporter} from '../../exporters/types';
1919
import {PluginNames} from '../instrumentation/types';
20+
import {Propagation} from '../propagation/types';
2021

2122
/** Interface configuration for a buffer. */
2223
export interface BufferConfig {
@@ -36,6 +37,8 @@ export interface TracerConfig {
3637
ignoreUrls?: Array<string|RegExp>;
3738
/** A logger object */
3839
logger?: Logger;
40+
/** A propagation instance */
41+
propagation?: Propagation;
3942
}
4043

4144
/** Available configuration options. */

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import * as logger from '../../common/console-logger';
1818
import * as loggerTypes from '../../common/types';
1919
import * as cls from '../../internal/cls';
2020
import * as configTypes from '../config/types';
21+
import {Propagation} from '../propagation/types';
2122
import {Sampler} from '../sampler/sampler';
2223
import * as samplerTypes from '../sampler/types';
2324

@@ -64,6 +65,11 @@ export class Tracer implements types.Tracer {
6465
this.contextManager.set('rootspan', root);
6566
}
6667

68+
/** A propagation instance */
69+
get propagation(): Propagation {
70+
return this.config ? this.config.propagation : null;
71+
}
72+
6773
/**
6874
* Starts a tracer.
6975
* @param config A tracer configuration object to start a tracer.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import * as loggerTypes from '../../common/types';
1818
import * as configTypes from '../config/types';
19+
import {Propagation} from '../propagation/types';
1920
import * as samplerTypes from '../sampler/types';
2021

2122

@@ -222,6 +223,9 @@ export interface Tracer extends OnEndSpanEventListener {
222223
/** A configuration for starting the tracer */
223224
logger: loggerTypes.Logger;
224225

226+
/** A propagation instance */
227+
readonly propagation: Propagation;
228+
225229
/** Get the eventListeners from tracer instance */
226230
readonly eventListeners: OnEndSpanEventListener[];
227231

0 commit comments

Comments
 (0)