Dynatrace OneAgent SDK for C/C++  1.7.1.1
Functions
Database Request Tracers

Trace SQL-based database requests. More...

Functions

onesdk_databaseinfo_handle_t onesdk_databaseinfo_create (onesdk_string_t name, onesdk_string_t vendor, onesdk_int32_t channel_type, onesdk_string_t channel_endpoint)
 Creates a database info object. More...
 
void onesdk_databaseinfo_delete (onesdk_databaseinfo_handle_t databaseinfo_handle)
 Releases a database info object. More...
 
onesdk_tracer_handle_t onesdk_databaserequesttracer_create_sql (onesdk_databaseinfo_handle_t databaseinfo_handle, onesdk_string_t statement)
 Creates a tracer for tracing SQL database requests. More...
 
void onesdk_databaserequesttracer_set_returned_row_count (onesdk_tracer_handle_t tracer_handle, onesdk_int32_t returned_row_count)
 Sets the number of returned rows for a database request. More...
 
void onesdk_databaserequesttracer_set_round_trip_count (onesdk_tracer_handle_t tracer_handle, onesdk_int32_t round_trip_count)
 Sets the number of round trips for a database request. More...
 

Detailed Description

Trace SQL-based database requests.

Database request tracers are used to capture information about database requests. They're not taggable.

To create a database request tracer, an application must first create a database info object which describes the database that the application uses - see onesdk_databaseinfo_create.

Note
Note that SQL database traces are only created if they occur within some other SDK trace (e.g. incoming remote call).

For further information, see the high level SDK documentation at https://github.com/Dynatrace/OneAgent-SDK/#database

Function Documentation

◆ onesdk_databaseinfo_create()

onesdk_databaseinfo_handle_t onesdk_databaseinfo_create ( onesdk_string_t  name,
onesdk_string_t  vendor,
onesdk_int32_t  channel_type,
onesdk_string_t  channel_endpoint 
)
inline

Creates a database info object.

Parameters
nameThe name of the database.
vendorThe type of the database (e.g. "sqlite", "MySQL", "Oracle", "DB2" - see database_vendor_strings).
channel_typeThe type of the channel used to communicate with the database.
channel_endpoint[optional] The endpoint of the channel used to communicate with the database.
Returns
A handle for the newly created database info object or ONESDK_INVALID_HANDLE.

This function creates a database info object which describes a database instance and is required for tracing database requests (see onesdk_databaserequesttracer_create_sql).

For information about channel_type and channel_endpoint see Channel Types and Endpoints.

◆ onesdk_databaseinfo_delete()

void onesdk_databaseinfo_delete ( onesdk_databaseinfo_handle_t  databaseinfo_handle)

Releases a database info object.

Parameters
databaseinfo_handleA valid database info handle.

This function releases the specified database info object. Allocated resources are freed and the handle is invalidated.

An application should call onesdk_databaseinfo_delete exactly once for each database info object that it has created.

Note
Calling onesdk_databaseinfo_delete with a handle to a database info object which is still referenced by existing tracers is supported. In that case the lifetime of the database info object is extended as necessary. The handle will always become invalid immediately though.

◆ onesdk_databaserequesttracer_create_sql()

onesdk_tracer_handle_t onesdk_databaserequesttracer_create_sql ( onesdk_databaseinfo_handle_t  databaseinfo_handle,
onesdk_string_t  statement 
)
inline

Creates a tracer for tracing SQL database requests.

Parameters
databaseinfo_handleA valid database info handle.
statementThe database statement (SQL).
Returns
A handle for the newly created database request tracer or ONESDK_INVALID_HANDLE.
See also
onesdk_databaseinfo_create

◆ onesdk_databaserequesttracer_set_returned_row_count()

void onesdk_databaserequesttracer_set_returned_row_count ( onesdk_tracer_handle_t  tracer_handle,
onesdk_int32_t  returned_row_count 
)

Sets the number of returned rows for a database request.

Parameters
tracer_handleA valid database request tracer handle.
returned_row_countThe number of returned rows. Must be >= 0.
Since
This function was added in version 1.1.0.

◆ onesdk_databaserequesttracer_set_round_trip_count()

void onesdk_databaserequesttracer_set_round_trip_count ( onesdk_tracer_handle_t  tracer_handle,
onesdk_int32_t  round_trip_count 
)

Sets the number of round trips for a database request.

Parameters
tracer_handleA valid database request tracer handle.
round_trip_countThe number of round trips between the client and the database. Must be >= 0.
Since
This function was added in version 1.1.0.