I'm using statistics collector and i would like to instead of hardcoding a name i would like to reference a flow variable:
<Statistic name="{custom_stat_name}" ref="_entry" type="String"/>
where custom_stat_name is a flow variable i defined in my proxy
Solved! Go to Solution.
Actually i was able to get this working. What I had was i had a proxy that had a StatisticsCollector policy and i wanted the caller of the proxy (another proxy of mine) to pass in the statistic name and then i would extract it from the query param into a flow variable and then reference it like:
<Statistic name="{my_flow_var}" ref="_entry" type="String"/>
where _entry is also another flow variable. What i ended up doing is i created many <Statistic> elements and did not use a reference to the name so i had something like:
<Statistic name="stat1" ref="_stat1" type="String"/>
<Statistic name="stat2" ref="_stat2" type="String"/>
and if stat1 was in the incoming request like ?stat1=123
and i extracted out stat1 query param into _stat1 flow far but stat2 was not in the request then the above would only write stat1 to statistics and stat2 would be ignored. Conversely if i called my proxy like ?stat2=456 then only stat2 would be written to statistics. I'm not sure if this is the best way but this is how i was able to implement what i needed.
No.
Can you explain in more detail what you are hoping to accomplish?
Actually i was able to get this working. What I had was i had a proxy that had a StatisticsCollector policy and i wanted the caller of the proxy (another proxy of mine) to pass in the statistic name and then i would extract it from the query param into a flow variable and then reference it like:
<Statistic name="{my_flow_var}" ref="_entry" type="String"/>
where _entry is also another flow variable. What i ended up doing is i created many <Statistic> elements and did not use a reference to the name so i had something like:
<Statistic name="stat1" ref="_stat1" type="String"/>
<Statistic name="stat2" ref="_stat2" type="String"/>
and if stat1 was in the incoming request like ?stat1=123
and i extracted out stat1 query param into _stat1 flow far but stat2 was not in the request then the above would only write stat1 to statistics and stat2 would be ignored. Conversely if i called my proxy like ?stat2=456 then only stat2 would be written to statistics. I'm not sure if this is the best way but this is how i was able to implement what i needed.
Ahh Clever!
User | Count |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |