The Fabasoft app.telemetry Software-Telemetry C/C++ API allows you to instrument any C/C++ application with instrumentation points to see what's going on in complex applications.
This chapter lists the available constants to be used for instrumenting your C/C++ application.
Flags are used to specify the type of an event and are passed as argument to every event call. They are predefined by the API with the data type UInt8 and have the following possible values:
For more details about the flags and there meaning see the general chapter “Flags”.
An event will only be logged if the event-level is lower or equal to the value selected in the session or log-definition. The log levels are predefined by the API with the data type UInt8 and have the following possible values:
For more details about the log levels and there meaning see the general chapter “Log Level”.
Parameter types provide type information of parameters in a call to APMEventArgs (see “Method APMEventArgs (C/C++)”)
Name | Value | Description |
---|---|---|
APM_PARAMETERTYPE_INT32 | 1 | parameter is of type UInt32 |
APM_PARAMETERTYPE_INT64 | 2 | parameter is of type UInt64 |
APM_PARAMETERTYPE_STRING | 3 | parameter is an utf-8 encoded string(0 terminated) |
For a list of available standard modules with a set of predefined events see chapter “Standard Modules”.
The SDK already provides a set of predefined events used for general purpose. For a full listing of all available predefined events see the generic chapter "Predefined Events".
Error/Trace Events:
Use these standard events to mark error, warning or info conditions in your application like in the following example:
Code Example |
---|
APMEventStr(anymodule, APM_EVENT_ERROR, APM_EVENT_LEVEL_NORMAL, APM_FLAG_ERROR, "My error message”); APMEventStr(anymodule, APM_EVENT_WARNING, APM_EVENT_LEVEL_NORMAL, APM_FLAG_WARNING, "My warning message”); APMEventStr(anymodule, APM_EVENT_INFO, APM_EVENT_LEVEL_NORMAL, APM_FLAG_NONE, "My info message”); APMEventStr(anymodule, APM_EVENT_TRACE, APM_EVENT_LEVEL_DETAIL, APM_FLAG_ERROR, "My trace message”); |
Key | Name | Purpose |
---|---|---|
APM_APP_PROPERTY_INSTANCE_GUID_KEY | APM_APP_PROPERTY_INSTANCE_GUID_NAME | Instance ID |
Key | Name | Purpose |
---|---|---|
APM_APP_VALUE_VERSION_KEY | APM_APP_VALUE_VERSION_NAME | Application Version |
APM_APP_VALUE_INSTANCE_NAME_KEY | APM_APP_VALUE_INSTANCE_NAME_NAME | Instance Name |
Counter attributes define behavior, aggregation, measurement, representation and labels of registered counters. Some of the attributes can be changed but most must be defined during the initial counter registration.
Name | Description | Type |
---|---|---|
APM_COUNTER_ATTRIBUTE_NONE | End marker for attribute definition lists. | - |
APM_COUNTER_ATTRIBUTE_GROUP_DISPLAY_NAME | Group display name of the counter. | Pointer |
APM_COUNTER_ATTRIBUTE_DISPLAY_NAME | Display name of the counter. | Pointer |
APM_COUNTER_ATTRIBUTE_INSTANCE_NAME | Name of the counter instance. | Pointer |
APM_COUNTER_ATTRIBUTE_INSTANCE_DISPLAY_NAME | Instance display name of the counter. | Pointer |
APM_COUNTER_ATTRIBUTE_DATA_SIZE | Length of the memory buffer for String values. | Number |
APM_COUNTER_ATTRIBUTE_CALLBACK | APMCounterCallback structure address. | Pointer |
APM_COUNTER_ATTRIBUTE_MEASUREMENT_INTERVAL | Interval (in Seconds) of automatic counter recording. | Number |
APM_COUNTER_ATTRIBUTE_AGGREGATION_FUNCTION_NAME | See APM_COUNTER_AGGREGATION_FUNCTION_* constants. | Pointer |
APM_COUNTER_ATTRIBUTE_APPLICATION | APMApplicationHandle of the application that owns the counter. | Number |
APM_COUNTER_ATTRIBUTE_BASE | Base for fractional counter values. | Number |
APM_COUNTER_ATTRIBUTE_WARNING_LIMIT | Warning limit for service check, related to the service check property “warning”, given as string. | Pointer |
APM_COUNTER_ATTRIBUTE_ERROR_LIMIT | Critical limit for service check, related to the service check property “error”, given as string. | Pointer |
Remarks:
The two attributes APM_COUNTER_ATTRIBUTE_WARNING_LIMIT and APM_COUNTER_ATTRIBUTE_ERROR_LIMIT are available with Version 2021 UR 1. Use them to automatically configure a corresponding service check with „warning“ and „error“ property as given, like in the following examples:
Attribute | Value | Service Check |
---|---|---|
APM_COUNTER_ATTRIBUTE_WARNING_LIMIT | “80” | The status of the service check is “Warning” if the value of the counter is above 80. |
APM_COUNTER_ATTRIBUTE_ERROR_LIMIT | “::90” | The status of the service check is “Critical” if the value of the counter is below 90. |
APM_COUNTER_ATTRIBUTE_WARNING_LIMIT | “10::20[15]” | The status of the service check is “Warning” if the value of the counter is above 10 and below 20 for a duration of 15 seconds. |
APM_COUNTER_ATTRIBUTE_ERROR_LIMIT | “error” | The status of the service check is “Critical” if the text of the counter matches “error” (for Counter Type APM_COUNTER_DATATYPE_TEXT). |
Name | Description |
---|---|
APM_COUNTER_TYPE_RAW | Raw counter without special interpretation. |
APM_COUNTER_TYPE_COUNTER | Per second values. |
APM_COUNTER_TYPE_FRACTION | Percent value. |
Name | Description |
---|---|
APM_COUNTER_DATATYPE_UINT32 | 32-Bit Unsigned Integer |
APM_COUNTER_DATATYPE_UINT64 | 64-Bit Unsigned Integer |
APM_COUNTER_DATATYPE_TEXT | UTF-8 Encoded Text |
Name | Description |
---|---|
APM_COUNTER_AGGREGATION_FUNCTION_SUM | Sum |
APM_COUNTER_AGGREGATION_FUNCTION_AVG | Average |
APM_COUNTER_AGGREGATION_FUNCTION_MAX | Maximum |
APM_COUNTER_AGGREGATION_FUNCTION_MIN | Minimum |
APMApplicationHandle is used to identify an application registered in your process by calling APMRegisterApplication (see “Method APMRegisterApplication (C/C++)”). The handle is only valid in the same process until you call APMUnregisterApplication (see “Method APMUnregisterApplication (C/C++)”)
Type Declaration |
---|
typedef UInt32 APMApplicationHandle; |
APMModuleHandle is used to identify a module registered in your process by calling APMRegisterModule (see “Method APMRegisterModule (C/C++)”). The handle is valid only in the same process until you call APMUnregisterModule (see “Method APMUnregisterModule (C/C++)”).
Type Declaration |
---|
typedef UInt32 APMModuleHandle; |
APMCounterHandle is used to identify a counter or counter instance registered using APMRegisterCounter (see “Method APMRegisterCounter (C/C++)”).
Type Declaration |
---|
typedef uint32_t APMCounterHandle; |
APMCounterAttributeType is used to identify which attribute is described by the encompassing APMCounterAttribute structure. See “Counter Attributes (C/C++)” for valid values.
Type Declaration |
---|
typedef uint32_t APMCounterAttributeType; |
APMCounterType specifies the type of the counter registered using APMRegisterCounter (see “Method APMRegisterCounter (C/C++)”). See 2.1.9 "Counter Types (C/C++)" for a list of valid values.
Type Declaration |
---|
typedef uint8_t APMCounterType; |
APMCounterDataType specifies the data-type of the counter registered using APMRegisterCounter (see “Method APMRegisterCounter (C/C++)”). See “Counter Datatypes (C/C++)” for a list of valid values.
Type Declaration |
---|
typedef uint8_t APMCounterDataType; |
APMCounterAttribute is used to pass attributes to the registration function APMRegisterCounter (see “Method APMRegisterCounter (C/C++)”).
Type Declaration |
---|
typedef struct { |
APMCounterCallback is used to pass a counter callback with optional custom data to the APMRegisterCounter (see “Method APMRegisterCounter (C/C++)”) function via the attributes as an APM_COUNTER_ATTRIBUTE_CALLBACK.
Type Declaration |
---|
typedef struct { |
APMEventId is used to identify an event. The event id must be unique per module and you are free to choose a value. Avoid using predefined event ids (see Predefined Events (C/C++)).
APMEventId is declared as:
Type Declaration |
---|
typedef UInt64 APMEventId; |
APMEventLevel is used to specify the importance of an event.
Type Declaration |
---|
typedef UInt8 APMEventLevel; |
Possible values are:
APMEventFlags is used to specify the type of an event.
Type Declaration |
---|
typedef UInt8 APMEventFlags; |
Possible values are:
APMParameterType is used to specify the type of the parameter (see “Method APMEventArgs (C/C++)”).
Code Definition |
---|
typedef UInt8 APMParameterType; |
Possible values are:
Applications may register a callback when calling APMRegisterApplication (see Method APMRegisterApplication (C/C++)”). The callback should enumerate all valid filter values by repeatedly calling APMRegisterFilterValue (see “Method APMRegisterFilterValue (C/C++)”) to register all valid values, that may be selected when starting a Software-Telemetry session. The callback will be triggered by the app.telemetry server, if no filter values are defined for the registered application or once per hour to refresh the values.
Code Definition |
---|
typedef void (APMFUNC *EnumAppFilterValuesCallback)(); |
Values of type APMContext need to be passed during inter-process communication to provide the caller context to the invoked program (see “Method APMGetContext (C/C++)” and “Method APMAttachContext (C/C++)”).
Code Definition |
---|
typedef unsigned char APMContext[16]; |
Values of type APMSyncMark need to be passed during inter-process communication to provide time sequence information (see “Method APMGetSyncMark (C/C++)” and “Method APMSetSyncMark (C/C++)”).
Code Definition |
---|
typedef unsigned char APMSyncMark[16]; |
Pointers of type APMParamHandle are used to register multiple parameters for use with APMEventParam (see “Method APMEventParam (C/C++)” and “Parameter Functions (C/C++)”).
Code Definition |
---|
typedef void *APMParamHandle; |
Call this function once to provide information about the context of the application.
Syntax |
---|
APMDECL_EXTERN APMApplicationHandle APMFUNC APMRegisterApplication( |
Parameters:
Return Value:
Remarks:
Your application must be registered before any events can be fired.
Usage Example |
---|
void RegisterSoftwareTelemetry() |
Call APMRegisterApplicationProperty to register additional application registration properties immediately after you call to APMRegisterApplication to ensure proper operation.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMRegisterApplicationProperty( |
Parameters:
Return Value:
This function does not return any value.
Remarks:
Application registration properties cannot be changed after they have been set.
Usage Example |
---|
void RegisterSoftwareTelemetryGUID() |
Call APMRegisterApplicationValue to register additional static information about your application such as the version number or the display name of this globally unique instance.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMRegisterApplicationValue( |
Parameters:
Return Value:
This function does not return any value.
Remarks:
Application values may be changed at runtime but must not have a high change frequency and do not have any history of previous values.
Usage Example |
---|
void RegisterSoftwareTelemetry() |
Call APMUnregisterApplication at the end of your program to tell app.telemetry agent that your program lifetime ends now.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMUnregisterApplication(APMApplicationHandle application); |
Parameters:
Return Value:
This function does not return any value.
Remarks:
Unregistering all applications will stop the connection to the app.telemetry agent. As reconnecting takes time it is not recommended to unregister and reregister applications frequently.
Usage Example |
---|
void UnregisterSoftwareTelemetry() |
Call this function to register modules inside your application.
Syntax |
---|
|
Parameters:
Return Value:
Remarks:
Usage Example |
---|
//define constants for your events APMApplicationHandle g_applicatione; void RepositoryRegisterEvents() void RegisterSoftwareTelemetry() |
Call APMUnregisterModule if you do not need to trace any more events tied with this module. Calling this function will clean up several internal processes.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMUnregisterModule(APMModuleHandle module); |
Parameters:
Return Value:
This function does not return any value.
Remarks:
You may register and unregister modules any time but you should not reregister a single module frequently as the app.telemetry server has to keep all module registrations to be able to display all requests of a process correctly.
Usage Example |
---|
void CleanupModule(APMModuleHandle module) |
It is required and important to register the events used in your application in order to get the correct event names and parameter descriptions as provided. The APMModuleRegisterEvent-function will tell the app.telemetry server a name for every event-ID and optionally parameter descriptions for the parameters used in the event calls.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMModuleRegisterEvent( |
Parameters:
Return Value:
This function does not return any value.
Remarks:
If an event has more than one parameter you need to separate the parameterdescription with semicolons (;).
Usage Example |
---|
void doRegisterEvents() |
It is useful to register all possible filter values used in your application in order to get a list of available filters with descriptions in the client interface.
You may actively register filter values any time after registering the application by calling the APMRegisterFilterValue method.
To optimize filter registration in case enumeration of filter values is a costly action, the registration of filter values may be performed in the EnumAppFilterValuesCallback function, which is only called if needed (see “EnumAppFilterValuesCallback (C/C++)”).
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMRegisterFilterValue( |
Parameters:
Return Value:
This function does not return any value.
Remarks:
This function may be called inside the EnumAppFilterValuesCallback function which is initiated by the app.telemetry server.
Usage Example |
---|
void EnumAppFilterValuesCallback() |
Call APMRegisterCounter once for every counter or counter instance to make the counter known to the app.telemetry library for collection.
Syntax |
---|
APMDECL_EXTERN APMCounterHandle APMFUNC APMRegisterCounter( |
Parameters:
Usage Example |
---|
static uint32_t g_availableThreadCounter = 0; |
Call APMUpdateCounterAttributes to update some attributes of a registered counter. Note: Only the listed attributes can be updated using this function.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMUpdateCounterAttributes( |
Parameters:
Supported Attributes:
Return Value:
This function does not return any value.
Usage Example |
---|
void UpdateCounters() |
Call APMUnregisterCounter to unregister a previously registered counter to free it’s associated resources and stop any collection.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMUnregisterCounter( |
Parameters:
Usage Example |
---|
void UnregisterCounters() |
Call APMCreateContext to create a new Software-Telemetry context. If the filter value matches a currently started session filter, logging is started for the current execution thread. Make sure to call APMReleaseContext when exiting the context. A context can be regarded as a complete request that is traced through several involved threads or modules. And the full context request has a duration that spans the interval from CreateContext to ReleaseContext.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMCreateContext(APMApplicationHandle app, const char *filtervalue); |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
void beginRequestProcessing(/* ... */) |
Call APMAttachContext to restore the context acquired through APMGetContext in another thread or process (see “Passing Context” and “Method APMGetContext (C/C++)”).
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMAttachContext(APMApplicationHandle app, const APMContext *context); |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
void ContinueRequest(/* ... */, const APMContext *context, APMSyncMark *syncMark) |
Call the APMGetContext-method to get a new context handle.
This context handle is used to synchronize different threads/processes/modules - this helps you track the control flow through a distributed environment. The acquired context handle has to be submitted (either by transmitting over the network or in another way) to the thread/process being called which associates the calling thread with itself by passing the context to the APMAttachContext-method.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMGetContext(APMContext *context); |
Parameters:
Return Value:
Usage Example |
---|
void initiateProcessing(/* ... */) //pass context to another thread, process on the same or a remote machine doRemote(/* data */, context); //do some local processing / wait for the remote processing to complete APMSyncMark syncMark; |
Call the APMGetSyncMark-method to get a synchronization handle that can be passed to another thread/process/module to synchronize control flow.
The difference between a sync mark and a context is:
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMGetSyncMark(APMSyncMark *context); |
Parameters:
Return Value:
Usage Example |
---|
void doRemote(/* ... */, APMContext *context) //application logic, events, ... APMSyncMark syncMark; |
Call APMSetSyncMark to pass a sync mark you got from APMGetSyncMark for synchronizing the sequence of events (see “Synchronizing Timeline with SyncMarks” and “Method APMGetSyncMark (C/C++)”).
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMSetSyncMark(const APMSyncMark *context); |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
void initiateProcessing(/* ... */) //pass context to another thread, process or a remote server doRemote(/* data */, context); //do some local processing/wait for the remote processing to complete |
Call APMReleaseContext to finish logging and to flush logged information to the app.telemetry infrastructure.
Make sure to call APMReleaseContext when exiting the context (when the request is finished).
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMReleaseContext(); |
Parameters:
This function does not take any arguments.
Return Value:
This function does not return any value.
Remarks:
Usage Example |
---|
void doRemote(/* ... */, APMContext *context) |
Call the APMDetachThread-method when processing of a particular request is suspended and will be resumed later in this or another thread in the same process. Pass the handle returned by this method to the APMAttachThread-method to resume processing.
This functionality is in particular useful in queuing systems, where a large number of requests will be queued and processed by a small number of worker threads asynchronous to the initial request. Using the APMDetach-/APMAttachThread methods you can follow the request through the process and even measure the time spent in the queue, even if a different thread continues processing.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMDetachThread(APMTransactionHandle *handle); |
Parameters:
Return Value:
Remarks:
Be careful to use APMDetachThread and APMAttachThread in a balanced way. APMDetachThread will store the current state of the request in memory and APMAttachThread will remove the information from memory while restoring the request state. So calls to APMDetachThread lacking a continuation will leak memory and will leave the request in a "running" state. Multiple calls to APMAttachThread with the same handle will not have an effect, because the request state is only available to the first call to APMAttachThread.
Usage Example |
---|
struct TaskData void initiateProcessing(/* ... */) void processTask(TaskData *task) // process work delete task; |
Call the APMAttachThread-method when processing of a particular request is resumed after being suspended in this or another thread of the same process. Pass the handle returned by APMDetachThread-method to restore the recorded state of the request.
This functionality is in particular useful in queuing systems, where a large number of requests will be queued and processed by a small number of worker threads asynchronous to the initial request. Using the Detach-/AttachThread methods you can follow the request through the process and even measure the time spent in the queue, even if a different thread continues processing.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMAttachThread(APMTransactionHandle handle); |
Parameters:
Remarks:
See “Method APMDetachThread (C/C++)”
Usage Example |
---|
struct TaskData void initiateProcessing(/* ... */) void processTask(TaskData *task) // process work delete task; |
The four APMEvent… functions log Software-Telemetry data. They have the first 4 parameters in common and vary in the options to pass additional parameters.
The common parameters are:
Call the APMEvent function to log an event without parameters. Only the event-ID and the flags define the representation of the event that will be displayed with the registered event name for the used id.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMEvent( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: |
Use APMEventArgs to log an event with various parameters, which must be passed in a predefined format.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMEventArgs( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: UInt32 par32 = 4; void *mem = calloc(1, size); APMEventArgs(module, id, APM_EVENT_LEVEL_DEBUG, APM_FLAG_NONE, 3, types, mem, size); |
Call the APMEventParam-method to log events with a generic parameter structure - with any number and combination of textual (string) values and integer values (32- and 64-bit).
To use the APMEventParam-method you have to initialize an APMParamHandle. With a few helper methods you can add values to this parameter object (see “Parameter Functions (C/C++)”) and use the parameter object in the event function to be logged. Do not forget to free the parameter handle with APMParamFree (see “Method APMParamFree (C/C++)”).
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMEventParam(APMModuleHandle module, |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: |
Use APMEventStr to log an event with an additional string value as parameter.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMEventStr( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: |
The parameter functions provide a way to pass up to 255 parameters to an APMEventParam call.
Allocate an APMParamHandle by calling APMParamInit. Add parameters calling APMParamAdd32, APMParamAdd64 or APMParamAddString. Pass the APMParamHandle to the APMEventParam function and finally call APMParamFree to free associated memory.
Usage Example |
---|
//steps required before logging events: |
APMParamInit is used to initialize an APMParamHandle.
Syntax |
---|
APMDECL_EXTERN APMParamHandle APMFUNC APMParamInit(); |
Parameters:
This function does not take any arguments.
Return Value:
Remarks:
Call APMParamAdd32 to add a 32 bit unsigned integer to the parameter handle.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMParamAdd32(APMParamHandle param, UInt32 value); |
Parameters:
Return Value:
This function does not return any value.
Call APMParamAdd64 to add a 64 bit unsigned integer to the parameter handle.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMParamAdd64(APMParamHandle param, UInt64 value); |
Parameters:
Return Value:
This function does not return any value.
Call APMParamAddString to add a string to the parameter handle.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMParamAddString(APMParamHandle param, const char *value); |
Parameters:
Return Value:
This function does not return any value.
Call APMParamFree to release the memory allocated for the parameters created by APMParamInit.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMParamFree(APMParamHandle param); |
Parameters:
Return Value:
This function does not return any value.
Remarks:
Use this function to free internal memory associated to the parameters.
Call APMReport to create a new feedback report.
The filter value will be matched to the description using the registered filter values. Use the textual description of the feedback entered by the user or generated by the application to identify the report session later again.
If a log pool exists for the current application, the latest requests where the APMCreateContext filtervalue parameter matches the filtervalue passed to the APMReport function, will be associated with the feedback.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMReport( |
Parameters:
Return Value:
This function does not return any value.
Remarks:
Usage Example |
---|
//application logic, context created / attached |
Call APMReportValue to add a key/value pair to an existing report.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMReportValue( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//application logic, context created / attached |
Call APMReportContent to associate content with an existing report.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMReportContent( |
Parameters:
Return Value:
Usage Example |
---|
std::string xmlContent = "..."; |
Call APMReportFile to associate a file with an existing report.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMReportFile( |
Parameters:
Return Value:
This function does not return any value.
Remarks:
Usage Example |
---|
//application logic, context created / attached |
Call APMHasActiveContext to test if a software-telemetry session is active for some logging level. This information should be used to avoid costly operations preparing parameters for events that are currently not logged.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMHasActiveContext(APMEventLevel level); |
Parameters:
Return Value:
Usage Example |
---|
void processRequest() //application logic if (0 != APMHasActiveContext(APM_EVENT_LEVEL_DEBUG)) |
Call APMIsConnected to test, if the application has successfully registered to an app.telemetry agent.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMIsConnected(); |
Parameters:
This function does not take any arguments.
Return Value:
Usage Example |
---|
bool checkConnection() |
Call APMIsCompatible to test, if the application was linked with a version that is compatible with the dynamically loaded library.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMIsCompatible(UInt32 size, char *message); |
Parameters:
Return Value:
Usage Example |
---|
bool checkCompatible() |
The functions specified so far all are executed within the context of the current thread. In some cases, it is necessary to explicitly define the current transaction context to the context handling functions, for example if your application's processes aren't based on operating system threads.
To use the explicit transaction functions, you have to define the symbolic constant APM_EXPLICIT_TRANSACTION in a preprocessor directive for your application. If only APM_EXPLICIT_TRANSACTION is defined, only the explicit transaction functions can be used. You have to define APM_THREAD_TRANSACTION in addition if you want to use the usual thread context functions from above.
Code Definition |
---|
#define APM_THREAD_TRANSACTION #define APM_EXPLICIT_TRANSACTION |
Call APMTxCreateContext to create a new Software-Telemetry context analogously to APMCreateContext. You use the APMTransactionHandle returned by this function to pass to other explicit transaction functions for the definition of the current transaction context. You have to call APMTxReleaseContext with the returned transaction handle when exiting the context.
Syntax |
---|
APMDECL_EXTERN APMTransactionHandle APMFUNC APMTxCreateContext(APMTransactionHandle tx, APMApplicationHandle app, const char *filtervalue); |
Parameters:
Return Value:
This function returns the transaction handle for the current or currently created transaction context.
Usage Example |
---|
void beginRequestProcessing(/* ... */) |
Call APMTxAttachContext to restore the context acquired through APMGetContext or APMTxGetContext in another thread or process (see “Passing Context” and “Method APMGetContext (C/C++)”). You can attach to an already existing transaction context or create a new transaction context which is returned by APMTxAttachContext to pass to other explicit transaction functions.
Syntax |
---|
APMDECL_EXTERN APMTransactionHandle APMFUNC APMTxAttachContext(APMTransactionHandle tx, APMApplicationHandle app, const APMContext *context); |
Parameters:
Return Value:
This function returns the transaction handle for the current or currently created transaction context.
Usage Example |
---|
void ContinueRequest(/* ... */, const APMContext *context, APMSyncMark *syncMark) |
Call the APMTxGetContext-method to get a new context handle for the current transaction context, analogously to APMGetContext.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMTxGetContext(APMTransactionHandle tx, APMContext *context); |
Parameters:
Return Value:
Usage Example |
---|
void initiateProcessing(/* ... */) //pass context to another thread, process on the same or a remote machine doRemote(/* data */, context); //do some local processing / wait for the remote processing to complete APMSyncMark syncMark; |
Call the APMTxGetSyncMark-method to get a synchronization handle that can be passed to another thread/process/module to synchronize control flow, same as APMGetSyncMark, for the current transaction context.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMTxGetSyncMark(APMTransactionHandle tx, APMSyncMark *context); |
Parameters:
Return Value:
Usage Example |
---|
void doRemote(/* ... */, APMContext *context) //application logic, events, ... APMSyncMark syncMark; |
Call APMTxSetSyncMark to pass a sync mark you got from APMGetSyncMark or APMTxGetSyncMark for synchronizing the sequence of events (see “Synchronizing Timeline with SyncMarks” and “Method APMGetSyncMark (C/C++)”).
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMTxSetSyncMark(APMTransactionHandle tx, const APMSyncMark *context); |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
void initiateProcessing(/* ... */) //pass context to another thread, process or a remote server doRemote(/* data */, context); //do some local processing/wait for the remote processing to complete |
Call APMTxReleaseContext with the current transaction handle to finish logging and exit the context, analogously to APMReleaseContext.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMTxReleaseContext(APMTransactionHandle tx); |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
void doRemote(/* ... */, APMContext *context) |
Call APMTxHasActiveContext to test if a software-telemetry session is active for some logging level for the current transaction context, analogously to APMHasActiveContext.
Syntax |
---|
APMDECL_EXTERN int APMFUNC APMTxHasActiveContext(APMTransactionHandle tx, APMEventLevel level); |
Parameters:
Return Value:
Usage Example |
---|
void processRequest() //application logic if (0 != APMTxHasActiveContext(tx, APM_EVENT_LEVEL_DEBUG)) |
Call the APMTxEvent function to log an event without parameters for the current transaction context.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMEvent( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: |
Use APMTxEventArgs to log an event for the current transaction context with various parameters, which must be passed in a predefined format.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMTxEventArgs( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: UInt32 par32 = 4; void *mem = calloc(1, size); APMTxEventArgs(tx, module, id, APM_EVENT_LEVEL_DEBUG, APM_FLAG_NONE, 3, types, mem, size); |
Call the APMTxEventParam-method to log events with a generic parameter structure analogously to APMEventParam for the current transaction context.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMTxEventParam( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: |
Use APMTxEventStr to log an event with an additional string value as parameter.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMTxEventStr( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//steps required before logging events: |
Call APMTxReport to create a new feedback report, see "Method APMReport (C/C++)".
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMTxReport( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//application logic, context created / attached |
Call APMTxReportValue to add a key/value pair to an existing report.
Syntax |
---|
APMDECL_EXTERN void APMFUNC APMTxReportValue( |
Parameters:
Return Value:
This function does not return any value.
Usage Example |
---|
//application logic, context created / attached |