[
https://issues.apache.org/jira/browse/SCB-383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16415082#comment-16415082
]
ASF GitHub Bot commented on SCB-383:
------------------------------------
liubao68 commented on a change in pull request #609: [SCB-383] Metrics
subscribe invocation life event and statistics
URL:
https://github.com/apache/incubator-servicecomb-java-chassis/pull/609#discussion_r177318158
##########
File path:
foundations/foundation-metrics/src/main/java/org/apache/servicecomb/foundation/metrics/MetricsBootstrap.java
##########
@@ -0,0 +1,82 @@
+/*
+ * 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.servicecomb.foundation.metrics;
+
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.servicecomb.foundation.common.utils.SPIServiceUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.Lists;
+import com.google.common.eventbus.EventBus;
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import com.netflix.spectator.api.CompositeRegistry;
+import com.netflix.spectator.api.Meter;
+
+public class MetricsBootstrap {
+ private static final Logger LOGGER =
LoggerFactory.getLogger(MetricsBootstrap.class);
+
+ private CompositeRegistry globalRegistry;
+
+ private EventBus eventBus;
+
+ private MetricsBootstrapConfig config = new MetricsBootstrapConfig();
+
+ private ScheduledExecutorService executorService;
+
+ public void start(CompositeRegistry globalRegistry, EventBus eventBus) {
+ this.globalRegistry = globalRegistry;
+ this.eventBus = eventBus;
+ this.executorService = Executors.newScheduledThreadPool(1,
+ new ThreadFactoryBuilder()
+ .setNameFormat("spectator-poller-%d")
+ .build());
+
+ loadMetricsInitializers();
+ startPoll();
+ }
+
+ public void shutdown() {
+ executorService.shutdown();
Review comment:
Do you actually mean shutdownNow?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> metrics subscribe invocation life event and do statistics
> ---------------------------------------------------------
>
> Key: SCB-383
> URL: https://issues.apache.org/jira/browse/SCB-383
> Project: Apache ServiceComb
> Issue Type: Sub-task
> Components: Java-Chassis
> Reporter: wujimin
> Assignee: wujimin
> Priority: Major
> Fix For: java-chassis-1.0.0-m2
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)