[id='configure_metrics-{context}']
= Enabling {brandname} Metrics
Configure {brandname} to export gauges and histograms.

.Procedure

* Configure metrics declaratively or programmatically.

.Declaratively

[source,xml,options="nowrap",subs=attributes+]
----
<cache-container statistics="true"> <1>
  <metrics gauges="true" histograms="true" /> <2>
</cache-container>
----

<1> Computes and collects statistics about the Cache Manager.
<2> Exports collected statistics as gauge and histogram metrics.

.Programmatically

[source,java]
----
GlobalConfiguration globalConfig = new GlobalConfigurationBuilder()
  .statistics().enable() <1>
  .metrics().gauges(true).histograms(true) <2>
  .build();
----

<1> Computes and collects statistics about the Cache Manager.
<2> Exports collected statistics as gauge and histogram metrics.
