DatadogTrackingHttpClient class
A wrapper around HttpClient that supports tracking network requests and sending them to Datadog
If the RUM feature is enabled, the SDK will send information about RUM
Resources (calling DatadogRum.startResource
, DatadogRum.stopResource
, and
DatadogRum.stopResourceWithErrorInfo
for all intercepted requests.
The SDK will also create a tracing Span for each 1st-party request, and add
extra HTTP headers to further propagate the trace. The percentage of
resources traced in this way is determined by
DatadogRumConfiguration.traceSampleRate
.
To specify which hosts are 1st party (and therefore should have tracing
Spans sent), see DatadogConfiguration.firstPartyHostsWithTracingHeaders
.
Unlike DatadogClient, the DatadogTrackingHttpClient is able to override
all network operations that use HttpClient, which includes requests made
by Flutter and other popular networking libraries (like http and Dio).
However, it is not able to intercept calls made from native packages like
cupertino_http
and cronet_http
, which should instead use
DatadogClient.
DatadogTrackingHttpClient and DatadogClient can be used together if needed, and will not interfere with each other.
See also DatadogClient.
- Implemented types
Constructors
- DatadogTrackingHttpClient(DatadogSdk datadogSdk, DdHttpTrackingPluginConfiguration configuration, HttpClient innerClient)
Properties
-
authenticate
← (Future<
bool> Function(Uri url, String scheme, String? realm)?) -
Sets the function to be called when a site is requesting
authentication.
no getteroverride
-
authenticateProxy
← (Future<
bool> Function(String host, int port, String scheme, String? realm)?) -
Sets the function to be called when a proxy is requesting
authentication.
no getteroverride
- autoUncompress ↔ bool
-
Gets and sets whether the body of a response will be automatically
uncompressed.
getter/setter pairoverride
- badCertificateCallback ← (bool Function(X509Certificate cert, String host, int port)?)
-
Sets a callback that will decide whether to accept a secure connection
with a server certificate that cannot be authenticated by any of our
trusted root certificates.
no getteroverride
- configuration → DdHttpTrackingPluginConfiguration
-
final
-
connectionFactory
← (Future<
ConnectionTask< Function(Uri url, String? proxyHost, int? proxyPort)?)Socket> > -
Sets the function used to create socket connections.
no getteroverride
- connectionTimeout ↔ Duration?
-
Gets and sets the connection timeout.
getter/setter pairoverride
- datadogSdk → DatadogSdk
-
final
- findProxy ← (String Function(Uri url)?)
-
Sets the function used to resolve the proxy server to be used for
opening a HTTP connection to the specified
url
. If this function is not set, direct connections will always be used.no getteroverride - hashCode → int
-
The hash code for this object.
no setterinherited
- idleTimeout ↔ Duration
-
Gets and sets the idle timeout of non-active persistent (keep-alive)
connections.
getter/setter pairoverride
- innerClient → HttpClient
-
final
- keyLog ← (dynamic Function(String line)?)
-
Sets a callback that will be called when new TLS keys are exchanged with
the server. It will receive one line of text in
NSS Key Log Format
for each call. Writing these lines to a file will allow tools (such as
Wireshark)
to decrypt communication between the this client and the server. This is
meant to allow network-level debugging of secure sockets and should not
be used in production code. For example:
no getteroverride
- maxConnectionsPerHost ↔ int?
-
Gets and sets the maximum number of live connections, to a single host.
getter/setter pairoverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- userAgent ↔ String?
-
Gets and sets the default value of the
User-Agent
header for all requests generated by this HttpClient.getter/setter pairoverride - uuid → Uuid
-
final
Methods
-
addCredentials(
Uri url, String realm, HttpClientCredentials credentials) → void -
Add credentials to be used for authorizing HTTP requests.
override
-
addProxyCredentials(
String host, int port, String realm, HttpClientCredentials credentials) → void -
Add credentials to be used for authorizing HTTP proxies.
override
-
close(
{bool force = false}) → void -
Shuts down the HTTP client.
override
-
delete(
String host, int port, String path) → Future< HttpClientRequest> -
Opens a HTTP connection using the DELETE method.
override
-
deleteUrl(
Uri url) → Future< HttpClientRequest> -
Opens a HTTP connection using the DELETE method.
override
-
get(
String host, int port, String path) → Future< HttpClientRequest> -
Opens a HTTP connection using the GET method.
override
-
getUrl(
Uri url) → Future< HttpClientRequest> -
Opens a HTTP connection using the GET method.
override
-
head(
String host, int port, String path) → Future< HttpClientRequest> -
Opens a HTTP connection using the HEAD method.
override
-
headUrl(
Uri url) → Future< HttpClientRequest> -
Opens a HTTP connection using the HEAD method.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
String method, String host, int port, String path) → Future< HttpClientRequest> -
Opens a HTTP connection.
override
-
openUrl(
String method, Uri url) → Future< HttpClientRequest> -
Opens a HTTP connection.
override
-
patch(
String host, int port, String path) → Future< HttpClientRequest> -
Opens a HTTP connection using the PATCH method.
override
-
patchUrl(
Uri url) → Future< HttpClientRequest> -
Opens a HTTP connection using the PATCH method.
override
-
post(
String host, int port, String path) → Future< HttpClientRequest> -
Opens a HTTP connection using the POST method.
override
-
postUrl(
Uri url) → Future< HttpClientRequest> -
Opens a HTTP connection using the POST method.
override
-
put(
String host, int port, String path) → Future< HttpClientRequest> -
Opens a HTTP connection using the PUT method.
override
-
putUrl(
Uri url) → Future< HttpClientRequest> -
Opens a HTTP connection using the PUT method.
override
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited