Skip to content

Commit 57f37ee

Browse files
authored
refactor(sdk-trace-base): fix eslint warnings (#5385)
1 parent e25de95 commit 57f37ee

File tree

1 file changed

+13
-4
lines changed
  • packages/opentelemetry-sdk-trace-base/src

1 file changed

+13
-4
lines changed

packages/opentelemetry-sdk-trace-base/src/Span.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,11 @@ export class SpanImpl implements Span {
157157
return this;
158158
}
159159

160+
const { attributeCountLimit } = this._spanLimits;
161+
160162
if (
161-
Object.keys(this.attributes).length >=
162-
this._spanLimits.attributeCountLimit! &&
163+
attributeCountLimit !== undefined &&
164+
Object.keys(this.attributes).length >= attributeCountLimit &&
163165
!Object.prototype.hasOwnProperty.call(this.attributes, key)
164166
) {
165167
this._droppedAttributesCount++;
@@ -189,12 +191,19 @@ export class SpanImpl implements Span {
189191
timeStamp?: TimeInput
190192
): this {
191193
if (this._isSpanEnded()) return this;
192-
if (this._spanLimits.eventCountLimit === 0) {
194+
195+
const { eventCountLimit } = this._spanLimits;
196+
197+
if (eventCountLimit === 0) {
193198
diag.warn('No events allowed.');
194199
this._droppedEventsCount++;
195200
return this;
196201
}
197-
if (this.events.length >= this._spanLimits.eventCountLimit!) {
202+
203+
if (
204+
eventCountLimit !== undefined &&
205+
this.events.length >= eventCountLimit
206+
) {
198207
if (this._droppedEventsCount === 0) {
199208
diag.debug('Dropping extra events.');
200209
}

0 commit comments

Comments
 (0)