Just a second...

Configuring metrics

You can configure metric collectors using the console or JMX.

Metrics availability

Diffusion™ Cloud servers provide metrics which are made available in several ways:
  • Java Management Extensions (JMX) MBeans
  • through the Diffusion Cloud web console

Metrics and performance

The cost of metrics has been greatly reduced compared to previous versions of Diffusion Cloud .

Topic and client instance statistics have been removed, and replaced with much more efficient metric collectors, which are suitable for production use.

Configuring metric collectors

Metric collectors allow custom aggregation of metrics that are relevant to your application. There are no default metric collectors, only the ones that you create.

There are two types of metric collector:

Session metric collectors

These can be configured to record metric data for a subset of all sessions, specified with a session filter.

The set of metrics recorded by each session metric collector is the same as those recorded for the whole server. For full details of session metrics, see the table in Metrics.

If the session filters of two different session metric collectors select the same session, both will record metrics for that session. It is only valid to add the metrics of different session metric collectors if their session filters select distinct sets of sessions.

You can optionally group the sessions within a collector by session properties.

Topic metric collectors

These can be configured to record metric data for a subset of all topics, specified with a topic selector.

You can optionally group the topics within a collector by topic type.

The set of metrics recorded by each topic metric collector is the same as those recorded for the whole server. For full details of topic metrics, see the table in Metrics.

If the topic selectors of two different topic metric collectors select the same topic, both will record metrics for that topic. It is only valid to add the metrics of different topic metric collectors if their topic selectors select distinct sets of topics.

You can create metric collectors using the Diffusion Cloud web console. See Diffusion management console for further details.

You can also create metric collectors using JMX . The MetricCollectors MBean has attributes which list the topic metric collectors and session metric collectors, together with operations that allow metric collectors to be created, replaced, and removed.

Note that metric collectors are replicated across a cluster unless configurationReplication is disabled in Replication.xml.

Metrics created by metric collectors

The JMX MBean object names used to publish metrics created by metric collectors have an additional property for the metric collector name, and further properties if the metric collector groups the results. Similarly, the Prometheus metric names used for metric collectors have additional dimensions for the metric collector names and grouping keys.

For example, a session metric collector with the name "My Session Metric Collector" that is not grouped by session properties, will publish its metrics to the JMX MBean:

com.pushtechnology.diffusion:type=SessionMetrics,server="server_name",
      name="My Session Metric Collector"

The Prometheus metrics have an additional collector dimension:

diffusion_sessions_connected{collector="My Session Metric Collector"}
diffusion_sessions_open{collector="My Session Metric Collector"}

, and so on.

Suppose the session metric collector is further grouped by the fixed session property $Transport and the application session property Country. Then there will be a separate MBean for each pair of property values. For example:

com.pushtechnology.diffusion:type=SessionMetrics,server="server_name",
      name="My Session Metric Collector",
      $Transport="WEBSOCKET","Country"="France"

The Prometheus metrics are similarly qualified, for example:

diffusion_sessions_connected{collector="My Session Metric Collector", _Transport="WEBSOCKET",Country="France"}

The dimension key in the Prometheus metric name has been adjusted to comply with Prometheus naming restrictions.

Similar naming patterns apply to topic metric collectors. For example, a topic metric collector with the name "My Topic Metric Collector" that is grouped by topic type will have a separate MBean for each matching topic type with a name like:

com.pushtechnology.diffusion:type=TopicMetrics,server="server_name",name="My Topic Metric Collector",Topic Type=JSON

The Prometheus metrics will be of the form:

diffusion_topics_subscriptions{collector="My Topic Metric Collector",type="JSON"}

The Statistics.xml configuration file

Metrics were previously configured in detail via etc/Statistics.xml. Changes to metrics in 6.3 mean that most of the configuration options in Statistics.xml are now deprecated.

  • <statistics>

    The top-level element.

  • <client-statistics>

    This section is used to configure the frequency of session reports to the server log.

  • <topic-statistics>, <publisher-statistics> and <server-statistics> are now deprecated. Topic and server statistics have been replaced by metric collectors, which you can create using the console or MBeans.

In previous versions of Diffusion Cloud , the <reporters> element was used to configure how metrics were distributed.

These reporters have now been removed and the <reporters> element is deprecated. If any reporter configuration is found, a warning will be logged on start up.

It is not necessary to enable a JMX statistics reporter. JMX MBeans are now always enabled.

The topics and sessions reporters previously configured in Statistics.xml are now replaced with metric collectors. You do not need to enable metric collectors to create them.