From 75672cb60c24ea4fe4e310ad3b8fae853620b35a Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 18 Nov 2020 10:13:02 -0500 Subject: [PATCH] chore: remove ordered attribute dropping --- packages/opentelemetry-tracing/src/Span.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/opentelemetry-tracing/src/Span.ts b/packages/opentelemetry-tracing/src/Span.ts index 62d6f35e5fd..6c21cf98a66 100644 --- a/packages/opentelemetry-tracing/src/Span.ts +++ b/packages/opentelemetry-tracing/src/Span.ts @@ -103,15 +103,10 @@ export class Span implements api.Span, ReadableSpan { if ( Object.keys(this.attributes).length >= - this._traceParams.numberOfAttributesPerSpan! + this._traceParams.numberOfAttributesPerSpan! && + !Object.prototype.hasOwnProperty.call(this.attributes, key) ) { - const attributeKeyToDelete = Object.keys(this.attributes).shift(); - if (attributeKeyToDelete) { - this._logger.warn( - `Dropping extra attributes : ${attributeKeyToDelete}` - ); - delete this.attributes[attributeKeyToDelete]; - } + return this; } this.attributes[key] = value; return this;