PHOENIX-2715 Query Log (Ankit Singhal)
[phoenix.git] / phoenix-core / src / main / java / org / apache / phoenix / log / QueryLogInfo.java
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.phoenix.log;
19
20 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.BIND_PARAMETERS;
21 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.CLIENT_IP;
22 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.EXCEPTION_TRACE;
23 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.EXPLAIN_PLAN;
24 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.GLOBAL_SCAN_DETAILS;
25 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.NO_OF_RESULTS_ITERATED;
26 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.QUERY;
27 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.QUERY_ID;
28 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.QUERY_STATUS;
29 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.SCAN_METRICS_JSON;
30 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.START_TIME;
31 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TENANT_ID;
32 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.TOTAL_EXECUTION_TIME;
33 import static org.apache.phoenix.jdbc.PhoenixDatabaseMetaData.USER;
34
35 import org.apache.phoenix.schema.types.PDataType;
36 import org.apache.phoenix.schema.types.PLong;
37 import org.apache.phoenix.schema.types.PTimestamp;
38 import org.apache.phoenix.schema.types.PVarchar;
39
40
41 public enum QueryLogInfo {
42
43 CLIENT_IP_I(CLIENT_IP, QueryLogState.STARTED, LogLevel.INFO, PVarchar.INSTANCE),
44 QUERY_I(QUERY,QueryLogState.STARTED, LogLevel.INFO,PVarchar.INSTANCE),
45 BIND_PARAMETERS_I(BIND_PARAMETERS,QueryLogState.STARTED, LogLevel.TRACE,PVarchar.INSTANCE),
46 QUERY_ID_I(QUERY_ID,QueryLogState.STARTED, LogLevel.INFO,PVarchar.INSTANCE),
47 TENANT_ID_I(TENANT_ID,QueryLogState.STARTED, LogLevel.INFO,PVarchar.INSTANCE),
48 START_TIME_I(START_TIME,QueryLogState.STARTED, LogLevel.INFO,PTimestamp.INSTANCE),
49 USER_I(USER,QueryLogState.STARTED, LogLevel.INFO,PVarchar.INSTANCE),
50 EXPLAIN_PLAN_I(EXPLAIN_PLAN,QueryLogState.COMPILED, LogLevel.DEBUG,PVarchar.INSTANCE),
51 GLOBAL_SCAN_DETAILS_I(GLOBAL_SCAN_DETAILS,QueryLogState.COMPILED, LogLevel.DEBUG,PVarchar.INSTANCE),
52 NO_OF_RESULTS_ITERATED_I(NO_OF_RESULTS_ITERATED,QueryLogState.COMPLETED, LogLevel.DEBUG,PLong.INSTANCE),
53 EXCEPTION_TRACE_I(EXCEPTION_TRACE,QueryLogState.COMPLETED, LogLevel.DEBUG,PVarchar.INSTANCE),
54 QUERY_STATUS_I(QUERY_STATUS,QueryLogState.COMPLETED, LogLevel.DEBUG,PVarchar.INSTANCE),
55 TOTAL_EXECUTION_TIME_I(TOTAL_EXECUTION_TIME,QueryLogState.COMPLETED, LogLevel.DEBUG,PLong.INSTANCE),
56 SCAN_METRICS_JSON_I(SCAN_METRICS_JSON,QueryLogState.COMPLETED, LogLevel.DEBUG,PVarchar.INSTANCE);
57
58 public final String columnName;
59 public final QueryLogState logState;
60 public final LogLevel logLevel;
61 public final PDataType dataType;
62
63 private QueryLogInfo(String columnName, QueryLogState logState, LogLevel logLevel, PDataType dataType) {
64 this.columnName = columnName;
65 this.logState=logState;
66 this.logLevel=logLevel;
67 this.dataType=dataType;
68 }
69
70 public String getColumnName() {
71 return columnName;
72 }
73
74 public QueryLogState getLogState() {
75 return logState;
76 }
77
78 public LogLevel getLogLevel() {
79 return logLevel;
80 }
81
82 public PDataType getDataType() {
83 return dataType;
84 }
85
86
87 }