Comments (5)
Should have seen that when we splitted the code in two: ActorMetrics and FutureMetrics!
Yes, we should definitely move that!
Are you willing to create a pull request?
from metrics-scala.
This was done because:
- The implementation of FutureMetrics is only written against the akka-style of futures.
- scala futures and akka futures were separate before 2.10
- We needed to support scala versions prior to 2.10
Thus the 2.10+ code is in its own source tree.
I'd agree this is no longer necessary, it should be a fairly quick fix. If a PR doesn't show up soon-ish, I had an enhancement for the FutureMetrics that covers the parallel case of tacking on a timer listener onto an externally built Future that I am wrapping up and I can create a PR.
from metrics-scala.
Brian, you are clearly more awake then me this week :)
I am also thinking about wrapping the executor. We have something that does this but is currently too specific. It mostly useful to see if tasks need to wait long before they can get executed.
from metrics-scala.
Here's what i'm thinking of adding. Basically timing a an API that already produces a future by leveraging the onComplete
listener. The current timer we have for Futures really only works with either a synchronous API or in code that the developer controls, making it restrictive. This would cover the parallel case, and although it's measuring something different, as long as that's understood, it can be useful.
To your point this measures (The time before the future is scheduled
+The time the task takes to run
+The time the listener takes to be scheduled
), so it's not exact. I don't know that this is a problem as long as the user is aware of it and treats it as such.
def timing[A](metricName: String)(block: => Future[A])(implicit context: ExecutionContext): Future[A] = {
val timer = metrics.timer(metricName)
val ctx = timer.timerContext
block.onComplete(_ => ctx.stop())
block
}
from metrics-scala.
@erikvanoosten, @scullxbones Thanks, guys! Such a quick turnaround 👍
from metrics-scala.
Related Issues (20)
- Add support for Akka Streams HOT 3
- Version for Scala 2.13.0-RC1 HOT 2
- Scala 2.13.0-RC2 HOT 4
- Releasing with sbt fails due to double uploads HOT 1
- Version for Scala 2.13.0 HOT 1
- MetricName.append breaks in v4 HOT 6
- Spark: Exception in thread "main" java.lang.NoSuchMethodError: com.codahale.metrics.MetricRegistry.timer(Ljava/lang/String;Lcom/codahale/metrics/MetricRegistry$MetricSupplier;)Lcom/codahale/metrics/Timer; HOT 5
- Memory leak on re-registering gauges HOT 11
- Using cachedGauge with Futures HOT 1
- Improve compatibility checks HOT 1
- Scala 3 HOT 6
- Create github release HOT 1
- Make constructors of PushGauge and PushGaugeWithTimeout not private HOT 2
- PushGauge should not throw "A metric named foobar already exists " HOT 2
- Plans for "metrics4-pekko" HOT 1
- support for the new pekko open source akka HOT 1
- Scala/Akka/Dropwizard Metrics app hanging for 10s before shutting down HOT 1
- Version Request: 3.5.9_a2.3 (with akka 2.4.19), or 3.5.9_a2.4 (against Scala 2.11) HOT 1
- Wrong artifact name in Wiki HOT 1
- Upgrade to metrics 5 HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from metrics-scala.