@@ -70,7 +70,7 @@ module.exports = function (elasticsearch, agent, { version, enabled }) {
7070 if ( result ) {
7171 const currSpan = ins . currSpan ( )
7272 if ( currSpan ) {
73- diagResultFromSpan [ currSpan ] = result
73+ diagResultFromSpan . set ( currSpan , result )
7474 }
7575 }
7676 } )
@@ -91,7 +91,7 @@ module.exports = function (elasticsearch, agent, { version, enabled }) {
9191 const conn = origGetConnection . apply ( this , arguments )
9292 const currSpan = ins . currSpan ( )
9393 if ( conn && currSpan ) {
94- connFromSpan [ currSpan ] = conn
94+ connFromSpan . set ( currSpan , conn )
9595 }
9696 return conn
9797 }
@@ -136,7 +136,7 @@ module.exports = function (elasticsearch, agent, { version, enabled }) {
136136 // Otherwise, fallback to using the first connection on
137137 // `Transport#connectionPool`, if any. (This is the best parsed
138138 // representation of connection options passed to the Client ctor.)
139- let conn = connFromSpan [ span ]
139+ let conn = connFromSpan . get ( span )
140140 if ( conn ) {
141141 connFromSpan . delete ( span )
142142 } else if ( this . connectionPool && this . connectionPool . connections ) {
@@ -154,7 +154,7 @@ module.exports = function (elasticsearch, agent, { version, enabled }) {
154154 // content-length: ...
155155 //
156156 // Getting the ES client request "DiagnosticResult" object has some edge cases:
157- // - In v7 using a callback, we always get `result`.
157+ // - In v7 using a callback, we always get it as `result`.
158158 // - In v7 using a Promise, if the promise is rejected, then `result` is
159159 // not passed.
160160 // - In v8, `result` only includes HTTP response info if `options.meta`
@@ -166,7 +166,7 @@ module.exports = function (elasticsearch, agent, { version, enabled }) {
166166 // `diagResult`.
167167 let diagResult = isGteV8 ? null : result
168168 if ( ! diagResult ) {
169- diagResult = diagResultFromSpan [ span ]
169+ diagResult = diagResultFromSpan . get ( span )
170170 if ( diagResult ) {
171171 diagResultFromSpan . delete ( span )
172172 }
0 commit comments