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

Commit 6b05124

Browse files
djonathascardososilva-fabio
authored andcommitted
fix: fixed gts issues
1 parent d543d2b commit 6b05124

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

packages/opencensus-core/src/trace/model/span-base-model.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,23 +72,38 @@ export abstract class SpanBaseModel implements Span {
7272
* "Zulu" format.
7373
*/
7474
get startTime(): Date {
75-
if (this.clock) return this.clock.startTime;
75+
if (!this.clock) {
76+
debug("calling startTime() on null clock");
77+
return null;
78+
}
79+
80+
return this.clock.startTime;
7681
}
7782

7883
/**
7984
* Gives a timestap that indicates the span's end time in RFC3339 UTC
8085
* "Zulu" format.
8186
*/
8287
get endTime(): Date {
83-
if (this.clock) return this.clock.endTime;
88+
if (!this.clock) {
89+
debug("calling endTime() on null clock");
90+
return null;
91+
}
92+
93+
return this.clock.endTime;
8494
}
8595

8696
/**
8797
* Gives a timestap that indicates the span's duration in RFC3339 UTC
8898
* "Zulu" format.
8999
*/
90100
get duration(): number {
91-
if (this.clock) return this.clock.duration;
101+
if (!this.clock) {
102+
debug("calling duration() on null clock");
103+
return null;
104+
}
105+
106+
return this.clock.duration;
92107
}
93108

94109
/** Gives the TraceContext of the span. */

0 commit comments

Comments
 (0)