Analytics Support for C++ SDK
Two of the existing API methods, which were previously only used for adding data to a snapshot, will now send Analytics data if Analytics is enabled for the current Business Transaction on the Controller:
-
Set URL for a snapshot: the URL is set for a snapshot if one is occurring. The data should be either 7-bit ASCII or UTF-8. You can call this function when a snapshot does not occur. When the given Business Transaction is not snapshotting, this function returns immediately. However, if extracting the data to pass to this function is expensive, you can use
appd_bt_is_snapshotting
to check if the Business Transaction is snapshotting before extracting the data and calling this function.void appd_bt_set_url(appd_bt_handle bt, const char* url);
- param bt: The business transaction to add the user data to, if it is taking a snapshot.
- param url: The value of the URL for the snapshot as 7-bit ASCII or UTF-8.
-
Add user data to a snapshot: the data should be either 7-bit ASCII or UTF-8. You can call this function when a snapshot does not occur or if Analytics is not enabled. If the data is only for snapshotting and extracting the data to pass to this function is expensive, you can use
appd_bt_is_snapshotting
to check if the Business Transaction is snapshotting before extracting the data, and calling this function.void appd_bt_add_user_data(appd_bt_handle bt, const char* key, const char* value);
- param bt: The business transaction to add the user data to, if it is taking a snapshot.
- param key: The name of the user data to add to the snapshot as 7-bit ASCII or UTF-8.
- param value: The value of the user data to add to the snapshot as 7-bit ASCII or UTF-8.
These API methods existed previously, but their behavior did not extend to reporting data to Analytics. To correctly connect to Analytics, initialize using the following configuration APIs:
void appd_config_set_analytics_host(struct appd_config* cfg, const char* host);
- param host: The host for the Analytics Agent, which defaults to
localhost
.
void appd_config_set_analytics_port(struct appd_config* cfg, const unsigned short port);
- param port: The port that the Analytics Agent listens on, which defaults to 9090.