You're viewing Apigee Edge documentation.
Go to the
Apigee X documentation. info
Symptom
The custom variable created using the StatisticsCollector policy is not visible under Custom Dimensions in the Analytics Custom Reports in the Edge UI.
Error messages
No errors are observed.
Possible causes
The following table lists possible causes of this issue:
Cause | For |
---|---|
Custom Variable not adhering to the standard guidelines | Edge Private and Public Cloud users |
No traffic on API Proxy implementing the StatisticsCollector policy | Edge Private and Public Cloud users |
Custom variable not pushed to Postgres Server | Edge Private Cloud users |
Click a link in the table to see possible resolutions to that cause.
Custom Variable not adhering to the standard guidelines
Diagnosis
If the custom variable name used in the StatisticsCollector policy does not adhere to the standard guidelines (see Resolution), then it will not appear in the Custom Reports.
The code snippet below shows that the variable name "product id" has a space, so it will not appear under the Custom Dimension in the Custom Report.
<StatisticsCollector name="publishPurchaseDetails"> <Statistics> <Statistic name="productID" ref="product id" type="string">999999</Statistic> </Statistics> </StatisticsCollector>
Resolution
Custom variable names used in the StatisticsCollector policy within the API proxy should adhere to the following guidelines:
- Names can include [a-z][0-9] and '_'.
- Names cannot include spaces. For example, in the code sample shown above, the variable name should be changed to "product_id".
- Case is ignored.
- Reserved keywords listed in the table at the following link are not permitted. For example, "user" is not permitted. For more information, see SQL Key Words.
If the problem persists, then proceed to No traffic on API Proxy implementing the StatisticsCollector policy.
No traffic on API Proxy implementing the StatisticsCollector policy
Diagnosis
If there is no traffic on the API proxy that implements the StatisticsCollector policy, then the custom variable will not appear in the Custom Reports.
Resolution
Make some calls to the API proxy that implements the StatisticsCollector policy.
Wait for some time and check if the custom variable(s) appears in the custom dimensions in Custom Report.
If the problem persists, then proceed to Custom Variable not pushed to Postgres Server.
Custom variable not pushed to Postgres Server
Diagnosis
When a custom variable is created in the API proxy and API calls are made, the variable first gets stored in-memory on the Message Processor. The Message Processor then sends the information about the new variable to ZooKeeper, which in turn sends it to the Postgres server to add it as a column in the Postgres database.
At times, the notification from ZooKeeper may not reach the Postgres server due to network issues. Because of this error, the custom variable might not appear in the Custom Report.
To identify where the custom variable is missing:
- Generate the ZooKeeper tree using the following command:
/opt/apigee/apigee-zookeeper/contrib/zk-tree.sh > zktree-output.txt
- Search for the custom variable in the ZooKeeper tree output.
- If the custom variable exists in the ZooKeeper tree, then execute the
following commands to check if the custom variable is added to the Postgres
database:
- On the Postgres node, log in to PostgreSQL:
psql -h /opt/apigee/var/run/apigee-postgresql -U apigee apigee
- Run the following SQL query:
select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS where table_name = 'orgname.envname.fact';
- On the Postgres node, log in to PostgreSQL:
- Very likely you will see that custom variable column will be missing in the fact table which is the reason for it not to appear in the Custom Dimensions.
Resolution
Solution #1: Restart the Postgres Server
- Restart the Postgres Server to force it to read all information relevant to
Analytics from Zookeeper:
/opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
If the problem persists, apply Solution #2.
Solution #2: Enable the property forceonboard
Enable the forceonboard property using the below steps:
- Create
/opt/apigee/customer/application/postgres-server.properties
file on the Postgres server machine, if it does not already exist. - Add the following line to this file:
conf_pg-agent_forceonboard=true
- Ensure this file is owned by Apigee by using the following command:
chown apigee:apigee /opt/apigee/customer/application/postgres-server.properties
- Restart the Postgres server:
/opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
- If you have more than one Postgres server, repeat the steps above on all the Postgres servers.
- Undeploy and deploy your API proxy that uses the StatisticsCollector policy.
- Run the API calls.
- Check if the custom variable(s) appear in the custom dimensions in Custom Report.
If the problem persists, contact Apigee Edge Support.