-
Notifications
You must be signed in to change notification settings - Fork 198
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 APM instrumentation middleware module for Fiber framework #999
Conversation
💚 CLA has been signed |
💚 Build Succeeded
Expand to view the summary
Build stats
Test stats 🧪
Trends 🧪 |
Thanks for the PR, @blessedvictim! I've taken a quick look over the PR and it looks good. Before I do a full review, can you please:
|
80e3173
to
e67e92f
Compare
@axw hi, i already sign CLA and add license headers |
@blessedvictim 2 of your comments are associated with a different email ( |
29c141d
to
99a5c79
Compare
@axw hi, there are still unresolved problems ? |
Thanks for those updates @blessedvictim. Nothing blocking now. Someone will hopefully be able to review within the next week. We're just a bit busy at the moment. |
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.
Thank you for the contribution! I do have a couple of remark, but the PR generally looks good.
Can you please add an entry to the supported tech stack doc and also an example showing how to use this module, similar to the fasthttp
example.
module/apmfiber/middleware.go
Outdated
// be ignored. If r is nil, all requests will be reported. | ||
func WithRequestIgnorer(fn apmfasthttp.RequestIgnorerFunc) Option { | ||
if fn == nil { | ||
panic("fn == nil") |
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.
this is not aligned with the comment, but it should be - it should not panic because of an unset ignore function
If r is nil, all requests will be reported.
module/apmfiber/middleware.go
Outdated
tracer *apm.Tracer | ||
requestIgnorer apmfasthttp.RequestIgnorerFunc | ||
panicPropagation bool | ||
} |
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 don't think introducing this type is necesarry, you should be able to use the middleware
.
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.
fixed
module/apmfiber/middleware_test.go
Outdated
|
||
resp, err := e.Test(req) | ||
assert.Nil(t, err) | ||
assert.Equal(t, resp.StatusCode, http.StatusInternalServerError) |
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.
Can you also test for the recovered error?
I'm also interested in this functionality. I could help by fixing the parts brought up in the comments above but i'm not sure how to wrangle the branches to make this as painless as possible. I guess i should branch from |
@misuto thanks for the offer. Let's wait for @blessedvictim to respond. |
0b4e7bc
to
e0d5b29
Compare
it seems the mentioned issues are fixed now |
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.
Thanks @blessedvictim, looks great! Just a few, very minor, comments on the code.
Not sure if you saw @simitt's request?
Can you please add an entry to the supported tech stack doc and also an example showing how to use this module, similar to the
fasthttp
example.
Then there are a couple of other small things that need to be updated before this can be merged, by running make fmt scripts/Dockerfile-testing
.
module/apmfiber/middleware.go
Outdated
tx.Name = string(reqCtx.Method()) + " unknown route" | ||
} else { | ||
// Workaround for set tx.Name as template path, not absolute | ||
tx.Name = string(reqCtx.Method()) + " " + c.Route().Path |
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.
tx.Name = string(reqCtx.Method()) + " " + c.Route().Path | |
tx.Name = string(reqCtx.Method()) + " " + path |
module/apmfiber/middleware.go
Outdated
defer func() { | ||
panic(v) | ||
}() |
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.
defer func() { | |
panic(v) | |
}() | |
defer panic(v) |
module/apmfiber/middleware.go
Outdated
//go:build go1.12 | ||
// +build go1.12 | ||
|
||
package apmfiber |
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.
package apmfiber | |
package apmfiber // import "go.elastic.co/apm/module/apmfiber" |
(this is needed to satisfy make check
)
jenkins run the tests please |
d78f1fd
to
1abf022
Compare
@blessedvictim please let us know if you would like any help with the remaining requested changes. If you'd like, we can make the changes and push to your branch and merge. |
69374ed
to
8ce1a9c
Compare
@axw added an example and some description for the apmfiber. Seems like all requested changes done, isn't 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.
Doc addition looks good, thanks - just a couple of minor formatting/copy-paste issues.
A couple of other things remaining:
- run
make scripts/Dockerfile-testing
(needed for our CI to pass) - merge master. There was a minor breaking change to the apmfasthttp exported API recently, the order of args to
apmfasthttp.StartTransactionWithBody
has changed
delete options type restore WithPanicPropagation add tests for WithPanicPropagation add tests for WithRequestIgnorer
5427d41
to
648b37a
Compare
648b37a
to
92f43ad
Compare
@axw I notify you that the noticed problems have been fixed. Is there any other blockers ? |
/test |
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 great, thank you very much for your contribution @blessedvictim! Just need to wait for CI to be happy, then we'll merge.
jenkins run the tests please |
increase go version in build tag
Head branch was pushed to by a user without write access
Thanks @blessedvictim. There are some test failures on older versions of Go, which I think are probably unrelated to your changes. I'll investigate tomorrow and merge if I can sort out the issues. |
@elasticmachine, run elasticsearch-ci/docs |
Thanks again for your contribution @blessedvictim! |
These changes add middleware to the fiber framework.
Closes #955