[ 
https://issues.apache.org/jira/browse/PHOENIX-7038?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17774260#comment-17774260
 ] 

ASF GitHub Bot commented on PHOENIX-7038:
-----------------------------------------

jpisaac commented on code in PR #1682:
URL: https://github.com/apache/phoenix/pull/1682#discussion_r1355852348


##########
phoenix-core/src/it/java/org/apache/phoenix/monitoring/connqueryservice/PhoenixConnectionQueryServiceMetrcisIT.java:
##########
@@ -0,0 +1,357 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.monitoring.connqueryservice;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseConfiguration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.phoenix.end2end.NeedsOwnMiniClusterTest;
+import org.apache.phoenix.jdbc.PhoenixConnection;
+import org.apache.phoenix.jdbc.PhoenixDriver;
+import org.apache.phoenix.monitoring.HistogramDistribution;
+import org.apache.phoenix.monitoring.Metric;
+import org.apache.phoenix.monitoring.MetricType;
+import org.apache.phoenix.monitoring.PhoenixConnectionProfileMetric;
+import org.apache.phoenix.query.BaseTest;
+import org.apache.phoenix.query.ConfigurationFactory;
+import org.apache.phoenix.query.HBaseFactoryProvider;
+import org.apache.phoenix.query.QueryServices;
+import org.apache.phoenix.query.QueryServicesOptions;
+import org.apache.phoenix.util.InstanceResolver;
+import org.apache.phoenix.util.PhoenixRuntime;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.Statement;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static 
org.apache.phoenix.monitoring.MetricType.OPEN_INTERNAL_PHOENIX_CONNECTIONS_COUNTER;
+import static 
org.apache.phoenix.monitoring.MetricType.OPEN_PHOENIX_CONNECTIONS_COUNTER;
+import static 
org.apache.phoenix.monitoring.MetricType.PHOENIX_CONNECTIONS_THROTTLED_COUNTER;
+import static 
org.apache.phoenix.query.QueryServices.CLIENT_CONNECTION_MAX_ALLOWED_CONNECTIONS;
+import static 
org.apache.phoenix.query.QueryServices.CONNECTION_QUERY_SERVICE_METRICS_ENABLED;
+import static 
org.apache.phoenix.query.QueryServices.INTERNAL_CONNECTION_MAX_ALLOWED_CONNECTIONS;
+import static org.apache.phoenix.query.QueryServices.QUERY_SERVICES_NAME;
+import static 
org.apache.phoenix.util.PhoenixRuntime.clearAllConnectionQueryServiceMetrics;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+@Category(NeedsOwnMiniClusterTest.class)
+public class PhoenixConnectionQueryServiceMetrcisIT extends BaseTest {

Review Comment:
   nit: Typo in classname



##########
phoenix-core/src/main/java/org/apache/phoenix/monitoring/PhoenixConnectionProfileMetric.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.monitoring;
+
+/**
+ * Class that exposes the various phoenix metrics collected
+ * at the Phoenix Connection Profile level. Because metrics are dynamic in 
nature,
+ * it is not guaranteed that the state exposed will always be in sync with 
each other.
+ * One should use these metrics primarily for monitoring and debugging 
purposes.
+ */
+public interface PhoenixConnectionProfileMetric extends Metric {

Review Comment:
   We do not have a concept of PhoenixConnectionProfile in the open source 
right?
   ConnectionProfile is a SFDC concept. 
   ConnectionProfile => QueryServiceName



##########
phoenix-core/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java:
##########
@@ -443,6 +448,11 @@ public ConnectionQueryServicesImpl(QueryServices services, 
ConnectionInfo connec
         for (Entry<String,String> entry : connectionInfo.asProps()) {
             config.set(entry.getKey(), entry.getValue());
         }
+        if (connectionInfo.getPrincipal() != null) {
+            config.set(QUERY_SERVICES_NAME, connectionInfo.getPrincipal());
+        }
+        LOGGER.info(String.format("CQS initialized with connection profile : 
%s",

Review Comment:
   Maybe the log should read "CQS initialized with query service name"



##########
phoenix-core/src/main/java/org/apache/phoenix/monitoring/connqueryservice/ConnectionQueryServiceMetricsHistograms.java:
##########
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.phoenix.monitoring.connqueryservice;

Review Comment:
   How are the metric classes in this package different from the ones in the 
monitoring package?





> Implement Phoenix Connection Profile Metrics
> --------------------------------------------
>
>                 Key: PHOENIX-7038
>                 URL: https://issues.apache.org/jira/browse/PHOENIX-7038
>             Project: Phoenix
>          Issue Type: New Feature
>            Reporter: Mihir Monani
>            Assignee: Mihir Monani
>            Priority: Major
>
> With JDBC connection profile string, Clients can provide connection profile 
> name. With use of Connection Profile, different kinds of clients/use-case in 
> single JVM can create connection with different configuration like time-outs, 
> retries, sleep between retries. 
> Connection URL Example : jdbc:phoenix:localhost:2181:CONN_PROFILE_2
> Here CONN_PROFILE_2 is connection profile name.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to