[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-17 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16515094#comment-16515094
 ] 

ASF GitHub Bot commented on SCB-670:


asifdxtreme closed pull request #374: SCB-670 Check the etcd cluster health 
when new connection
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/374
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pkg/util/concurrent_map.go b/pkg/util/concurrent_map.go
index b7ec0399..546ec47a 100644
--- a/pkg/util/concurrent_map.go
+++ b/pkg/util/concurrent_map.go
@@ -115,6 +115,6 @@ func (cm *ConcurrentMap) ForEach(f func(item MapItem) (next 
bool)) {
close(ch)
 }
 
-func NewConcurrentMap(size int) ConcurrentMap {
-   return ConcurrentMap{size: size}
+func NewConcurrentMap(size int) *ConcurrentMap {
+   return &ConcurrentMap{size: size}
 }
diff --git a/pkg/util/context.go b/pkg/util/context.go
index 4bc9b3a3..565cf697 100644
--- a/pkg/util/context.go
+++ b/pkg/util/context.go
@@ -24,7 +24,7 @@ import (
 
 type StringContext struct {
parentCtx context.Context
-   kvConcurrentMap
+   kv*ConcurrentMap
 }
 
 func (c *StringContext) Deadline() (deadline time.Time, ok bool) {
diff --git a/server/bootstrap/bootstrap.go b/server/bootstrap/bootstrap.go
index 1bd7a5a7..7b59caf9 100644
--- a/server/bootstrap/bootstrap.go
+++ b/server/bootstrap/bootstrap.go
@@ -48,6 +48,9 @@ import _ 
"github.com/apache/incubator-servicecomb-service-center/server/govern"
 // module
 import _ "github.com/apache/incubator-servicecomb-service-center/server/broker"
 
+// metrics
+import _ "github.com/apache/incubator-servicecomb-service-center/server/metric"
+
 import (
"github.com/apache/incubator-servicecomb-service-center/pkg/util"

"github.com/apache/incubator-servicecomb-service-center/server/handler/auth"
diff --git a/server/core/backend/metric.go b/server/core/backend/metrics.go
similarity index 100%
rename from server/core/backend/metric.go
rename to server/core/backend/metrics.go
diff --git a/server/metric/common.go b/server/metric/common.go
new file mode 100644
index ..5e423ada
--- /dev/null
+++ b/server/metric/common.go
@@ -0,0 +1,32 @@
+/*
+ * 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 metric
+
+import "time"
+
+const (
+   defaultMetricsSize = 100
+   collectInterval= 5 * time.Second
+
+   familyName = "service_center_"
+)
+
+var sysMetricNames = map[string]struct{}{
+   "process_resident_memory_bytes": {},
+   "process_cpu_seconds_total": {},
+   "go_threads":{},
+}
diff --git a/server/metric/gatherer.go b/server/metric/gatherer.go
new file mode 100644
index ..7140909e
--- /dev/null
+++ b/server/metric/gatherer.go
@@ -0,0 +1,90 @@
+/*
+ * 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 metric
+
+import (
+   "github.com/apache/incubator-servicecomb-service-center/pkg/util"
+   pm "github.com/prometheus/client_golang/prometheus"
+   "golang.org/x/net/context"
+   "strings"
+   "sync"
+   "time"
+)
+
+var Gatherer *MetricsGatherer
+
+func init() {
+   Gatherer = 

[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513502#comment-16513502
 ] 

ASF GitHub Bot commented on SCB-670:


coveralls commented on issue #374: SCB-670 Check the etcd cluster health when 
new connection
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/374#issuecomment-397202249
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/17508050/badge)](https://coveralls.io/builds/17508050)
   
   Coverage increased (+0.1%) to 74.636% when pulling 
**514beeea2d3506ecb224a426bce7b542310f6d13 on little-cui:cluster** into 
**cb913ba39b69c8161a02593ab13c64a2fd3250d2 on apache:master**.
   


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


> Check the etcd cluster health when new connection
> -
>
> Key: SCB-670
> URL: https://issues.apache.org/jira/browse/SCB-670
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513501#comment-16513501
 ] 

ASF GitHub Bot commented on SCB-670:


codecov-io commented on issue #374: SCB-670 Check the etcd cluster health when 
new connection
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/374#issuecomment-397202205
 
 
   # 
[Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=h1)
 Report
   > Merging 
[#374](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=desc)
 into 
[master](https://codecov.io/gh/apache/incubator-servicecomb-service-center/commit/cb913ba39b69c8161a02593ab13c64a2fd3250d2?src=pr&el=desc)
 will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374/graphs/tree.svg?height=150&width=650&token=GAaF7zrg8R&src=pr)](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=tree)
   
   ```diff
   @@   Coverage Diff   @@
   ##   master #374   +/-   ##
   ===
 Coverage   71.46%   71.46%   
   ===
 Files  25   25   
 Lines3690 3690   
   ===
 Hits 2637 2637   
 Misses884  884   
 Partials  169  169
   ```
   
   
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=footer).
 Last update 
[cb913ba...514beee](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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


> Check the etcd cluster health when new connection
> -
>
> Key: SCB-670
> URL: https://issues.apache.org/jira/browse/SCB-670
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513491#comment-16513491
 ] 

ASF GitHub Bot commented on SCB-670:


coveralls commented on issue #374: SCB-670 Check the etcd cluster health when 
new connection
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/374#issuecomment-397202249
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/17507926/badge)](https://coveralls.io/builds/17507926)
   
   Coverage increased (+0.1%) to 74.631% when pulling 
**7de62874ffd4c8583d804cbf617151a6832213f2 on little-cui:cluster** into 
**cb913ba39b69c8161a02593ab13c64a2fd3250d2 on apache:master**.
   


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


> Check the etcd cluster health when new connection
> -
>
> Key: SCB-670
> URL: https://issues.apache.org/jira/browse/SCB-670
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-15 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16513490#comment-16513490
 ] 

ASF GitHub Bot commented on SCB-670:


codecov-io commented on issue #374: SCB-670 Check the etcd cluster health when 
new connection
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/374#issuecomment-397202205
 
 
   # 
[Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=h1)
 Report
   > Merging 
[#374](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=desc)
 into 
[master](https://codecov.io/gh/apache/incubator-servicecomb-service-center/commit/cb913ba39b69c8161a02593ab13c64a2fd3250d2?src=pr&el=desc)
 will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374/graphs/tree.svg?width=650&height=150&src=pr&token=GAaF7zrg8R)](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=tree)
   
   ```diff
   @@   Coverage Diff   @@
   ##   master #374   +/-   ##
   ===
 Coverage   71.46%   71.46%   
   ===
 Files  25   25   
 Lines3690 3690   
   ===
 Hits 2637 2637   
 Misses884  884   
 Partials  169  169
   ```
   
   
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=footer).
 Last update 
[cb913ba...7de6287](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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


> Check the etcd cluster health when new connection
> -
>
> Key: SCB-670
> URL: https://issues.apache.org/jira/browse/SCB-670
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16512095#comment-16512095
 ] 

ASF GitHub Bot commented on SCB-670:


codecov-io commented on issue #374: SCB-670 Check the etcd cluster health when 
new connection
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/374#issuecomment-397202205
 
 
   # 
[Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=h1)
 Report
   > Merging 
[#374](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=desc)
 into 
[master](https://codecov.io/gh/apache/incubator-servicecomb-service-center/commit/cb913ba39b69c8161a02593ab13c64a2fd3250d2?src=pr&el=desc)
 will **not change** coverage.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree 
graph](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374/graphs/tree.svg?width=650&height=150&src=pr&token=GAaF7zrg8R)](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=tree)
   
   ```diff
   @@   Coverage Diff   @@
   ##   master #374   +/-   ##
   ===
 Coverage   71.46%   71.46%   
   ===
 Files  25   25   
 Lines3690 3690   
   ===
 Hits 2637 2637   
 Misses884  884   
 Partials  169  169
   ```
   
   
   
   --
   
   [Continue to review full report at 
Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=continue).
   > **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute  (impact)`, `ø = not affected`, `? = missing data`
   > Powered by 
[Codecov](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=footer).
 Last update 
[cb913ba...bd85b73](https://codecov.io/gh/apache/incubator-servicecomb-service-center/pull/374?src=pr&el=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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


> Check the etcd cluster health when new connection
> -
>
> Key: SCB-670
> URL: https://issues.apache.org/jira/browse/SCB-670
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16512096#comment-16512096
 ] 

ASF GitHub Bot commented on SCB-670:


coveralls commented on issue #374: SCB-670 Check the etcd cluster health when 
new connection
URL: 
https://github.com/apache/incubator-servicecomb-service-center/pull/374#issuecomment-397202249
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/17485900/badge)](https://coveralls.io/builds/17485900)
   
   Coverage increased (+0.2%) to 74.705% when pulling 
**bd85b7378b0da5159098b66f7f836d2b39423d19 on little-cui:cluster** into 
**cb913ba39b69c8161a02593ab13c64a2fd3250d2 on apache:master**.
   


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


> Check the etcd cluster health when new connection
> -
>
> Key: SCB-670
> URL: https://issues.apache.org/jira/browse/SCB-670
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (SCB-670) Check the etcd cluster health when new connection

2018-06-14 Thread ASF GitHub Bot (JIRA)


[ 
https://issues.apache.org/jira/browse/SCB-670?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16512075#comment-16512075
 ] 

ASF GitHub Bot commented on SCB-670:


little-cui opened a new pull request #374: SCB-670 Check the etcd cluster 
health when new connection
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/374
 
 
   Follow this checklist to help us incorporate your contribution quickly and 
easily:
   
- [ ] Make sure there is a [JIRA 
issue](https://issues.apache.org/jira/browse/SCB) filed for the change (usually 
before you start working on it).  Trivial changes like typos do not require a 
JIRA issue.  Your pull request should address just this issue, without pulling 
in other changes.
- [ ] Each commit in the pull request should have a meaningful subject line 
and body.
- [ ] Format the pull request title like `[SCB-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `SCB-XXX` with the appropriate JIRA 
issue.
- [ ] Write a pull request description that is detailed enough to 
understand what the pull request does, how, and why.
- [ ] Run `go build` `go test` `go fmt` `go vet` to make sure basic checks 
pass. A more thorough check will be performed on your pull request 
automatically.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   ---
   


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


> Check the etcd cluster health when new connection
> -
>
> Key: SCB-670
> URL: https://issues.apache.org/jira/browse/SCB-670
> Project: Apache ServiceComb
>  Issue Type: Improvement
>  Components: Service-Center
>Reporter: little-cui
>Assignee: little-cui
>Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)