Dynatrace OneAgent SDK for C/C++  1.7.1.1
Functions
Incoming Web Request Tracers

Trace the server side of web requests. More...

Functions

onesdk_webapplicationinfo_handle_t onesdk_webapplicationinfo_create (onesdk_string_t web_server_name, onesdk_string_t application_id, onesdk_string_t context_root)
 Creates a web application info object. More...
 
void onesdk_webapplicationinfo_delete (onesdk_webapplicationinfo_handle_t webapplicationinfo_handle)
 Releases a web application info object. More...
 
onesdk_tracer_handle_t onesdk_incomingwebrequesttracer_create (onesdk_webapplicationinfo_handle_t webapplicationinfo_handle, onesdk_string_t url, onesdk_string_t method)
 Creates a tracer for tracing an incoming web request. More...
 
void onesdk_incomingwebrequesttracer_set_remote_address (onesdk_tracer_handle_t tracer_handle, onesdk_string_t remote_address)
 Sets the remote address of an incoming web request. More...
 
void onesdk_incomingwebrequesttracer_add_request_header (onesdk_tracer_handle_t tracer_handle, onesdk_string_t name, onesdk_string_t value)
 Adds an HTTP request header of an incoming web request. More...
 
void onesdk_incomingwebrequesttracer_add_parameter (onesdk_tracer_handle_t tracer_handle, onesdk_string_t name, onesdk_string_t value)
 Adds an HTTP POST parameter of an incoming web request. More...
 
void onesdk_incomingwebrequesttracer_add_response_header (onesdk_tracer_handle_t tracer_handle, onesdk_string_t name, onesdk_string_t value)
 Adds an HTTP response header for an incoming web request. More...
 
void onesdk_incomingwebrequesttracer_set_status_code (onesdk_tracer_handle_t tracer_handle, onesdk_int32_t status_code)
 Sets the HTTP status code for an incoming web request. More...
 

Detailed Description

Trace the server side of web requests.

Incoming web request tracers are used to capture information about HTTP requests that the application services (processes, answers).

To create an incoming web request tracer, an application must first create a web application info object which describes the web application - see onesdk_webapplicationinfo_create.

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

See also
Outgoing Web Request Tracers
Since
Incoming web request tracers were added in version 1.1.0.

Function Documentation

◆ onesdk_incomingwebrequesttracer_add_parameter()

void onesdk_incomingwebrequesttracer_add_parameter ( onesdk_tracer_handle_t  tracer_handle,
onesdk_string_t  name,
onesdk_string_t  value 
)
inline

Adds an HTTP POST parameter of an incoming web request.

Parameters
tracer_handleA valid incoming web request tracer handle.
nameThe name of the HTTP POST parameter.
value[optional] The value of the HTTP POST parameter.
Note
The native SDK agent will currently capture all provided parameters.
Since
This function was added in version 1.1.0.

◆ onesdk_incomingwebrequesttracer_add_request_header()

void onesdk_incomingwebrequesttracer_add_request_header ( onesdk_tracer_handle_t  tracer_handle,
onesdk_string_t  name,
onesdk_string_t  value 
)
inline

Adds an HTTP request header of an incoming web request.

Parameters
tracer_handleA valid incoming web request tracer handle.
nameThe name of the HTTP request header.
value[optional] The value of the HTTP request header.

To allow the agent to determine various bits of useful information, an application should add all HTTP request headers.

Note
The native SDK agent will currently capture all provided headers.
If an HTTP request contains multiple header lines with the same header name, an application should call this function once per line. Alternatively, depending on the header, the application can call this function once per header name, with an appropriately concatenated header value.
This function can not be used after the tracer was started.
Since
This function was added in version 1.1.0.

◆ onesdk_incomingwebrequesttracer_add_response_header()

void onesdk_incomingwebrequesttracer_add_response_header ( onesdk_tracer_handle_t  tracer_handle,
onesdk_string_t  name,
onesdk_string_t  value 
)
inline

Adds an HTTP response header for an incoming web request.

Parameters
tracer_handleA valid incoming web request tracer handle.
nameThe name of the HTTP response header.
value[optional] The value of the HTTP response header.
Note
The native SDK agent will currently capture all provided headers.
If the HTTP response contains multiple header lines with the same header name, an application should call this function once per line. Alternatively, depending on the header, the application can call this function once per header name, with an appropriately concatenated header value.
Since
This function was added in version 1.1.0.

◆ onesdk_incomingwebrequesttracer_create()

onesdk_tracer_handle_t onesdk_incomingwebrequesttracer_create ( onesdk_webapplicationinfo_handle_t  webapplicationinfo_handle,
onesdk_string_t  url,
onesdk_string_t  method 
)
inline

Creates a tracer for tracing an incoming web request.

Parameters
webapplicationinfo_handleA valid web application info handle.
urlThe requested URL. Will be parsed into scheme, host/port, path and query.
methodThe HTTP method of the request.
Returns
A handle for the newly created incoming web request tracer or ONESDK_INVALID_HANDLE.
Note
url does not have to contain a scheme or host. You can use the URL as it was sent in the HTTP request.
If url contains a host name it will be resolved by the agent (asynchronously) after onesdk_tracer_start was called.
Since
This function was added in version 1.1.0.

◆ onesdk_incomingwebrequesttracer_set_remote_address()

void onesdk_incomingwebrequesttracer_set_remote_address ( onesdk_tracer_handle_t  tracer_handle,
onesdk_string_t  remote_address 
)
inline

Sets the remote address of an incoming web request.

Parameters
tracer_handleA valid incoming web request tracer handle.
remote_addressThe remote IP address.

The remote address is very useful to gain information about load balancers, proxies and ultimately the end user that is sending the request.

Note
The remote address is the peer address of the socket connection via which the request was received. In case one or more proxies are used, this will be the address of the last proxy in the proxy chain. To enable the agent to determine the client IP address (=the address where the request originated), an application should also call onesdk_incomingwebrequesttracer_add_request_header to add any HTTP request headers.
Calling this function with remote_address = onesdk_nullstr() will reset/clear any value that was set previously.
This function can not be used after the tracer was started.
Since
This function was added in version 1.1.0.

◆ onesdk_incomingwebrequesttracer_set_status_code()

void onesdk_incomingwebrequesttracer_set_status_code ( onesdk_tracer_handle_t  tracer_handle,
onesdk_int32_t  status_code 
)

Sets the HTTP status code for an incoming web request.

Parameters
tracer_handleA valid incoming web request tracer handle.
status_codeThe HTTP status code of the response sent to the client.
Note
If an application can not send a response to the client, it should not call this function. Instead the application can use onesdk_tracer_error to signal that the request could not be processed successfully.
Since
This function was added in version 1.1.0.

◆ onesdk_webapplicationinfo_create()

onesdk_webapplicationinfo_handle_t onesdk_webapplicationinfo_create ( onesdk_string_t  web_server_name,
onesdk_string_t  application_id,
onesdk_string_t  context_root 
)
inline

Creates a web application info object.

Parameters
web_server_nameThe logical name of the web server that hosts the application. In case of a cluster, every node in the cluster must use the same web_server_name.
application_idA unique ID for the web application. This will also be used as the display name.
context_rootThe context root of the web application. This is the common path prefix for requests which will be routed to the web application.
Returns
A handle for the newly created web application info object or ONESDK_INVALID_HANDLE.

This function creates a web application info object which is required for tracing incoming web requests (see onesdk_incomingwebrequesttracer_create).

The provided information determines the identity and name of the resulting web request service in Dynatrace.

See https://www.dynatrace.com/support/help/server-side-services/introduction/how-does-dynatrace-detect-and-name-services/#web-request-services for more information about the meaning of the parameters.

Since
This function was added in version 1.1.0.

◆ onesdk_webapplicationinfo_delete()

void onesdk_webapplicationinfo_delete ( onesdk_webapplicationinfo_handle_t  webapplicationinfo_handle)

Releases a web application info object.

Parameters
webapplicationinfo_handleA valid web application info handle.

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

An application should call onesdk_webapplicationinfo_delete exactly once for each web application info object that it has created.

Note
Calling onesdk_webapplicationinfo_delete with a handle to a web application info object which is still referenced by existing tracers is supported. In that case the lifetime of the web application info object is extended as necessary. The handle will always become invalid immediately though.
Since
This function was added in version 1.1.0.