Was this helpful?

The StatisticsCollector policy type 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.

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.

For usage, see Analyze API message content using custom analytics.

For more information on how to analyze your data using Apigee analytics, see Analyze API message content using custom analytics.

Configuring a Statistics Collector policy

Configure the StatisticsCollector Policy using the following elements.

Field Name Description
name Custom name provided for the referenced variable. The name cannot contain spaces or dashes. In the example below, the referenced variable is product.id.
ref Flow variable that can be a predefined variable or a variable defined in the XML payload of the Extract Variables policy. See Extract message content using ExtractVariables.
type Valid values: string/integer/float/long/boolean/double

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.

Note that in the example below, if defaultval is not provided, the variable is typically assigned during the message flow.

Example - Statistics Collector policy

<StatisticsCollector name="publishPurchaseDetails">
<Statistics>
<Statistic name="productID" ref="product.id" type="string">{defaultval}</Statistic>
<Statistic name="price" ref="product.price" type="string">{defaultval}</Statistic>
</Statistics>
</StatisticsCollector>

Policy-specific error codes

The default format for error codes returned by Policies is:

{
  "code" : " {ErrorCode} ",
  "message" : " {Error message} ",
  "contexts" : [ ]
}

The StatisticsCollector Policy type defines the following error codes:

Error Code Message
DatatypeMissing StatisticsCollection {0}: Datatype of {1} is missing. Context {2}
UnsupportedDatatype StatisticsCollection {0}: Datatype {1} is unsupported . Context {2}

Policy schema

Each policy type is defined by an XML schema (.xsd). For reference, policy schemas are available on GitHub.

コメント

No policy schema for this policy. If you could attach that would be great. Thanks!

Paul--sorry for the delay. We are now publishing the schemas on GitHub:
https://github.com/apigee/api-platform-samples/tree/master/schemas/policy
Appreciate your patience while we complete the collection.
Thanks

Need to add documentation on the different optional fields. Ex: enabled="true" continueOnError="true" async="true" and what each one does.

Thanks--those settings are common to all policies, so we document them here.
http://apigee.com/docs/api-platform/content/api-proxy-configuration-reference
We will add a reference to make this clearer in the future.

Something to know about the 'name' attribute in element: "This name attribute is a column family name in postgres. The postgres version we use does not allow spaces or dashes in the column family names."

-- this came from Apigee Support and probably should be included in the documentation.

Thanks, Jeof --
I qualified the description of "name" as you suggested.
--Will

コメントを追加

Provide your email address if you wish to be contacted offline about your comment.
We will not display your email address as part of your comment.

We'd love your feedback and perspective! Please be as specific as possible.
Type the characters you see in this picture. (verify using audio)

Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.