Comments (10)
Goproxy uses session ctx.Session & 0xFF
as identifier we should probably adapt it
func (ctx *ProxyCtx) printf(msg string, argv ...interface{}) {
ctx.Proxy.Logger.Printf("[%03d] "+msg+"\n", append([]interface{}{ctx.Session & 0xFF}, argv...)...)
}
example output
2022/09/26 14:01:10 [local] DEBUG: [001] INFO: Copying response to client 200 OK [200]
2022/09/26 14:01:10 [local] DEBUG: [001] INFO: Copied 4 bytes to client error=<nil>
If X-Request-ID
is present it should be logged to associate the ID with Session ID.
from forwarder.
There are exported logging functions
// Logf prints a message to the proxy's log. Should be used in a ProxyHttpServer's filter
// This message will be printed only if the Verbose field of the ProxyHttpServer is set to true
//
// proxy.OnRequest().DoFunc(func(r *http.Request,ctx *goproxy.ProxyCtx) (*http.Request, *http.Response){
// nr := atomic.AddInt32(&counter,1)
// ctx.Printf("So far %d requests",nr)
// return r, nil
// })
func (ctx *ProxyCtx) Logf(msg string, argv ...interface{}) {
if ctx.Proxy.Verbose {
ctx.printf("INFO: "+msg, argv...)
}
}
// Warnf prints a message to the proxy's log. Should be used in a ProxyHttpServer's filter
// This message will always be printed.
//
// proxy.OnRequest().DoFunc(func(r *http.Request,ctx *goproxy.ProxyCtx) (*http.Request, *http.Response){
// f,err := os.OpenFile(cachedContent)
// if err != nil {
// ctx.Warnf("error open file %v: %v",cachedContent,err)
// return r, nil
// }
// return r, nil
// })
func (ctx *ProxyCtx) Warnf(msg string, argv ...interface{}) {
ctx.printf("WARN: "+msg, argv...)
}
from forwarder.
I think its not needed since we log request with response.
from forwarder.
Reopening the issue.
This mainly requires changes in Marian logging, when sth goes wrong, we want to know which issue caused the error.
from forwarder.
Once we have the context the in the logs the implementation should be in Proxy::readRequest
(and a parallel implementation in handler).
To request context.Context add requestID value
- if X-Request-ID header is set use its value
- otherwise use Martian context ID
from forwarder.
As long as CONNECT request does not forward X-Forwarded-Headers
we are not able to support reusing request id.
from forwarder.
@Choraden we have RequestIDHeader
in martian and as far as I can tell it's never used.
from forwarder.
It looks like this functionality was removed in 56352ab.
We need to decide whether we want to fix it or completely remove it.
from forwarder.
I'll fix it.
from forwarder.
It can be added to out connect implementation.
from forwarder.
Related Issues (20)
- e2e: do not run terminal in test containers
- e2e: move wait to tests HOT 1
- e2e: add wrk test
- dial: gather information about dials on per host basis
- martian: res.Close should not be passed downstream
- chore: change copyright to 2022-2024
- connection leak in via loop detection
- martian: make connect t/o 2* dial t/o by default
- net: dial retries
- net: improve host label in dial metrics
- chore: modernize local/linux
- httpbin remove API server
- modernize local/linux HOT 1
- e2e: run test container in compose
- docs: improve log-level flags docs
- utils/compose: implement builder pattern in Compose directly
- Support WireGuard server as upstream
- e2e: run tests in two separate jobs
- dialvia: add connect timeout
- http_proxy: remove ambiguity in connect headers configuration
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forwarder.