You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/04/07 14:07:34 UTC

[incubator-servicecomb-website] 01/02: fix style

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-website.git

commit cded6aef8bd30c207e66cdf7c33ca831e25d5c6e
Author: zhengyangyong <ya...@huawei.com>
AuthorDate: Wed Apr 4 16:14:18 2018 +0800

    fix style
    
    Signed-off-by: zhengyangyong <ya...@huawei.com>
---
 _users/cn/metrics-in-1.0.0-m1.md                     | 20 ++++++++++++--------
 ...etrics-integration-with-prometheus-in-1.0.0-m1.md |  2 ++
 _users/edge-in-1.0.0-m1.md                           |  2 +-
 _users/metrics-in-1.0.0-m1.md                        | 20 +++++++++++++-------
 ...etrics-integration-with-prometheus-in-1.0.0-m1.md |  7 +++++--
 5 files changed, 33 insertions(+), 18 deletions(-)

diff --git a/_users/cn/metrics-in-1.0.0-m1.md b/_users/cn/metrics-in-1.0.0-m1.md
index bd08c41..124cf97 100644
--- a/_users/cn/metrics-in-1.0.0-m1.md
+++ b/_users/cn/metrics-in-1.0.0-m1.md
@@ -251,8 +251,10 @@ public class OrderController {
 }
 ```
 
-注意事项:  
+注意事项: 
+ 
 1. 通过MonitorManager获取Monitor传递name和tag数组,最终输出的ID是它们连接后的字符串,所以请保持唯一性,上面的例子输出的Metrics为:
+
 ```java
 Map<String,Double> metrics = MonitorManager.getInstance().measure();
 
@@ -264,17 +266,19 @@ Map<String,Double> metrics = MonitorManager.getInstance().measure();
 ```
 
 2. MonitorManager获取Monitor的方法均为**获取或创建**,因此多次传递相同的name和tag数组返回的是同一个计数器:
+
 ```java
-    Counter counter1 = MonitorManager.getInstance().getCounter("订单数量", "商品名", "levis jeans", "型号", "512");
-    Counter counter2 = MonitorManager.getInstance().getCounter("订单数量", "商品名", "levis jeans", "型号", "512");
+Counter counter1 = MonitorManager.getInstance().getCounter("订单数量", "商品名", "levis jeans", "型号", "512");
+Counter counter2 = MonitorManager.getInstance().getCounter("订单数量", "商品名", "levis jeans", "型号", "512");
 
-    counter1.increment();
-    counter2.increment();
+counter1.increment();
+counter2.increment();
 
-    Assert.assertEquals(2,counter1.getValue());
-    Assert.assertEquals(2,counter2.getValue());
-    Assert.assertEquals(2.0,MonitorManager.getInstance().measure().get("订单数量(商品名=levis jeans,型号=512)"),0);
+Assert.assertEquals(2,counter1.getValue());
+Assert.assertEquals(2,counter2.getValue());
+Assert.assertEquals(2.0,MonitorManager.getInstance().measure().get("订单数量(商品名=levis jeans,型号=512)"),0);
 ```
+
 **获取Monitor的方法性能较低,请在初始化阶段一次获取所需的Monitor,然后将它们缓存起来,请参照前面OrderController的做法。**
 
 **提示:Servo已经被Netflix标记为DEPRECATED,我们将在1.0.0-m2中使用Netflix spectator替换,扩展自定义Metrics的方式会有调整**
diff --git a/_users/cn/metrics-integration-with-prometheus-in-1.0.0-m1.md b/_users/cn/metrics-integration-with-prometheus-in-1.0.0-m1.md
index b5100dc..63fc23b 100644
--- a/_users/cn/metrics-integration-with-prometheus-in-1.0.0-m1.md
+++ b/_users/cn/metrics-integration-with-prometheus-in-1.0.0-m1.md
@@ -87,6 +87,7 @@ scrape_configs:
 
 ### 验证输出
 Prometheus Simple HTTP Server使用/metrics作为默认URL,metrics-prometheus会使用9696作为默认端口,微服务启动后你可以使用http://localhost:9696/metrics 访问它。
+
 使用Prometheus Simple HTTP Server接口发布的数据是Prometheus采集的标准格式:
 ```text
 # HELP ServiceComb Metrics ServiceComb Metrics
@@ -114,6 +115,7 @@ servicecomb_invocation_calculator_calculatorRestEndpoint_calculate{role="produce
 如何在Grafana中添加Prometheus作为数据源请参考[这篇文章](https://prometheus.io/docs/visualization/grafana/)。
 ## 运行效果
 配置好Prometheus并启动了微服务之后,就可以打开Prometheus Web界面(默认地址是http://localhost:9090/ ),在Metrics列表中看到ServiceComb开头的Java Chassis Metrics,如下图所示:
+
 ![MetricsInPrometheus](/assets/images/MetricsInPrometheus.png)  
 
 为了能够达到更好的查询效果,在Grafana中添加Prometheus作为数据源,通过Grafana查询数据如下图示:
diff --git a/_users/edge-in-1.0.0-m1.md b/_users/edge-in-1.0.0-m1.md
index 4bd689a..7429f56 100644
--- a/_users/edge-in-1.0.0-m1.md
+++ b/_users/edge-in-1.0.0-m1.md
@@ -92,7 +92,7 @@ Edge Service use SPI(Service Provider Interface) to load custom VertxHttpDispatc
 Edge Service always use to provide monitoring, resiliency, security, and more, not only dynamic routing. We recommend extend custom handlers, there is an example named AuthHandler in demo-edge.
 
 ## Other Reference
-In demo/demo-edge we had provided a simple demo to show abilities of Edge Service:
+In demo/demo-edge we had provided a simple demo to show abilities of Edge Service:
 1. edge-service:Edge Service, include AuthHandler;
 2. authentication:Simulate authentication, accept requests from AuthHandler;
 3. business-x.x.x:Simulate multi-version business instances;
diff --git a/_users/metrics-in-1.0.0-m1.md b/_users/metrics-in-1.0.0-m1.md
index f46d845..16af428 100644
--- a/_users/metrics-in-1.0.0-m1.md
+++ b/_users/metrics-in-1.0.0-m1.md
@@ -200,6 +200,7 @@ Metrics data will output as Map<String,Double>,in order to let user easier fetch
     //get K3=30 Metric from node
     node.getChildrenNode("1").getChildrenNode("20").getFirstMatchMetricValue("K3","30");
 ```
+
 *More detail can be found in demo/perf/PerfMetricsFilePublisher.java*
 
 ## How to Extend Custom Metrics
@@ -250,8 +251,11 @@ public class OrderController {
   }
 }
 ```
+
 Notice:
+
 1. Metric ID is join name and all tags that pass to MonitorManager when getting monitor,so please keep uniqueness,metrics output of front example are:
+
 ```java
 Map<String,Double> metrics = MonitorManager.getInstance().measure();
 
@@ -263,17 +267,19 @@ Map<String,Double> metrics = MonitorManager.getInstance().measure();
 ```
 
 2. All get monitor method in MonitorManager act as **get or new**,so use same name and tags will return same one monitor:
+
 ```java
-    Counter counter1 = MonitorManager.getInstance().getCounter("orderGenerated", "product", "levis jeans", "model", "512");
-    Counter counter2 = MonitorManager.getInstance().getCounter("orderGenerated", "product", "levis jeans", "model", "512");
+Counter counter1 = MonitorManager.getInstance().getCounter("orderGenerated", "product", "levis jeans", "model", "512");
+Counter counter2 = MonitorManager.getInstance().getCounter("orderGenerated", "product", "levis jeans", "model", "512");
 
-    counter1.increment();
-    counter2.increment();
+counter1.increment();
+counter2.increment();
 
-    Assert.assertEquals(2,counter1.getValue());
-    Assert.assertEquals(2,counter2.getValue());
-    Assert.assertEquals(2.0,MonitorManager.getInstance().measure().get("orderGenerated(product=levis jeans,model=512)"),0);
+Assert.assertEquals(2,counter1.getValue());
+Assert.assertEquals(2,counter2.getValue());
+Assert.assertEquals(2.0,MonitorManager.getInstance().measure().get("orderGenerated(product=levis jeans,model=512)"),0);
 ```
+
 **Performance of get monitor from MonitorManager is slightly lower,so please get all monitors what needed when init,then cache them for later use,like OrderController example.**
 
 **Notice: Servo had marked with DEPRECATED by Netflix, we will use Netflix spectator instead in 1.0.0-m2, the way of extending custom metrics will be adjusted**
diff --git a/_users/metrics-integration-with-prometheus-in-1.0.0-m1.md b/_users/metrics-integration-with-prometheus-in-1.0.0-m1.md
index e78275c..827c4df 100644
--- a/_users/metrics-integration-with-prometheus-in-1.0.0-m1.md
+++ b/_users/metrics-integration-with-prometheus-in-1.0.0-m1.md
@@ -86,7 +86,8 @@ scrape_configs:
 The job_name: 'servicecomb' is our custom job,it will collect metrics data from local microservice localhost:9696,more information about configuration of prometheus can found [here](https://prometheus.io/docs/prometheus/latest/configuration/configuration/).  
 
 ### Verify Output
-Prometheus Simple HTTP Server use /metrics as default URL,metrics-prometheus will use 9696 as default port,after microservice start up you can get metrics data at http://localhost:9696/metrics . 
+Prometheus Simple HTTP Server use /metrics as default URL,metrics-prometheus will use 9696 as default port,after microservice start up you can get metrics data at http://localhost:9696/metrics.
+ 
 Prometheus Simple HTTP Server provider interface will publish the standard format which prometheus needed:
 ```text
 # HELP ServiceComb Metrics ServiceComb Metrics
@@ -114,7 +115,9 @@ servicecomb_invocation_calculator_calculatorRestEndpoint_calculate{role="produce
 How add prometheus as a datasource in grafana can found [here](https://prometheus.io/docs/visualization/grafana/).  
 ## Effect Show
 After complete prometheus config and start up microservice,we can open prometheus web site(default address is http://localhost:9090/),in metrics list java chassis metrics with prefix 'servicecomb' can be seen:
+
 ![MetricsInPrometheus](/assets/images/MetricsInPrometheus.png)  
 
-For get more better data query experience,add prometheus as a datasource in grafana then query metrics data by it:  
+For get more better data query experience,add prometheus as a datasource in grafana then query metrics data by it:
+  
 ![MetricsInGrafana](/assets/images/MetricsInGrafana.png)  
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.