On this page: Related pages: |
This page describes the functions, structures, and environment variables defined in the C/C++ SDK to instrument C/C++ applications.
The API includes functions to create business transactions, transaction backends/exit points, and define custom metrics.
The C/C++ SDK defines the following opaque types:
appd_bt_handle
: A handle to an active business transactionappd_exitcall_handle
: A handle to an active exit callstruct appd_config*
: A pointer to a configuration objectstruct appd_context_config*
: A pointer to a context configuration object
Initializes an empty configuration structure. Call this function before before calling appd_sdk_init()
.
APPD_API struct appd_config * appd_config_init ()
cfg
: Set an enable/disable flag for Analytics Agent reporting. When disabled, Analytics-related logging messages are suppressed.
APPD_API void appd_config_set_analytics_enabled(struct appd_config* cfg, const unsigned short enable)
cfg
:enable
: The enable/disable flag for the Analytics Agent. If the value is non-zero, the agent is enabled. If the value is zero (default setting), then the agent is disabled.Set business application name.
appd_config_set_app_name(cfg, APP_NAME);
APP_NAME
: Name of the application.Set tier name.
appd_config_set_tier_name(cfg, TIER_NAME);
cfg: configuration object.
TIER_NAME
: Name of the tier.
Set node name.
appd_config_set_node_name(cfg, NODE_NAME);
cfg
– NODE_NAME
– Name of the node.Set hostname of the Controller.
appd_config_set_controller_host(cfg, CONTROLLER_HOST);
cfg
: CONTROLLER_HOST
: Name of the Controller host.
Set the port number on which the Controller is listening.
appd_config_set_controller_port(cfg, CONTROLLER_PORT);
cfg
: CONTROLLER_PORT
: Port number that the Controller is listening on.Set the account name for connecting to the Controller.
appd_config_set_controller_account(cfg, CONTROLLER_ACCOUNT);
cfg
: CONTROLLER_ACCOUNT
: Account name that the Controller is connected to.Set the access key for connecting to the Controller.
appd_config_set_controller_access_key(cfg, CONTROLLER_ACCESS_KEY);
cfg
: CONTROLLER_ACCESS_KEY:
Access key for connecting to the Controller.Specify whether SSL should be used to communicate with the Controller.
appd_config_set_controller_use_ssl(cfg, CONTROLLER_USE_SSL);
cfg
: CONTROLLER_USE_SSL:
Whether to use SSL to connect with the Controller. Set to a non-zero integer for true. Set to the integer zero for false. Note that SaaS Controllers require this to be set to non-zero.Optional. Set the hostname of the HTTP proxy if using an HTTP proxy to talk to Controller.
appd_config_set_controller_http_proxy_host(cfg, CONTROLLER_HTTP_PROXY_HOST);
cfg
: CONTROLLER_HTTP_PROXY_HOST
: Hostname of the HTTP proxy if using an HTTP proxy to talk to Controller. Optional. Set the port number of the HTTP proxy. Default is 80.
appd_config_set_controller_http_proxy_port(cfg, CONTROLLER_HTTP_PROXY_PORT);
cfg:
CONTROLLER_HTTP_PROXY_PORT
: Port name of the HTTP proxy. Default is 80.Optional. Set the username to connect to the HTTP proxy with.
appd_config_set_controller_http_proxy_username(cfg, CONTROLLER_HTTP_PROXY_USERNAME);
cfg
: CONTROLLER_HTTP_PROXY_USERNAME
: Username to connect to the HTTP proxy with.Optional. Set the password to connect to the HTTP proxy with.
appd_config_set_controller_http_proxy_password(cfg, CONTROLLER_HTTP_PROXY_PASSWORD);
cfg
: CONTROLLER_HTTP_PROXY_PASSWORD
: Password to connect to the HTTP proxy with.Optional. Set the file containing password to connect to the HTTP proxy with.
appd_config_set_controller_http_proxy_password_file(cfg, CONTROLLER_HTTP_PROXY_PASSWORD_FILE);
cfg
: CONTROLLER_HTTP_PROXY_PASSWORD_FILE
: File containing password to connect to the HTTP proxy with.Optional. Set the the CA certificate file name. Set this if you choose to use your own certificate file.
appd_config_set_controller_certificate_file(cfg, CONTROLLER_HTTP_CERTIFICATE_FILE);
cfg
: CONTROLLER_CERTIFICATE_FILE
: Name of the certificate file. Defaults to the included ca-bundle.
crt file. Optional. Set the full path to the CA certificate file. Set this if you have multiple certificate files.
appd_config_set_controller_certificate_dir(cfg, CONTROLLER_HTTP_CERTIFICATE_DIR);
cfg
: CONTROLLER_CERTIFICATE_DIR
: Full path to the certificate files.Specify whether to collect metrics in the final minute before SDK shutdown—via appd_sdk_term
. By default, metrics reported in the minute before shutdown are lost. If you enable metric flushing, then you can retain the metrics reported in the final minute before shutdown.
APPD_API void appd_config_set_flush_metrics_on_shutdown(struct appd_config* cfg, int enable);
cfg
: int
: Set to a non-zero integer to enable flushing metrics to the Controller. Default is 0.By setting this flag, the |
Set the minimum level of logging that is allowed. If APPD_LOG_LEVEL_TRACE
, all log messages are allowed. If APPD_LOG_LEVEL_FATA
L, only the most severe errors are logged. The default is APPD_LOG_LEVEL_INFO
.
appd_config_set_logging_min_level(cfg, LOGGING_MIN_LEVEL);
cfg
: LOGGING_MIN_LEVEL
: The minimum level of logging that is allowed.APPD_LOG_LEVEL_TRACE
APPD_LOG_LEVEL_DEBUG
APPD_LOG_LEVEL_INFO
APPD_LOG_LEVEL_WARN
APPD_LOG_LEVEL_ERROR
APPD_LOG_LEVEL_FATAL
Set the directory to log to. The process running the SDK must have permissions to create this directory, if it does not already exist, to list the files within it, and to write to the files within it.
appd_config_set_logging_log_dir(cfg, LOGGING_LOG_DIR);
cfg
: LOGGING_LOG_DIR:
The directory where you want to store log files. Defaults to /tmp/appd
.Set the maximum number of log files allowed per tenant. Log files are rotated when they reach this number.
appd_config_set_logging_max_num_files(cfg, LOGGING_MAX_NUM_FILES);
Parameters
cfg
: LOGGING_MAX_NUM_FILES
: The maximum number of log files allowed per tenant. Default is 10.Set the maximum size of an individual log file, in bytes. Log files are rotated when they reach this size.
appd_config_set_logging_max_file_size_bytes(cfg, LOGGING_MAX_FILE_SIZE_BYTES);
cfg
: LOGGING_MAX_FILE_SIZE_BYTES:
The maximum size of an individual log file, in bytes. Default is 5 * 1024 * 1024
.Set the number of milliseconds you want appd_sdk_init
(an asynchronous action) to wait until it has received controller configuration and is ready to capture business transactions. Set this if you want to capture short-running business transactions that occur at application startup and you don't mind the delay of waiting for the Controller to send the configuration.
appd_config_set_init_timeout_ms(cfg, INIT_TIMEOUT_MS);
cfg
: INIT_TIMEOUT_MS
: The number of milliseconds you want appd_sdk_init
(an asynchronous action) to wait until it has received controller configuration and is ready to capture business transactions.Set the environment variable for configuring the SDK. Environment variables are not read by default. You must call this function to configure the SDK via environment variables.
For a list of available environment variables, see Environment Variables.
APPD_API void appd_config_getenv(struct appd_config * cfg, const char * prefix);
cfg
: prefix:
The prefix of the environment variable name, where the environment variable name is <prefix>.<base>. Initializes and returns an empty context configuration structure.
APPD_API struct appd_context_config* appd_context_config_init(const char* context_name)
context_name: N
ame for this context.Add the Controller host to the application context.
APPD_API void appd_context_config_set_controller_host (struct appd_context_config * context_cfg, const char * host)
context_cfg
: A host
: Name of the Controller host.Add the Controller port to the application context.
APPD_API void appd_context_config_set_controller_port (struct appd_context_config * context_cfg, const unsigned short port)
context_cfg
: A port:
Port number that the Controller is listening on.Add the Controller port to the application context.
APPD_API void appd_context_config_set_controller_port (struct appd_context_config * context_cfg, const char * acct)
context_cfg
: A account:
Account name that the Controller is connected to.Add the Controller access key to the application context.
APPD_API void appd_context_config_set_controller_port (struct appd_context_config * context_cfg, const char * key)
context_cfg
: A key:
Access key for connecting to the Controller.Add the Controller access key to the application context.
APPD_API void appd_context_config_set_controller_port (struct appd_context_config * context_cfg, unsigned int * ssl)
context_cfg
: A ssl
: Set to a non-zero integer for true. Set to the integer zero for false. Note that SaaS Controllers require this to be set to non-zero.Optional. Set the hostname of the HTTP proxy if using an HTTP proxy to talk to controller.
APPD_API void appd_context_config_set_controller_http_proxy_host(struct appd_context_config * context_cfg, const char * host);
context_cfg
: A host
: Hostname of the HTTP proxy if using an HTTP proxy to talk to Controller. Optional. Set the hostname of the HTTP proxy if using an HTTP proxy to talk to Controller.
APPD_API void appd_context_config_set_controller_http_proxy_host(struct appd_context_config * context_cfg, const unsigned short port);
context_cfg
: A port:
Port name of the HTTP proxy. Default is 80.Optional. Set the username to connect to the HTTP proxy with.
APPD_API void appd_context_config_set_controller_http_proxy_host(struct appd_context_config * context_cfg, const char * user);
context_cfg
: A user
: Username to connect to the HTTP proxy with.Optional. Set the password to connect to the HTTP proxy with.
APPD_API void appd_context_config_set_controller_http_proxy_host(struct appd_context_config * context_cfg, const char * pwd);
context_cfg
: A pwd
: Password to connect to the HTTP proxy with.Optional. Set the password to connect to the HTTP proxy with.
APPD_API void appd_context_config_set_controller_http_proxy_host(struct appd_context_config * context_cfg, const char * file);
context_cfg
: A file
: File containing password to connect to the HTTP proxy with.Optional. Set the CA certificate file name. Set this if you choose to use your own certificate file.
APPD_API void appd_context_config_set_controller_http_proxy_host(struct appd_context_config * context_cfg, const char * file);
context_cfg
: A file
: Name of the certificate file. Defaults to the included ca-bundle.
crt file. Optional. Set the full path to the CA certificate file. Set this if you have multiple certificate files.
APPD_API void appd_context_config_set_controller_http_proxy_host(struct appd_context_config * context_cfg, const char * dir);
context_cfg
: A dir
: Full path to the certificate files.This function starts the definition of a custom event. Returns a handle to the defined event. By calling appd_custom_event_end()
, the definition of the event is signaled as complete. The event handle returns null on failure.
APPD_API appd_event_handle appd_custom_event_start(const char* application_context, enum appd_event_severity severity, const char* event_sub_type, const char* summary)
application_context
: This string picks one agent out of multiple agents running in multi-tenant mode. If the value is null, the default agent is used.severity
: This is an enum representing the severity of the event. Valid values are APPD_EVENT_SEVERITY_INFO
, APPD_EVENT_SEVERITY_WARNING
, and APPD_EVENT_SEVERITY_ERROR
.event_sub_type
: The string containing the subtype of the custom event. This can be used in the Controller to filter the custom events belonging to a specific subtype.summary
: A string with a brief description of the event.This function adds a detail made up of a name and a value to the definition of a custom event. Returns a non-zero value on success, otherwise zero. This call can be made between the calls of appd_custom_event_start()
and appd_custom_event_end()
. This function can be called multiple times to add details to the event. The event handle returned by appd_custom_event_start()
identifies the right event to add the detail to. If multiple calls to this function are made with the same detail name, then the detail value from the most recent call will be used to associate that detail name.
APPD_API int appd_custom_event_add_detail(appd_event_handle event_handle, const char* detail_name, const char* detail_value)
detail_name
: This string contains the name of the detail that needs to be added. If the value is null or empty, the API fails and returns zero.detail_value
: This string contains the name of the value that needs to be added. If the value is null or empty, the API fails and returns zero.event_handle
: Refers to the event to which the detail needs to be added to. If the value is null or invalid, the API fails and returns zero.This function adds a property made up of a name and a value to the definition of a custom event. Returns a non-zero value on successful, otherwise zero. This call can be made between the calls of appd_custom_event_start()
and appd_custom_event_end()
. This function can be called multiple times to add properties to the event. The event handle returned by appd_custom_event_start()
identifies the right event to add the property to. This property can be used in the Controller to filter the custom events. If multiple calls to this function are made with the same property name, then the property value from the most recent call will be used to associate that property name.
APPD_API int appd_custom_event_add_property(appd_event_handle event_handle, const char* property_name, const char* property_value)
event_handle
: Refers to the event to which the property needs to be added to. If the value is null or invalid, the API fails and returns zero.property_name
: This string contains the name of the property to be added. If the value is null or empty, the API fails and returns zero.property_value
: This string contains the value of the property to be added. If the value is null or empty, the API fails and returns zero.Signals to the C++ SDK that the event definition is complete and queues the event to be sent to the Controller. Returns a zero value on success, otherwise a non-zero value.
APPD_API int appd_custom_event_end(appd_event_handle event_handle)
event_handle
: Used to refer to the event. If the value is null or invalid, the API fails and returns zero.Returns an EUM–ADRUM cookie for a business transaction in an EUM-enabled browser application. You can call this function between appd_bt_begin()
and appd_bt_end()
.
At this time, appd_eum_get_cookie
works only on snapshots that contain call graphs. See Correlate Business Transactions for EUM for more information.
APPD_API const char* appd_eum_get_cookie(appd_bt_handle bt, int https, int short_form, const char* referrer_url, const char* path)
bt
: The handle to the business transaction that the EUM-ADRUM cookie is generated for.https
: When set to a non-zero value, this flag indicates that the incoming request uses the HTTPS protocol. This flag is used to make the EUM cookie secure.short_form
: When set to a non-zero value, this flag indicates that shortened names will be used for sub-cookie names inside the EUM cookie.NULL
or ""
if the referrer URL is unknown.path
: The URL path where the cookie will be stored. This can be set to "/"
in most cases. If set to NULL
or ""
, the default value "/"
is used.Returns
On success, the function returns a string that contains a cookie key and a cookie value separated by =
. Do not free the memory associated with the returned cookie string; when you call appd_bt_end()
, memory is automatically released.
If EUM is disabled or no configuration information has been received from the Controller, then NULL is returned.
Initialize the SDK.
APPD_API int appd_sdk_add_app_context (struct appd_context_config * context_cfg)
context_cfg
: A Initialize the C/C++ SDK. An instrumented application must call this function once, preferably during application startup.
When using |
APPD_API int appd_sdk_init (const struct appd_config * config)
config
: Zero on success, otherwise a non-zero value. If the return value is not zero, a log message describes the error.
Stop the C/C++ SDK. Ends all active business transactions for this agent and stops agent metric reporting to the controller.
If you execute the agent for less than a few minutes, the agent may not have enough time to fully report to the Controller, as this action is done once every 60 seconds. To ensure that any remaining data is transmitted to the Controller, wait at least one minute before issuing the |
APPD_API void appd_sdk_term()
Start a Business Transaction or continue an existing transaction.
Keep in mind that each application is limited to 200 registered business transactions, and each agent is limited to 50 registered business transactions. Like transactions discovered by other types of agents, business transactions that exceed the limit that are reported by the C/C++ SDK are included in the "all other traffic" grouping. Ensure that your agent does not create excessive business transactions and that your implementation does not introduce the possibility of business transaction explosion.
APPD_API appd_bt_handle appd_bt_begin (const char * name, const char * correlation_header)
name
: The name for the business transaction. In the case of a continuing transaction in the current business application with a valid correlation header, the SDK uses the name from the header. Do not use the following characters in transaction names: { } [ ] | & ;correlation_header
: A correlation header if this is a continuing transaction, else NULL
. If specified, the correlation header has been generated by another agent and made available to this agent as a string. The correlation header provides information to enable this transaction to correlate with an upstream transaction.An opaque handle for the business transaction that was started.
Start a business transaction or continue an existing transaction in a multi-tenant Controller environment.
APPD_API appd_bt_handle appd_bt_begin_with_app_context (const char * context, const char * name, const char * correlation_header)
context
: The application context name that this business transaction belongs to.name
: The name for the business transaction. In the case of a continuing transaction in the current business application with a valid correlation header, the SDK uses the name from the header. Do not use the following characters in transaction names: { } [ ] | & ;correlation_header
: A correlation header if this is a continuing transaction, else NULL
. If specified, the correlation header has been generated by another agent and made available to this agent as a string. The correlation header provides information to enable this transaction to correlate with an upstream transaction.Enables a snapshot for a given business transaction. This call can be made between the calls of appd_bt_begin()
and appd_bt_end()
. Returns a non-zero value if the snapshot is successfully enabled, otherwise returns a zero.
APPD_API int appd_bt_enable_snapshot(appd_bt_handle bt)
bt
: The handle to the business transaction for which the snapshot needs to be enabled.End the given business transaction.
APPD_API void appd_bt_end (appd_bt_handle bt)
bt
: The handle to the business transaction to end.Get a BT handle associated with the given GUID by appd_bt_store
.
APPD_API appd_bt_handle appd_bt_get (const char * guid)
guid
: The globally unique identifier that was passed to appd_bt_store
.The handle to the business transaction associated with the given GUID.
In the following cases the SDK logs a warning and returns a handle that you may safely use in other API functions but that will cause these functions to immediately return without doing anything:
Reports whether the agent is currently taking a transaction snapshot. Useful before calling appd_add_user_data()
or appd_bt_set_url()
, since those potentially expensive functions would do nothing if called when a snapshot is not being taken.
APPD_API char appd_bt_is_snapshotting (appd_bt_handle bt)
bt:
The handle to the business transaction to check for snapshotting. Non-zero if the given business transaction is taking a snapshot. Otherwise, zero.
Set URL for a snapshot (if one is being taken).
URL is set for a snapshot if one is occurring. Data should be either 7-bit ASCII or UTF-8.
It is safe to call this function when a snapshot is not occurring. When the given business transaction is NOT snapshotting, this function immediately returns. 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.
APPD_API void appd_bt_set_url (appd_bt_handle bt, const char * url)
bt
: The business transaction to add the user data to, if it's taking a snapshot.Takes a time, in milliseconds, representing the number of milliseconds elapsed since Jan 1, 1970 UTC. The time specified for this function overrides the default start time, which is the time at which the appd_bt_begin()
API is called according to the system clock. By overriding the start time with a specific value, the BT internal start time is disabled, and the specified start time is reported to the Controller.
This function is located in the appdynamics_advanced.h
file, and is only used in special cases.
APPD_API void appd_bt_override_start_time_ms(appd_bt_handle bt, unsigned int timeMS);
bt
: The business transaction to override the timing oftimeMS
: Time in milliseconds since start of epoch (midnight, Jan 1, 1970 UTC).Takes a time, in milliseconds, that overrides the business transaction response time as reported for this business transaction to the Controller.
The C/C++ SDK maintains its own, internal timer for the response time for the business transaction. This timer reflects the elapsed time spent between the bt_begin
and bt_end
calls. In some cases, you may want to set the business transaction timer directly, overriding the default business transaction response timer. For instance, this may be useful for integrating external monitoring systems with AppDynamics.
It is important to note that when calling this function, the reported business transaction will be either the time you specify or the sum of all exit call timings for the transaction, whichever is greatest. This is because a business transaction cannot be reported to take less time than the total of the exit calls it contains.
This function is located in the appdynamics_advanced.h
file, and is only used in special cases.
APPD_API void appd_bt_override_time_ms(appd_bt_handle bt, unsigned int timeMS);
bt
: The business transaction for which to set the response time.timeMS
: The time the business transaction took, in milliseconds.Store a BT handle for retrieval with appd_bt_get
.
This function allows you to store a BT in a global registry to retrieve later. This is convenient when you need to start and end a BT in separate places, and it is difficult to pass the handle to the BT through the parts of the code that need it.
When the BT is ended, the handle is removed from the global registry.
APPD_API void appd_bt_store (appd_bt_handle bt, const char * guid)
bt:
The BT to store.guid:
A globally unique identifier to associate with the given BT.int begin_transaction(uint64_t txid, uint64_t sku, float price) { appd_bt_handle bt = appd_bt_begin("payment-processing", NULL); appd_bt_store(bt, std::to_string(txid).c_str()); // ... } |
Add an error to a business transaction.
Errors are reported as part of the business transaction. However, you can add an error without marking the business transaction as an error (e.g., for non-fatal errors).
APPD_API void appd_bt_add_error (appd_bt_handle bt, enum appd_error_level level, const char * message, int mark_bt_as_error)
bt:
The handle to the business transaction to which the error is added.level:
The error levels are APPD_LEVEL_NOTICE
, APPD_LEVEL_WARNING
, and APPD_LEVEL_ERROR
.
message:
Error message for this error.mark_bt_as_error:
If true, the business transaction experiencing this error is marked as an error transaction. In this case, the business transaction is counted only as an error transaction. It is not also counted as a slow, very slow or stalled transaction, even if the transaction was also slow or stalled. If false, the business transaction is not marked as an error transaction.Attaches user data to transaction snapshots generated for the specified business transaction.
The user data is added to the business transaction but reported only when a transaction snapshot is occurring. In the Controller UI, the user data appears in the Business Data tab of the transaction snapshot details.
It is safe to call this function when a snapshot is not occurring. When the specified business transaction is not taking a snapshot, this function immediately returns.
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 actually taking a snapshot before extracting the data and calling this function.
Data should be either 7-bit ASCII or UTF-8.
APPD_API void appd_bt_add_user_data (appd_bt_handle bt, const char * key, const char * value)
bt
: The business transaction to add the user data to, if it's taking a snapshot.key:
The name of the user data to add to the snapshot as 7-bit ASCII or UTF-8.value:
The value of the user data to add to the snapshot as 7-bit ASCII or UTF-8.Add a declared backend to the current business application. Use appd_backend_declare
to declare a backend before adding it.
This function fails if the type of the backend being added does not have at least one identifying property.
APPD_API int appd_backend_add (const char * backend)
backend:
Pointer to the backend.Zero on success, otherwise a non-zero value. If the return value is not zero, a log message describes the error.
Declare the existence of a backend. Call this only if the backend is not already registered with the C++ SDK instance.
APPD_API void appd_backend_declare (const char * type, const char * unregistered_name)
type:
The type of the backend, from these options: APPD_BACKEND_HTTP
APPD_BACKEND_DB
APPD_BACKEND_CACHE
APPD_BACKEND_RABBITMQ
APPD_BACKEND_WEBSERVICE
APPD_BACKEND_JMS
unregistered_name:
The name of the backend. Must be unique to the C++ SDK instance.
Call to prevent a downstream agent from resolving as this backend. If used, this must be called before appd_backend_add()
.
Normally, if an agent picks up a correlation header for an unresolved backend, it will resolve itself as that backend. This is usually the desired behavior.
However, if the backend is actually an uninstrumented tier that is passing through the correlation header (for example, a message queue or proxy), then you may wish the backend to show up distinct from the tier that it routes to. If you call this function, correlation headers generated for exit calls to this backend in the SDK will instruct downstream agents to report as distinct from the backend.
For example: if you have Tier A talking to uninstrumented Backend B which routes to instrumented Tier C, if you do NOT call this function, the flow map will be A > C. If you DO call this function, the flow map will be A > B > C.
APPD_API int appd_backend_prevent_agent_resolution (const char * backend)
backend:
Pointer to the declared backend.Zero on success, otherwise a non-zero value. If the return value is not zero, a log message describes the error.
Sets an identifying property of a backend. Call once for every identifying property that you want to set. Call this function after appd_backend_declare()
and before appd_backend_add()
.
A backend's identifying properties uniquely identify the downstream component being called. In the Controller UI, these properties are visible in the upper right panel of the backend dashboards.
You must set at least one identifying property when you add a backend of one of the built-in exit call types. The valid properties vary by the following exit call type.
Exit Call Type | Valid Identifying Properties |
---|---|
| HOST , PORT , URL , QUERY STRING |
APPD_BACKEND_DB | HOST , PORT , DATABASE , VENDOR , VERSION |
APPD_BACKEND_CACHE | SERVER POOL , VENDOR |
APPD_BACKEND_RABBITMQ | HOST , PORT , ROUTING KEY , EXCHANGE |
APPD_BACKEND_WEBSERVICE | SERVICE , URL , OPERATION , SOAP ACTION , VENDOR |
APPD_BACKEND_JMS | DESTINATION , DESTINATIONTYPE , VENDOR |
APPD_BACKEND_WEBSPHEREMQ | HOST , PORT , DESTINATION , DESTINATIONTYPE , MAJOR VERSION , VENDOR |
APPD_API int appd_backend_set_identifying_property (const char * backend, const char * key, const char * value)
backend:
Pointer to the backend.key:
Name of the property. For example, DESTINATION or PORT.value:
Value of the property. For example, Order Queue or 3304 Zero on success, otherwise a non-zero value. If the return value is not zero, a log message describes the error.
Report a custom metric.
APPD_API void appd_custom_metric_add (const char * application_context, const char * metric_path, enum appd_time_rollup_type time_rollup_type, enum appd_cluster_rollup_type cluster_rollup_type, enum appd_hole_handling_type hole_handling_type)
application_context:
The application context for this custom metric.metric_path:
The path of the custom metric. This path defines where the custom metric appears in the Metric Browser. Use a pipe character to separate branches in the path. For example, Custom Metrics|MyCustomMetric
defines MyCustomMetric
as a top-level metric in the tree.time_rollup_type:
Specifies how to rollup metric values for this metric over time, from the following: APPD_TIMEROLLUP_TYPE_AVERAGE:
Compute the average value of the metric over time.
APPD_TIMEROLLUP_TYPE_SUM:
Compute the sum of the value of the metric over time.
APPD_TIMEROLLUP_TYPE_CURRENT:
Report the current value of the metric.
cluster_rollup_type
: Specifies how to rollup metric values for this metric across clusters, from the following:
APPD_CLUSTERROLLUP_TYPE_INDIVIDUAL
: Roll-up the value individually for each member of the cluster.
APPD_CLUSTERROLLUP_TYPE_COLLECTIVE
: Roll-up the value across all members of the cluster.
hole_handling_type
: Specifies how to handle holes—gaps where no value has been reported from this metric, from the following: APPD_HOLEHANDLING_TYPE_RATE_COUNTER
: Considers the gap or 0 value to be meaningful in the aggregation of the metric.
APPD_HOLEHANDLING_TYPE_REGULAR_COUNTER
: Does not consider the gap or 0 value to be meaningful in the aggregation of the metric.
For additional information on these parameters, see Create Custom Metrics.
Report a value for a given metric.
APPD_API void appd_custom_metric_report (const char * application_context, const char * metric_path, long value)
application_context
: The application context for this custom metric.metric_path
: The path of the metric to report, as defined by appd_custom_metric_add
.value
: The value to report for the metric. The way the value is aggregated is specified by the roll-up parameters to appd_custom_metric_add
.Add an error to the exit call.
APPD_API void appd_exitcall_add_error (appd_exitcall_handle exitcall, enum appd_error_level level, const char * message, int mark_bt_as_error)
exitcall
: Handle to the exit call.level
: The level of this error are APPD_LEVEL_NOTICE
, APPD_LEVEL_WARNING
, and APPD_LEVEL_ERROR
.
message
: Error message for this error.mark_bt_as_error
: If true, the business transaction making the exit call that is experiencing this error is marked as an error transaction. In this case, the business transaction is counted only as an error transaction. It is not also counted as a slow, very slow or stalled transaction, even if the transaction was also slow or stalled. If false, the business transaction is not marked as an error transaction.Start an exit call to the specified backend as part of a business transaction.
APPD_API appd_exitcall_handle appd_exitcall_begin (appd_bt_handle bt, const char * backend)
bt:
Handle to the business transaction making the exit call.backend
: The destination backend of the exit call. Returns
An opaque handle to the exit call that was started.
Complete the exit call.
APPD_API void appd_exitcall_end (appd_exitcall_handle exitcall)
exitcall
: Handle to the exit call being ended.Get a handle to an exit call associated with a GUID via appd_exitcall_store()
.
APPD_API appd_exitcall_handle appd_exitcall_get (const char * guid)
guid:
The globally unique identifier that was passed to appd_exitcall_store()
.The handle to the exit call associated with the given GUID.
In the following cases, the SDK logs a warning and returns a handle that you may safely use in other API functions but that will cause these functions to immediately return without doing anything:
Get the header for correlating a business transaction.
If a business transaction makes exit calls that you wish to correlate across, you should retrieve the correlation header and inject it into your exit call's payload.
The returned string is freed when the exit call ends. Do not free it yourself.
APPD_API const char* appd_exitcall_get_correlation_header (appd_exitcall_handle exitcall)
exitcall
: Handle to the exit call.On success returns a 7-bit ASCII string containing the correlation information. You can inject this string into the exit call's payload. A downstream agent can then extract the header from that payload and continue the business transaction.
On error, returns the default header that prevents downstream business transaction detection.
Takes a time, in milliseconds, representing the number of milliseconds elapsed since Jan 1, 1970 UTC. The time specified for this function overrides the default start time, which is the time at which the appd_exitcall_begin()
API is called according to the system clock. By overriding the start time with a specific value, the exit call's internal start time is disabled, and the specified start time is reported to the Controller.
This function is located in the appdynamics_advanced.h
file, and is only used in special cases.
APPD_API void appd_exitcall_override_time_ms(appd_exitcall_handle exitCall, int64_t timeMS);
exitCall
: The exit call for which to override the start timetimeMS:
The time that you want to override the exit call start timeTakes a time, in milliseconds, that overrides the exit call time reported to the Controller.
The C/C++ SDK maintains its own internal timer for the time it takes to complete the exit call. In some cases, you may want to disable the exit call's internal timer. For instance, this can be useful for reporting exit calls that are recorded in external monitoring systems and read into an SDK program.
This function is located in the appdynamics_advanced.h
file, and is only used in special cases.
APPD_API void appd_exitcall_override_time_ms(appd_exitcall_handle exitCall, int64_t timeMS);
exitCall
: The exit call for which to set the completion timetimeMS
: The time that you want to override the exit call time.Set the details string for an exit call. This can be used, for example, to add the SQL statement that a DB backend has executed as part of the exit call. This data is then visible in the exit calls details UI for the transaction snapshot.
APPD_API int appd_exitcall_set_details (appd_exitcall_handle exitcall, const char * details)
exitcall
: Handle to the exit call.details
: An arbitrary string to add to the exit call.Zero on success, otherwise a non-zero value. If the return value is not zero, a log message describes the error.
Store an exit call handle for retrieval with appd_exitcall_get()
.
This function allows you to store an exit call in a global registry to retrieve later. This is convenient when you need to start and end the call in separate places, and it is difficult to pass the handle through the parts of the code that need it.
The handle is removed when the exit call (or the BT containing it) ends.
APPD_API void appd_exitcall_store (appd_exitcall_handle exitcall, const char * guid)
exitcall
: The exit call to store.guid
: A globally unique identifier to associate with the given call.appd_exitcall_handle ec = appd_exitcall_begin(bt, "authdb"); appd_exitcall_store(ec, "login-exit"); |
Records the start of a method call in the call stack. To track the duration of your method call, you must call appd_frame_begin
near the start of the method code, and appd_frame_end
when the method returns.
APPD_API appd_frame_handle appd_frame_begin(appd_bt_handle bt, enum appd_frame_type frame_type,
const char* class_name, const char* method_name, const char* file, unsigned int line_number);
bt
: The business transaction for the call graph.frame_type
: The type of the frame. When used in C or C++ code, use APPD_FRAME_TYPE_CPP
.class_name
: The name of the class if this method is a member of the class. This value cannot be NULL.method_name
: The name of the method. This value cannot be NULL.file
: The path of the source file.line_number
: The line number in the source file.An opaque handle for the frame. NULL if an error occurred.
Records the end of a method call in the call stack. To track the duration of your method call, you must call appd_frame_begin
near the start of the method code, and appd_frame_end
when the method returns.
APPD_API void appd_frame_end(appd_bt_handle bt, appd_frame_handle frame);
bt
: The business transaction for the call graph.frame
: The handle of returned by the corresponding appd_frame_begin
call.You can configure the following environment variables for the C/C++ SDK.
Environment Variable | Value |
---|---|
APP_NAME | The name of the application. |
CONTROLLER_ACCESS_KEY | The access key for connecting to the Controller. |
CONTROLLER_ACCOUNT | The account name for connecting to the Controller. |
CONTROLLER_HOST | The hostname of the Controller. |
CONTROLLER_PORT | The port number on which the Controller is listening. |
CONTROLLER_HTTP_PROXY_HOST | If using an HTTP proxy to talk to the Controller, the hostname of that HTTP proxy. |
CONTROLLER_HTTP_PROXY_PASSWORD | The password for connecting to the HTTP proxy. |
CONTROLLER_HTTP_PROXY_PASSWORD_FILE | The file containing password to connect to the HTTP proxy with. |
CONTROLLER_HTTP_PROXY_PORT | The port number of the HTTP proxy. |
CONTROLLER_HTTP_PROXY_USERNAME | The username to connect to the HTTP proxy with. |
CONTROLLER_USE_SSL (optional) | To disable SSL, set to |
CONTROLLER_CERTIFICATE_FILE | The SSL certificate file name for connecting to the Controller. |
CONTROLLER_CERTIFICATE_DIR | The directory where the SSL certificate is located. |
FLUSH_METRICS_ON_SHUTDOWN | To enable metric flushing before shutdown, set to a non-zero integer. |
INIT_TIMEOUT_MS | The number of milliseconds that you want appd_sdk_init, an asynchronous action, to wait until it has received Controller configuration and is ready to capture business transactions. |
| The directory that the logs are saved to. |
LOGGING_LEVEL | The level of severity for which activity is logged. Options: all, trace, debug, info, warn, error. |
LOGGING_MAX_NUM_FILES | The maximum number of log files that can be saved. |
LOGGING_MAX_FILE_SIZE_BYTES | The maximum log file size that can be saved. |
NODE_NAME | The name of the node. |
TIER_NAME | The name of the tier. |
UNIQUE_HOST_ID (optional) | The identifier of the physical host or virtual machine that the agent is installed on. |