---
title: "IceMX.Metrics.*"
url: https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties
language: swift
docs_index: https://docs.zeroc.com/llms.txt
---

> For an index of every page, see [llms.txt](https://docs.zeroc.com/llms.txt).

# IceMX.Metrics.\*

Programming language: Swift. Other languages: [C++](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/cpp.md), [C#](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/csharp.md), [Java](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/java.md), [JavaScript](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/js.md), [MATLAB](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/matlab.md), [PHP](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/php.md), [Python](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/python.md), [Ruby](https://docs.zeroc.com/ice/3.8/property-reference/icemx-metrics-properties/ruby.md).

Metrics properties use the following prefixes for views, maps, and sub-maps:

- IceMX.Metrics.*view-name*
- IceMX.Metrics.*view-name*.Map.*map-name*
- IceMX.Metrics.*view-name*.Map.*map-name*.Map.*submap-name*

When a view has no `Map.` properties, it includes all maps known to the [Metrics facet](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/metrics-facet/swift.md), using the view's configuration. When a view defines `Map.` properties, it includes only the maps configured under those prefixes.

The same rule applies to sub-maps. If a parent map has no `Map.` properties, its sub-maps inherit its configuration. If the parent defines any `Map.` properties, Ice creates only the explicitly configured sub-maps. An explicitly configured map or sub-map uses its own properties and their defaults.

For a list of supported maps see:

- [The Metrics Facet](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/metrics-facet/swift.md)
- [Glacier2 Metrics](https://docs.zeroc.com/ice/3.8/services/glacier2/glacier2-metrics.md)
- [IceStorm Metrics](https://docs.zeroc.com/ice/3.8/services/icestorm/icestorm-metrics.md)

## Regular Expression Filters

`Accept` and `Reject` rules filter instrumented objects and operations by their attributes. An object or operation must match every applicable `Accept` rule and none of the applicable `Reject` rules to be monitored. A rule for an attribute that is unavailable on that object or operation does not exclude it.

Regular expressions use POSIX extended syntax and must match the entire attribute value.

## IceMX.Metrics.*view*.Accept.*attribute*

`IceMX.Metrics.view.Accept.attribute=regexp`

Requires `attribute` to match `regexp` when that attribute is available on the instrumented object or operation, subject to the other [filter rules](#regular-expression-filters).

For example, to accept monitoring instrumented objects or operations which are from the object adapter named "MyAdapter", you can setup the following accept property:

- `IceMX.Metrics.MyView.Accept.parent=MyAdapter`

## IceMX.Metrics.*view*.Disabled

`IceMX.Metrics.view.Disabled=num`

If `num` is set to a value larger than `0`, the metrics view or the map is disabled. This property is useful to pre-configure a view or map. The view can be disabled initially to not incur overhead and enabled only when needed at runtime.

## IceMX.Metrics.*view*.GroupBy

`IceMX.Metrics.view.GroupBy=delimited attributes`

Sets the attributes by which a map groups the instrumented objects it records: all those with the same values for these attributes are grouped into one metrics object, whose ID is built from these values. The default value is `id`, which groups the instrumented objects that share an ID, such as all the dispatches of one operation on one Ice object.

To group by several attributes, separate them with a space or punctuation (any character other than a letter, a digit or a dot). The separators appear in the IDs: for example, `identity [operation]` groups invocations by proxy identity and operation name, with IDs such as `hello [sayHello]`, and `remoteHost:remotePort` gives IDs such as `192.168.1.10:4061`.

Each map supports its own set of attributes, listed in [Metrics Attributes](https://docs.zeroc.com/ice/3.8/administration/administrative-facility/metrics-facet/swift.md#metrics-attributes) for the Ice runtime, and in [Glacier2 Metrics](https://docs.zeroc.com/ice/3.8/services/glacier2/glacier2-metrics.md) and [IceStorm Metrics](https://docs.zeroc.com/ice/3.8/services/icestorm/icestorm-metrics.md) for these services. A map records an instrumented object only when it can resolve every attribute in `GroupBy`.

A view-level `GroupBy` applies to every map of a view that has no `Map.` properties, so it suits only the attributes every map supports: `id`, `parent` and `none`. In a view with `Map.` properties, each map uses its own `GroupBy`. To group by an attribute that only some maps support, set `GroupBy` on these maps:

```config
IceMX.Metrics.ByOperation.Map.Invocation.GroupBy=operation
IceMX.Metrics.ByOperation.Map.Invocation.Map.Remote.GroupBy=id
IceMX.Metrics.ByOperation.Map.Invocation.Map.Collocated.GroupBy=id

IceMX.Metrics.ByIdentity.Map.Invocation.GroupBy=identity [operation]
IceMX.Metrics.ByIdentity.Map.Invocation.Map.Remote.GroupBy=id
IceMX.Metrics.ByIdentity.Map.Invocation.Map.Collocated.GroupBy=id

IceMX.Metrics.ByPeer.Map.Connection.GroupBy=remoteHost:remotePort
```

A view with `Map.` properties includes only the maps they name. The `Remote` and `Collocated` sub-maps of the Invocation map inherit its `GroupBy` unless they set their own, and they support neither `operation` nor `identity`, so the first two views set their `GroupBy` to `id`.

## IceMX.Metrics.*view*.Reject.*attribute*

`IceMX.Metrics.view.Reject.attribute=regexp`

Excludes an instrumented object or operation when `attribute` matches `regexp`. A matching `Reject` rule takes precedence over any `Accept` rules; see [Regular Expression Filters](#regular-expression-filters).

For example, to reject monitoring instrumented objects or operations which are from the object adapter named "Ice.Admin", you can setup the following reject property:

- `IceMX.Metrics.MyView.Reject.parent=Ice\.Admin`

## IceMX.Metrics.*view*.RetainDetached

`IceMX.Metrics.view.RetainDetached=num`

If `num` is set to a value larger than `0`, up to `num` metrics object whose `current` value is `0` will be kept in memory by the metrics map. This is useful to prevent indefinite memory growth if the monitoring of an instrumented object or operation creates a unique metrics object, only the last `num` metrics object will be kept in memory. The default value is `10`, meaning that at most ten metrics object with a `current` value equal to `0` will be retained by the metrics map.
