You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@phoenix.apache.org by MrSandmanRUS <gi...@git.apache.org> on 2018/07/18 12:30:29 UTC

[GitHub] phoenix pull request #311: Fixed Phoenix Tracing Web Application

GitHub user MrSandmanRUS opened a pull request:

    https://github.com/apache/phoenix/pull/311

    Fixed Phoenix Tracing Web Application

    Fixed check null, trace table name, webapp path, column names. Fixed traceserver.py

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/MrSandmanRUS/phoenix PHOENIX-4817

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/phoenix/pull/311.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #311
    
----
commit 070192c1bb557d8744f78e52f6a75a5bf58625e3
Author: Vitaly Monastyrev <vm...@...>
Date:   2018-07-18T12:24:49Z

    Fixed Phoenix Tracing Web Application (fixed check null, trace table name, webapp path, column names). Fixed traceserver.py

----


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    apache-phoenix-4.11.0-HBase-1.1-bin 、hadoop-2.7.1
    @MrSandmanRUS 


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    traceserver.py start        NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
     
    ![2018-07-20 18-33-36](https://user-images.githubusercontent.com/8455464/42998108-a008041e-8c4b-11e8-8015-88bf9bee58c2.png)



---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203445596
  
    --- Diff: bin/traceserver.py ---
    @@ -116,8 +116,10 @@
     
     #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
     #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \
    -java_cmd = '%(java)s $PHOENIX_OPTS ' + \
    -    '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \
    +java_cmd = '%(java)s  ' + \
    --- End diff --
    
    Seems like `$PHOENIX_OPTS` was dropped. Was this not being interpolated correctly? Is this environment variable propagated into the traceserver java process?


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r204807188
  
    --- Diff: bin/traceserver.py ---
    @@ -116,8 +116,10 @@
     
     #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
     #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \
    -java_cmd = '%(java)s $PHOENIX_OPTS ' + \
    -    '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \
    +java_cmd = '%(java)s  ' + \
    --- End diff --
    
    Do I need to add something like this?
    
    phoenix_opts= os.getenv('PHOENIX_OPTS', '')
    ......
    if hbase_env.has_key('PHOENIX_OPTS'):
        opts = hbase_env['PHOENIX_OPTS']
    .....
    java_cmd = '%(java)s  ' + phoenix_opts + \
    ....


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203550218
  
    --- Diff: phoenix-tracing-webapp/src/main/java/org/apache/phoenix/tracingwebapp/http/Main.java ---
    @@ -62,15 +63,18 @@ public int run(String[] arg0) throws Exception {
             final String home = getConf().get(TRACE_SERVER_HTTP_JETTY_HOME_KEY,
                     DEFAULT_HTTP_HOME);
             //setting up the embedded server
    -        ProtectionDomain domain = Main.class.getProtectionDomain();
    -        URL location = domain.getCodeSource().getLocation();
    -        String webappDirLocation = location.toString().split("target")[0] +"src/main/webapp";
    +        String webappDirLocation = DEFAULT_WEBAPP_DIR_LOCATION;
    --- End diff --
    
    Fixed


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r204818876
  
    --- Diff: bin/traceserver.py ---
    @@ -116,8 +116,10 @@
     
     #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
     #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \
    -java_cmd = '%(java)s $PHOENIX_OPTS ' + \
    -    '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \
    +java_cmd = '%(java)s  ' + \
    --- End diff --
    
    Actually, looks like queryserver.py doesn't include `$PHOENIX_OPTS` so let's just leave that to clients. `$PHOENIX_TRACESERVER_OPTS` is inlined, so you're good. Sorry for the confusion.


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    
    Thank you very much for the problem.
    
    @MrSandmanRUS 


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r204795871
  
    --- Diff: bin/traceserver.py ---
    @@ -116,8 +116,10 @@
     
     #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
     #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \
    -java_cmd = '%(java)s $PHOENIX_OPTS ' + \
    -    '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \
    +java_cmd = '%(java)s  ' + \
    --- End diff --
    
    The issue is that subprocess doesn't handle shell variable expansion "in the command". Subprocess has API to provide an environment to the process being run.
    
    `$PHOENIX_OPTS` and `$PHOENIX_TRACESERVER_OPTS` should be placed into the subprocess's environment, not just dropped.


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    You use version from apache phoenix, I fixed it back, just compile my sources
    @mygood 


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    mygood, add libs jackson-mapper-asl-{someVersion}.jar, jackson-core-asl-{someVersion}.jar, jackson-jaxrs-{someVersion}.jar, jackson-xc-{someVersion}.jar to your hadoop_classpath


---

[GitHub] phoenix issue #311: Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    Fixed Phoenix Tracing Web Application, fixed traceserver.py


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203446437
  
    --- Diff: phoenix-tracing-webapp/src/main/java/org/apache/phoenix/tracingwebapp/http/Main.java ---
    @@ -62,15 +63,18 @@ public int run(String[] arg0) throws Exception {
             final String home = getConf().get(TRACE_SERVER_HTTP_JETTY_HOME_KEY,
                     DEFAULT_HTTP_HOME);
             //setting up the embedded server
    -        ProtectionDomain domain = Main.class.getProtectionDomain();
    -        URL location = domain.getCodeSource().getLocation();
    -        String webappDirLocation = location.toString().split("target")[0] +"src/main/webapp";
    +        String webappDirLocation = DEFAULT_WEBAPP_DIR_LOCATION;
    --- End diff --
    
    Suggest dropping `webappDirLocation` and just using `DEFAULT_WEBAPP_DIR_LOCATION` since this is not configurable anyways.


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203446592
  
    --- Diff: phoenix-tracing-webapp/src/main/java/org/apache/phoenix/tracingwebapp/http/TraceServlet.java ---
    @@ -42,14 +45,21 @@
       private static Connection con;
       protected String DEFAULT_LIMIT = "25";
       protected String DEFAULT_COUNTBY = "hostname";
    +  protected String DEFAULT_DESCRIPTION = "description";
       protected String LOGIC_AND = "AND";
       protected String LOGIC_OR = "OR";
       protected String TRACING_TABLE = "SYSTEM.TRACING_STATS";
     
    -
    +  @Override
    +  public void init() {
    +    org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create();
    --- End diff --
    
    Import `org.apache.hadoop.conf.Configuration` please.


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203552153
  
    --- Diff: bin/traceserver.py ---
    @@ -116,8 +116,10 @@
     
     #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
     #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \
    -java_cmd = '%(java)s $PHOENIX_OPTS ' + \
    -    '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \
    +java_cmd = '%(java)s  ' + \
    --- End diff --
    
    https://issues.apache.org/jira/browse/PHOENIX-2659
     I think it's your comment:
    "Josh Elser added a comment - 12/Feb/16 03:23
    ok, PHOENIX_OPTS isn't working because subprocess isn't popping a shell like sqlline does. It will automatically get added to PQS's environment already. We can just remove that.
    Steve is spot-on for the argument parsing. It's just busted."
    So, I just delete it.


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    I have a problem that the data does not into SYSTEM.TRACING_STATS
    0: jdbc:phoenix:localhost:2181:/hbase> trace on;
    +----------------------+
    |       trace_id       |
    +----------------------+
    | 2701156331755118993  |
    +----------------------+
    1 row selected (0.001 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> upsert into T(a,b) values(2,2);
    1 row affected (0.015 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> trace off;
    +----------------------+
    |       trace_id       |
    +----------------------+
    | 2701156331755118993  |
    +----------------------+
    1 row selected (0.001 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> trace off;
    +-----------+
    | trace_id  |
    +-----------+
    +-----------+
    No rows selected (0 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> select * from SYSTEM.TRACING_STATS where trace_id=2701156331755118993;
    +-----------+------------+----------+--------------+-------------+-----------+-----------+--------+--------+
    | TRACE_ID  | PARENT_ID  | SPAN_ID  | DESCRIPTION  | START_TIME  | END_TIME  | HOSTNAME  | COUNT  | COUNT  |
    +-----------+------------+----------+--------------+-------------+-----------+-----------+--------+--------+
    +-----------+------------+----------+--------------+-------------+-----------+-----------+--------+--------+
    No rows selected (0.109 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> select * from SYSTEM.TRACING_STATS;
    +-----------+------------+----------+--------------+-------------+-----------+-----------+--------+--------+
    | TRACE_ID  | PARENT_ID  | SPAN_ID  | DESCRIPTION  | START_TIME  | END_TIME  | HOSTNAME  | COUNT  | COUNT  |
    +-----------+------------+----------+--------------+-------------+-----------+-----------+--------+--------+
    | 2         | 2          | 2        | upsert       | 20180720    | 20180721  | host1     | 20     | 30     |
    | 3         | 3          | 3        | upsert       | 20180720    | 20180721  | host1     | 10     | 30     |
    +-----------+------------+----------+--------------+-------------+-----------+-----------+--------+--------+
    2 rows selected (0.098 seconds)
    @MrSandmanRUS 


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/phoenix/pull/311


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203550254
  
    --- Diff: phoenix-tracing-webapp/src/main/java/org/apache/phoenix/tracingwebapp/http/TraceServlet.java ---
    @@ -42,14 +45,21 @@
       private static Connection con;
       protected String DEFAULT_LIMIT = "25";
       protected String DEFAULT_COUNTBY = "hostname";
    +  protected String DEFAULT_DESCRIPTION = "description";
       protected String LOGIC_AND = "AND";
       protected String LOGIC_OR = "OR";
       protected String TRACING_TABLE = "SYSTEM.TRACING_STATS";
     
    -
    +  @Override
    +  public void init() {
    +    org.apache.hadoop.conf.Configuration conf = HBaseConfiguration.create();
    --- End diff --
    
    Fixed


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r204819321
  
    --- Diff: bin/traceserver.py ---
    @@ -116,8 +116,10 @@
     
     #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
     #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \
    -java_cmd = '%(java)s $PHOENIX_OPTS ' + \
    -    '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \
    +java_cmd = '%(java)s  ' + \
    --- End diff --
    
    Ok, thank you


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
     CREATE TABLE SYSTEM.TRACING_STATS (
          trace_id BIGINT NOT NULL,
          parent_id BIGINT NOT NULL,
          span_id BIGINT NOT NULL,
          description VARCHAR,
          start_time BIGINT,
          end_time BIGINT,
          hostname VARCHAR,
          tags.count SMALLINT,
          annotations.count SMALLINT,
          CONSTRAINT pk PRIMARY KEY (trace_id, parent_id, span_id)
          )
    Phoenix Tracing List
    ![image](https://user-images.githubusercontent.com/8455464/42999737-8c7c6cae-8c51-11e8-842d-334ffcf3b69e.png)
    Is it caused by this problem? NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet 
    



---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    Can you show me your trace table? Column “description” is standard column of this table, if you start tracing via base-site.xml


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    Add to hbase-site.xml:
    	  <property>
    	    <name>phoenix.trace.enabled</name>
    	    <value>true</value>
    	  </property>


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by joshelser <gi...@git.apache.org>.
Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203447995
  
    --- Diff: phoenix-tracing-webapp/src/main/java/org/apache/phoenix/tracingwebapp/http/TraceServlet.java ---
    @@ -98,33 +108,36 @@ protected String getCount(String countby) {
         if(countby == null) {
           countby = DEFAULT_COUNTBY;
         }
    -    // Throws exception if the column not present in the trace table.
    -    MetricInfo.getColumnName(countby.toLowerCase());
         String sqlQuery = "SELECT "+countby+", COUNT(*) AS count FROM " + TRACING_TABLE + " GROUP BY "+countby+" HAVING COUNT(*) > 1 ";
         json = getResults(sqlQuery);
         return json;
       }
     
       //search the trace over parent id or trace id
    -  protected String searchTrace(String parentId, String traceId,String logic) {
    +  protected String searchTrace(String parentId, String traceId, String logic) {
    +
         String json = null;
         String query = null;
         // Check the parent Id, trace id type or long or not.
         try {
    +      if (parentId != null) {
             Long.parseLong(parentId);
    +      }
    +      if (traceId != null) {
             Long.parseLong(traceId);
    +      }
         } catch (NumberFormatException e) {
    -    	throw new RuntimeException("The passed parentId/traceId is not a number.", e);
    +      throw new RuntimeException("The passed parentId/traceId is not a number.", e);
         }
    -    if(!logic.equals(LOGIC_AND) || !logic.equals(LOGIC_OR)) {
    -    	throw new RuntimeException("Wrong logical operator passed to the query. Only "+ LOGIC_AND+","+LOGIC_OR+" are allowed.") ;
    +    if (logic != null && (!logic.equals(LOGIC_AND) && !logic.equals(LOGIC_OR))) {
    --- End diff --
    
    Parenthesis around `(!logic.equals(LOGIC_AND) && !logic.equals(LOGIC_OR))` are unnecessary, please drop them.


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    Tracing List is ok  but  Trace Count Chart Graph 
    Request URL: http://192.168.178.31:8864/trace/?action=getCount
    Request Method: GET
    Status Code: 500 Unknown tracename: description
    ![image](https://user-images.githubusercontent.com/8455464/42999258-a07728ea-8c4f-11e8-8110-75d6f5e95eae.png)
    see trace log 
    ![image](https://user-images.githubusercontent.com/8455464/42999272-b426b518-8c4f-11e8-9491-f6df5af9f489.png)



---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    Hi @MrSandmanRUS  
    I have a problem apache-phoenix-4.11.0-HBase-1.1-bin, hadoop-2.7.1
    1.hbase-site.xml modification
    <property>
    <name>phoenix.trace.frequency</name>
        <value>always</value>
    </property>
    2. Copy $PHOENIX_HOME/bin/hadoop-metrics2-hbase.properties to $HBASE_HOME/conf
    
    3. The client writes data but SYSTEM.TRACING_STATS has no data to write.


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    It's ok, just info message, try to open localhost:8864
    @mygood 


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    trace on not data into trace table
    I use apache-phoenix-4.13.1-HBase-1.1-bin and hbase-1.1.6 and hadoop-2.7.1
    cp $PHOENIX_HOME/phoenix-4.13.1-HBase-1.1-server.jar $HBASE_HOME/lib
    cp $PHOENIX_HOME/bin/hadoop-metrics2-hbase.properties $HBASE_HOME/conf
    cp $PHOENIX_HOME/bin/hadoop-metrics2-phoenix.properties $HBASE_HOME/conf
    
    add hbase-sit.xml
    <property>
    <name>phoenix.trace.frequency</name>
    <value>always</value>
    </property>
    <property>
    <name>phoenix.trace.statsTableName</name>
    <value>SYSTEM.TRACING_STATS</value>
    </property>
    <property> 
    <name>phoenix.trace.frequency</name>
    <value>true</value>
    </property>
    run sqlline.py
    create SYSTEM.TRACING_STATS
    CREATE TABLE SYSTEM.TRACING_STATS (
    trace_id BIGINT NOT NULL,
    parent_id BIGINT NOT NULL,
    span_id BIGINT NOT NULL,
    description VARCHAR,
    start_time BIGINT,
    end_time BIGINT,
    hostname VARCHAR,
    tags.count SMALLINT,
    annotations.count SMALLINT,
    CONSTRAINT pk PRIMARY KEY (trace_id, parent_id, span_id)
    )
    0: jdbc:phoenix:localhost:2181:/hbase> trace on;
    -----------------------
    
    trace_id
    -----------------------
    
    -7450651397611882467
    -----------------------
    1 row selected (0.001 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> create table t(a bigint not null PRIMARY key,b bigint);
    No rows affected (2.523 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> !ta
    ------------------------------------------------------------------------------------------------------------+
    
    TABLE_CAT   TABLE_SCHEM TABLE_NAME  TABLE_TYPE  REMARKS     TYPE_NAME   SELF_REFERENCING_COL_NAME     REF_GENERATIO
    ------------------------------------------------------------------------------------------------------------+
    
          SYSTEM      CATALOG     SYSTEM TABLE                         
          SYSTEM      FUNCTION    SYSTEM TABLE                         
          SYSTEM      SEQUENCE    SYSTEM TABLE                         
          SYSTEM      STATS SYSTEM TABLE                         
          SYSTEM      TRACING_STATS     SYSTEM TABLE                         
                T     TABLE                    
    ------------------------------------------------------------------------------------------------------------+
    0: jdbc:phoenix:localhost:2181:/hbase> upsert into t(a,b) values(1,1);
    1 row affected (0.046 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> select * from SYSTEM.TRACING_STATS where trace_id=-7450651397611882467;
    ----------------------------------------------------------------------------------
    
    TRACE_ID    PARENT_ID   SPAN_ID     DESCRIPTION START_TIME  END_TIME    HOSTNAME    COUNT COUNT
    ----------------------------------------------------------------------------------
    ----------------------------------------------------------------------------------
    No rows selected (0.09 seconds)
    0: jdbc:phoenix:localhost:2181:/hbase> select * from SYSTEM.TRACING_STATS;
    ----------------------------------------------------------------------------------
    
    TRACE_ID    PARENT_ID   SPAN_ID     DESCRIPTION START_TIME  END_TIME    HOSTNAME    COUNT COUNT
    ----------------------------------------------------------------------------------
    ----------------------------------------------------------------------------------
    No rows selected (0.09 seconds)
    @MrSandmanRUS @joshelser 


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    It's ok, clone my branch and compile only web application, then rename jar for your version


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203552899
  
    --- Diff: bin/traceserver.py ---
    @@ -116,8 +116,10 @@
     
     #    " -Xdebug -Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=n " + \
     #    " -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -XX:FlightRecorderOptions=defaultrecording=true,dumponexit=true" + \
    -java_cmd = '%(java)s $PHOENIX_OPTS ' + \
    -    '-cp ' + hbase_config_path + os.pathsep + phoenix_utils.phoenix_traceserver_jar + os.pathsep + phoenix_utils.phoenix_client_jar + \
    +java_cmd = '%(java)s  ' + \
    --- End diff --
    
    All in all, the server successfully starts and works correctly.


---

[GitHub] phoenix pull request #311: PHOENIX-4817 Fixed Phoenix Tracing Web Applicatio...

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on a diff in the pull request:

    https://github.com/apache/phoenix/pull/311#discussion_r203550322
  
    --- Diff: phoenix-tracing-webapp/src/main/java/org/apache/phoenix/tracingwebapp/http/TraceServlet.java ---
    @@ -98,33 +108,36 @@ protected String getCount(String countby) {
         if(countby == null) {
           countby = DEFAULT_COUNTBY;
         }
    -    // Throws exception if the column not present in the trace table.
    -    MetricInfo.getColumnName(countby.toLowerCase());
         String sqlQuery = "SELECT "+countby+", COUNT(*) AS count FROM " + TRACING_TABLE + " GROUP BY "+countby+" HAVING COUNT(*) > 1 ";
         json = getResults(sqlQuery);
         return json;
       }
     
       //search the trace over parent id or trace id
    -  protected String searchTrace(String parentId, String traceId,String logic) {
    +  protected String searchTrace(String parentId, String traceId, String logic) {
    +
         String json = null;
         String query = null;
         // Check the parent Id, trace id type or long or not.
         try {
    +      if (parentId != null) {
             Long.parseLong(parentId);
    +      }
    +      if (traceId != null) {
             Long.parseLong(traceId);
    +      }
         } catch (NumberFormatException e) {
    -    	throw new RuntimeException("The passed parentId/traceId is not a number.", e);
    +      throw new RuntimeException("The passed parentId/traceId is not a number.", e);
         }
    -    if(!logic.equals(LOGIC_AND) || !logic.equals(LOGIC_OR)) {
    -    	throw new RuntimeException("Wrong logical operator passed to the query. Only "+ LOGIC_AND+","+LOGIC_OR+" are allowed.") ;
    +    if (logic != null && (!logic.equals(LOGIC_AND) && !logic.equals(LOGIC_OR))) {
    --- End diff --
    
    Fixed


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by MrSandmanRUS <gi...@git.apache.org>.
Github user MrSandmanRUS commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    Yes
    @mygood


---

[GitHub] phoenix issue #311: PHOENIX-4817 Fixed Phoenix Tracing Web Application

Posted by mygood <gi...@git.apache.org>.
Github user mygood commented on the issue:

    https://github.com/apache/phoenix/pull/311
  
    You use version from apache phoenix 、hbase 、hadoop
    @MrSandmanRUS 



---