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

Commit

Permalink
Cleanup: remove redundant types in JSDoc (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 committed May 9, 2019
1 parent 53dab13 commit 111223e
Show file tree
Hide file tree
Showing 21 changed files with 102 additions and 110 deletions.
6 changes: 3 additions & 3 deletions examples/stats/exporter/prometheus.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ lineReader.on('line', function (line) {

/**
* Takes a line and process it.
* @param {string} line The line to process
* @param line The line to process
*/
function processLine (line) {
// Currently, it just capitalizes it.
Expand All @@ -151,8 +151,8 @@ function processLine (line) {

/**
* Converts to milliseconds.
* @param {number} endNanoseconds The end time of REPL.
* @param {number} startNanoseconds The start time of REPL.
* @param endNanoseconds The end time of REPL.
* @param startNanoseconds The start time of REPL.
*/
function sinceInMilliseconds (endNanoseconds, startNanoseconds) {
return (endNanoseconds - startNanoseconds) / 1e6;
Expand Down
6 changes: 3 additions & 3 deletions examples/stats/exporter/stackdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ setTimeout(function () {

/**
* Takes a line and process it.
* @param {string} line The line to process
* @param line The line to process
*/
function processLine (line) {
// Currently, it just capitalizes it.
Expand All @@ -170,8 +170,8 @@ function processLine (line) {

/**
* Converts to milliseconds.
* @param {number} endNanoseconds The end time of REPL.
* @param {number} startNanoseconds The start time of REPL.
* @param endNanoseconds The end time of REPL.
* @param startNanoseconds The start time of REPL.
*/
function sinceInMilliseconds (endNanoseconds, startNanoseconds) {
return (endNanoseconds - startNanoseconds) / 1e6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* limitations under the License.
*/

/**
/**
* A Common JS module for proxying monitoring and trace calls to the server
*/

Expand All @@ -24,8 +24,8 @@ class WebMetrics {

/**
* Creates a WebMetrics instance
* @param {string} incrementbutton - ID of the increment button DOM element
* @param {string} flushbutton - ID of the flush button DOM element
* @param incrementbutton - ID of the increment button DOM element
* @param flushbutton - ID of the flush button DOM element
*/
constructor(incrementbutton, flushbutton) {
// [START web_client_monitoring_click_counter]
Expand Down
7 changes: 3 additions & 4 deletions packages/opencensus-core/src/common/time-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function resetHrtimeFunctionCache() {
/**
* Gets the current timestamp with seconds and nanoseconds.
*
* @returns {Timestamp} The Timestamp.
* @returns The Timestamp.
*/
export function getTimestampWithProcessHRTime(): Timestamp {
const [offsetSecs, offsetNanos] = hrtime(hrtimeOrigin);
Expand All @@ -62,9 +62,8 @@ export function getTimestampWithProcessHRTime(): Timestamp {
/**
* Creates a new timestamp from the given milliseconds.
*
* @param {number} epochMilli the timestamp represented in milliseconds since
* epoch.
* @returns {Timestamp} new timestamp with specified fields.
* @param epochMilli the timestamp represented in milliseconds since epoch.
* @returns new timestamp with specified fields.
*/
export function timestampFromMillis(epochMilli: number): Timestamp {
return {
Expand Down
10 changes: 5 additions & 5 deletions packages/opencensus-core/src/common/validations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import {LabelKey, LabelValue} from '../metrics/export/types';
* Validates that an object reference passed as a parameter to the calling
* method is not null.
*
* @param {T} reference An object reference.
* @param {string} errorMessage The exception message to use if the check fails.
* @returns {T} An object reference.
* @param reference An object reference.
* @param errorMessage The exception message to use if the check fails.
* @returns An object reference.
*/
export function validateNotNull<T>(reference: T, errorMessage: string): T {
if (reference === null || reference === undefined) {
Expand All @@ -34,8 +34,8 @@ export function validateNotNull<T>(reference: T, errorMessage: string): T {
/**
* Validates that an array passed as a parameter doesn't contain null element.
*
* @param {T} list The argument list to check for null.
* @param {string} errorMessage The exception message to use if the check fails.
* @param list The argument list to check for null.
* @param errorMessage The exception message to use if the check fails.
*/
export function validateArrayElementsNotNull<T>(
array: T[], errorMessage: string) {
Expand Down
8 changes: 4 additions & 4 deletions packages/opencensus-core/src/internal/string-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export class StringUtils {
/**
* Determines whether the String contains only printable characters.
*
* @param {string} str The String to be validated.
* @returns {boolean} Whether the String contains only printable characters.
* @param str The String to be validated.
* @returns Whether the String contains only printable characters.
*/
static isPrintableString(str: string): boolean {
for (let i = 0; i < str.length; i++) {
Expand All @@ -38,8 +38,8 @@ export class StringUtils {
/**
* Determines whether the Character is printable.
*
* @param {string} ch The Character to be validated.
* @returns {boolean} Whether the Character is printable.
* @param ch The Character to be validated.
* @returns Whether the Character is printable.
*/
static isPrintableChar(ch: string): boolean {
return ch >= ' ' && ch <= '~';
Expand Down
34 changes: 16 additions & 18 deletions packages/opencensus-core/src/metrics/cumulative/cumulative.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ export class Cumulative implements Meter {
/**
* Constructs a new Cumulative instance.
*
* @param {string} name The name of the metric.
* @param {string} description The description of the metric.
* @param {string} unit The unit of the metric.
* @param {MetricDescriptorType} type The type of metric.
* @param {LabelKey[]} labelKeys The list of the label keys.
* @param {Map<LabelKey, LabelValue>} constantLabels The map of constant
* labels for the Metric.
* @param name The name of the metric.
* @param description The description of the metric.
* @param unit The unit of the metric.
* @param type The type of metric.
* @param labelKeys The list of the label keys.
* @param constantLabels The map of constant labels for the Metric.
*/
constructor(
name: string, description: string, unit: string,
Expand All @@ -65,8 +64,8 @@ export class Cumulative implements Meter {
* It is recommended to keep a reference to the Point instead of always
* calling this method for manual operations.
*
* @param {LabelValue[]} labelValues The list of the label values.
* @returns {CumulativePoint} The value of single cumulative.
* @param labelValues The list of the label values.
* @returns The value of single cumulative.
*/
getOrCreateTimeSeries(labelValues: LabelValue[]): CumulativePoint {
validateArrayElementsNotNull(
Expand All @@ -78,7 +77,7 @@ export class Cumulative implements Meter {
* Returns a Point for a cumulative with all labels not set, or default
* labels.
*
* @returns {CumulativePoint} The value of single cumulative.
* @returns The value of single cumulative.
*/
getDefaultTimeSeries(): CumulativePoint {
return this.registerTimeSeries(this.defaultLabelValues);
Expand All @@ -89,7 +88,7 @@ export class Cumulative implements Meter {
* references to previous Point objects are invalid (not part of the
* metric).
*
* @param {LabelValue[]} labelValues The list of label values.
* @param labelValues The list of label values.
*/
removeTimeSeries(labelValues: LabelValue[]): void {
validateNotNull(labelValues, 'labelValues');
Expand All @@ -109,8 +108,8 @@ export class Cumulative implements Meter {
* labelValues is not already associated with this cumulative, else returns an
* existing Point.
*
* @param {LabelValue[]} labelValues The list of the label values.
* @returns {CumulativePoint} The value of single cumulative.
* @param labelValues The list of the label values.
* @returns The value of single cumulative.
*/
private registerTimeSeries(labelValues: LabelValue[]): CumulativePoint {
const hash = hashLabelValues(labelValues);
Expand All @@ -131,8 +130,7 @@ export class Cumulative implements Meter {
/**
* Provides a Metric with one or more TimeSeries.
*
* @returns {Metric} The Metric, or null if TimeSeries is not present in
* Metric.
* @returns The Metric, or null if TimeSeries is not present in Metric.
*/
getMetric(): Metric|null {
if (this.registeredPoints.size === 0) {
Expand Down Expand Up @@ -168,7 +166,7 @@ export class CumulativePointEntry implements CumulativePoint {

/**
* Increment the cumulative metric.
* @param {number} val The new value.
* @param val The new value.
*/
inc(val?: number): void {
if ((val && !Number.isFinite(val)) || (val !== undefined && isNaN(val))) {
Expand All @@ -184,8 +182,8 @@ export class CumulativePointEntry implements CumulativePoint {
/**
* Returns the TimeSeries with one or more Point.
*
* @param {Timestamp} now The time at which the cumulative is recorded.
* @returns {TimeSeries} The TimeSeries.
* @param now The time at which the cumulative is recorded.
* @returns The TimeSeries.
*/
getTimeSeries(now: Timestamp): TimeSeries {
return {
Expand Down
6 changes: 3 additions & 3 deletions packages/opencensus-core/src/metrics/cumulative/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ export interface CumulativePoint {

/**
* Increment the cumulative metric.
* @param {number} val The new value.
* @param val The new value.
*/
inc(val?: number): void;

/**
* Returns the TimeSeries with one or more Point.
*
* @param {Timestamp} now The time at which the cumulative is recorded.
* @returns {TimeSeries} The TimeSeries.
* @param now The time at which the cumulative is recorded.
* @returns The TimeSeries.
*/
getTimeSeries(now: Timestamp): TimeSeries;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {Metric, MetricProducer} from './types';
export abstract class BaseMetricProducer implements MetricProducer {
/**
* Gets a collection of produced Metric`s to be exported.
* @returns {Metric[]} List of metrics
* @returns The List of metrics
*/
abstract getMetrics(): Metric[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class BaseMetricProducerManager implements MetricProducerManager {
/**
* Adds the MetricProducer to the manager if it is not already present.
*
* @param {MetricProducer} metricProducer The MetricProducer to be added to
* the manager.
* @param metricProducer The MetricProducer to be added to the manager.
*/
add(metricProducer: MetricProducer): void {
validateNotNull(metricProducer, 'metricProducer');
Expand All @@ -48,8 +47,7 @@ class BaseMetricProducerManager implements MetricProducerManager {
/**
* Removes the MetricProducer to the manager if it is present.
*
* @param {MetricProducer} metricProducer The MetricProducer to be removed
* from the manager.
* @param metricProducer The MetricProducer to be removed from the manager.
*/
remove(metricProducer: MetricProducer): void {
validateNotNull(metricProducer, 'metricProducer');
Expand Down
19 changes: 9 additions & 10 deletions packages/opencensus-core/src/metrics/gauges/derived-gauge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,12 @@ export class DerivedGauge implements types.Meter {
/**
* Constructs a new DerivedGauge instance.
*
* @param {string} name The name of the metric.
* @param {string} description The description of the metric.
* @param {string} unit The unit of the metric.
* @param {MetricDescriptorType} type The type of metric.
* @param {LabelKey[]} labelKeys The list of the label keys.
* @param {Map<LabelKey, LabelValue>} constantLabels The map of constant
* labels for the Metric.
* @param name The name of the metric.
* @param description The description of the metric.
* @param unit The unit of the metric.
* @param type The type of metric.
* @param labelKeys The list of the label keys.
* @param constantLabels The map of constant labels for the Metric.
*/
constructor(
name: string, description: string, unit: string,
Expand Down Expand Up @@ -153,7 +152,7 @@ export class DerivedGauge implements types.Meter {
* observed from a obj or a function. The ValueExtractor is invoked whenever
* metrics are collected, meaning the reported value is up-to-date.
*
* @param {LabelValue[]} labelValues The list of the label values.
* @param labelValues The list of the label values.
* @param objOrFn obj The obj to get the size or length or value from. If
* multiple options are available, the value (ToValueInterface) takes
* precedence first, followed by length and size. e.g value -> length ->
Expand Down Expand Up @@ -200,7 +199,7 @@ export class DerivedGauge implements types.Meter {
* references to previous Point objects are invalid (not part of the
* metric).
*
* @param {LabelValue[]} labelValues The list of label values.
* @param labelValues The list of label values.
*/
removeTimeSeries(labelValues: LabelValue[]): void {
validateNotNull(labelValues, DerivedGauge.LABEL_VALUES);
Expand All @@ -218,7 +217,7 @@ export class DerivedGauge implements types.Meter {
/**
* Provides a Metric with one or more TimeSeries.
*
* @returns {Metric} The Metric.
* @returns The Metric, or null if TimeSeries is not present in Metric.
*/
getMetric(): Metric|null {
if (this.registeredPoints.size === 0) {
Expand Down
Loading

0 comments on commit 111223e

Please sign in to comment.