package com.a.eye.skywalking.trace.tag;

import com.a.eye.skywalking.trace.Span;

/**
 * The span tags are supported by sky-walking engine.
 * As default, all tags will be stored, but these ones have particular meanings.
 *
 * Created by wusheng on 2017/2/17.
 */
public final class Tags {
    private Tags() {
    }

    /**
     *  HTTP_URL records the url of the incoming request.
     */
    public static final StringTag HTTP_URL = new StringTag("http.url");

    /**
     *  HTTP_STATUS records the http status code of the response.
     */
    public static final IntTag HTTP_STATUS = new IntTag("http.status_code");

    /**
     *  SPAN_KIND represents the kind of span.
     *  e.g. db=database,
     */
    public static final class SPAN_KIND{
        private static StringTag SPAN_KIND_TAG = new StringTag("span.kind");

        public static void asDBAccess(Span span){
            SPAN_KIND_TAG.set(span, "db");
        }
    }

    /**
     *  COMPONENT is a low-cardinality identifier of the module, library, or package that is instrumented.
     *  Like dubbo/dubbox/motan
     */
    public static final StringTag COMPONENT  = new StringTag("component");

    /**
     * ERROR indicates whether a Span ended in an error state.
     */
    public static final BooleanTag ERROR = new BooleanTag("error");

    /**
     *  PEER_HOST_IPV4 records IPv4 host address of the peer.
     */
    public static final IntTag PEER_HOST_IPV4 = new IntTag("peer.ipv4");

    /**
     *  DB_URL records the url of the database access.
     */
    public static final StringTag DB_URL = new StringTag("db.url");

    /**
     *  DB_SQL records the sql of the database access.
     */
    public static final StringTag DB_SQL = new StringTag("db.sql");
}

@@ -698,16 +698,79 @@
 atabase,
+ rpc=Remote Procedure Call, nosql=something like redis/memcache
 %0A     */
@@ -991,16 +991,322 @@
        %7D
+%0A%0A        public static void asRPC(Span span)%7B%0A            SPAN_KIND_TAG.set(span, %22rpc%22);%0A        %7D%0A%0A        public static void asNoSQL(Span span)%7B%0A            SPAN_KIND_TAG.set(span, %22nosql%22);%0A        %7D%0A%0A        public static void asHttp(Span span)%7B%0A            SPAN_KIND_TAG.set(span, %22http%22);%0A        %7D
 %0A    %7D%0A%0A
@@ -2015,16 +2015,26 @@
 the sql 
+statement 
 of the d
@@ -2119,16 +2119,22 @@
 ag(%22db.s
-ql
+tatement
 %22);%0A%7D%0A

Add severl types of span.