com.ibm.streams.operator.metrics
Interface OperatorMetrics
-
public interface OperatorMetrics
OperatorMetrics provides access to metrics related to an operator and its ports. An operator may access read-only information about its ports and define custom metrics that will be available for external monitoring of the application.- See Also:
Metric
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static class
OperatorMetrics.InputPortMetric
Enumeration representing metric names for operator input ports.static class
OperatorMetrics.OutputPortMetric
Enumeration representing metric names for operator output ports.
-
Method Summary
Methods Modifier and Type Method and Description Metric
createCustomMetric(java.lang.String name, java.lang.String description, Metric.Kind kind)
Create a custom metric specific to this operator.Metric
getCustomMetric(java.lang.String name)
Return a custom metric either previously created by createCustomMetric or specified in the operator model.java.util.Map<java.lang.String,Metric>
getCustomMetrics()
Returns a read-only view of the operator's custom metrics.Metric
getInputPortMetric(int port, OperatorMetrics.InputPortMetric name)
Get a read-only Metric for a specific operator input port.Metric
getOutputPortMetric(int port, OperatorMetrics.OutputPortMetric name)
Get a read-only Metric for a specific operator output port.
-
-
-
Method Detail
-
createCustomMetric
Metric createCustomMetric(java.lang.String name, java.lang.String description, Metric.Kind kind)
Create a custom metric specific to this operator. The initial value of the metric is zero.- Parameters:
name
- Name of the metric, the actual value used for the metric's name is trimmed usingtrim()
.description
- Description of the metric.kind
- Kind of the metric- Returns:
- The Metric object for the custom metric.
- Throws:
java.lang.IllegalArgumentException
- Metricname
already exists.java.lang.IllegalArgumentException
- Empty String is passed forname
.java.lang.NullPointerException
- An argument (name
,description
orkind
) is null.java.lang.IllegalStateException
- Operator has been shutdown.
-
getCustomMetric
Metric getCustomMetric(java.lang.String name)
Return a custom metric either previously created by createCustomMetric or specified in the operator model.- Parameters:
name
- Name of the metric, the actual value used for the metric's name is trimmed usingtrim()
.- Returns:
- The Metric object for the custom metric.
- Throws:
java.lang.IllegalArgumentException
- Metricname
does not exist.java.lang.NullPointerException
-name
is null.java.lang.IllegalStateException
- Operator has been shutdown and the metric has not been accessed previously.- See Also:
createCustomMetric(String, String, com.ibm.streams.operator.metrics.Metric.Kind)
-
getCustomMetrics
java.util.Map<java.lang.String,Metric> getCustomMetrics()
Returns a read-only view of the operator's custom metrics. The map's key is a custom metric's name and its value is the corresponding Metric object. Includes all custom metrics including those defined by the operator model and those defined dynamically using SPL orcreateCustomMetric(String, String, com.ibm.streams.operator.metrics.Metric.Kind)
The returned map is a view of the current state of the operator's custom metrics and its contents can change if custom metrics are being created dynamically.- Returns:
- A read-only map of the operator's custom metrics.
- Since:
- InfoSphere® Streams Version 2.0.0.3
-
getInputPortMetric
Metric getInputPortMetric(int port, OperatorMetrics.InputPortMetric name)
Get a read-only Metric for a specific operator input port.- Parameters:
port
- Port for the metric.name
- Enumeration representing the name of the metric.- Returns:
- A read-only Metric.
- Throws:
java.lang.NullPointerException
-name
is null.java.lang.IllegalStateException
- Operator has been shutdown and the metric has not been accessed previously.
-
getOutputPortMetric
Metric getOutputPortMetric(int port, OperatorMetrics.OutputPortMetric name)
Get a read-only Metric for a specific operator output port.- Parameters:
port
- Port for the metric.name
- Enumeration representing the name of the metric.- Returns:
- A read-only Metric.
- Throws:
java.lang.NullPointerException
-name
is null.java.lang.IllegalStateException
- Operator has been shutdown and the metric has not been accessed previously.
-
-