[[metrics]]
= Metrics (`metrics`)

The `metrics` endpoint provides access to application metrics to diagnose the metrics the application has recorded.
This endpoint should not be "scraped" or used as a metrics backend in production.
Its purpose is to show the currently registered metrics so users can see what metrics are available, what their current values are, and if triggering certain operations causes any change in certain values.
If you want to diagnose your applications through the metrics they collect, you should use an xref:reference:actuator/metrics.adoc[external metrics backend].
In this case, the `metrics` endpoint can still be useful.



[[metrics.retrieving-names]]
== Retrieving Metric Names

To retrieve the names of the available metrics, make a `GET` request to `/actuator/metrics`, as shown in the following curl-based example:

include::partial$rest/actuator/metrics/names/curl-request.adoc[]

The resulting response is similar to the following:

include::partial$rest/actuator/metrics/names/http-response.adoc[]



[[metrics.retrieving-names.response-structure]]
=== Response Structure

The response contains details of the metric names.
The following table describes the structure of the response:

[cols="3,1,2"]
include::partial$rest/actuator/metrics/names/response-fields.adoc[]



[[metrics.retrieving-metric]]
== Retrieving a Metric

To retrieve a metric, make a `GET` request to `/actuator/metrics/{metric.name}`, as shown in the following curl-based example:

include::partial$rest/actuator/metrics/metric/curl-request.adoc[]

The preceding example retrieves information about the metric named `jvm.memory.max`.
The resulting response is similar to the following:

include::partial$rest/actuator/metrics/metric/http-response.adoc[]



[[metrics.retrieving-metric.query-parameters]]
=== Query Parameters

The endpoint uses query parameters to xref:rest/actuator/metrics.adoc#metrics.drilling-down[drill down] into a metric by using its tags.
The following table shows the single supported query parameter:

[cols="2,4"]
include::partial$rest/actuator/metrics/metric-with-tags/query-parameters.adoc[]



[[metrics.retrieving-metric.response-structure]]
=== Response Structure

The response contains details of the metric.
The following table describes the structure of the response:

include::partial$rest/actuator/metrics/metric/response-fields.adoc[]



[[metrics.drilling-down]]
== Drilling Down

To drill down into a metric, make a `GET` request to `/actuator/metrics/{metric.name}` using the `tag` query parameter, as shown in the following curl-based example:

include::partial$rest/actuator/metrics/metric-with-tags/curl-request.adoc[]

The preceding example retrieves the `jvm.memory.max` metric, where the `area` tag has a value of `nonheap` and the `id` attribute has a value of `Compressed Class Space`.
The resulting response is similar to the following:

include::partial$rest/actuator/metrics/metric-with-tags/http-response.adoc[]
