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 Helper Function to Build classifierF (to pass to client and server's Middleware) #3167
Add Helper Function to Build classifierF (to pass to client and server's Middleware) #3167
Conversation
Summoning @ChristopherDavenport, since I think he does the most with metrics.
testing/src/main/scala/org/http4s/testing/ArbitraryInstances.scala
Outdated
Show resolved
Hide resolved
def classifierFMethodWithOptionallyExcludedPath[F[_]]( | ||
exclude: String => Boolean | ||
): Request[F] => Option[String] = { request: Request[F] => | ||
val dsl: Http4sDsl[F] = Http4sDsl[F] |
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 surprised http4s-dsl is available in this project. That seems like a bad coupling. Can we do this without 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 surprised http4s-dsl is available in this project. That seems like a bad coupling.
I only used it since I saw it available via https://github.com/http4s/http4s/blob/series/0.20/build.sbt#L153.
Can we do this without it?
Sure. Can you please advise if you know, off-hand, how to get the path as a List[String]
, @rossabaker?
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.
You could copy this code and build a List
rather than a Path
.
In the long run, turning a path into a list of segments ought to be core functionality on a URI.
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.
So this dependency already exists, to support the PrometheusExportService
. I think we could re-express it without that, but that's a separate ticket.
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, Ross, for telling me how to get a path list from a String
. I did that, as well as removed the Http4sDsl
usage via commits at #3167 (commits).
Are you needing this in 0.20.x? |
I would not say need, but it'd be nice. If it's a pain to support it in 0.20.x, please let me know, Ross. |
This reverts commit c13d63e.
I'd like to phase out 0.20.x releases in general and focus on keeping 0.21 healthy and developing the next version, but if somebody sends PRs, there's no particular reason we can't release another 0.20. |
Comments below. This should still pass MiMa checks and be eligible for 0.20.18 and/or 0.21.1.
def classifierFMethodWithOptionallyExcludedPath[F[_]]( | ||
exclude: String => Boolean | ||
): Request[F] => Option[String] = { request: Request[F] => | ||
val dsl: Http4sDsl[F] = Http4sDsl[F] |
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.
You could copy this code and build a List
rather than a Path
.
In the long run, turning a path into a list of segments ought to be core functionality on a URI.
Understood, @rossabaker. I ran I believe that I've addressed your review findings, Ross. Can you please take a look?
I interpret this to mean that it's OK for me to target |
Since the other tests succeeded per https://travis-ci.org/http4s/http4s/builds/648221349?utm_source=github_status&utm_medium=notification, I'm guessing the test failure in https://travis-ci.org/http4s/http4s/jobs/648221350?utm_medium=notification&utm_source=github_status was the result of flakiness.
As a result, I'll close, and then re-open, the PR to prompt another build. |
Looks like another, I'm guessing, flaky test is to blame per https://travis-ci.org/http4s/http4s/jobs/648223657?utm_medium=notification&utm_source=github_status. I will close, and then re-open. To make sure I follow, is it necessary to get the build green, @rossabaker, even if you have high confidence that a PR was not to blame for a failing test? |
I'm rerunning the test, but the failure is definitely not related to this ticket.
Thanks for the cleanups.
And yes, if you need this on 0.20.18, it's not a problem to keep it on this branch. I backported the GitHub Actions build and threw in a Tomcat bugfix in separate PRs to make it more worth our while. |
Address Ross's comment, http4s#3167 (comment).
It's already included in Http4sSpec.
The motivation for this change was to show that the larger PR did not modify the build.sbt.
The motivation for this change was to show that the larger PR did not modify this file.
Can you please review this one, @ChristopherDavenport, again? |
The most recent build appears to have run into a transient error.
I'll close, and then re-open. |
I see a few tests failed:
but I highly doubt that my changes introduced such tests' failures. |
Yes, three are still a few tests that are flaky. I was hoping the move to GitHub Actions would help, and, well, maybe, but not entirely. |
Hi @rossabaker - please let me know what I can do to influence the merging of this PR. Thanks. |
@ChristopherDavenport, are all your comments addressed? |
Hi @rossabaker and @ChristopherDavenport - could you please cut a release per v0.20.19...series/0.20? I don't have a rush, but I'd like to start using this function. Thanks! |
Could you please take a look at #3167 (comment), Ross or Chris? I believe I have a use case for this in prod today. |
I was trying to get another fix in, but life has been upside down. Let's get this out now. Versions are cheap. |
Thank you, @rossabaker ! |
Yes, unfortunately so. I'm glad to have spoken with you last week at NEScala. I hope you're doing well. |
…elper Add Helper Function to Build classifierF (to pass to client and server's Middleware)
…elper Add Helper Function to Build classifierF (to pass to client and server's Middleware)
Adds a function,
classifierFMethodWithOptionallyExcludedPath
, toPrometheus
.Given an exclude function, return a 'classifier' function, i.e. for application in
[[org.http4s.client.middleware.Metrics#apply]]
and[[org.http4s.server.middleware.Metrics#apply]]
.Let's say you want a classifier that excludes integers since your paths consist of:
In such a case, we could use:
This idea, namely adding a classifier with an
exclude: String => Boolean
, was inspired by an internal library that @ChristopherDavenport wrote.