-
Notifications
You must be signed in to change notification settings - Fork 969
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
feat: Trace web hook calls #2154
Conversation
I am not sure about the failing tests. As far as I can see those tests are also red on master |
Those are flaky :) Should be fine! |
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.
Great stuff! Just a minor remark regarding tests :)
selfservice/hook/web_hook.go
Outdated
return rt(r) | ||
} | ||
|
||
func createHttpClient(tracer *tracing.Tracer) *http.Client { |
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.
Is there some way to write a test for this functionality? It looks fine but we need to ensure:
- It works
- It doesn't break when someone changes something
selfservice/hook/web_hook.go
Outdated
|
||
delegateClient := http.DefaultTransport | ||
|
||
var roundTripper RoundTripperFunc = func(req *http.Request) (*http.Response, error) { |
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.
Could you move this to ory/x/httpx
? It could be an option like
so for example:
httpx.ResilientClientWithTracer()
that would allow this to be used across the ecosystem :)
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 will have a look, also at the test
ory/x is merged :) Probably makes sense to redo this PR completely from master and just add tracing here: kratos/driver/registry_default.go Lines 687 to 698 in d9c8217
|
01cd201
to
04170c0
Compare
Ups. Updating ory/x did not go well. There appear to be breaking changes in the upgraded jsonschema/v3 |
Oh yeah, if you make your changes against #2166 then you won't have any problems upgrading ory/x :) |
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.
Looks good! I just think it is missing some tests to verify that the changes do fix the problem. Other than that it's good :)
Thank you for the review @Benehiko :) @martinei added tests in the PR in ory/x. Given that we only do some bootstrapping here it will be difficult to test this e2e with Jaeger, so I think we can take a leap of faith on this one! There are however some CI failures, I'm not sure if they're flakes or not (rerunning CI now) but could you (@martinei ) please take a look if they fail? |
Thanks @aeneasr This is based on the v0.8 branch which also has failing tests. I was hopping to first see green test there, so I can sort out if this PR brakes anything new. |
Ah, got it, fair point! Thank you :) |
This Pull request attempt to improve tracing in two places:
Checklist
introduces a new feature.
contributing code guidelines.
vulnerability. If this pull request addresses a security. vulnerability, I
confirm that I got green light (please contact
[email protected]) from the maintainers to push
the changes.
works.
Further Comments
This PR still creates the Http client in webhooks. I am not sure if it would be a good Idea to move it to the registry.
Further the client has no timeouts configured. Making the configurable could be a task for further improvements.
I had some trouble because the the config and thus the tracer are "contextualized" - at least that is what the function signatures say. In reality I believe the context param is never used and I think it makes the overall thingh to complex.