argoproj / gitops-engine

Democratizing GitOps
https://pkg.go.dev/github.com/argoproj/gitops-engine?tab=subdirectories
Apache License 2.0
1.68k stars 252 forks source link

feat: add profile feature for agent, and fix logr's panic #444

Closed alswl closed 1 year ago

alswl commented 2 years ago

Feature

Using env variables to enable profiling mode, the agent can be started with the following envs:

export GITOPS_ENGINE_PROFILE=web
# optional, default pprofile address is 127.0.0.1:6060
export GITOPS_ENGINE_PROFILE_HOST=127.0.0.1
export GITOPS_ENGINE_PROFILE_PORT=6060

And then you can open profile in the browser(or using pprof cmd to generate diagrams):

Fix

logr will panic when format with none string params, error meesage:

key is not a string: "error creating gvk parser: duplicate entry for /v1, Kind=WatchEvent"
sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

codecov[bot] commented 2 years ago

Codecov Report

Merging #444 (c90b78a) into master (2bc3fef) will not change coverage. The diff coverage is 0.00%.

@@           Coverage Diff           @@
##           master     #444   +/-   ##
=======================================
  Coverage   55.22%   55.22%           
=======================================
  Files          41       41           
  Lines        4449     4449           
=======================================
  Hits         2457     2457           
  Misses       1803     1803           
  Partials      189      189           
Impacted Files Coverage Δ
pkg/cache/cluster.go 54.86% <0.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

alswl commented 2 years ago

@alexmt @jannfis Please code review when you have time.

alswl commented 2 years ago

ping @terrytangyuan