Statistics Collector policy

What

Enables you to collect statistical data for messages processed in a flow, such as product ID, price, REST action, client and target URL, and message length (predefined flow variables as well as custom variables). The data is then provided to the analytics server, which analyzes the statistics and generates reports. You can view the reports through Analytics Services.

Where

This policy can be attached in one of the following locations.

Only one StatisticsCollector policy can be attached to a single API proxy bundle.

ProxyEndpoint

TargetEndpoint

PreFlow

Flow

PostFlow

PreFlow

Flow

PostFlow

Request

→

•

•

•

•

•

•

←

Response

PostFlow

Flow

PreFlow

PostFlow

Flow

PreFlow

You attach the StatisticsCollector policy to the response path in your API proxy, where you can capture and publish a range of statistics to the analytics server.

Samples

You can set the defaultval as shown in the following example to initialize a variable with a static, default value. If you provide a default value, then the default value you provide will be assigned to the variable the variable only when the variable does not get initialized during the message flow. If you do not provide a defaultval, then the variable is assigned normally during the message flow and calls fail if the variable is not resolved.

<StatisticsCollector> attributes

Set to true to specify that the policy should be run in a thread pool different from the pool servicing the request/response flow.

Note: This setting is only used for for internal optimization. Contact Apigee Support via the Support Portal for more information.

false

Optional

continueOnError

Set to false to return an error when a policy fails. This is expected behavior for most policies.

Set to true to have flow execution continue even after a policy fails.

false

Optional

enabled

Set to true to enforce the policy.

Set to false to "turn off" the policy. The policy will not be enforced even if it remains attached to a flow.

true

Optional

name

The internal name of the policy. Characters you can use in the name are restricted to: A-Z0-9._\-$ %. However, the Edge management UI enforces additional restrictions, such as automatically removing characters that are not alphanumeric.

Optionally, use the <DisplayName> element to label the policy in the management UI proxy editor with a different, natural-lanaguage name.

N/A

Required

<DisplayName> element

Use in addition to the name attribute to label the policy in the management UI proxy editor with a different, natural-lanaguage name.

If provided, overrides the existing datatype of ref. Note that the type can be left empty only if ref is a predefined variable or the type is declared in the XML payload of the Extract Variables policy.