SkyAPM / go2sky

Distributed tracing and monitor SDK in Go for Apache SkyWalking APM
https://skywalking.apache.org/
Apache License 2.0
448 stars 122 forks source link

(Summer 2022)Feat add golang runtime metrics #168

Closed easonyipj closed 1 year ago

easonyipj commented 1 year ago

Feature Description

This feature is about the golang runtime metrics collcection, while using go2Sky gRPCReporter, it can collect golang runtime metrics automatically, and sending the metrics to OAP Server where you can monitor these metrics in general-Instance dashboard.

Supported metrics:

How it works

  1. Using runtime.MemStats get golang runtime metrics, using shirou/gopsutil collect mem and cpu metrics
  2. Using Meter API sending metrics to OAP Server
  3. Add Meter Configuration files in OAP Server which defines the metrics name and collection way
  4. Update the general-instance.json add some golang panels config

How to use

Just define the interval parameter function WithMeterCollectPeriod in NewGRPCReporter report, err := NewGRPCReporter("127.0.0.1:11800", WithMeterCollectPeriod(15*time.Second)) and default is 15 seconds

Example

example image

wu-sheng commented 1 year ago

The doc should be updated to showing how to use meter APIs.

easonyipj commented 1 year ago

ok, i will add it

codecov-commenter commented 1 year ago

Codecov Report

Merging #168 (8d3b501) into master (91d0dd3) will decrease coverage by 5.18%. The diff coverage is 10.34%.

@@            Coverage Diff             @@
##           master     #168      +/-   ##
==========================================
- Coverage   64.85%   59.67%   -5.19%     
==========================================
  Files          22       23       +1     
  Lines        1104     1220     +116     
==========================================
+ Hits          716      728      +12     
- Misses        334      433      +99     
- Partials       54       59       +5     
Impacted Files Coverage Ξ”
metrics.go 0.00% <0.00%> (ΓΈ)
reporter/grpc_opts.go 66.66% <0.00%> (-4.77%) :arrow_down:
reporter/grpc.go 42.12% <16.43%> (-8.57%) :arrow_down:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more