apigee统计收集器/自定义报告不起作用

时间:2015-04-03 09:19:00

标签: statistics report analytics apigee

我坚持使用Statistics Collector生成自定义报告。

我的情景,

我有一个名为" icustomer"的集合的BaaS数据库。它的名称/价值对很少。

我创建了一个代理(icustomer)来显示特定的客户(资源名称特定的),具体取决于唯一的" cust_id"。

对于特定客户,我做了"提取变量并分配变量策略"哪个工作正常。

现在,为了获取自定义报告,我再次添加了一个Extract Variable策略,用于从JSON Path中提取cust_id,然后添加了Statistic Collector策略以获取统计信息。

然后我从Google Analytics创建了一个新报告并将其保存。但报告尚未生成。我得到的只是" NO_ID"报告。

我哪里出错了?

代理端点代码

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
    <Description/>
<PreFlow name="PreFlow">
    <Request/>
    <Response/>
</PreFlow>
<Flows>
    <Flow name="specficcust">
        <Description/>
        <Request/>
        <Response/>
        <Condition>(proxy.pathsuffix MatchesPath &quot;/{cust_id}&quot;) and (request.verb = &quot;GET&quot;)</Condition>
    </Flow>
</Flows>
<PostFlow name="PostFlow">
    <Request/>
    <Response/>
</PostFlow>
<HTTPProxyConnection>
    <BasePath>/icustomer</BasePath>
    <VirtualHost>default</VirtualHost>
    <VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>
<RouteRule name="default">
    <TargetEndpoint>default</TargetEndpoint>
</RouteRule>
 </ProxyEndpoint>

目标端点代码

<?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>
        <Condition>(proxy.pathsuffix MatchesPath &quot;/{cust_id}&quot;) and (request.verb = &quot;GET&quot;)</Condition>
        <Response/>
    </Flow>
</Flows>
<PostFlow name="PostFlow">
    <Response>
        <Step>
            <FaultRules/>
            <Name>Extracting-for-Stats</Name>
        </Step>
        <Step>
            <FaultRules/>
            <Name>Statistics-Collector-1</Name>
        </Step>
    </Response>
    <Request/>
</PostFlow>
<HTTPTargetConnection>
    <URL>https://api.usergrid.com/siddharth1/sandbox/icustomer</URL>
</HTTPTargetConnection>
</TargetEndpoint>

提取统计代码 -

<?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>$.entities[0].cust_id</JSONPath>
    </Variable>
</JSONPayload>
<Source clearPayload="false">response</Source>
<VariablePrefix>apigee</VariablePrefix>

</ExtractVariables>

统计信息收集器代码 -

<?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>

1 个答案:

答案 0 :(得分:0)

您的ExtractVariables指定了“apigee”的VariablePrefix。我希望可以从apigee.customer_id而不是customer_id访问提取的字段,这将在StatisticsCollector检查中返回null。我认为这就是你获得默认“NO_ID”的原因。