Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kvdb Debug Log Wrapper #78

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Kvdb Debug Log Wrapper #78

wants to merge 2 commits into from

Conversation

adityadani
Copy link
Member

@adityadani adityadani commented Mar 15, 2019

  • Add a new kvdb option: DebugLogFileNameKey
  • If the above option is specified it adds a wrapper over the kvdb object to log every request on the kvdb package if configured.
  • In case of etcdv3 if the above option is enabled it adds a grpc interceptor to the etcd client to log every etcd request

A typical kvdb request debug log will look like this

time="2019-03-15T01:38:24-07:00" level=info caller="github.com/portworx/porx/storage/driver/volume.kvdbSpec.put" key="storage/spec/f6703b28-0f05-4f40-8584-4295d2f73be4" method="github.com/portworx/porx/vendor/github.com/portworx/kvdb.(*debugKvdb).CompareAndSet" type=etcdv3-kv
time="2019-03-15T01:38:24-07:00" level=info msg=Start method="/etcdserverpb.KV/Txn"
time="2019-03-15T01:38:24-07:00" level=info msg=Successful duration=38.945493ms method="/etcdserverpb.KV/Txn"
time="2019-03-15T01:38:24-07:00" level=info msg=Start method="/etcdserverpb.KV/Range"
time="2019-03-15T01:38:24-07:00" level=info msg=Successful duration=24.855404ms method="/etcdserverpb.KV/Range"

@codecov-io
Copy link

Codecov Report

Merging #78 into master will decrease coverage by 0.21%.
The diff coverage is 4.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
- Coverage   68.53%   68.32%   -0.22%     
==========================================
  Files           7        7              
  Lines        3417     3438      +21     
==========================================
+ Hits         2342     2349       +7     
- Misses        845      860      +15     
+ Partials      230      229       -1
Impacted Files Coverage Δ
etcd/v3/kv_etcd.go 66.23% <4.76%> (-1.12%) ⬇️
consul/kv_consul.go 73.03% <0%> (+0.58%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 521b74b...93fa6b2. Read the comment docs.

)

const (
defaultLogLocation = "/var/lib/osd/kvdb_audit.log"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change this to /var/cores since that's where we are storing all of your support bundles?

return d.kv.Defragment(endpoint, timeout)
}

func OpenLog(logfile string) (*os.File, error) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function. Add function comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants