Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/opencensus-core/src/exporters/console-exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,12 @@ export class ConsoleStatsExporter implements types.StatsEventListener {
onRecord(views: View[], measurement: Measurement) {
console.log(`Measurement recorded: ${measurement.measure.name}`);
}

/**
* Starts the Console exporter that polls Metric from Metrics library and
* shows in the log console..
*/
start(): void {
// TODO(mayurkale): dependency with PR#253.
}
}
8 changes: 8 additions & 0 deletions packages/opencensus-core/src/exporters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,23 @@ export interface Exporter extends modelTypes.SpanEventListener {
export interface StatsEventListener {
/**
* Is called whenever a new view is registered
* @deprecated since version 0.0.9 - use {@link start} instead
* @param view The registered view
*/
onRegisterView(view: View): void;
/**
* Is called whenever a new measurement is recorded.
* @deprecated since version 0.0.9 - use {@link start} instead
* @param views The views related to the measurement
* @param measurement The recorded measurement
*/
onRecord(views: View[], measurement: Measurement): void;

/**
* Starts the exporter that polls Metric from Metrics library and send
* batched data to backend.
*/
start(): void;
}

export type ExporterConfig = configTypes.BufferConfig;
4 changes: 4 additions & 0 deletions packages/opencensus-core/src/stats/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export class Stats {
exporter.onRegisterView(view);
}
}

// dependency with PR#253 and once start method is implemented in all stats
// exporters
// exporter.start();
}

/**
Expand Down
4 changes: 4 additions & 0 deletions packages/opencensus-core/test/test-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ class TestExporter implements StatsEventListener {
this.recordedMeasurements.push(measurement);
}

start(): void {
// TODO(mayurkale): dependency with PR#253.
}

clean() {
this.registeredViews = [];
this.recordedMeasurements = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ export class PrometheusStatsExporter implements StatsEventListener {
}
}

/**
* Starts the Prometheus exporter that polls Metric from Metrics library and
* send batched data to backend.
*/
start(): void {
// TODO(mayurkale): add setInterval here to poll Metric, transform and send
// // it to backend (dependency with PR#253).
}

/**
* Register or get a metric in Prometheus
* @param view View will be used to register the metric
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ export class StackdriverStatsExporter implements StatsEventListener {
}
}

/**
* Starts the Stackdriver exporter that polls Metric from Metrics library and
* send batched data to backend.
*/
start(): void {
// TODO(mayurkale): add setInterval here to poll Metric, transform and send
// // it to backend (dependency with PR#253).
}

/**
* Clear the interval timer to stop uploading metrics. It should be called
* whenever the exporter is not needed anymore.
Expand Down
4 changes: 4 additions & 0 deletions packages/opencensus-exporter-zpages/src/zpages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export class ZpagesExporter implements Exporter, StatsEventListener {
});
}

start(): void {
// TODO(mayurkale): dependency with PR#253.
}

/**
* Send a trace to traces array
* @param trace the rootSpan to be sent to the array list
Expand Down