-
Notifications
You must be signed in to change notification settings - Fork 110
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
Httptrace #1087
base: main
Are you sure you want to change the base?
Httptrace #1087
Conversation
logger := backend.Logger.FromContext(ctx) | ||
trace := &httptrace.ClientTrace{ | ||
GetConn: func(hostPort string) { | ||
logger.Debug("HTTPTrace event", "event_name", "GetConn") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if all of these should be level trace
because for data source services, we have debug
level logging turned on. This would produce a lot of logs that are only sometimes needed. So we could turn it on in that case.
We have trace
log level: https://github.com/grafana/grafana-plugin-sdk-go/blob/main/backend/log/log.go#L14, but we are missing logger.Trace()
method - all other levels have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm with Ivana here. Why not just even be a trace instead of log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea.. Happy to change to Trace ( but we need to make sure the changes done in SDK first )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, Any thoughts on making it to debug
but only calling this method on healthcheck rather query. Won't that solve the problems we disucussed here. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking about a proper trace so these would be spans instead of logs. Like in here https://github.com/AdamKorcz/skipper/blob/d0b249a4aa8993a050b87cecc11cc6ca839195a4/proxy/proxy.go#L1464
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea.. that too possible too.
I am thinking of deferring this to 3.0.0-beta.2
This is nice to have PR and allow us investigate any connection issues. More details about HTTP trace can be found in https://pkg.go.dev/net/http/httptrace
To debug connection issues such as DNS lookup, adding the HTTPTrace event debug logging.
How to test
git checkout httptrace
yarn && yarn build && mage -v && docker compose -f ./docker-compose-debug.yaml up