diff --git a/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbAttributesGetter.java b/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbAttributesGetter.java index bd50cca427cf..a2d209f1b435 100644 --- a/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbAttributesGetter.java +++ b/instrumentation/influxdb-2.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/influxdb/v2_4/InfluxDbAttributesGetter.java @@ -5,7 +5,6 @@ package io.opentelemetry.javaagent.instrumentation.influxdb.v2_4; -import io.opentelemetry.api.internal.StringUtils; import io.opentelemetry.instrumentation.api.incubator.semconv.db.DbClientAttributesGetter; import javax.annotation.Nullable; @@ -22,12 +21,11 @@ public String getStatement(InfluxDbRequest request) { public String getOperation(InfluxDbRequest request) { if (request.getSqlStatementInfo() != null) { String operation = request.getSqlStatementInfo().getOperation(); - return StringUtils.isNullOrEmpty(operation) ? request.getSql() : operation; + return operation == null ? request.getSql() : operation; } return null; } - @Nullable @Override public String getSystem(InfluxDbRequest request) { return "influxdb"; @@ -43,7 +41,7 @@ public String getUser(InfluxDbRequest request) { @Override public String getName(InfluxDbRequest request) { String dbName = request.getDbName(); - return StringUtils.isNullOrEmpty(dbName) ? null : dbName; + return "".equals(dbName) ? null : dbName; } @Nullable diff --git a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java index 50ab67b0b04f..cd337ae3a3d6 100644 --- a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java +++ b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-2.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/spring/gateway/v2_0/ServerWebExchangeHelper.java @@ -8,7 +8,6 @@ import static org.springframework.cloud.gateway.support.ServerWebExchangeUtils.GATEWAY_ROUTE_ATTR; import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.internal.StringUtils; import io.opentelemetry.api.trace.Span; import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.api.instrumenter.LocalRootSpan; @@ -86,7 +85,7 @@ public static String extractServerRoute(ServerWebExchange exchange) { */ private static String convergeRouteId(Route route) { String routeId = route.getId(); - if (StringUtils.isNullOrEmpty(routeId)) { + if (routeId == null || routeId.isEmpty()) { return null; } if (UUID_REGEX.matcher(routeId).matches()) { diff --git a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/gateway/common/AbstractRouteMappingTest.java b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/gateway/common/AbstractRouteMappingTest.java index 2d6f4d398c33..b670ef420298 100644 --- a/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/gateway/common/AbstractRouteMappingTest.java +++ b/instrumentation/spring/spring-cloud-gateway/spring-cloud-gateway-common/testing/src/main/java/io/opentelemetry/instrumentation/spring/gateway/common/AbstractRouteMappingTest.java @@ -8,7 +8,6 @@ import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo; import io.opentelemetry.api.common.AttributeKey; -import io.opentelemetry.api.internal.StringUtils; import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension; import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension; import io.opentelemetry.sdk.testing.assertj.AttributeAssertion; @@ -21,6 +20,7 @@ import org.springframework.boot.test.context.TestConfiguration; import org.springframework.boot.web.embedded.netty.NettyReactiveWebServerFactory; import org.springframework.context.annotation.Bean; +import org.springframework.util.StringUtils; public abstract class AbstractRouteMappingTest { @TestConfiguration @@ -49,7 +49,7 @@ void beforeEach() { protected List buildAttributeAssertions( String routeId, String uri, int order, int filterSize) { List assertions = new ArrayList<>(); - if (!StringUtils.isNullOrEmpty(routeId)) { + if (!StringUtils.isEmpty(routeId)) { assertions.add(equalTo(AttributeKey.stringKey("spring-cloud-gateway.route.id"), routeId)); } assertions.add(equalTo(AttributeKey.stringKey("spring-cloud-gateway.route.uri"), uri));