Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 2.43 KB

File metadata and controls

60 lines (41 loc) · 2.43 KB
description
This page provides the technical details of the Assign Metrics policy

Assign Metrics

{% hint style="warning" %} This feature requires Gravitee's Enterprise Edition. {% endhint %}

Overview

You can use the assign-metrics policy to push extra metrics in addition to the natively provided request metrics.

These metrics can then be used from analytics dashboards to create custom widgets and, optionally, apply aggregations based on their value.

Functional and implementation information for the assign-metrics policy is organized into the following sections:

Examples

{% hint style="warning" %} This policy can be applied to v2 APIs and v4 proxy APIs. It cannot be applied to v4 message APIs. {% endhint %}

{% tabs %} {% tab title="Proxy API example" %} To display your request distribution based on a particular HTTP header in your dashboards, create the custom metric shown below.

"assign-metrics": {
    "metrics": [
        {
            "name": "myCustomHeader,
            "value": "{#request.headers['X-MyCustomHeader'] != null ? #request.headers['X-MyCustomHeader'][0] : null}"
        }
    ]
}

{% endtab %} {% endtabs %}

Configuration

You can enable or disable the policy with policy identifier policy-assign-metrics.

Phases

The phases checked below are supported by the assign-metrics policy:

v2 PhasesCompatible?v4 PhasesCompatible?
onRequesttrueonRequesttrue
onResponsetrueonResponsetrue
onRequestContenttrueonMessageRequestfalse
onResponseContenttrueonMessageResponsefalse

Compatibility matrix

The following is the compatibility matrix for APIM and the assign-metrics policy:

Plugin VersionSupported APIM versions
1.xUp to 3.1.7
2.x3.18 to 3.20
3.x4.0+