You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/07/07 09:06:03 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #5046: Add health checker module

wu-sheng commented on a change in pull request #5046:
URL: https://github.com/apache/skywalking/pull/5046#discussion_r450706714



##########
File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/query/type/HealthStatus.java
##########
@@ -0,0 +1,29 @@
+/*
+ * 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.skywalking.oap.server.core.query.type;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class HealthStatus {
+    private int score;

Review comment:
       score rule should be added as comments.

##########
File path: oap-server/server-query-plugin/query-graphql-plugin/src/main/java/org/apache/skywalking/oap/query/graphql/resolver/HealthQuery.java
##########
@@ -0,0 +1,47 @@
+/*
+ * 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.skywalking.oap.query.graphql.resolver;
+
+import com.coxautodev.graphql.tools.GraphQLQueryResolver;
+import java.util.Optional;
+import lombok.RequiredArgsConstructor;
+import org.apache.skywalking.oap.server.core.query.type.HealthStatus;
+import org.apache.skywalking.oap.server.health.checker.module.HealthCheckerModule;
+import org.apache.skywalking.oap.server.health.checker.provider.HealthQueryService;
+import org.apache.skywalking.oap.server.library.module.ModuleManager;
+
+@RequiredArgsConstructor
+public class HealthQuery  implements GraphQLQueryResolver {

Review comment:
       ```suggestion
   public class HealthQuery implements GraphQLQueryResolver {
   ```

##########
File path: docs/en/setup/backend/backend-health-check.md
##########
@@ -0,0 +1,62 @@
+# Health Check
+
+Health check intends to provide a unique approach to check the healthy status of OAP server. It includes the health status
+of modules, GraphQL and gRPC services readiness.
+
+## Health Checker Module.
+
+Health Checker module could solute how to observe the health status of modules. We can active it by below:
+```yaml
+health-checker:
+  selector: ${SW_HEALTH_CHECKER:default}
+  default:
+    checkIntervalSeconds: ${SW_HEALTH_CHECKER_INTERVAL_SECONDS:5}
+```
+Notice, we should enable `prometheus` telemetry at the same time.

Review comment:
       I think this is a design issue. **Any module should not depend on another module's implementation**. Otherwise, you are breaking the design principle.
   
   From the codes level, I think you should say, the user needs to activate the `telemetry` module, meaning, the provider should not be `none` or `-`.

##########
File path: oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/H2StorageProvider.java
##########
@@ -131,6 +135,9 @@ public void prepare() throws ServiceNotProvidedException, ModuleStartException {
 
     @Override
     public void start() throws ServiceNotProvidedException, ModuleStartException {
+        MetricsCreator metricCreator = getManager().find(TelemetryModule.NAME).provider().getService(MetricsCreator.class);
+        GaugeMetrics healthChecker = metricCreator.createHealthCheckerGauge("storage_h2", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE);
+        healthChecker.setValue(1);

Review comment:
       Why always `1`? According to your doc, 1 should mean unhealthy? I think you missed some codes.

##########
File path: oap-server/server-telemetry/telemetry-api/src/main/java/org/apache/skywalking/oap/server/telemetry/api/MetricsCreator.java
##########
@@ -42,4 +46,30 @@
      */
     HistogramMetrics createHistogramMetric(String name, String tips, MetricsTag.Keys tagKeys,
         MetricsTag.Values tagValues, double... buckets);
+
+    /**
+     * Create a Health Check gauge.
+     */
+    default GaugeMetrics createHealthCheckerGauge(String name, MetricsTag.Keys tagKeys, MetricsTag.Values tagValues) {

Review comment:
       I don't think health guage requires the tag/value(s).




----------------------------------------------------------------
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:
users@infra.apache.org