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

Add zerolog logging middleware #224

Closed
wants to merge 56 commits into from
Closed

Add zerolog logging middleware #224

wants to merge 56 commits into from

Conversation

Ahmet-Kaplan
Copy link

Inspired from adrien-f PR, I want to add Zerolog logging into that project.

For benchmarks, you can visit that site. Zerolog is much faster than Logrus and Zap as seen.

domgreen and others added 30 commits February 27, 2018 15:16
Support retrying gRPCs with chained interceptors
ctxloggers for zap and logrus should live with logging
fixing vet issues ... most relating to the Examples
Add 'grpc.request.deadline' example and fix typo.
* implement noopTags
* fix tag reference
Spelling/grammar corrections for validator docs
* Update server_interceptors.go

fix misspelling

* Update fieldextractor.go

fix misspelling

* Update options.go

fix misspelling

* Update options.go

fix comment

* Update server_interceptors.go

lint comment

* Update payload_interceptors.go

lint comment

* Update client_interceptors.go

lint comment

* Update payload_interceptors.go

lint comment

* update docs
* Travis will now check to see if the docs have correctly been updated
* adding a CHANGELOG file

* fixing styling
* Add exponential backoff functions

* Move backoff exponent to backoffutils

* Add an exampe for the exponential backoff
* Added retry on server stream call

* Updated interceptor suite with restart server and added test cases for stream connection retry

* Fixed a typo when initilizaing the restart channel in InterceptorTestSuite

* Added a delay when stopping the interceptor suite server

* Added another test for ServerStream CallFailsOnDeadlineExceeded

* Actually validates the errors in the stream call retry-tc's
* retry: add new BackoffFuncContext type

BackoffFuncContext adds the context parameter, allowing
the retry function access to the contents of the parent
context.

Fixes #171

* recovery: add new RecoveryHandlerFuncContext type

Allows the user to configure a custom recovery handler
that has access to the request scoped values in the
context.

Fixes #168
Docs will now be only in code / in godoc.org.

We should remove the auto generation of docs from this repo, as much as it was nice to have them alongside the code in github it is normal go practice to look for most documentation via godoc.org.

The libraries that we have been using to generate the github markdown are no longer maintained and updated in the godoc codebase itself have meant that we would also have to update these dependant libraries ... which I do not think we should take.
* we now will not add the traceId / spanId to ctxtags if it is not sampled

* update to add sampled to the tags

* code review

* OT explicitly check value is true or false

* OT not add tag if unknown value
* Update Gopkg.lock

* Update go version to 1.11
* grpc ratelimit interceptor

* refine ratelimit inteceptor options

* add ratelimit interceptor unit test

* refactor ratelimit interceptor according to comments

* remove useless options and file header

* remove tokenbucket ratelimiter implementation from repo

* add ratelimit to README.md

* put an alwaysPassLimiter in example and remove external dependency
* gRPC Zap ReplaceGrpcLoggerV2

* explicitly allow verbosity to be modified instead of through env var

* remove severity

* remove levels const

* update example

* small edits

* address nits

* make closer to upstream

* pass through verbosity

* small comment change

* address comments

* don't export Logger
@googlebot
Copy link

All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter.

We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only @googlebot I consent. in this pull request.

Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the cla label to yes (if enabled on your project).

ℹ️ Googlers: Go here for more info.

@codecov-io
Copy link

codecov-io commented Aug 22, 2019

Codecov Report

Merging #224 into master will increase coverage by 0.87%.
The diff coverage is 77.77%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #224      +/-   ##
==========================================
+ Coverage   71.55%   72.43%   +0.87%     
==========================================
  Files          37       42       +5     
  Lines        1392     1625     +233     
==========================================
+ Hits          996     1177     +181     
- Misses        347      392      +45     
- Partials       49       56       +7
Impacted Files Coverage Δ
ratelimit/ratelimit.go 100% <ø> (ø) ⬆️
logging/zerolog/ctxzr/context.go 0% <0%> (ø)
logging/zap/payload_interceptors.go 84.61% <100%> (ø) ⬆️
logging/zerolog/server_interceptors.go 100% <100%> (ø)
logging/zerolog/client_interceptors.go 100% <100%> (ø)
logging/zerolog/payload_interceptors.go 80.59% <80.59%> (ø)
logging/zerolog/options.go 82% <82%> (ø)
... and 2 more

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 e0797f4...8a7307e. Read the comment docs.

…grpc-middleware into feature/zerolog

* 'feature/zerolog' of https://github.com/Ahmet-Kaplan/go-grpc-middleware: (35 commits)
  import paths are updated for Travis CI.
  import paths are updated for Travis CI.
  All tests are PASSED :)
  Log initialization fix
  Log Levels updated
  Log Levels updated
  import paths
  Pointer definitions
  import paths are updated
  import paths are updated
  import paths are updated
  Add zerolog (much faster than logrus) logging middleware
  Add go-kit logging middleware
  golang.org/x/net/context => context (#201)
  gRPC Zap ReplaceGrpcLoggerV2 (#221)
  Ratelimit interceptor (#181)
  golang 1.11 and golang.org/x/net upgrades
  Add if the trace was sampled to the ctxTags (#184)
  Remove generation of docs (#183)
  Add context functions to retry and recover (#172)
  ...
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.