Remove unused service method (#321)
This commit is contained in:
parent
dc90ea7acb
commit
e8a451cbce
|
@ -19,8 +19,6 @@ import io.opentelemetry.trace.Span;
|
|||
|
||||
public abstract class ClientDecorator extends BaseDecorator {
|
||||
|
||||
protected abstract String service();
|
||||
|
||||
@Override
|
||||
public Span afterStart(final Span span) {
|
||||
assert span != null;
|
||||
|
|
|
@ -35,11 +35,6 @@ public abstract class HttpClientDecorator<REQUEST, RESPONSE> extends ClientDecor
|
|||
|
||||
protected abstract Integer status(RESPONSE response);
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String spanNameForRequest(final REQUEST request) {
|
||||
if (request == null) {
|
||||
return DEFAULT_SPAN_NAME;
|
||||
|
|
|
@ -51,11 +51,6 @@ class ClientDecoratorTest extends BaseDecoratorTest {
|
|||
|
||||
def newDecorator(String serviceName) {
|
||||
return new ClientDecorator() {
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return serviceName
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class DatabaseClientDecoratorTest extends ClientDecoratorTest {
|
|||
|
||||
def "test afterStart"() {
|
||||
setup:
|
||||
def decorator = newDecorator((String) serviceName)
|
||||
def decorator = newDecorator()
|
||||
|
||||
when:
|
||||
decorator.afterStart(span)
|
||||
|
@ -103,14 +103,9 @@ class DatabaseClientDecoratorTest extends ClientDecoratorTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
def newDecorator(String serviceName = "test-service") {
|
||||
def newDecorator() {
|
||||
return new DatabaseClientDecorator<Map>() {
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return serviceName
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "test-db"
|
||||
|
|
|
@ -148,14 +148,9 @@ class HttpClientDecoratorTest extends ClientDecoratorTest {
|
|||
}
|
||||
|
||||
@Override
|
||||
def newDecorator(String serviceName = "test-service") {
|
||||
def newDecorator() {
|
||||
return new HttpClientDecorator<Map, Map>() {
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return serviceName
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String method(Map m) {
|
||||
return m.method
|
||||
|
|
|
@ -55,12 +55,6 @@ class OrmClientDecoratorTest extends DatabaseClientDecoratorTest {
|
|||
protected String dbInstance(Object o) {
|
||||
return "test-user"
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "test-service"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -100,11 +100,6 @@ public class AwsSdkClientDecorator extends HttpClientDecorator<Request, Response
|
|||
return operationNames.get(awsOperation);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return COMPONENT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String method(final Request request) {
|
||||
return request.getHttpMethod().name();
|
||||
|
|
|
@ -86,11 +86,6 @@ public class AwsSdkClientDecorator extends HttpClientDecorator<SdkHttpRequest, S
|
|||
return span;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return COMPONENT_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String method(final SdkHttpRequest request) {
|
||||
return request.method().name();
|
||||
|
|
|
@ -24,11 +24,6 @@ import io.opentelemetry.trace.Span;
|
|||
public class CassandraClientDecorator extends DatabaseClientDecorator<Session> {
|
||||
public static final CassandraClientDecorator DECORATE = new CassandraClientDecorator();
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "cassandra";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "cassandra";
|
||||
|
|
|
@ -20,11 +20,6 @@ import io.opentelemetry.auto.bootstrap.instrumentation.decorator.DatabaseClientD
|
|||
class CouchbaseClientDecorator extends DatabaseClientDecorator {
|
||||
public static final CouchbaseClientDecorator DECORATE = new CouchbaseClientDecorator();
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "couchbase";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "couchbase";
|
||||
|
|
|
@ -30,11 +30,6 @@ public class ElasticsearchRestClientDecorator extends DatabaseClientDecorator {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.elasticsearch");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "elasticsearch";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "elasticsearch";
|
||||
|
|
|
@ -27,11 +27,6 @@ public class ElasticsearchTransportClientDecorator extends DatabaseClientDecorat
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.elasticsearch");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "elasticsearch";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "elasticsearch";
|
||||
|
|
|
@ -40,9 +40,4 @@ public class GeodeDecorator extends DatabaseClientDecorator<Region> {
|
|||
protected String dbInstance(final Region region) {
|
||||
return region.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "apache-geode";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,6 @@ public class GrpcClientDecorator extends ClientDecorator {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.grpc-1.5");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Span onClose(final Span span, final io.grpc.Status status) {
|
||||
|
||||
span.setAttribute("status.code", status.getCode().name());
|
||||
|
|
|
@ -30,11 +30,6 @@ public class HibernateDecorator extends OrmClientDecorator {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.hibernate");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "hibernate";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return null;
|
||||
|
|
|
@ -35,11 +35,6 @@ public class JDBCDecorator extends DatabaseClientDecorator<DBInfo> {
|
|||
|
||||
private static final String DB_QUERY = "DB Query";
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "jdbc"; // Overridden by onConnection
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "jdbc";
|
||||
|
|
|
@ -26,11 +26,6 @@ public class JedisClientDecorator extends DatabaseClientDecorator<Connection> {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.jedis-1.4");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "redis";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "redis";
|
||||
|
|
|
@ -26,11 +26,6 @@ public class JedisClientDecorator extends DatabaseClientDecorator<Connection> {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.jedis-1.4");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "redis";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "redis";
|
||||
|
|
|
@ -32,11 +32,6 @@ public class JMSDecorator extends ClientDecorator {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.jms-1.1");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "jms";
|
||||
}
|
||||
|
||||
public String spanNameForReceive(final Message message) {
|
||||
return toResourceName(message, null);
|
||||
}
|
||||
|
|
|
@ -28,11 +28,6 @@ public class KafkaDecorator extends ClientDecorator {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.kafka-clients-0.11");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "kafka";
|
||||
}
|
||||
|
||||
public String spanNameOnConsume(final ConsumerRecord record) {
|
||||
final String topic = record.topic();
|
||||
if (topic != null) {
|
||||
|
|
|
@ -27,11 +27,6 @@ public class KafkaStreamsDecorator extends ClientDecorator {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.kafka-streams-0.11");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "kafka";
|
||||
}
|
||||
|
||||
public String spanNameForConsume(final StampedRecord record) {
|
||||
if (record == null) {
|
||||
return null;
|
||||
|
|
|
@ -28,11 +28,6 @@ public class LettuceClientDecorator extends DatabaseClientDecorator<RedisURI> {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.lettuce-5.0");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "redis";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "redis";
|
||||
|
|
|
@ -39,11 +39,6 @@ public class MongoClientDecorator extends DatabaseClientDecorator<CommandStarted
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.mongo");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "mongo";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "mongo";
|
||||
|
|
|
@ -23,11 +23,6 @@ import okhttp3.Response;
|
|||
public class OkHttpClientDecorator extends HttpClientDecorator<Request, Response> {
|
||||
public static final OkHttpClientDecorator DECORATE = new OkHttpClientDecorator();
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String method(final Request httpRequest) {
|
||||
return httpRequest.method();
|
||||
|
|
|
@ -29,11 +29,6 @@ public class RabbitDecorator extends ClientDecorator {
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.rabbitmq-amqp-2.7");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "rabbitmq";
|
||||
}
|
||||
|
||||
public void onPublish(final Span span, final String exchange, final String routingKey) {
|
||||
final String exchangeName = exchange == null || exchange.isEmpty() ? "<default>" : exchange;
|
||||
final String routing =
|
||||
|
|
|
@ -24,9 +24,4 @@ public class RmiClientDecorator extends ClientDecorator {
|
|||
|
||||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.rmi");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,4 @@ public final class SpringDataDecorator extends ClientDecorator {
|
|||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.spring-data-1.8");
|
||||
|
||||
private SpringDataDecorator() {}
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,11 +26,6 @@ public class MemcacheClientDecorator extends DatabaseClientDecorator<MemcachedCo
|
|||
public static final Tracer TRACER =
|
||||
OpenTelemetry.getTracerProvider().get("io.opentelemetry.auto.spymemcached-2.12");
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return "memcached";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String dbType() {
|
||||
return "memcached";
|
||||
|
|
|
@ -37,11 +37,6 @@ public class TwilioClientDecorator extends ClientDecorator {
|
|||
|
||||
static final String COMPONENT_NAME = "twilio-sdk";
|
||||
|
||||
@Override
|
||||
protected String service() {
|
||||
return COMPONENT_NAME;
|
||||
}
|
||||
|
||||
/** Decorate trace based on service execution metadata. */
|
||||
public String spanNameOnServiceExecution(final Object serviceExecutor, final String methodName) {
|
||||
return spanNameForClass(serviceExecutor.getClass()) + "." + methodName;
|
||||
|
|
Loading…
Reference in New Issue