Custom variable not visible to analytics custom reports

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:

  1. Generate the ZooKeeper tree using the following command:
    /opt/apigee/apigee-zookeeper/contrib/zk-tree.sh > zktree-output.txt
  2. Search for the custom variable in the ZooKeeper tree output.
  3. 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:
    1. On the Postgres node, log in to PostgreSQL:
      psql -h /opt/apigee/var/run/apigee-postgresql -U apigee apigee
    2. Run the following SQL query:
      select column_name, data_type, character_maximum_length from INFORMATION_SCHEMA.COLUMNS
        where table_name = 'orgname.envname.fact';
  4. 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

  1. 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:

  1. Create /opt/apigee/customer/application/postgres-server.properties file on the Postgres server machine, if it does not already exist.
  2. Add the following line to this file:
    conf_pg-agent_forceonboard=true
  3. Ensure this file is owned by Apigee by using the following command:
    chown apigee:apigee /opt/apigee/customer/application/postgres-server.properties
  4. Restart the Postgres server:
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart
  5. If you have more than one Postgres server, repeat the steps above on all the Postgres servers.
  6. Undeploy and deploy your API proxy that uses the StatisticsCollector policy.
  7. Run the API calls.
  8. Check if the custom variable(s) appear in the custom dimensions in Custom Report.

If the problem persists, contact Apigee Edge Support.