Take Adrian Cole ’s advice, remove http prefix of tag. Maybe still need some improvements.
This commit is contained in:
parent
ebd745c728
commit
fc19ce8518
|
|
@ -13,38 +13,48 @@ public final class Tags {
|
|||
}
|
||||
|
||||
/**
|
||||
* HTTP_URL records the url of the incoming request.
|
||||
* URL records the url of the incoming request.
|
||||
*/
|
||||
public static final StringTag HTTP_URL = new StringTag("http.url");
|
||||
public static final StringTag URL = new StringTag("url");
|
||||
|
||||
/**
|
||||
* HTTP_STATUS records the http status code of the response.
|
||||
* STATUS_CODE records the http status code of the response.
|
||||
*/
|
||||
public static final IntTag HTTP_STATUS = new IntTag("http.status_code");
|
||||
public static final IntTag STATUS_CODE = new IntTag("status_code");
|
||||
|
||||
/**
|
||||
*
|
||||
* SPAN_KIND hints at the relationship between spans, e.g. client/server.
|
||||
*/
|
||||
public static final StringTag SPAN_KIND = new StringTag("span.kind");
|
||||
|
||||
/**
|
||||
* A constant for setting the span kind to indicate that it represents a server span.
|
||||
*/
|
||||
public static final String SPAN_KIND_SERVER = "server";
|
||||
|
||||
/**
|
||||
* A constant for setting the span kind to indicate that it represents a client span.
|
||||
*/
|
||||
public static final String SPAN_KIND_CLIENT = "client";
|
||||
|
||||
/**
|
||||
* SPAN_LAYER represents the kind of span.
|
||||
* e.g. db=database, rpc=Remote Procedure Call, nosql=something like redis/memcache
|
||||
* e.g. db=database; rpc=Remote Procedure Call Framework, like motan, thift; nosql=something like redis/memcache
|
||||
*/
|
||||
public static final class SPAN_LAYER {
|
||||
private static StringTag SPAN_LAYER_TAG = new StringTag("span.layer");
|
||||
|
||||
private static final String DB_LAYER = "db";
|
||||
private static final String RPC_LAYER = "rpc";
|
||||
private static final String RDB_LAYER = "rda";
|
||||
private static final String RPC_FRAMEWORK_LAYER = "rpc";
|
||||
private static final String NOSQL_LAYER = "nosql";
|
||||
private static final String HTTP_LAYER = "http";
|
||||
|
||||
public static void asDBAccess(Span span){
|
||||
SPAN_LAYER_TAG.set(span, DB_LAYER);
|
||||
SPAN_LAYER_TAG.set(span, RDB_LAYER);
|
||||
}
|
||||
|
||||
public static void asRPC(Span span){
|
||||
SPAN_LAYER_TAG.set(span, RPC_LAYER);
|
||||
public static void asRPCFramework(Span span){
|
||||
SPAN_LAYER_TAG.set(span, RPC_FRAMEWORK_LAYER);
|
||||
}
|
||||
|
||||
public static void asNoSQL(Span span){
|
||||
|
|
@ -60,11 +70,11 @@ public final class Tags {
|
|||
}
|
||||
|
||||
public static boolean isDBAccess(Span span){
|
||||
return DB_LAYER.equals(get(span));
|
||||
return RDB_LAYER.equals(get(span));
|
||||
}
|
||||
|
||||
public static boolean isRPC(Span span){
|
||||
return RPC_LAYER.equals(get(span));
|
||||
public static boolean isRPCFramework(Span span){
|
||||
return RPC_FRAMEWORK_LAYER.equals(get(span));
|
||||
}
|
||||
|
||||
public static boolean isNoSQL(Span span){
|
||||
|
|
@ -98,7 +108,7 @@ public final class Tags {
|
|||
public static final StringTag DB_URL = new StringTag("db.url");
|
||||
|
||||
/**
|
||||
* DB_SQL records the sql statement of the database access.
|
||||
* DB_STATEMENT records the sql statement of the database access.
|
||||
*/
|
||||
public static final StringTag DB_SQL = new StringTag("db.statement");
|
||||
public static final StringTag DB_STATEMENT = new StringTag("db.statement");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,10 +41,10 @@ public class SpanTestCase {
|
|||
Tags.COMPONENT.set(span1, "Spring");
|
||||
Tags.PEER_HOST.set(span1, ipToInt("127.0.0.1"));
|
||||
Tags.ERROR.set(span1, true);
|
||||
Tags.HTTP_STATUS.set(span1, 302);
|
||||
Tags.HTTP_URL.set(span1, "http://127.0.0.1/serviceA");
|
||||
Tags.STATUS_CODE.set(span1, 302);
|
||||
Tags.URL.set(span1, "http://127.0.0.1/serviceA");
|
||||
Tags.DB_URL.set(span1, "jdbc:127.0.0.1:user");
|
||||
Tags.DB_SQL.set(span1, "select * from users");
|
||||
Tags.DB_STATEMENT.set(span1, "select * from users");
|
||||
|
||||
Map<String, Object> tags = span1.getTags();
|
||||
Assert.assertEquals(8, tags.size());
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class PreparedStatementTracing {
|
|||
try {
|
||||
Tags.SPAN_LAYER.asDBAccess(span);
|
||||
Tags.DB_URL.set(span, connectInfo);
|
||||
Tags.DB_SQL.set(span, sql);
|
||||
Tags.DB_STATEMENT.set(span, sql);
|
||||
return exec.exe(realStatement, sql);
|
||||
} catch (SQLException e) {
|
||||
span.log(e);
|
||||
|
|
|
|||
Loading…
Reference in New Issue