Metrics facet implements the Instrumentation Facility to provide convenient access to metrics for the Ice run time and select Ice services. The metrics provided by this facet include the number of threads currently running and their state, the number of connections, information on invocations and dispatch, as well as connection establishment and endpoint name resolution.
On this page:
- metric: an "analytical measurement intended to quantify the state of a system", recorded by the Ice run time, such as bytes sent over a connection.
- metric name: the name of the metric, such as "number of connections".
- metrics map: a collection of metrics objects.
metrics view: a collection of metrics maps. A view contains metrics maps of different types (e.g., connections and threads). Several metrics views can be configured with different purposes. For example, you can have a "debug" metrics view to get detailed metrics of each of the instrumented objects in the Ice communicator. This view can be enabled from time to time for debugging purposes but it's disabled most of the time. You could also have a more coarse-grained metrics view to collect data at a higher level, such as the amount of bytes received and sent by all the connections from the communicator. This metrics view can be enabled all the time.
Metrics are specified as Slice classes defined in the
Ice/Metrics.ice Slice file. All the metrics types are defined in the
The base class is
A metrics object is an instance of
IceMX::Metrics and represents metrics of one or more instrumented objects. An instrumented object can be anything that supports instrumentation. The Ice run time supports instrumentation of the following objects and activities:
- Connection establishment
- Endpoint resolution
id of a metric identifies the instrumented object(s). The
current members specify the total and current number of instrumented objects created since the creation of the Ice communicator, respectively. The
totalLifetime member is the sum of the lifetime of each instrumented object and
failures is the number of failures that have occurred for the metrics object(s).
Failures are specified using a separate
failures dictionary provides the count of each type of failure for a metric identified by
id. Failures are dependent on the instrumented objects. For example, failures for Ice connections are represented with the name of the exception that caused the connection to fail (e.g.,
A metrics map is simply defined as a sequence of
IceMX::Metrics objects, and a metrics view is defined as a dictionary of metrics map:
The key for the metrics view dictionary is a string that identifies the metrics map. The Ice run time supports the following metrics maps:
|Metrics map name||Slice class||Description|
|Thread||Thread metrics. The Ice run time instruments threads for the communicator's thread pools |
as well as threads used internally.
|Invocation||Client-side proxy invocation metrics.|
|Dispatch||Server-side dispatch metrics.|
|EndpointLookup||Endpoint lookup metrics. For tcp, ssl and udp endpoints, this corresponds to|
the DNS lookups made to resolve the host names in endpoints.
|ConnectionEstablishment||Connection establishment metrics.|
A metrics map can also contain sub-metrics maps. An example is the
Invocation metrics map, which provides a
Remote sub-metrics map to record metrics associated with remote invocations. The Slice class for remote invocation metrics is
The Slice interface
IceMX::MetricsAdmin allows you to retrieve the metrics associated with the Ice communicator:
getMetricsViewName operation retrieves the names of the configured enabled and disabled views. The enableMetricsView and disableMetricsView allow to enable and disable a specific view. Calling those methods is equivalent to setting the view Disabled property to 1 or 0.The
getMetricsView operation returns the metrics for the given view. The
getMetricsFailures operations retrieve the metrics failures for a given map or metrics id.
Obtaining the Local Metrics Facet
We already showed how to obtain a proxy for a remote administrative facet, but suppose you want to interact with the facet in your local address space. The code below shows the necessary steps:
As shown here, the facet is registered with the name
Metrics and a regular language cast is used to downcast the base object type to the
Metrics views are configured with IceMX Metrics properties.
Reject properties are specified using attributes that are specific to each metrics map. The table below describes the attributes supported by the Ice run time's metrics maps.
|id||All||A unique identifier to select the instrumented object or operation.|
|parent||All||The parent of the instrumented object or operation.|
|none||All||The none attribute is a special attribute that evaluates to the empty string.|
|endpoint||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||The stringified endpoint.|
|endpointType||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||The endpoint numerical type as defined in |
|endpointIsDatagram||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||A boolean indicating if the endpoint is a datagram endpoint.|
|endpointIsSecure||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||A boolean indicating if the endpoint is secure.|
|endpointTimeout||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||The endpoint timeout.|
|endpointCompress||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||A boolean indicating if the endpoint requires compression.|
|endpointHost||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||The endpoint host.|
|endpointPort||Connection, Dispatch, Remote, ConnectionEstablishment, EndpointLookup||The endpoint port.|
|connection||Dispatch||The connection description.|
|incoming||Connection, Dispatch, Remote||A boolean where true indicates an incoming (server) connection and false an outgoing (client) connection.|
|Connection, Dispatch, Remote|
If the connection is a server connection, adapterName returns the name of the
|connectionId||Connection, Dispatch, Remote||The ID of the connection if one is set, otherwise it is the empty string.|
|localAddress||Connection, Dispatch, Remote||The connection's local address.|
|localPort||Connection, Dispatch, Remote||The connection's local port.|
|remoteAddress||Connection, Dispatch, Remote||The connection's remote address.|
|remotePort||Connection, Dispatch, Remote||The connection's remote port.|
|mcastAddress||Connection, Dispatch, Remote||The connection's multicast address.|
|mcastPort||Connection, Dispatch, Remote||The connection's multicast port.|
|state||Connection||The state of the connection.|
|operation||Dispatch, Invocation||The dispatched or invoked operation name.|
|identity||Dispatch, Invocation||The identity of the Ice object used for the dispatch or invocation.|
|facet||Dispatch, Invocation||The facet of the Ice object used for the dispatch or invocation.|
|mode||Dispatch, Invocation||The dispatch or invocation mode.|
|context.key||Dispatch, Invocation||The value of the dispatch or invocation context with the given key.|
|proxy||Invocation||The proxy used for the invocation.|
The proxy encoding.
none attributes are supported by all maps.
The value of the
parent attribute depends on the map. For the Connection, Dispatch and Remote maps, the
parent will either be "Communicator" if the connection is a client connection, or the object adapter name if it's a server connection. For the Invocation, EndpointLookup, and ConnectionEstablishment maps, it will always be "Communicator". The
parent attribute enables the filtering of metrics based on the object adapter. When used with the
GroupBy property it also allows you to obtain metrics at the object adapter level. For instance, the following configuration does not monitor any metrics for the
Ice.Admin object adapter and it groups all the metrics based on the object adapter or communicator:
This configuration enables the communicator to get metrics on a per object adapter or communicator basis.
You can also use the
none attribute to get metrics for the communicator including the metrics from object adapters, e.g.,
IceMX.Metrics.MyView.GroupBy=none. This provides the lowest possible level of detail as all the statistics will be recorded by a single metrics object.
id attribute allows you to get a higher level of detail by recording metrics on a per instrumented object or operation basis. If you specify
Metrics facet will record metrics for each individual object or operation.