You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/synthetics/api_tests/_index.md
+59-33Lines changed: 59 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,15 +19,15 @@ further_reading:
19
19
20
20
## Overview
21
21
22
-
API tests are useful to help you monitor your API endpoints and alert you when they are failing or too slow. These checks verify that your applications are responding to requests, as well as that they meet any conditions you define—such as response time, HTTP status code, and header or body contents. Use the [Datadog API][1] to see the full list.
22
+
API tests are useful to help you monitor your API endpoints and alert you when they are failing or too slow. These tests verify that your applications are responding to requests, as well as that they meet any conditions you define—such as response time, HTTP status code, and header or body contents. Use the [Datadog API][1] to see the full list.
23
23
24
24
## Configuration
25
25
26
-
API tests configuration depends on the type of API test you want to create. There are two API test types: [HTTP test](?tab=httptest) and [SSL test](?tab=ssltest).
26
+
API tests configuration depends on the type of API test you want to create: [HTTP test](?tab=httptest), [SSL test](?tab=ssltest), or [TCP test](?tab=tcptest).
27
27
28
28
### Make a request
29
29
30
-
Define the `HTTP`or `SSL` request you want to be executed by Datadog:
30
+
Define the `HTTP`, `SSL`, or `TCP` request you want to be executed by Datadog:
31
31
32
32
{{< tabs >}}
33
33
@@ -66,7 +66,7 @@ Define the request you want to be executed by Datadog:
66
66
1.**Choose request type**: `SSL`
67
67
2. Specify the `Host` and the SSL `Port`. By default, the port is set to _443_.
68
68
3.**Name**: The name of your API test.
69
-
4.**Select your tags**: The tags attached to your browser test. Use the `<KEY>:<VALUE>` format to filter on a `<VALUE>` for a given `<KEY>` on the [Synthetic Monitoring page][1].
69
+
4.**Select your tags**: The tags attached to your SSL test. Use the `<KEY>:<VALUE>` format to filter on a `<VALUE>` for a given `<KEY>` on the [Synthetic Monitoring page][1].
70
70
5.**Locations**: The Datadog managed locations to run the test from. Many AWS locations from around the world are available. The full list is retrievable through the [Datadog API][2]. You can also set up a [Private Location][3] to run a Synthetic API test on a private endpoint not accessible from the public internet.
71
71
6.**How often should Datadog run the test?** Intervals are available between every five minutes to once per week.
72
72
7. Click on **Test Connection** to try out the request configuration. You should see a response preview show up on the right side of your screen.
@@ -76,32 +76,26 @@ Define the request you want to be executed by Datadog:
76
76
[3]: /synthetics/private_locations/
77
77
{{% /tab %}}
78
78
79
-
{{< /tabs >}}
80
-
81
-
### Alert Conditions
79
+
{{% tab "TCP Test" %}}
82
80
83
-
Set alert conditions to determine the circumstances under which you want a test to send a notification alert:
When you set the alert conditions to: `An alert is triggered if any assertion fails for X minutes from any n of N locations`, an alert is triggered if:
89
-
90
-
* At least one location was in failure (at least one assertion failed) during the last *X* minutes, **AND**
91
-
* At one moment during the last *X* minutes, at least *n* locations were in failure
92
-
93
-
The uptime bar is displayed differently on your test result: location uptime is displayed on a per-evaluation basis (whether the last test was up or down). Total uptime is displayed based on the configured alert conditions. Notifications sent are based on the total uptime bar.
83
+
1.**Choose request type**: `TCP`
84
+
2. Specify the `Host` and the TCP `Port`.
85
+
3.**Name**: The name of your API test.
86
+
4.**Select your tags**: The tags attached to your TCP test. Use the `<KEY>:<VALUE>` format to filter on a `<VALUE>` for a given `<KEY>` on the [Synthetic Monitoring page][1].
87
+
5.**Locations**: The Datadog managed locations to run the test from. Many AWS locations from around the world are available. The full list is retrievable through the [Datadog API][2]. You can also set up a [Private Location][3] to run a Synthetic API test on a private endpoint not accessible from the public internet.
88
+
6.**How often should Datadog run the test?** Intervals are available between every five minutes to once per week.
89
+
7. Click **Test URL** to try the request configuration and see a response preview on the righthand side.
94
90
95
-
**Note**: You can decide the number of retries needed to consider a location as *failed* before sending a notification alert. By default, Synthetic tests do not retry after a failed result for a given location.
91
+
[1]: /synthetics/
92
+
[2]: /api/#get-available-locations
93
+
[3]: /synthetics/private_locations/
96
94
{{% /tab %}}
97
-
{{% tab "SSL Test" %}}
98
-
99
-
If one of the assertions defined fails for a given location, an alert is triggered.
100
95
101
-
{{% /tab %}}
102
96
{{< /tabs >}}
103
97
104
-
####Assertions
98
+
### Assertions
105
99
106
100
When running an API test, you must define at least one assertion that should be monitored by Datadog. An assertion is defined by a parameter, an optional property, a comparator, and a target value.
107
101
@@ -116,6 +110,8 @@ When running an API test, you must define at least one assertion that should be
116
110
| Headers |`contains`, `does not contain`, `is`, `is not` <br> `matches`, `does not match`|_String_ <br> _[Regex][1]_|
117
111
| Body |`contains`, `does not contain`, `is`, `is not` <br> `matches`, `does not match`|_String_ <br> _[Regex][1]_|
118
112
113
+
**Note**: HTTP tests can uncompress bodies with the following `content-encoding` headers: `br`, `deflate`, `gzip`, and `identity`.
114
+
119
115
If you click on **Test URL**, then the basic assertions are automatically filled:
120
116
121
117
-`Response time`_lessThan_ 2000 ms
@@ -139,25 +135,41 @@ If you click on **Test URL**, then the basic assertion is automatically filled:
|`CONNRESET`| The connection was abruptly closed by the remote server. Possible causes include the webserver encountering an error or crashing while responding, loss of connectivity of the webserver, etc. |
155
-
| DNS | DNS entry not found for the check URL. Possible causes include misconfigured check URL, wrong configuration of your DNS entries, etc. |
156
-
|`INVALID_REQUEST`| The configuration of the check is invalid (e.g., typo in the URL). |
157
-
|`SSL`| The SSL connection couldn't be performed. [See the dedicated error page for more information][2]. |
158
-
|`TIMEOUT`| The request couldn't be completed in a reasonable time. Two types of `TIMEOUT` can happen. A `TIMEOUT: The request couldn’t be completed in a reasonable time.` indicates that the timeout happened at the TCP socket connection level. A `TIMEOUT: Retrieving the response couldn’t be completed in a reasonable time.` indicates that the timeout happened on the overall run (which includes TCP socket connection, data transfer, and assertions). |
159
+
Set alert conditions to determine the circumstances under which you want a test to fail and trigger an alert.
160
+
161
+
#### Alerting Rule
162
+
163
+
When you set the alert conditions to: `An alert is triggered if any assertion fails for X minutes from any n of N locations`, an alert is triggered if:
164
+
165
+
* At least one location was in failure (at least one assertion failed) during the last *X* minutes, **and**
166
+
* At one moment during the last *X* minutes, at least *n* locations were in failure.
159
167
160
-
If a test fails, the uptime directly considers the endpoint as `down`. It is not re-tested until the next test run.
168
+
The uptime bar is displayed differently on your test result: location uptime is displayed on a per-evaluation basis (whether the last test was up or down). Total uptime is displayed based on the configured alert conditions. Notifications sent are based on the total uptime bar.
169
+
170
+
#### Fast Retry
171
+
172
+
You can decide the number of retries needed to consider a location as *failed*. By default, Synthetic tests do not retry after a failed result for a given location.
161
173
162
174
### Use global variables
163
175
@@ -201,6 +213,20 @@ The Synthetic test details page displays the following network timings:
201
213
202
214
Response time is the sum of these network timings.
203
215
216
+
## Test Failure
217
+
218
+
A test is considered `FAILED` if it does not satisfy its assertions or if the request failed for another reason. These reasons include:
|`CONNRESET`| The connection was abruptly closed by the remote server. Possible causes include the webserver encountering an error or crashing while responding, or loss of connectivity of the webserver. |
223
+
| DNS | DNS entry not found for the check URL. Possible causes include misconfigured check URL, wrong configuration of your DNS entries, etc. |
224
+
|`INVALID_REQUEST`| The configuration of the check is invalid (for example, a typo in the URL). |
225
+
|`SSL`| The SSL connection couldn't be performed. [See the dedicated error page for more information][2]. |
226
+
|`TIMEOUT`| The request couldn't be completed in a reasonable time. Two types of `TIMEOUT` can happen. `TIMEOUT: The request couldn’t be completed in a reasonable time.` indicates that the timeout happened at the TCP socket connection level. `TIMEOUT: Retrieving the response couldn’t be completed in a reasonable time.` indicates that the timeout happened on the overall run (which includes TCP socket connection, data transfer, and assertions). |
227
+
228
+
If a test fails, the uptime directly considers the endpoint to be `down`. It is not retested until the next test run.
This feature is in private beta. To request access, contact <ahref="/help/">Datadog Support</a>.
22
-
</div>
23
-
24
-
On top of executing your tests at predefined intervals, you can also execute Datadog Synthetic tests on-demand using the dedicated API endpoints. You can execute Datadog Synthetic tests in your continuous integration (CI) pipelines, enabling you to block the deployment of branches which would break your key features and endpoints.
20
+
In addition to running tests at predefined intervals, you can also run Datadog Synthetic tests on-demand using API endpoints. You can run Datadog Synthetic tests in your continuous integration (CI) pipelines, letting you block the deployment of branches that would break your product.
21
+
Datadog Continuous Testing can also be used to **run tests as part of your CD process**, evaluating the state of your production application immediately after a deployment finishes. This lets you detect potential regressions that could impact your users—and automatically trigger a rollback whenever a critical test fails.
25
22
26
23
This function allows you to avoid spending time fixing issues on production, and to catch bugs and regressions earlier in the process.
27
24
28
-
On top of these API endpoints, Datadog provides and maintains a command line interface (CLI), allowing you to easily integrate Datadog Synthetic tests with your CI tooling.
25
+
On top of these API endpoints, Datadog provides and maintains a command line interface (CLI), allowing you to easily integrate Datadog Synthetic tests with your CI tooling. Synthetic Continuous Testing is open-source, and its source code is available on GitHub at [DataDog/datadog-ci][1].
29
26
30
27
## API usage
31
28
@@ -241,9 +238,7 @@ curl -G \
241
238
242
239
### Package installation
243
240
244
-
The package is published privately under [@datadog/datadog-ci][1] in the NPM registry.
245
-
246
-
Until it is made public, an NPM token is needed to access it. If you do not have an NPM token to access the package, reach out to [Datadog support][2].
241
+
The package is published under [@datadog/datadog-ci][2] in the NPM registry.
247
242
248
243
{{< tabs >}}
249
244
{{% tab "NPM" %}}
@@ -517,7 +512,7 @@ You can also see the results of your tests listed on your Datadog test details p
0 commit comments