suddendust commented on code in PR #14155:
URL: https://github.com/apache/pinot/pull/14155#discussion_r1810470817


##########
pinot-common/src/test/java/org/apache/pinot/common/metrics/prometheus/PinotPrometheusMetricsTest.java:
##########
@@ -0,0 +1,498 @@
+/**
+ * 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.pinot.common.metrics.prometheus;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Objects;
+import com.google.common.io.Resources;
+import io.prometheus.jmx.JmxCollector;
+import io.prometheus.jmx.common.http.HTTPServerFactory;
+import io.prometheus.jmx.shaded.io.prometheus.client.CollectorRegistry;
+import io.prometheus.jmx.shaded.io.prometheus.client.exporter.HTTPServer;
+import io.prometheus.jmx.shaded.io.prometheus.client.hotspot.DefaultExports;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringReader;
+import java.net.InetSocketAddress;
+import java.net.URI;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.pinot.common.utils.SimpleHttpResponse;
+import org.apache.pinot.common.utils.http.HttpClient;
+import org.apache.pinot.spi.annotations.metrics.PinotMetricsFactory;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.env.PinotConfiguration;
+import org.apache.pinot.spi.metrics.PinotMetricUtils;
+import org.apache.pinot.spi.utils.JsonUtils;
+import org.apache.pinot.spi.utils.builder.TableNameBuilder;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+import static 
org.apache.pinot.common.metrics.prometheus.PinotPrometheusMetricsTest.ExportedLabelKeys.*;
+import static 
org.apache.pinot.common.metrics.prometheus.PinotPrometheusMetricsTest.ExportedLabelValues.CONTROLLER_PERIODIC_TASK_CHC;
+import static 
org.apache.pinot.common.metrics.prometheus.PinotPrometheusMetricsTest.ExportedLabelValues.IN_PROGRESS;
+import static 
org.apache.pinot.common.metrics.prometheus.PinotPrometheusMetricsTest.ExportedLabelValues.TABLENAME_WITH_TYPE_REALTIME;
+import static 
org.apache.pinot.common.metrics.prometheus.PinotPrometheusMetricsTest.ExportedLabelValues.TABLETYPE_REALTIME;
+import static 
org.apache.pinot.spi.utils.CommonConstants.CONFIG_OF_METRICS_FACTORY_CLASS_NAME;
+
+
+public abstract class PinotPrometheusMetricsTest {
+
+  protected static final String TABLE_NAME_WITH_TYPE =
+      
TableNameBuilder.forType(TableType.REALTIME).tableNameWithType(ExportedLabelValues.TABLENAME);
+  protected static final String KAFKA_TOPIC = "myTopic";
+  protected static final String PARTITION_GROUP_ID = "partitionGroupId";
+  protected static final String CLIENT_ID =
+      String.format("%s-%s-%s", TABLE_NAME_WITH_TYPE, KAFKA_TOPIC, 
PARTITION_GROUP_ID);
+
+  protected HttpClient _httpClient;
+
+  protected PinotMetricsFactory _pinotMetricsFactory;
+
+  //config keys
+  private static final String CONFIG_KEY_JMX_EXPORTER_PARENT_DIR = 
"jmxExporterConfigsParentDir";
+  private static final String CONFIG_KEY_CONTROLLER_CONFIG_FILE_NAME = 
"controllerConfigFileName";
+  private static final String CONFIG_KEY_SERVER_CONFIG_FILE_NAME = 
"serverConfigFileName";
+  private static final String CONFIG_KEY_BROKER_CONFIG_FILE_NAME = 
"brokerConfigFileName";
+  private static final String CONFIG_KEY_MINION_CONFIG_FILE_NAME = 
"minionConfigFileName";
+
+  //each meter defined in code is exported with these measurements
+  private static final List<String> METER_TYPES =
+      List.of("Count", "FiveMinuteRate", "MeanRate", "OneMinuteRate", 
"FifteenMinuteRate");
+
+  //each timer defined in code is exported with these measurements
+  private static final List<String> TIMER_TYPES =
+      List.of("Count", "FiveMinuteRate", "Max", "999thPercentile", 
"95thPercentile", "75thPercentile", "98thPercentile",
+          "OneMinuteRate", "50thPercentile", "99thPercentile", 
"FifteenMinuteRate", "Mean", "StdDev", "MeanRate",
+          "Min");
+
+  //each gauge defined in code is exported with these measurements
+  private static final List<String> GAUGE_TYPES = List.of("Value");
+
+  private String _exporterConfigsParentDir;
+
+  private final Map<PinotComponent, String> _pinotComponentToConfigFileMap = 
new HashMap<>();

Review Comment:
   This is addressed, thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to