diff --git a/packages/datadog-plugin-http2/src/client.js b/packages/datadog-plugin-http2/src/client.js index 6cd0f414c0a..5de0ba163c6 100644 --- a/packages/datadog-plugin-http2/src/client.js +++ b/packages/datadog-plugin-http2/src/client.js @@ -110,6 +110,7 @@ class Http2ClientPlugin extends ClientPlugin { } _onClose ({ span }) { + this.tagPeerService(span) span.finish() } } diff --git a/packages/dd-trace/src/plugins/outbound.js b/packages/dd-trace/src/plugins/outbound.js index f439f63605e..8fba9fcaaaf 100644 --- a/packages/dd-trace/src/plugins/outbound.js +++ b/packages/dd-trace/src/plugins/outbound.js @@ -61,13 +61,17 @@ class OutboundPlugin extends TracingPlugin { finish () { const span = this.activeSpan + this.tagPeerService(span) + super.finish(...arguments) + } + + tagPeerService (span) { if (this.tracer._computePeerService) { const peerData = this.getPeerService(span.context()._tags) if (peerData) { span.addTags(peerData) } } - super.finish(...arguments) } connect (url) {