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

Commit

Permalink
Fix docs (#457)
Browse files Browse the repository at this point in the history
* Fix docs

* Fix review comment -> add descriptive class comment
  • Loading branch information
mayurkale22 committed Apr 1, 2019
1 parent 469d15a commit 26eb382
Show file tree
Hide file tree
Showing 56 changed files with 158 additions and 209 deletions.
8 changes: 4 additions & 4 deletions packages/opencensus-core/src/common/console-logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class ConsoleLogger implements types.Logger {

/**
* Logger error function.
* @param message menssage erro to log in console
* @param message message error to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
Expand All @@ -62,7 +62,7 @@ export class ConsoleLogger implements types.Logger {

/**
* Logger warning function.
* @param message menssage warning to log in console
* @param message message warning to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
Expand All @@ -72,7 +72,7 @@ export class ConsoleLogger implements types.Logger {

/**
* Logger info function.
* @param message menssage info to log in console
* @param message message info to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
Expand All @@ -82,7 +82,7 @@ export class ConsoleLogger implements types.Logger {

/**
* Logger debug function.
* @param message menssage debug to log in console
* @param message message debug to log in console
* @param args arguments to log in console
*/
// tslint:disable-next-line:no-any
Expand Down
2 changes: 1 addition & 1 deletion packages/opencensus-core/src/common/time-util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright 2019, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 the "License";
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand Down
4 changes: 2 additions & 2 deletions packages/opencensus-core/src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// tslint:disable:no-any
export type LogFunction = (message: any, ...args: any[]) => void;

/** Defines an logger interface. */
/** Defines a logger interface. */
export interface Logger {
/** Logger verbosity level. If omitted, `debug` level is assumed. */
level?: string;
Expand All @@ -28,7 +28,7 @@ export interface Logger {
debug: LogFunction;
}

/** Defines an logger options interface. */
/** Defines a logger options interface. */
export interface LoggerOptions {
level?: string;
}
18 changes: 10 additions & 8 deletions packages/opencensus-core/src/exporters/console-exporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ import * as loggerTypes from '../common/types';
import {Measurement, View} from '../stats/types';
import {TagKey, TagValue} from '../tags/types';
import * as modelTypes from '../trace/model/types';

import {ExporterBuffer} from './exporter-buffer';
import * as types from './types';
import {Exporter, ExporterConfig, StatsEventListener} from './types';

/** Do not send span data */
export class NoopExporter implements types.Exporter {
export class NoopExporter implements Exporter {
logger?: loggerTypes.Logger;
onStartSpan(root: modelTypes.RootSpan) {}
onEndSpan(root: modelTypes.RootSpan) {}
Expand All @@ -33,7 +32,7 @@ export class NoopExporter implements types.Exporter {
}

/** Format and sends span data to the console. */
export class ConsoleExporter implements types.Exporter {
export class ConsoleExporter implements Exporter {
/** Buffer object to store the spans. */
// @ts-ignore
private logger?: loggerTypes.Logger;
Expand All @@ -42,23 +41,26 @@ export class ConsoleExporter implements types.Exporter {
/**
* Constructs a new ConsoleLogExporter instance.
* @param config Exporter configuration object to create a console log
* exporter.
* exporter.
*/
constructor(config: types.ExporterConfig) {
constructor(config: ExporterConfig) {
this.buffer = new ExporterBuffer(this, config);
this.logger = config.logger;
}

onStartSpan(root: modelTypes.RootSpan) {}

/**
* Event called when a span is ended.
* @param root Ended span.
*/
onEndSpan(root: modelTypes.RootSpan) {
this.buffer.addToBuffer(root);
}

/**
* Sends the spans information to the console.
* @param rootSpans
* @param rootSpans A list of root spans to publish.
*/
publish(rootSpans: modelTypes.RootSpan[]) {
rootSpans.map((root) => {
Expand All @@ -79,7 +81,7 @@ export class ConsoleExporter implements types.Exporter {
}

/** Exporter that receives stats data and shows in the log console. */
export class ConsoleStatsExporter implements types.StatsEventListener {
export class ConsoleStatsExporter implements StatsEventListener {
/**
* Event called when a view is registered
* @param view registered view
Expand Down
1 change: 1 addition & 0 deletions packages/opencensus-core/src/exporters/exporter-buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ export class ExporterBuffer {
getQueue(): modelTypes.RootSpan[] {
return this.queue;
}

/**
* Add a rootSpan in the buffer.
* @param root RootSpan to be added in the buffer.
Expand Down
1 change: 1 addition & 0 deletions packages/opencensus-core/src/exporters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export interface StatsEventListener {
* @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
Expand Down
25 changes: 1 addition & 24 deletions packages/opencensus-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


// types
export * from './trace/types';
export * from './trace/model/types';
Expand All @@ -25,28 +24,7 @@ export * from './trace/propagation/types';
export * from './exporters/types';
export * from './common/types';
export * from './metrics/gauges/types';
import {Metric, MetricDescriptor, TimeSeries, MetricDescriptorType, LabelKey, LabelValue, Point as TimeSeriesPoint, DistributionValue, BucketOptions, Bucket as DistributionBucket, SummaryValue, Explicit, Exemplar, Timestamp, Snapshot, ValueAtPercentile, MetricProducerManager, MetricProducer} from './metrics/export/types';

export {
Metric,
MetricDescriptor,
TimeSeries,
MetricDescriptorType,
LabelKey,
LabelValue,
TimeSeriesPoint,
DistributionValue,
BucketOptions,
DistributionBucket,
SummaryValue,
Explicit,
Exemplar,
Timestamp,
Snapshot,
ValueAtPercentile,
MetricProducerManager,
MetricProducer
};
export {Metric, MetricDescriptor, TimeSeries, MetricDescriptorType, LabelKey, LabelValue, Point as TimeSeriesPoint, DistributionValue, BucketOptions, Bucket as DistributionBucket, SummaryValue, Explicit, Exemplar, Timestamp, Snapshot, ValueAtPercentile, MetricProducerManager, MetricProducer} from './metrics/export/types';

// classes

Expand Down Expand Up @@ -97,7 +75,6 @@ export * from './metrics/metric-registry';
export * from './metrics/gauges/derived-gauge';
export * from './metrics/gauges/gauge';


// Stats singleton instance
import {BaseStats} from './stats/stats';
import {Stats} from './stats/types';
Expand Down
2 changes: 0 additions & 2 deletions packages/opencensus-core/src/internal/clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
* limitations under the License.
*/


/**
* The Clock class is used to record the duration and endTime for spans.
*/
Expand Down Expand Up @@ -52,7 +51,6 @@ export class Clock {
return ns / 1e6;
}


/** Starts the clock. */
get startTime(): Date {
return this.startTimeLocal;
Expand Down
4 changes: 2 additions & 2 deletions packages/opencensus-core/src/internal/string-utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,7 +38,7 @@ export class StringUtils {
/**
* Determines whether the Character is printable.
*
* @param {string} str The Character to be validated.
* @param {string} ch The Character to be validated.
* @returns {boolean} Whether the Character is printable.
*/
static isPrintableChar(ch: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion packages/opencensus-core/src/internal/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 the "License";
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright 2019, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 the "License";
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand Down Expand Up @@ -35,7 +35,8 @@ class BaseMetricProducerManager implements MetricProducerManager {
/**
* Adds the MetricProducer to the manager if it is not already present.
*
* @param {MetricProducer} The MetricProducer to be added to the manager.
* @param {MetricProducer} metricProducer The MetricProducer to be added to
* the manager.
*/
add(metricProducer: MetricProducer): void {
validateNotNull(metricProducer, 'metricProducer');
Expand All @@ -47,7 +48,8 @@ class BaseMetricProducerManager implements MetricProducerManager {
/**
* Removes the MetricProducer to the manager if it is present.
*
* @param {MetricProducer} The MetricProducer to be removed from the manager.
* @param {MetricProducer} metricProducer The MetricProducer to be removed
* from the manager.
*/
remove(metricProducer: MetricProducer): void {
validateNotNull(metricProducer, 'metricProducer');
Expand Down
3 changes: 1 addition & 2 deletions packages/opencensus-core/src/metrics/export/types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright 2018, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 the "License";
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand All @@ -14,7 +14,6 @@
* limitations under the License.
*/


/** Properties of a Metric which has one or more timeseries */
export interface Metric {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/opencensus-core/src/metrics/metric-component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Copyright 2019, OpenCensus Authors
*
* Licensed under the Apache License, Version 2.0 the "License";
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
Expand Down
5 changes: 0 additions & 5 deletions packages/opencensus-core/src/metrics/metric-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import {validateArrayElementsNotNull, validateNotNull} from '../common/validations';
import {MeasureUnit,} from '../stats/types';

import {BaseMetricProducer} from './export/base-metric-producer';
import {LabelKey, Metric, MetricDescriptorType, MetricProducer} from './export/types';
import {DerivedGauge} from './gauges/derived-gauge';
Expand Down Expand Up @@ -179,10 +178,6 @@ export class MetricRegistry {
/**
* A MetricProducerForRegistry is a producer that can be registered for
* exporting using MetricProducerManager.
*
* TODO (mayurkale): Add MetricProducerManager, that Keeps a set of
* MetricProducer that is used by exporters to determine the metrics that
* need to be exported.
*/
class MetricProducerForRegistry extends BaseMetricProducer {
private registeredMetrics: Map<string, Meter>;
Expand Down
1 change: 0 additions & 1 deletion packages/opencensus-core/src/resource/resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import {StringUtils} from '../internal/string-utils';

import {Labels, Resource} from './types';

/**
Expand Down
1 change: 0 additions & 1 deletion packages/opencensus-core/src/stats/metric-producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import {BaseMetricProducer} from '../metrics/export/base-metric-producer';
import {Metric} from '../metrics/export/types';

import {Stats} from './types';

/**
Expand Down
3 changes: 1 addition & 2 deletions packages/opencensus-core/src/stats/metric-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

import {LabelValue, MetricDescriptor, MetricDescriptorType} from '../metrics/export/types';
import {TagValue} from '../tags/types';

import {AggregationType, Measure, MeasureType, View} from './types';

/** Utils to convert Stats data models to Metric data models */
Expand Down Expand Up @@ -75,7 +74,7 @@ export class MetricUtils {

/**
* Converts tag values to label values.
* @param tagValues
* @param tagValues the list of tag values
* @returns {LabelValue[]} List of label values
*/
static tagValuesToLabelValues(tagValues: Array<TagValue|null>): LabelValue[] {
Expand Down
7 changes: 3 additions & 4 deletions packages/opencensus-core/src/stats/stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {Metrics} from '../metrics/metrics';
import {TagMap} from '../tags/tag-map';
import * as tagger from '../tags/tagger';
import {TagKey} from '../tags/types';

import {MetricProducerForStats} from './metric-producer';
import {AggregationType, Measure, Measurement, MeasureType, MeasureUnit, Stats, View} from './types';
import {BaseView} from './view';
Expand Down Expand Up @@ -85,7 +84,7 @@ export class BaseStats implements Stats {
* @param aggregation The view aggregation type
* @param tagKeys The view columns (tag keys)
* @param description The view description
* @param bucketBoundaries optional The view bucket boundaries for a
* @param bucketBoundaries An optional The view bucket boundaries for a
* distribution aggregation type
*/
createView(
Expand Down Expand Up @@ -129,7 +128,7 @@ export class BaseStats implements Stats {
* Creates a measure of type Double.
* @param name The measure name
* @param unit The measure unit
* @param description The measure description
* @param description An optional measure description
*/
createMeasureDouble(name: string, unit: MeasureUnit, description?: string):
Measure {
Expand All @@ -141,7 +140,7 @@ export class BaseStats implements Stats {
* Number.MAX_SAFE_INTERGER.
* @param name The measure name
* @param unit The measure unit
* @param description The measure description
* @param description An optional measure description
*/
createMeasureInt64(name: string, unit: MeasureUnit, description?: string):
Measure {
Expand Down
2 changes: 1 addition & 1 deletion packages/opencensus-core/src/stats/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface Stats {
* @param tagKeys The view columns (tag keys)
* @param description The view description
* @param bucketBoundaries The view bucket boundaries for a distribution
* aggregation type
* aggregation type
*/
createView(
name: string, measure: Measure, aggregation: AggregationType,
Expand Down
Loading

0 comments on commit 26eb382

Please sign in to comment.