Class

com.twitter.finagle.stats

LazyStatsReceiver

Related Doc: package stats

Permalink

final class LazyStatsReceiver extends StatsReceiverProxy

Wraps an underlying StatsReceiver to ensure that derived counters and stats will not start exporting metrics until incr or add is first called on them.

This should be used when integrating with tools that create metrics eagerly, but you don't know whether you're going to actually use those metrics or not. One example might be if you're speaking to a remote peer that exposes many endpoints, and you eagerly create metrics for all of those endpoints, but aren't going to use all of the different methods.

We don't apply this very widely automatically--it can mess with caching, and adds an extra allocation when you construct a new counter or stat, so please be judicious when using it.

Note

does not change the way gauges are used, since there isn't a way of modeling whether a gauge is "used" or not.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. LazyStatsReceiver
  2. StatsReceiverProxy
  3. DelegatingStatsReceiver
  4. StatsReceiver
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new LazyStatsReceiver(self: StatsReceiver)

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def addGauge(schema: GaugeSchema)(f: ⇒ Float): Gauge

    Permalink

    Add the function f as a gauge with the given name.

    Add the function f as a gauge with the given name.

    The returned gauge value is only weakly referenced by the StatsReceiver, and if garbage collected will eventually cease to be a part of this measurement: thus, it needs to be retained by the caller. Or put another way, the measurement is only guaranteed to exist as long as there exists a strong reference to the returned gauge and typically should be stored in a member variable.

    Measurements under the same name are added together.

    Definition Classes
    StatsReceiverProxyStatsReceiver
    See also

    java.lang.ref.WeakReference

    StatsReceiver.provideGauge when there is not a good location to store the returned gauge that can give the desired lifecycle.

  5. def addGauge(f: Supplier[Float], verbosity: Verbosity, name: String*): Gauge

    Permalink

    Just like addGauge(Verbosity,String*,=>Float) but optimized for better Java experience.

    Just like addGauge(Verbosity,String*,=>Float) but optimized for better Java experience.

    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  6. def addGauge(f: Supplier[Float], name: String*): Gauge

    Permalink

    Just like addGauge(String*,=>Float) but optimized for better Java experience.

    Just like addGauge(String*,=>Float) but optimized for better Java experience.

    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  7. def addGauge(verbosity: Verbosity, name: String*)(f: ⇒ Float): Gauge

    Permalink

    Add the function f as a gauge with the given name.

    Add the function f as a gauge with the given name.

    The returned gauge value is only weakly referenced by the StatsReceiver, and if garbage collected will eventually cease to be a part of this measurement: thus, it needs to be retained by the caller. Or put another way, the measurement is only guaranteed to exist as long as there exists a strong reference to the returned gauge and typically should be stored in a member variable.

    Measurements under the same name are added together.

    Definition Classes
    StatsReceiver
    See also

    java.lang.ref.WeakReference

    StatsReceiver.addGauge(java.util.function.Supplier,Verbosity,String*) for a Java-friendly version.

    StatsReceiver.provideGauge when there is not a good location to store the returned gauge that can give the desired lifecycle.

  8. def addGauge(name: String*)(f: ⇒ Float): Gauge

    Permalink

    Add the function f as a gauge with the given name.

    Add the function f as a gauge with the given name.

    The returned gauge value is only weakly referenced by the StatsReceiver, and if garbage collected will eventually cease to be a part of this measurement: thus, it needs to be retained by the caller. Or put another way, the measurement is only guaranteed to exist as long as there exists a strong reference to the returned gauge and typically should be stored in a member variable.

    Measurements under the same name are added together.

    Definition Classes
    StatsReceiver
    See also

    java.lang.ref.WeakReference

    StatsReceiver.addGauge(java.util.function.Supplier,String*) for a Java-friendly version.

    StatsReceiver.provideGauge when there is not a good location to store the returned gauge that can give the desired lifecycle.

  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. def counter(schema: CounterSchema): Counter

    Permalink

    Get a counter with the given schema.

    Get a counter with the given schema.

    Definition Classes
    LazyStatsReceiverStatsReceiverProxyStatsReceiver
  12. def counter(verbosity: Verbosity, name: String*): Counter

    Permalink

    Get a counter with the given name.

    Get a counter with the given name.

    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  13. def counter(name: String*): Counter

    Permalink

    Get a counter with the given name.

    Get a counter with the given name.

    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  14. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  15. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  16. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  18. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def isNull: Boolean

    Permalink

    Accurately indicates if this is a NullStatsReceiver.

    Accurately indicates if this is a NullStatsReceiver. Because equality is not forwarded via scala.Proxy, this is helpful to check for a NullStatsReceiver.

    Definition Classes
    StatsReceiverProxyStatsReceiver
  21. def metricBuilder(): MetricBuilder

    Permalink

    Get a metricBuilder for this StatsReceiver.

    Get a metricBuilder for this StatsReceiver.

    Definition Classes
    StatsReceiver
  22. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  25. def provideGauge(f: Supplier[Float], name: String*): Unit

    Permalink

    Just like provideGauge() but optimized for better Java experience.

    Just like provideGauge() but optimized for better Java experience.

    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  26. def provideGauge(name: String*)(f: ⇒ Float): Unit

    Permalink

    Register a function f as a gauge with the given name that has a lifecycle with no end.

    Register a function f as a gauge with the given name that has a lifecycle with no end.

    This measurement exists in perpetuity.

    Measurements under the same name are added together.

    Definition Classes
    StatsReceiver
    See also

    String*) for a Java-friendly version.

    StatsReceiver.addGauge if you can properly control the lifecycle of the returned gauge.

  27. def repr: AnyRef

    Permalink

    Specifies the representative receiver.

    Specifies the representative receiver. This is in order to expose an object we can use for comparison so that global stats are only reported once per receiver.

    Definition Classes
    StatsReceiverProxyStatsReceiver
  28. final def scope(namespaces: String*): StatsReceiver

    Permalink

    Prepend namespace and namespaces to the names of the returned StatsReceiver.

    Prepend namespace and namespaces to the names of the returned StatsReceiver.

    For example:

    statsReceiver.scope("client", "backend", "pool").counter("adds")

    will generate a counter named /client/backend/pool/adds.

    Note it's recommended to be mindful with usage of the scope method as it's almost always more efficient to pass a full metric name directly to a constructing method.

    Put this way, whenever possible prefer

    statsReceiver.counter("client", "backend", "pool", "adds")

    to

    statsReceiver.scope("client", "backend", "pool").counter("adds")
    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  29. def scope(namespace: String): StatsReceiver

    Permalink

    Prepend namespace to the names of the returned StatsReceiver.

    Prepend namespace to the names of the returned StatsReceiver.

    For example:

    statsReceiver.scope("client").counter("adds")
    statsReceiver.scope("client").scope("backend").counter("adds")

    will generate counters named /client/adds and /client/backend/adds.

    Note it's recommended to be mindful with usage of the scope method as it's almost always more efficient to pass a full metric name directly to a constructing method.

    Put this way, whenever possible prefer

    statsReceiver.counter("client", "adds")

    to

    statsReceiver.scope("client").counter("adds")
    Definition Classes
    StatsReceiver
  30. def scopeSuffix(suffix: String): StatsReceiver

    Permalink

    Prepend a suffix value to the next scope.

    Prepend a suffix value to the next scope.

    For example:

    statsReceiver.scopeSuffix("toto").scope("client").counter("adds")

    will generate a counter named /client/toto/adds.

    Definition Classes
    StatsReceiver
  31. val self: StatsReceiver

    Permalink
    Definition Classes
    LazyStatsReceiverStatsReceiverProxy
  32. def stat(schema: HistogramSchema): Stat

    Permalink

    Get a stat with the given schema.

    Get a stat with the given schema.

    Definition Classes
    LazyStatsReceiverStatsReceiverProxyStatsReceiver
  33. def stat(verbosity: Verbosity, name: String*): Stat

    Permalink

    Get a stat with the given name.

    Get a stat with the given name.

    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  34. def stat(name: String*): Stat

    Permalink

    Get a stat with the given name.

    Get a stat with the given name.

    Definition Classes
    StatsReceiver
    Annotations
    @varargs()
  35. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  36. def toString(): String

    Permalink
    Definition Classes
    StatsReceiverProxy → AnyRef → Any
  37. def underlying: Seq[StatsReceiver]

    Permalink

    The underlying StatsReceivers that the class delegates to.

    The underlying StatsReceivers that the class delegates to.

    Must be nonempty.

    Definition Classes
    StatsReceiverProxyDelegatingStatsReceiver
  38. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from StatsReceiverProxy

Inherited from DelegatingStatsReceiver

Inherited from StatsReceiver

Inherited from AnyRef

Inherited from Any

Ungrouped