kezhenxu94 commented on code in PR #10083: URL: https://github.com/apache/skywalking/pull/10083#discussion_r1038764171
########## oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/status/ServerStatusService.java: ########## @@ -0,0 +1,51 @@ +/* + * 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.status; + +import lombok.RequiredArgsConstructor; +import org.apache.skywalking.oap.server.library.module.ModuleManager; +import org.apache.skywalking.oap.server.library.module.Service; +import org.apache.skywalking.oap.server.telemetry.TelemetryModule; +import org.apache.skywalking.oap.server.telemetry.api.MetricsCreator; +import org.apache.skywalking.oap.server.telemetry.api.MetricsTag; + +/** + * The server status service provides the indicators for the current server status. + * Notice, this should not be treated as a kind of health checker or self telemetry. + * For more, this helps modules to be aware of current OAP server status. + * + * @since 9.4.0 + */ +@RequiredArgsConstructor +public class ServerStatusService implements Service { + private final ModuleManager manager; + private BootingStatus bootingStatus = new BootingStatus(); + + public void bootedNow(long uptime) { + bootingStatus.setBooted(true); + bootingStatus.setUptime(uptime); + manager.find(TelemetryModule.NAME) + .provider() + .getService(MetricsCreator.class) + .createGauge("uptime", "oap server start up time", MetricsTag.EMPTY_KEY, MetricsTag.EMPTY_VALUE) + // Set uptime to second + .setValue(uptime / 1000d); Review Comment: This doesn't make sense to me. You are essentially proposing to replicate the health checker module in the core module again. What's the boundary to do or not to do this kind of stuff in your mind? You said you don't want to replace the health checker module but it can not persuade me and we have no reason to stop future contributors from doing similar things. The new server status service and the old health checker are the same to me except for the fact that they are written by different authors. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
