Skip to content

Commit

Permalink
refactor: drop JSDoc types
Browse files Browse the repository at this point in the history
  • Loading branch information
kjin committed Sep 22, 2017
1 parent 9ded713 commit 24a558a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
12 changes: 6 additions & 6 deletions src/span-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ interface StackFrame {
}

// Auto-incrementing integer
let uid: number = 1;
let uid = 1;

export class SpanData {
public readonly span: TraceSpan;

/**
* Creates a trace context object.
* @param {Trace} trace The object holding the spans comprising this trace.
* @param {string} name The name of the span.
* @param {number} parentSpanId The id of the parent span, 0 for root spans.
* @param {boolean} isRoot Whether this is a root span.
* @param {number} skipFrames the number of frames to remove from the top of the stack.
* @param trace The object holding the spans comprising this trace.
* @param name The name of the span.
* @param parentSpanId The id of the parent span, 0 for root spans.
* @param isRoot Whether this is a root span.
* @param skipFrames the number of frames to remove from the top of the stack.
* @constructor
*/
constructor(
Expand Down
6 changes: 3 additions & 3 deletions src/trace-span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class TraceSpan {

/**
* Sets or updates a label value.
* @param {string} key The label key to set.
* @param {string} value The new value of the label.
* @param key The label key to set.
* @param value The new value of the label.
*/
setLabel(key: string, value: string): void {
this.labels[key] = value;
Expand All @@ -59,7 +59,7 @@ export class TraceSpan {

/**
* Checks whether or not this span has been closed.
* @returns {boolean} True if the span is closed, false otherwise.
* @returns True if the span is closed, false otherwise.
*/
isClosed(): boolean {
return this.endTime !== '';
Expand Down
12 changes: 6 additions & 6 deletions src/trace-writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface LabelObject {
* A class representing a service that publishes traces in the background.
*/
export class TraceWriter extends common.Service {
// TODO(kjin): Make this private (it's public for testing)
// TODO(kjin): Make public members private (they're public for testing)
private logger_: common.Logger;
private config_: TraceWriterOptions;
/** Stringified traces to be published */
Expand All @@ -69,8 +69,8 @@ export class TraceWriter extends common.Service {

/**
* Constructs a new TraceWriter instance.
* @param {!Logger} logger The Trace Agent's logger object.
* @param {Object} config A config object containing information about
* @param logger The Trace Agent's logger object.
* @param config A config object containing information about
* authorization credentials.
* @constructor
*/
Expand Down Expand Up @@ -239,7 +239,7 @@ export class TraceWriter extends common.Service {
* Ensures that all sub spans of the provided spanData are
* closed and then queues the span data to be published.
*
* @param {SpanData} spanData The trace to be queued.
* @param spanData The trace to be queued.
*/
writeSpan(spanData: SpanData) {
for (const span of spanData.trace.spans) {
Expand All @@ -261,7 +261,7 @@ export class TraceWriter extends common.Service {
* Buffers the provided trace to be published.
*
* @private
* @param {Trace} trace The trace to be queued.
* @param trace The trace to be queued.
*/
queueTrace_(trace: Trace) {
this.getProjectId((err, projectId?) => {
Expand Down Expand Up @@ -316,7 +316,7 @@ export class TraceWriter extends common.Service {
/**
* Publishes flushed traces to the network.
*
* @param {string} json The stringified json representation of the queued traces.
* @param json The stringified json representation of the queued traces.
*/
publish_(json: string) {
const uri = `https://cloudtrace.googleapis.com/v1/projects/${this.config_.projectId}/traces`;
Expand Down
18 changes: 8 additions & 10 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ export interface TraceContext {
* note that we ignore trailing garbage if there is more than one '='
* Returns null if traceId or spanId could not be found.
*
* @param {string} str string representation of the trace headers
* @return {?{traceId: string, spanId: string, options: number}}
* object with keys. null if there is a problem.
* @param str string representation of the trace headers
* @return object with keys. null if there is a problem.
*/
export function parseContextFromHeader(str: string): TraceContext | null {
if (!str) {
Expand All @@ -97,9 +96,8 @@ export function parseContextFromHeader(str: string): TraceContext | null {
* Generates a trace context header value that can be used
* to follow the associated request through other Google services.
*
* @param {?{traceId: string, spanId: string, options: number}} traceContext
* An object with information sufficient for creating a serialized trace
* context.
* @param traceContext An object with information sufficient for creating a
* serialized trace context.
*/
export function generateTraceContext(traceContext: TraceContext): string {
if (!traceContext) {
Expand All @@ -117,7 +115,7 @@ export function generateTraceContext(traceContext: TraceContext): string {
* For example:
* './node_modules/bar/index/foo.js' => 'bar'
*
* @param {string} path The full import path.
* @param path The full import path.
*/
export function packageNameFromPath(path: string) {
const matches = moduleRegex.exec(path);
Expand All @@ -128,8 +126,8 @@ export function packageNameFromPath(path: string) {
* Determines the path at which the requested module will be loaded given
* the provided parent module.
*
* @param {string} request The name of the module to be loaded.
* @param {object} parent The module into which the requested module will be loaded.
* @param request The name of the module to be loaded.
* @param parent The module into which the requested module will be loaded.
*/
export function findModulePath(request: string, parent: NodeModule): string | null {
const mainScriptDir = path.dirname(Module._resolveFilename(request, parent));
Expand All @@ -146,7 +144,7 @@ export function findModulePath(request: string, parent: NodeModule): string | nu
/**
* Determines the version of the module located at `modulePath`.
*
* @param {?string} modulePath The absolute path to the root directory of the
* @param modulePath The absolute path to the root directory of the
* module being loaded. This may be null if we are loading an internal module
* such as http.
*/
Expand Down

0 comments on commit 24a558a

Please sign in to comment.