-
Notifications
You must be signed in to change notification settings - Fork 821
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(prometheus): add getMetricsRequestHandler
-method to Prometheus
#1879
Merged
+33
−0
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c881208
feat(prometheus): add `getMetricsRequestHandler`-method to Prometheus…
tapico-weyert d4dbd22
Merge branch 'main' into expose-request-handler
weyert 23c1f77
test(prometheus): add sinon to write unit test
tapico-weyert 57715c7
style(prometheus): fix the linting issue
tapico-weyert 2233775
Merge branch 'main' into expose-request-handler
vmarchaud e81465c
Merge branch 'main' into expose-request-handler
weyert 548a7e3
Merge branch 'main' into expose-request-handler
weyert c1468ff
chore: regenerated package-lock.json file
tapico-weyert f67d72f
chore: merge main branch into feature branch
tapico-weyert 5392643
fix: remove `package-lock.json` file from `exporter-prometheus`-package
tapico-weyert 141c21c
chore: revert the deletion of `package-lock.json` in root
tapico-weyert File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 function names implies you are getting a handler, which is not the what is actually happening. I think it would be smarter to return a middleware that is compatible with express and other web frameworks:
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.
The idea I was having to return a
raw
handler which has theIncomingMessage
, andServerResponse
arguments as we can't really be sure what the user's framework is. I was thinking the user could do something like this for Express:while for Hapi you could do something like:
while for Koa something like:
Probably would need to allow the handler to be async but the above the idea to offer most flexibility. Maybe the name needs to better reflect this?
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.
But you have a point maybe it should be returned with
.bind(this)
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 agree with @weyert here, its better to use a simpler model that doesn't necessarely match express api so it can be used with every framework (at the cost of having a different usage)
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 @vmarchaud :)