Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usages of sdk internal StringUtils class #11547

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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";
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down Expand Up @@ -49,7 +49,7 @@ void beforeEach() {
protected List<AttributeAssertion> buildAttributeAssertions(
String routeId, String uri, int order, int filterSize) {
List<AttributeAssertion> 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));
Expand Down
Loading