You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@skywalking.apache.org by dz...@sina.com on 2022/09/21 06:37:02 UTC

Meter Analysis

hi,    I want to use skywalking for business metrics monitoring. The configuration is as follows:   1. agent-analyzer in application.yml:
    agent-analyzer:
      selector: ${SW_AGENT_ANALYZER:default}
      meterAnalyzerActiveFiles: ${SW_METER_ANALYZER_ACTIVE_FILES:datasource,threadpool,satellite,spring-meter}

 2. meter-analyzer-config/spring-meter.yaml
      expSuffix: instance(['service'], ['instance'], Layer.GENERAL)
      metricPrefix: meter_order
      metricsRules:
           - name: dzx_increase_count
          exp: dzx_increase_count.increase("PT1M")
           - name: new_increase_count
          exp: new_increase_count.increase("PT1M")
          - name: test_increase_count
          exp: test_increase_count.increase("PT1M")

   3.test interface
@GetMapping("meter")
public void meter() {
    Counter counter = MeterFactory
            .counter(new MeterId("new_increase_count",MeterId.MeterType.COUNTER))
            .tag("Order Count", "100")
            .mode(Counter.Mode.INCREMENT).build();
    counter.increment(Math.random()*10);

    Counter counter1 = MeterFactory
            .counter(new MeterId("test_increase_count",MeterId.MeterType.COUNTER))
            .tag("Test Count", "100")
            .mode(Counter.Mode.INCREMENT).build();
    counter1.increment(Math.random()*10);
    log.info("{}:{}", counter1.getName(),counter.get());
}

   There are the following questions   1. Is the configuration correct?   2. Which indexes in elasticaserch the data is stored in? Ability to find relevant data in sw_metrics-all.     {"_index": "sw_metrics-all-20220921","_id": "meter_order_test_increase_count_202209211103_YWlzcC1jbG91ZA==.1_NmMdddddddddmQzYWIwNGE0ZTU4ZTRAMTAuMTMuMTQuMTIw","_score": 7.472535,"_source": {"metric_table": "meter_order_test_increase_count","service_id": "YWlzdddddG91ZA==.1","count": 1,"time_bucket": 202209211103,"entity_id": "YWlzcC1jbG91ZA==.1_NmM0YjhhddddddddGE0ZTU4ZTRAMTAuMTMuMTQuMTIw","value": 0,"summation": 0}}3. Only executed the test interface three times. Why does the data auto-increment?


4. No data can be found.        
   watch org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient ids "{params,returnObj}" -x 4


  Through arthas investigation, it is found that the id of the query is inconsistent with the id of the stored data. 
id of the query:  "meter_order_test_increase_count_202209211103_YWlzcC1jbG91ZA==.1"
 id of the stored:  "meter_order_test_increase_count_202209211103_YWlzcC1jbG91ZA==.1_NmMdddddddddmQzYWIwNGE0ZTU4ZTRAMTAuMTMuMTQuMTIw",

Re: Meter Analysis

Posted by Sheng Wu <wu...@gmail.com>.
Generally, GraphQL is recommended only for data query. The ElasticSearch
index structure doesn't have official guarantee to be consistent from
version to version.

If you insist to use ElasticSearch to query, you need to check your chosen
version source codes.

<dz...@sina.com>于2022年9月21日 周三14:37写道:

> hi,    I want to use skywalking for business metrics monitoring. The
> configuration is as follows:   1. agent-analyzer in application.yml:
>     agent-analyzer:
>       selector: ${SW_AGENT_ANALYZER:default}
>       meterAnalyzerActiveFiles:
> ${SW_METER_ANALYZER_ACTIVE_FILES:datasource,threadpool,satellite,spring-meter}
>
>  2. meter-analyzer-config/spring-meter.yaml
>       expSuffix: instance(['service'], ['instance'], Layer.GENERAL)
>       metricPrefix: meter_order
>       metricsRules:
>            - name: dzx_increase_count
>           exp: dzx_increase_count.increase("PT1M")
>            - name: new_increase_count
>           exp: new_increase_count.increase("PT1M")
>           - name: test_increase_count
>           exp: test_increase_count.increase("PT1M")
>
>    3.test interface
> @GetMapping("meter")
> public void meter() {
>     Counter counter = MeterFactory
>             .counter(new
> MeterId("new_increase_count",MeterId.MeterType.COUNTER))
>             .tag("Order Count", "100")
>             .mode(Counter.Mode.INCREMENT).build();
>     counter.increment(Math.random()*10);
>
>     Counter counter1 = MeterFactory
>             .counter(new
> MeterId("test_increase_count",MeterId.MeterType.COUNTER))
>             .tag("Test Count", "100")
>             .mode(Counter.Mode.INCREMENT).build();
>     counter1.increment(Math.random()*10);
>     log.info("{}:{}", counter1.getName(),counter.get());
> }
>
>    There are the following questions   1. Is the configuration correct?
>  2. Which indexes in elasticaserch the data is stored in? Ability to find
> relevant data in sw_metrics-all.     {"_index":
> "sw_metrics-all-20220921","_id":
> "meter_order_test_increase_count_202209211103_YWlzcC1jbG91ZA==.1_NmMdddddddddmQzYWIwNGE0ZTU4ZTRAMTAuMTMuMTQuMTIw","_score":
> 7.472535,"_source": {"metric_table":
> "meter_order_test_increase_count","service_id":
> "YWlzdddddG91ZA==.1","count": 1,"time_bucket": 202209211103,"entity_id":
> "YWlzcC1jbG91ZA==.1_NmM0YjhhddddddddGE0ZTU4ZTRAMTAuMTMuMTQuMTIw","value":
> 0,"summation": 0}}3. Only executed the test interface three times. Why does
> the data auto-increment?
>
>
> 4. No data can be found.
>    watch
> org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient
> ids "{params,returnObj}" -x 4
>
>
>   Through arthas investigation, it is found that the id of the query is
> inconsistent with the id of the stored data.
> id of the query:
> "meter_order_test_increase_count_202209211103_YWlzcC1jbG91ZA==.1"
>  id of the stored:
> "meter_order_test_increase_count_202209211103_YWlzcC1jbG91ZA==.1_NmMdddddddddmQzYWIwNGE0ZTU4ZTRAMTAuMTMuMTQuMTIw",

-- 
Sheng Wu 吴晟

Apache SkyWalking
Apache Incubator
Apache ShardingSphere, ECharts, DolphinScheduler podlings
Zipkin
Twitter, wusheng1108