- 필수 기능
- 시작하기
- Glossary
- 표준 속성
- Guides
- Agent
- 통합
- 개방형텔레메트리
- 개발자
- API
- Datadog Mobile App
- CoScreen
- Cloudcraft
- 앱 내
- 서비스 관리
- 인프라스트럭처
- 애플리케이션 성능
- APM
- Continuous Profiler
- 스팬 시각화
- 데이터 스트림 모니터링
- 데이터 작업 모니터링
- 디지털 경험
- 소프트웨어 제공
- 보안
- AI Observability
- 로그 관리
- 관리
HTTP tests allow you to send HTTP requests to your applications’ API endpoints to verify responses and defined conditions, such as overall response time, expected status code, header, or body content.
HTTP tests can run from both managed and private locations depending on your preference for running the test from outside or inside your network. HTTP tests can run on a schedule, on-demand, or directly within your CI/CD pipelines.
After choosing to create an HTTP
test, define your test’s request.
Choose the HTTP Method and specify the URL to query. Available methods are: GET
, POST
, PATCH
, PUT
, HEAD
, DELETE
, and OPTIONS
. Both http
and https
URLs are supported.
Name your HTTP test.
Add env
Tags as well as any other tag to your HTTP test. You can then use these tags to filter through your Synthetic tests on the Synthetic Monitoring & Continuous Testing page.
Click Test URL to try out the request configuration. A response preview is displayed on the right side of your screen.
HTTP/1.1 only
, HTTP/2 only
, or HTTP/2 fallback to HTTP/1.1
.user-agent
header).<COOKIE_NAME1>=<COOKIE_VALUE1>; <COOKIE_NAME2>=<COOKIE_VALUE2>
.Client Certificate: Authenticate through mTLS by uploading your client certificate (.crt
) and the associated private key (.key
) in PEM
format. You can use the openssl
library to convert your certificates. For example, convert a PKCS12
certificate to PEM
formatted private keys and certificates.
openssl pkcs12 -in <CERT>.p12 -out <CERT_KEY>.key -nodes -nocerts
openssl pkcs12 -in <CERT>.p12 -out <CERT>.cert -nokeys
HTTP Basic Auth: Add HTTP basic authentication credentials.
Digest Auth: Add Digest authentication credentials.
NTLM: Add NTLM authentication credentials. Support both NTLMv2 and NTLMv1.
AWS Signature v4: Enter your Access Key ID and Secret Access Key. Datadog generates the signature for your request. This option uses the basic implementation of SigV4. Specific signatures such as Amazon S3 are not supported out-of-the box.
For “Single Chunk” transfer requests to Amazon S3 buckets, add x-amz-content-sha256
containing the sha256-encoded body of the request as a header (for an empty body: x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
).
OAuth 2.0: Choose between granting client credentials or a resource owner password and enter an access token URL. Depending on your selection, enter a client ID and secret, or a username and password. From the dropdown menu, select an option to either send the API token as a basic authentication header, or send the client credentials in the body. Optionally, you can provide additional information such as the audience, resource, and scope (as well as the client ID and secret, if you selected Resource Owner Password).
application/json
, application/octet-stream
, application/x-www-form-urlencoded
, multipart/form-data
, text/html
, text/plain
, text/xml
, GraphQL
, or None
) you want to add to your HTTP request.application/json
, application/x-www-form-urlencoded
, text/html
, text/plain
, text/xml
, GraphQL
.application/octet-stream
.multipart/form-data
.http://<YOUR_USER>:<YOUR_PWD>@<YOUR_IP>:<YOUR_PORT>
).Define variables for your HTTP API tests with JavaScript:
<div class="shortcode-wrapper shortcode-img expand"><figure class="text-center"><a href="https://datadog-docs-staging.imgix.net/images/synthetics/api_tests/http_javascript.66fe410698cb2c156ee0634db040393e.png?fit=max&auto=format" class="pop" data-bs-toggle="modal" data-bs-target="#popupImageModal"><picture class="" style="width:90%;" >
<img
class="img-fluid"
srcset="https://datadog-docs-staging.imgix.net/images/synthetics/api_tests/http_javascript.66fe410698cb2c156ee0634db040393e.png?auto=format"
style="width:90%;" alt="Define HTTP API test with Javascript" />
</picture></a></figure>
</div>
Assertions define what an expected test result is. After you click Test URL, basic assertions on response time
, status code
, and header
content-type
are added based on the response that was obtained. You must define at least one assertion for your test to monitor.
Type | Operator | Value type |
---|---|---|
body | contains , does not contain , is , is not ,matches , does not match ,jsonpath , xpath | String Regex |
header | contains , does not contain , is , is not ,matches , does not match | String Regex |
response time | is less than | Integer (ms) |
status code | is , is not ,matches , does not match | Integer Regex |
HTTP tests can decompress bodies with the following content-encoding
headers: br
, deflate
, gzip
, and identity
.
You can create up to 20 assertions per API test by clicking New Assertion or by clicking directly on the response preview:
To perform OR
logic in an assertion, use the matches regex
comparator to define a regex with multiple expected values like (200|302)
. For example, you may want your HTTP test to succeed when a server must respond with a 200
or 302
status code. The status code
assertion succeeds if the status code is 200 or 302. You can also add OR
logic on a body
or header
assertion.
If a test does not contain an assertion on the response body, the body payload drops and returns an associated response time for the request within the timeout limit set by the Synthetics Worker.
If a test contains an assertion on the response body and the timeout limit is reached, an Assertions on the body/response cannot be run beyond this limit
error appears.
Select the Locations to run your HTTP test from. HTTP tests can run from both managed and private locations depending on your preference for running the test from outside or inside your network.
Datadog’s out-of-the-box managed locations allow you to test public-facing websites and endpoints from regions where your customers are located.
Americas | APAC | EMEA |
---|---|---|
Canada Central (AWS) | Hong Kong (AWS) | Cape Town (AWS) |
Northern California (AWS) | Mumbai (AWS) | Frankfurt (AWS) |
Northern Virginia (AWS) | Seoul (AWS) | Ireland (AWS) |
Ohio (AWS) | Singapore (AWS) | London (AWS) |
Oregon (AWS) | Sydney (AWS) | Paris (AWS) |
São Paulo (AWS) | Tokyo (AWS) | Stockholm (AWS) |
Virginia (Azure) | Osaka (AWS) | Milan (AWS) |
Jakarta (AWS) | Bahrain (AWS) |
The Datadog for Government site (US1-FED) uses the following managed location:
Americas |
---|
US-West |
HTTP tests can run:
Set alert conditions to determine the circumstances under which you want a test to fail and trigger an 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 only if these two conditions are true:
Your test can trigger retries X
times after Y
ms in case of a failed test result. Customize the retry interval to suit your alerting sensibility.
Location uptime is computed on a per-evaluation basis (whether the last test result before evaluation was up or down). The total uptime is computed based on the configured alert conditions. Notifications sent are based on the total uptime.
A notification is sent by your test based on the alerting conditions previously defined. Use this section to define how and what to message your team.
Similar to how you configure monitors, select users and/or services that should receive notifications either by adding an @notification
to the message or by searching for team members and connected integrations with the dropdown menu.
Enter the notification message for your test. This field allows standard Markdown formatting and supports the following conditional variables:
Conditional Variable | Description |
---|---|
{{ #is_alert }} | Show when the test alerts. |
{{ ^is_alert }} | Show unless the test alerts. |
{{ #is_recovery }} | Show when the test recovers from alert. |
{{ ^is_recovery }} | Show unless the test recovers from alert. |
{{ #is_renotify }} | Show when the monitor renotifies. |
{{ ^is_renotify }} | Show unless the monitor renotifies. |
{{ #is_priority }} | Show when the monitor matches priority (P1 to P5). |
{{ ^is_priority }} | Show unless the monitor matches priority (P1 to P5). |
Specify how often you want your test to re-send the notification message in case of test failure. To prevent renotification on failing tests, leave the option as Never renotify if the monitor has not been resolved
.
Click Create to save your test configuration and monitor.
For more information, see Using Synthetic Test Monitors.
To create a local variable, click Create a Local Variable. You can select one of the following available builtins to add to your variable string:
n
digits.n
letters.n
characters.n
units.n
units.To obfuscate local variable values in test results, select Hide and obfuscate variable value. Once you have defined the variable string, click Add Variable.
You can use the global variables defined on the Settings page in the URL, advanced options, and assertions of your HTTP tests.
To display your list of variables, type {{
in your desired field:
A test is considered FAILED
if it does not satisfy one or more assertions or if the request prematurely failed. In some cases, the test can fail without testing the assertions against the endpoint.
The most common errors include the following:
CONNREFUSED
CONNRESET
DNS
Error performing HTTP/2 request
INVALID_REQUEST
SSL
TIMEOUT
TIMEOUT
can happen:TIMEOUT: The request couldn't be completed in a reasonable time.
indicates that the request duration hit the test defined timeout (default is set to 60s).
For each request only the completed stages for the request are displayed in the network waterfall. For example, in the case of Total response time
only being displayed, the timeout occurred during the DNS resolution.TIMEOUT: Overall test execution couldn't be completed in a reasonable time.
indicates that the test duration (request + assertions) hits the maximum duration (60.5s).MALFORMED_RESPONSE
By default, only users with the Datadog Admin and Datadog Standard roles can create, edit, and delete Synthetic HTTP tests. To get create, edit, and delete access to Synthetic HTTP tests, upgrade your user to one of those two default roles.
If you are using the custom role feature, add your user to any custom role that includes synthetics_read
and synthetics_write
permissions.
Access restriction is available for customers using custom roles on their accounts.
You can restrict access to an HTTP test based on the roles in your organization. When creating an HTTP test, choose which roles (in addition to your user) can read and write your test.