custom reports not working.

sidd-harth
Participant V

Hi guys, I'm stuck at generating custom reports using Statistics Collector.

My scenario,

I have an BaaS DB with a collection named "icustomer" which has few name/value pair's.

I created a proxy(icustomer) to display an specific Customer(Resource name- specificcust) depending on unique "cust_id".

For Specific Customer I did "extract variable and assign variable policies" which is working fine.

Now to get custom reports I again added an Extract Variable policy to extract cust_id from JSON Path and then added and Statistic Collector policy to get stats.

Then I created an new report from Analytics and saved it. But reports aren't generated.

Where did I go wrong?

Proxy Link - http://siddharth1-test.apigee.net/icustomer

Extract Variable Policy for stats

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extracting-for-Stats">
    <DisplayName>Extracting for Stats</DisplayName>
    <FaultRules/>
    <Properties/>
   
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <JSONPayload>
        <Variable name="customer_id">
            <JSONPath>$.cust_id</JSONPath>
        </Variable>
    </JSONPayload>
    <Source clearPayload="false">request</Source>
    <VariablePrefix>apigee</VariablePrefix>
    
</ExtractVariables>


Statistic Collector Policy

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<StatisticsCollector async="false" continueOnError="false" enabled="true" name="Statistics-Collector-1">
    <DisplayName>Statistics Collector 1</DisplayName>
    <FaultRules/>
    <Properties/>
    <Statistics>
        <Statistic name="test_cust_id" ref="customer_id" type="STRING">NO_ID</Statistic>
    </Statistics>
</StatisticsCollector>

Target Endpoint Code

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="default">
    <Description/>
    <PreFlow name="PreFlow">
        <Request/>
        <Response/>
    </PreFlow>
    <Flows>
        <Flow name="specficcust">
            <Description/>
            <Request>
                <Step>
                    <FaultRules/>
                    <Name>Extract-Variables-1</Name>
                </Step>
                <Step>
                    <FaultRules/>
                    <Name>Assign-Message-1</Name>
                </Step>
            </Request>
            <Response>
                <Step>
                    <FaultRules/>
                    <Name>Extracting-for-Stats</Name>
                </Step>
            </Response>
            <Response>
                <Step>
                    <FaultRules/>
                    <Name>Statistics-Collector-1</Name>
                </Step>
            </Response>
            <Condition>(proxy.pathsuffix MatchesPath "/{cust_id}") and (request.verb = "GET")</Condition>
        </Flow>
    </Flows>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <HTTPTargetConnection>
        <URL>https://api.usergrid.com/siddharth1/sandbox/icustomer</URL>
    </HTTPTargetConnection>
</TargetEndpoint>

Custom Report Screenshot

244-screenshot-3.jpg

Solved Solved
0 7 722
1 ACCEPTED SOLUTION

Not applicable

Hi @Barahalikar Siddharth

With the provided information it is seems that one of the following reasons are responsible for this issue: 1. In the Target Endpoint Code, there are two <Response> flow in the resource "specficcust" which shouldn't be the there, it should be like following: <Response> <Step> <FaultRules/> <Name>Extracting-for-Stats</Name> </Step> <Step> <FaultRules/> <Name>Statistics-Collector-1</Name> </Step> </Response> 2. Extracting-for-Stats policy should extract the cust_id from response object. <Source clearPayload="false">response</Source> 3. Please check your JSON path in the policy Extracting-for-Stats, it should be $.entities[0].cust_id

View solution in original post

7 REPLIES 7

Not applicable

Hi @Barahalikar Siddharth

With the provided information it is seems that one of the following reasons are responsible for this issue: 1. In the Target Endpoint Code, there are two <Response> flow in the resource "specficcust" which shouldn't be the there, it should be like following: <Response> <Step> <FaultRules/> <Name>Extracting-for-Stats</Name> </Step> <Step> <FaultRules/> <Name>Statistics-Collector-1</Name> </Step> </Response> 2. Extracting-for-Stats policy should extract the cust_id from response object. <Source clearPayload="false">response</Source> 3. Please check your JSON path in the policy Extracting-for-Stats, it should be $.entities[0].cust_id

sidd-harth
Participant V

Thanks for highlighting those 3 things. I made the changes but still I can't get the reports.

As in Statistic Collector Policy, I mentioned "NO_ID" which should come when an invalid "cust_id" is requested. So this is reflecting in the custom reports graphs.

<Statistics>
        <Statistic name="test_cust_id" ref="customer_id" type="STRING">NO_ID</Statistic>
    </Statistics>

247-screenshot-4.jpg

Not applicable

Hi @Barahalikar Siddharth

Seems like the variable customer_id is still not populated in extractVariable policy, you are getting the default value ( NO_ID ) assigned by you, If you are allowed to share the debug Trace information, Can you please post it here.

I have attached it please have a look. It is just for learning purpose so if needed I can even attach the whole proxy zip file.

trace-1427972009844.zip

Not applicable

In the share trace log, "Extracting-for-Stats" policy is not seen executing anywhere. Can you share the proxy and Request made by you.

Yeah I've seen that, don't know why its happening...BTW FYI there is an OAuth policy included which is disabled in the proxy

These are the requests,

http://siddharth1-test.apigee.net/icustomer/F7D4F6

http://siddharth1-test.apigee.net/icustomer/X4L5B2

icustomer-rev5-2015-04-02-1.zip

sidd-harth
Participant V

Hi @seshi ,

I did few changes to the proxy...now both the "Extracting-for-Stats" and "statistics-collector" policies are executing and can be seen in trace. But now I'm getting "not set" in reports.

What I did was, I changed <Response> tags from "specificcust Target Endpoint" to "PostFlow Target Endpont" .

Hope this might help you debug the issue.

251-screenshot-5.jpg