Skip to content

First release candidate of MP-Metrics 2.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@pilhuhn pilhuhn released this 07 May 07:03
<dependency>
    <groupId>org.eclipse.microprofile.metrics</groupId>
    <artifactId>microprofile-metrics-api</artifactId>
    <version>2.0-RC1</version>
</dependency>

Changes in 2.0 (see spec document for a nicer rendering of the list):

  • Refactoring of Counters, as the old @counted was misleading in practice.

    • Counters via @counted are now always monotonic, the monotonic attribute is gone. The Counted interface lost the dec() methods.
    • Former non-monotonic counters are now @ConcurrentGauge and also in the output reported as gauges.
    • See Migration hints about migration of applications using MicroProfile Metrics.
  • Removed unnecessary @InterceptorBinding annotation from org.eclipse.microprofile.metrics.annotation.Metric.

  • Removed deprecated org.eclipse.microprofile.metrics.MetricRegistry.register(String name, Metric, Metadata)

  • Metadata is now immutable and built via a MetadataBuilder.

  • Introduced a Tag object which represents a singular tag key/value pair.

  • Metrics are now uniquely identified by a MetricID (combination of the metric’s name and tags).

  • MetricFilter modified to filter with MetricID instead of name

  • The 'Metadata' is mapped to a unique metric name in the MetricRegistry and this relationship is immutable.

  • Tag key names for labels are restricted to match the regex [a-zA-Z_][a-zA-Z0-9_]*.

  • Tag values defined through MP_METRICS_TAGS must escape equal signs = and commas , with a backslash .

  • JSON output format for GET requests now appends tags along with the metric in metricName;tag=value;tag=value format. JSON format for OPTIONS requests have been modified such that the 'tags' attribute is a list of nested lists which holds tags from different metrics that are associated with the metadata.

  • OpenMetrics format - formerly called Prometheus format

    • Reserved characters in OpenMetrics format must be escaped.

    • In OpenMetrics output format, the separator between scope and metric name is now a _ instead of a :.

    • Metric names with camelCase are no longer converted to snake_case for OpenMetrics output.

    • The default value of the reusable attribute for metric objects created programmatically (not via annotations) is now true

  • Some base metrics' names have changed to follow the convention of ending the name of accumulating counters with total.

  • Some base metrics' types have changed from Counter to Gauge since Counters must now count monotonically.

  • Some base metrics' names have changed because they now use tags to distinguish metrics for multiple JVM objects. For example, each existing garbage collector now has its own gc.total metric with the name of the garbage collector being in a tag. Names of some base metrics in the OpenMetrics output are also affected by the removal of conversion from camelCase to snake_case.

  • Added a set of recommendations how application servers with multiple deployed applications should behave if they support MP Metrics.