Are multiple StatisticsCollector policies allowed in a proxy?

sgilson
Participant V

I used the Beta version of the Solution Builder to create custom analytics variables for an API proxy. When I configured it, I selected a request variable (a query param) and a response variable (a response header) to track.

The Solution Builder created two ExtractVariables policies and two StatisticsCollector policies: one each in the request flow and in the response flow.

But the doc states that you are only allowed to put one StatisticsCollector policy in a proxy, and it must be in the response flow.

Has that restriction been removed?

Thanks,

Stephen

Solved Solved
1 5 407
1 ACCEPTED SOLUTION

sgilson
Participant V

So it looks like you can put a StatisticsCollector anywhere in the API proxy, meaning in any request or response flow, but you can only use one StatisticsCollector policy in the API proxy. If there are multiple StatisticsCollectors in an proxy, the last one to execute determines the data written to the analytics server.

Stephen

View solution in original post

5 REPLIES 5

I am also curious to know, I thought we could always attach multiple stats collector policies, for eg, i remember using it in response and fault flows

sgilson
Participant V

So it looks like you can put a StatisticsCollector anywhere in the API proxy, meaning in any request or response flow, but you can only use one StatisticsCollector policy in the API proxy. If there are multiple StatisticsCollectors in an proxy, the last one to execute determines the data written to the analytics server.

Stephen

ok, so it also mean, I could have 2 statistics collector policies one in response and one in fault flow - only of them would execute for any message based on whether its success or fault

I have not tried that, but from my tests, it should work.

According to the docs, you can have multiple Statistics Collector policies in an API proxy. Say one in the request or response flow, and another in a fault handler. If a fault occurs in the API proxy, then the Statistics Collector in the fault handler determines the data collected. You can use that Statistics Collector to record information about the fault, or to record any other information that you think necessary. The Statistics Collector in the fault handler determines the data collected regardless of whether or not the Statistics Collector in the request/response already executed.