Class InstrumentedProxy
- java.lang.Object
-
- com.netflix.spinnaker.kork.telemetry.InstrumentedProxy
-
- All Implemented Interfaces:
java.lang.reflect.InvocationHandler
public class InstrumentedProxy extends java.lang.Object implements java.lang.reflect.InvocationHandlerAdds automatic instrumentation to a target object's method invocations.Two metrics will be recorded for any target: timing and invocations, with an additional tag for "success", having either the value "success" or "failure".
Instrumented methods will be generated at proxy creation time, each associated with a metric name following a pattern of "{namespace}.{method}.{metricName}", where "{metricName}" is either "timing" or "invocations". The namespace is provided at creation time, and is typically unique per target. The "method" is automatically generated, using the method name and parameter count of the method.
Instrumented methods can be customized slightly via the
Meteredannotation:- A method can be ignored, causing no metrics to be collected on it. - Provided a custom metric name, in case auto naming produces naming conflicts. - A list of tags added to the metrics.
-
-
Constructor Summary
Constructors Constructor Description InstrumentedProxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace)InstrumentedProxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace, java.util.Map<java.lang.String,java.lang.String> tags)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectinvoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)static <T> Tproxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace)static <T> Tproxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace, java.util.Map<java.lang.String,java.lang.String> tags)
-
-
-
Constructor Detail
-
InstrumentedProxy
public InstrumentedProxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace)
-
InstrumentedProxy
public InstrumentedProxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace, java.util.Map<java.lang.String,java.lang.String> tags)
-
-
Method Detail
-
proxy
public static <T> T proxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace)
-
proxy
public static <T> T proxy(com.netflix.spectator.api.Registry registry, java.lang.Object target, java.lang.String metricNamespace, java.util.Map<java.lang.String,java.lang.String> tags)
-
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler- Throws:
java.lang.Throwable
-
-