Trace the client side of web requests.
More...
Trace the client side of web requests.
Outgoing web request tracers are used to capture information about HTTP requests that the application sends.
To create an outgoing web request tracer, an application can simply call onesdk_outgoingwebrequesttracer_create. To enable continuing the trace on the server/service side, the application must then retrieve the string tag from the tracer and send it along with the request in the HTTP request header "X-dynaTrace"
.
- See also
- onesdk_tracer_get_outgoing_dynatrace_string_tag
-
ONESDK_DYNATRACE_HTTP_HEADER_NAME
-
Incoming Web Request Tracers
For further information, see the high level SDK documentation at https://github.com/Dynatrace/OneAgent-SDK/#webrequests
- Since
- Outgoing web request tracers were added in version 1.2.0.
◆ ONESDK_DYNATRACE_HTTP_HEADER_NAME
#define ONESDK_DYNATRACE_HTTP_HEADER_NAME "X-dynaTrace" |
HTTP header name for the Dynatrace string tag.
Sending an "X-dynaTrace"
request header with a Dynatrace string tag along with an HTTP request enables any Dynatrace OneAgent on the server side to continue tracing (connect the server side trace to the traced operation from which the tag was obtained).
◆ onesdk_outgoingwebrequesttracer_add_request_header()
Adds an HTTP request header of an outgoing web request.
- Parameters
-
tracer_handle | A valid outgoing web request tracer handle. |
name | The 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.2.0.
◆ onesdk_outgoingwebrequesttracer_add_response_header()
Adds an HTTP response header for an outgoing web request.
- Parameters
-
tracer_handle | A valid outgoing web request tracer handle. |
name | The 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.2.0.
◆ onesdk_outgoingwebrequesttracer_create()
Creates a tracer for tracing an outgoing web request.
- Parameters
-
url | The requested URL. Will be parsed into scheme , host /port , path and query . |
method | The HTTP method of the request. |
- Returns
- A handle for the newly created outgoing web request tracer or ONESDK_INVALID_HANDLE.
- Note
url
should be a full, absolute URL, i.e. containing the scheme
, host
, port
(unless default), path
and query
. Any fragment
part, if present, will be ignored (fragments are only processed locally and not part of the request URL).
-
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.2.0.
◆ onesdk_outgoingwebrequesttracer_set_status_code()
Sets the HTTP status code for an outgoing web request.
- Parameters
-
tracer_handle | A valid outgoing web request tracer handle. |
status_code | The HTTP status code of the response that was received. |
- Note
- If an application fails to receive or decode the reply, it should not call this function. Instead the application can use onesdk_tracer_error to signal that the request was not completed successfully.
- Since
- This function was added in version 1.2.0.