From 98d3f88ab8d1bb231f740f6a6a8a6191c53c5339 Mon Sep 17 00:00:00 2001 From: Lauri Tulmin Date: Thu, 16 Dec 2021 03:29:57 +0200 Subject: [PATCH] Fix npe in apache http client 4.0 instrumentation (#4913) --- .../apachehttpclient/v4_0/ApacheHttpClientInstrumentation.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientInstrumentation.java b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientInstrumentation.java index 253a22214991..9dd2f6cde429 100644 --- a/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientInstrumentation.java +++ b/instrumentation/apache-httpclient/apache-httpclient-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v4_0/ApacheHttpClientInstrumentation.java @@ -257,6 +257,9 @@ public static void methodEnter( @Advice.Local("otelContext") Context context, @Advice.Local("otelScope") Scope scope) { Context parentContext = currentContext(); + + otelRequest = new ApacheHttpClientRequest(host, request); + if (!instrumenter().shouldStart(parentContext, otelRequest)) { return; }