Jackie-Jiang commented on a change in pull request #6817:
URL: https://github.com/apache/incubator-pinot/pull/6817#discussion_r616264494
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/broker/BrokerAdminApiApplication.java
##########
@@ -39,12 +40,15 @@
public class BrokerAdminApiApplication extends ResourceConfig {
private static final String RESOURCE_PACKAGE =
"org.apache.pinot.broker.api.resources";
+ public static final String PINOT_CONFIGURATION = "pinotConfiguration";
Review comment:
Do you think it might be better to put this as a global constant to be
shared among all instances?
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java
##########
@@ -0,0 +1,367 @@
+/**
+ * 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.utils;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryManagerMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadMXBean;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.spi.env.PinotConfiguration;
+
+
+/**
+ * Class that represents various configs for a pinot component:
+ * <ul>
+ * <li>System Configs</li>
+ * <li>JVM Configs</li>
+ * <li>Runtime Configs</li>
+ * <li>PinotConfiguration</li>
+ * </ul>
+ *
+ * This class is JSON serializable and de-serializable.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({"systemConfig", "runtimeConfig", "pinotConfig",
"jvmConfig"})
+public class PinotAppConfigs {
+ private static final String UNKNOWN_VALUE = "-";
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ @JsonProperty("systemConfig")
+ SystemConfig _systemConfig;
+
+ @JsonProperty("jvmConfig")
+ JVMConfig _jvmConfig;
+
+ @JsonProperty("runtimeConfig")
+ RuntimeConfig _runtimeConfig;
+
+ @JsonProperty("pinotConfig")
+ PinotConfiguration _pinotConfig;
Review comment:
I would directly return a `Map` here to avoid having the custom ser-de
for `PinotConfiguration`.
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java
##########
@@ -0,0 +1,367 @@
+/**
+ * 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.utils;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryManagerMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadMXBean;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.spi.env.PinotConfiguration;
+
+
+/**
+ * Class that represents various configs for a pinot component:
+ * <ul>
+ * <li>System Configs</li>
+ * <li>JVM Configs</li>
+ * <li>Runtime Configs</li>
+ * <li>PinotConfiguration</li>
+ * </ul>
+ *
+ * This class is JSON serializable and de-serializable.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({"systemConfig", "runtimeConfig", "pinotConfig",
"jvmConfig"})
Review comment:
Any specific reason for this order? Better to keep the order the same as
variable declaration?
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/api/resources/PinotBrokerAppConfigs.java
##########
@@ -0,0 +1,53 @@
+/**
+ * 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.broker.api.resources;
+
+import io.swagger.annotations.Api;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import org.apache.pinot.broker.broker.BrokerAdminApiApplication;
+import org.apache.pinot.common.utils.PinotAppConfigs;
+import org.apache.pinot.spi.env.PinotConfiguration;
+
+
+/**
+ * Resource to get the app configs {@link PinotAppConfigs} for
+ * the broker.
+ */
+@Api(tags = "AppConfig")
+@Path("/")
+public class PinotBrokerAppConfigs {
+
+ @Context
+ private Application _application;
+
+ @GET
+ @Path("/appconfigs")
+ @Produces(MediaType.APPLICATION_JSON)
+ public String getAppConfigs() {
Review comment:
Here we should be able to directly return `PinotAppConfigs` without
explicitly serializing it
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java
##########
@@ -0,0 +1,367 @@
+/**
+ * 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.utils;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryManagerMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadMXBean;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.spi.env.PinotConfiguration;
+
+
+/**
+ * Class that represents various configs for a pinot component:
+ * <ul>
+ * <li>System Configs</li>
+ * <li>JVM Configs</li>
+ * <li>Runtime Configs</li>
+ * <li>PinotConfiguration</li>
+ * </ul>
+ *
+ * This class is JSON serializable and de-serializable.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({"systemConfig", "runtimeConfig", "pinotConfig",
"jvmConfig"})
+public class PinotAppConfigs {
+ private static final String UNKNOWN_VALUE = "-";
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ @JsonProperty("systemConfig")
+ SystemConfig _systemConfig;
Review comment:
`private final`? Same for other places
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotControllerAppConfigs.java
##########
@@ -0,0 +1,53 @@
+/**
+ * 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.controller.api.resources;
+
+import io.swagger.annotations.Api;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import org.apache.pinot.common.utils.PinotAppConfigs;
+import org.apache.pinot.controller.api.ControllerAdminApiApplication;
+import org.apache.pinot.spi.env.PinotConfiguration;
+
+
+/**
+ * Resource to get the application configs {@link PinotAppConfigs}
+ * for the pinot controller.
+ */
+@Api(tags = Constants.APP_CONFIGS)
Review comment:
This is not the same as broker and server which has capital `a`
(`AppConfigs`).
##########
File path:
pinot-common/src/main/java/org/apache/pinot/common/utils/PinotAppConfigs.java
##########
@@ -0,0 +1,367 @@
+/**
+ * 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.utils;
+
+import com.fasterxml.jackson.annotation.JsonCreator;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.lang.management.GarbageCollectorMXBean;
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryMXBean;
+import java.lang.management.MemoryManagerMXBean;
+import java.lang.management.MemoryUsage;
+import java.lang.management.OperatingSystemMXBean;
+import java.lang.management.RuntimeMXBean;
+import java.lang.management.ThreadMXBean;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.spi.env.PinotConfiguration;
+
+
+/**
+ * Class that represents various configs for a pinot component:
+ * <ul>
+ * <li>System Configs</li>
+ * <li>JVM Configs</li>
+ * <li>Runtime Configs</li>
+ * <li>PinotConfiguration</li>
+ * </ul>
+ *
+ * This class is JSON serializable and de-serializable.
+ */
+@JsonIgnoreProperties(ignoreUnknown = true)
+@JsonPropertyOrder({"systemConfig", "runtimeConfig", "pinotConfig",
"jvmConfig"})
+public class PinotAppConfigs {
+ private static final String UNKNOWN_VALUE = "-";
+ private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
+
+ @JsonProperty("systemConfig")
+ SystemConfig _systemConfig;
+
+ @JsonProperty("jvmConfig")
+ JVMConfig _jvmConfig;
+
+ @JsonProperty("runtimeConfig")
+ RuntimeConfig _runtimeConfig;
+
+ @JsonProperty("pinotConfig")
+ PinotConfiguration _pinotConfig;
+
+ @JsonCreator
+ @SuppressWarnings("unused")
+ public PinotAppConfigs() {
Review comment:
I don't think we need the empty constructer because we won't deserialize
(there is no setters)
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]