GithubHelp home page GithubHelp logo

huaweicse / cse-collector Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 9.0 133 KB

A go-chassis metrics report plugin to report metrics to CSE

License: Apache License 2.0

Go 84.56% Shell 14.31% Dockerfile 1.13%

cse-collector's Introduction

Metric Collector for Go-Chassis

Build Status
This is a reporter plugin for go-chassis which report circuit breaker metrics to Huaweicloud.

How to use

in main.go

import _ "github.com/huaweicse/cse-collector"

Introdction

The metrics reported by this collector is listed below:

attempts
errors
successes
failures
rejects
shortCircuits
timeouts
fallbackSuccesses
fallbackFailures
totalDuration
runDuration

It also collects data for each api's:

Name                 string  `json:"name"`
Desc                 string  `json:"desc"`
Qps                  float64 `json:"qps"`
Latency              int     `json:"latency"`
L995                 int     `json:"l995"`
L99                  int     `json:"l99"`
L90                  int     `json:"l90"`
L75                  int     `json:"l75"`
L50                  int     `json:"l50"`
L25                  int     `json:"l25"`
L5                   int     `json:"l5"`
Rate                 float64 `json:"rate"`
Total                int64   `json:"total"`
Failure              int64   `json:"failure"`
ShortCircuited       int64   `json:"shortCircuited"`
IsCircuitBreakerOpen bool    `json:"isCircuitBreakerOpen"`
SemaphoreRejected    int64   `json:"semaphoreRejected"`
ThreadPoolRejected   int64   `json:"threadPoolRejected"`
CountTimeout         int64   `json:"countTimeout"`

Configurations

in chassis.yaml file. You need to configure your micro service to send the data to Huaweicloud ServiceStage.

cse:
  monitor:
    client:
      serverUri: https://cse.cn-north-1.myhwclouds.com:443
      enable: true

Data Post

Every 2 sec data will be posted to monitoring server if serverUri is correct and enable is true

The data format

{
  "data": {
    "appId": "default",
    "version": "1.0.0",
    "name": "order",
    "environment": "",
    "instance": "order-c3bbef-8457f585dc-c69cz",
    "thread": 14,
    "customs": null,
    "interfaces": [
      {
        "name": "Consumer.restaurant.rest",
        "desc": "Consumer.restaurant.rest",
        "qps": 0,
        "latency": 1,
        "l995": 0,
        "l99": 0,
        "l90": 0,
        "l75": 0,
        "l50": 0,
        "l25": 0,
        "l5": 0,
        "rate": 1,
        "total": 0,
        "failure": 0,
        "shortCircuited": 0,
        "circuitBreakerOpen": false,
        "semaphoreRejected": 0,
        "threadPoolRejected": 0,
        "countTimeout": 0,
        "failureRate": 0
      }
    ],
    "cpu": 4,
    "memory": {
      "heapAlloc": 3041688,
      "heapIdle": 61628416,
      "heapInUse": 4399104,
      "heapObjects": 28501,
      "heapReleased": 61595648,
      "heapSys": 66027520
    },
    "serviceId": "32370e6ed839834a0493dddc3e7a7d5cb6d5db59",
    "instanceId": "7c91fbb922ef11ea99b30255ac1004a6"
  }
}

Data Flush

Every 10sec data will be flushed

[
    [
        {
            "time": 1526905933600,
            "appId": "default",
            "version": "0.0.1",
            "qps": 0,
            "latency": 0,
            "failureRate": 0,
            "total": 0,
            "breakerRateAgg": 0,
            "circuitBreakerOpen": false,
            "failure": 0,
            "shortCircuited": 0,
            "semaphoreRejected": 0,
            "threadPoolRejected": 0,
            "countTimeout": 0,
            "l995": 0,
            "l99": 0,
            "l90": 0,
            "l75": 0,
            "l50": 0,
            "l25": 0,
            "l5": 0,
            "instanceId": "6a0895085cf211e8bb850255ac105551",
            "thread": 11,
            "cpu": 4,
            "memory": {
                "heapAlloc": 2649632,
                "heapIdle": 1597440,
                "heapInUse": 3874816,
                "heapObjects": 24737,
                "heapReleased": 0,
                "heapSys": 5472256
            },
            "functionCount": 1,
            "customs": null,
            "name": "root1-ThinkPad-T440p"
        }
    ]
]

cse-collector's People

Contributors

asifdxtreme avatar humingcheng avatar ninokop avatar savitaashture avatar thandayuthapani avatar tianxiaoliang avatar wangkirin avatar willemjiang avatar zenlint avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cse-collector's Issues

不配置monitor抛出异常

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x8 pc=0xf10473]

goroutine 69 [running]:
github.com/huaweicse/cse-collector.(*Reporter).getData(0x0, 0xc000197080, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
D:/gopath/pkg/mod/github.com/huaweicse/[email protected]/csemonitor.go:59 +0x143
github.com/huaweicse/cse-collector.(*Reporter).Send(0x0, 0xc000197080)
D:/gopath/pkg/mod/github.com/huaweicse/[email protected]/csemonitor.go:40 +0x15d
github.com/huaweicse/cse-collector.reportMetricsToCSEDashboard(0xc000197080, 0x28, 0x0)
D:/gopath/pkg/mod/github.com/huaweicse/[email protected]/cse_reporter.go:80 +0x5b
github.com/go-chassis/go-chassis/third_party/forked/afex/hystrix-go/hystrix.StartReporter()
D:/gopath/pkg/mod/github.com/go-chassis/[email protected]/third_party/forked/afex/hystrix-go/hystrix/reporter.go:38 +0xf6
created by github.com/go-chassis/go-chassis.(*chassis).initialize
D:/gopath/pkg/mod/github.com/go-chassis/[email protected]/chassis_init.go:158 +0x2b5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.