motiv-labs / janus

An API Gateway written in Go
https://hellofresh.gitbooks.io/janus
MIT License
2.79k stars 317 forks source link

PT-1149 Track upstream hosts usage stats and log upstream details #326

Closed vgarvardt closed 6 years ago

vgarvardt commented 6 years ago

What does this PR do?

This PR adds stats for upstreams to track RPS for each upstream that is useful especially for weight balancing when rolling out new service and balancing some traffic to it.

Additionally added upstream logging as it si not available from original request - probably something was changed in RoudTrip implementation in one of the recent go version (probably when context became part fo the stdlib).

codecov[bot] commented 6 years ago

Codecov Report

Merging #326 into master will decrease coverage by 0.32%. The diff coverage is 21.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #326      +/-   ##
==========================================
- Coverage   41.75%   41.43%   -0.33%     
==========================================
  Files          74       74              
  Lines        2467     2474       +7     
==========================================
- Hits         1030     1025       -5     
- Misses       1376     1387      +11     
- Partials       61       62       +1
Impacted Files Coverage Δ
pkg/proxy/register_options.go 0% <0%> (ø) :arrow_up:
pkg/proxy/register.go 0% <0%> (ø) :arrow_up:
pkg/proxy/reverse_proxy.go 0% <0%> (ø) :arrow_up:
main.go 0% <0%> (ø) :arrow_up:
pkg/middleware/logger.go 100% <100%> (+13.63%) :arrow_up:
pkg/middleware/stats.go 100% <100%> (ø) :arrow_up:
pkg/middleware/request_id.go 12.5% <33.33%> (+12.5%) :arrow_up:

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 d8bdfa3...b539753. Read the comment docs.