Skip to content

Commit

Permalink
refactor(sdk-trace-base): fix eslint warnings (#5385)
Browse files Browse the repository at this point in the history
  • Loading branch information
chancancode authored Feb 5, 2025
1 parent e25de95 commit 57f37ee
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/opentelemetry-sdk-trace-base/src/Span.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,11 @@ export class SpanImpl implements Span {
return this;
}

const { attributeCountLimit } = this._spanLimits;

if (
Object.keys(this.attributes).length >=
this._spanLimits.attributeCountLimit! &&
attributeCountLimit !== undefined &&
Object.keys(this.attributes).length >= attributeCountLimit &&
!Object.prototype.hasOwnProperty.call(this.attributes, key)
) {
this._droppedAttributesCount++;
Expand Down Expand Up @@ -189,12 +191,19 @@ export class SpanImpl implements Span {
timeStamp?: TimeInput
): this {
if (this._isSpanEnded()) return this;
if (this._spanLimits.eventCountLimit === 0) {

const { eventCountLimit } = this._spanLimits;

if (eventCountLimit === 0) {
diag.warn('No events allowed.');
this._droppedEventsCount++;
return this;
}
if (this.events.length >= this._spanLimits.eventCountLimit!) {

if (
eventCountLimit !== undefined &&
this.events.length >= eventCountLimit
) {
if (this._droppedEventsCount === 0) {
diag.debug('Dropping extra events.');
}
Expand Down

0 comments on commit 57f37ee

Please sign in to comment.