diff --git a/content/en/synthetics/notifications/template_variables.md b/content/en/synthetics/notifications/template_variables.md index dde18cb4d6a..d29c6fac0a7 100644 --- a/content/en/synthetics/notifications/template_variables.md +++ b/content/en/synthetics/notifications/template_variables.md @@ -13,925 +13,32 @@ further_reading: ## Overview -Template variables allow you to insert dynamic values from your test results and configuration into Synthetic Monitoring notification messages. Access these variables using the `synthetics.attributes` prefix. For example: +Template variables allow you to insert dynamic values from your test results and configuration into Synthetic Monitoring notification messages. These variables are accessed using the `synthetics.attributes` prefix. -```text -Test failed at step {{synthetics.failed_step.name}} with error: {{synthetics.failed_step.failure.message}}. -``` +**Note:** Not all variables are available for every test type. You may need to test different outputs to verify the data returned. You can export the result as a JSON file from the **Actions** tab of a test run in the [Results Explorer][1], then reference the path directly within your monitor configuration. -**Note**: For information about accessing local (config) variables, see the [Variables](#variables) section. +{{< img src="synthetics/notifications/action_tab.png" alt="Actions tab from the Synthetics Result Explorer with Export Result JSON highlighted" style="width:90%;" >}} -### Common variable shortcuts +## Available variables -`{{synthetics.failed_step.name}}` -: The name of the failing step (for example, `Test div #title content`). +### Test execution variables -`{{synthetics.failed_step.failure.message}}` -: The error message (for example, `Element's content should match the given regex`). +{{< partial name="synthetics/template-variables-execution.html" >}} -`{{synthetics.failed_step.url}}` -: The URL of the failed step (for example, `https://www.datadoghq.com/blog/`). +### Result variables -`{{synthetics.attributes.result.response.statusCode}}` -: The HTTP status code (for example, `403`). - -`{{synthetics.result.step_count}}` -: Number of steps (for example, `4`). - -`{{synthetics.result.duration}}` -: Duration of the test run (in milliseconds) (for example, `9096`). - -`{{tags.env}}` -: The environment tag value (for example, `prod`). - -**Note:** Not all variables are available for every test type. You may need to test different outputs to verify the data returned. You can export the result as a JSON file from the **Actions** tab, then reference the path directly within your monitor configuration. - - -### Result attributes - -{{< tabs >}} -{{% tab "Test Info" %}} - -`{{synthetics.attributes.test}}` -: The `test` object contains information about the test like its `name`, `type`, `subtype`, and `id` - -`{{synthetics.attributes.test.name}}` -: The name of the test - -`{{synthetics.attributes.test.type}}` -: Test type (for example, `api`) - -`{{synthetics.attributes.test.subType}}` -: Subtype for API tests (for example, `http`, `dns`, and `multi`) - -`{{synthetics.attributes.test.id}}` -: The test's public ID (for example, `abc-def-ghi`) - -{{% /tab %}} -{{% tab "Location" %}} - -`{{synthetics.attributes.location}}` -: The `location` object contains information about the location of where the test is run from - -`{{synthetics.attributes.location.id}}` -: Location ID (for example, `aws:eu-central-1`) - -`{{synthetics.attributes.location.name}}` -: Name of the location (for example, `Frankfurt (AWS)`) - -`{{synthetics.attributes.location.privateLocation}}` -: `true` for Private Locations - -{{% /tab %}} -{{% tab "Device" %}} - -Applies to browser and mobile tests. - -`{{synthetics.attributes.device}}` -: The `device` object contains information about the device on which the test is run on - -`{{synthetics.attributes.device.id}}` -: Device identifier - -`{{synthetics.attributes.device.name}}` -: Human-readable device name - -`{{synthetics.attributes.device.type}}` -: Device type classification - -`{{synthetics.attributes.device.width}}`, `{{synthetics.attributes.device.height}}` -: Screen resolution dimensions - -`{{synthetics.attributes.device.browser.type}}` -: Browser type (browser tests only) - -`{{synthetics.attributes.device.platform.name}}`, `{{synthetics.attributes.device.platform.version}}` -: Platform information (mobile tests only) - -**Example values:** -```json -{ - "device": { - "id": "chrome.laptop_large", - "name": "Laptop Large", - "type": "laptop", - "resolution": {"width": 1440, "height": 1100}, - "browser": {"type": "Chrome"}, - "platform": {"name": "Android", "version": "14"} - } -} -``` - -{{% /tab %}} -{{% tab "Result" %}} - -`{{synthetics.attributes.result}}` -: The `result` object contains information about the executed test run - -`{{synthetics.attributes.result.id}}` -: Unique result ID - -`{{synthetics.attributes.result.status}}` -: Test execution status (for example, `passed` or `failed`) - -`{{synthetics.attributes.result.duration}}` -: Test duration in milliseconds - -`{{synthetics.attributes.result.testStartedAt}}`, `{{synthetics.attributes.result.testFinishedAt}}`, `{{synthetics.attributes.result.testTriggeredAt}}` -: Epoch timestamps in milliseconds - -`{{synthetics.attributes.result.failure}}` -: The `failure` object contains information about why the test failed - -`{{synthetics.attributes.result.failure.message}}` -: The failure message - -`{{synthetics.attributes.result.failure.code}}` -: The failure code - -**Example values:** -```json -{ - "result": { - "id": "3015485096247415772", - "status": "failed", - "duration": 9096, - "testStartedAt": 1743760758904, - "testFinishedAt": 1743760772025, - "testTriggeredAt": 1743760758593, - "failure": { - "message": "Error: Element's content should match the given regex", - "code": "ASSERTION_FAILURE" - } - } -} -``` - -{{% /tab %}} -{{% tab "Count" %}} - -Applies to Multistep, Browser, and Mobile tests. - -`{{synthetics.attributes.count}}` -: The `count` object contains step statistics about the test - -`{{synthetics.attributes.count.steps.total}}` -: The total number of steps - -`{{synthetics.attributes.count.steps.completed}}` -: The number of steps that were run - -`{{synthetics.attributes.count.errors}}` -: The total number of errors that occurred while running the test. For multistep and mobile tests, this is the number of failed steps. For browser tests, this is the sum of all browser errors. - -`{{synthetics.attributes.count.hops}}` -: The number of traceroute hops for TCP and ICMP tests - -{{% /tab %}} -{{< /tabs >}} - -## Variables - -{{< tabs >}} -{{% tab "Local config variables" %}} - -These are local variables configured for API tests or defined outside individual steps in step-based tests. This also includes variables created by JavaScript code execution. - -Located at `{{synthetics.attributes.result.variables.config}}`: - -`{{synthetics.attributes.result.variables.config.name}}` -: Variable name - -`{{synthetics.attributes.result.variables.config.type}}` -: Variable type - -`{{synthetics.attributes.result.variables.config.secure}}` -: Whether the variable value is obfuscated - -`{{synthetics.attributes.result.variables.config.value}}` -: Variable value (non-obfuscated only) - -**Examples:** -```json -{ - "name": "RANDOM_NUMBER", - "type": "text", - "secure": false, - "value": "133245995" -} -``` - -{{% /tab %}} -{{% tab "Global variables" %}} - -These are extracted variables whose value updates a global variable value. - -Available only for **successful test results** and **recovery notifications**. - -Located at `{{synthetics.attributes.result.variables.extracted}}`: - -`{{synthetics.attributes.result.variables.extracted.id}}` -: Global variable ID - -`{{synthetics.attributes.result.variables.extracted.name}}` -: Variable name - -`{{synthetics.attributes.result.variables.extracted.secure}}` -: Whether the variable value is obfuscated - -`{{synthetics.attributes.result.variables.extracted.val}}` -: Variable value (note: uses `.val`, not `.value`) - -**Examples:** -```json -{ - "id": "ec734823-536e-4aba-8b5f-55733189d936", - "name": "EXTRACTED_NUMBER", - "secure": false, - "val": "250661" -} -``` - -{{% /tab %}} -{{% tab "Step extracted variables" %}} - -For tests with steps, step data is contained in `{{synthetics.attributes.result.steps}}`. - -`.extractedValue.name` -: Variable name - -`.extractedValue.secure` -: Whether the variable value is obfuscated - -`.extractedValue.value` -: Variable value (if step was successful) - -**Examples:** -```json -{ - "extractedValue": { - "name": "EXTRACTED_COUNT", - "secure": false, - "value": "12" - } -} -``` - -{{% /tab %}} -{{< /tabs >}} +{{< partial name="synthetics/template-variables-result.html" >}} ### Variables extracted by steps -Similar to standard API tests, the variables are listed in the `variables.extracted` property, but inside steps themselves. These values are available as long as the step is successful. - -{{< tabs >}} -{{% tab "General steps" %}} - -**For multistep/browser/mobile tests**: - -`.steps.allowFailure` -: Whether the step is allowed to fail without failing the entire test - -`.steps.duration` -: Step execution duration in milliseconds - -`.steps.failure` -: Failure information object containing `.code` and `.message` - -`.steps.id` -: Unique step identifier - -`.steps.isCritical` -: Whether the step is critical to the test - -`.steps.status` -: Step execution status - -`.steps.type` -: Type of step being executed - -**Subtest information:** - -`.steps.subTest.id` -: Subtest identifier - -`.steps.subStep.parentStep.id` -: Parent step identifier - -`.steps.subStep.parentTest.id` -: Parent test identifier - -`.steps.subStep.level` -: Nesting level (1 for subtests, 2 for subtests of subtests) - -**Examples:** -```json -{ - "steps": [ - { - "allowFailure": false, - "duration": 10955, - "failure": { - "code": "ASSERTION_FAILURE", - "message": "Element's content should not equal given value." - }, - "id": "g8e-q4a-fix", - "isCritical": true, - "status": "failed", - "type": "assertElementContent", - "subTest": { - "id": "m2i-fcy-eva" - }, - "subStep": { - "parentStep": {"id": "ikj-juk-z2u"}, - "parentTest": {"id": "th5-wic-5mj"}, - "level": 1 - } - } - ] -} -``` - -{{% /tab %}} -{{% tab "Browser Tests" %}} - -**General:** - -`{{synthetics.attributes.result.startUrl}}` -: URL from test configuration - -**Steps:** - -`.apiTest.request` -: API test request configuration (only for "Run API Test" steps where `type` is `runApiTest`) - -`.apiTest.result` -: API test result data (similar to `attributes.result` for API tests) - -`.assertionResult.expected` -: Expected value for assertions - -`.assertionResults.checkType` -: Type of assertion check - -`.assertionResults.actual` -: Actual value found during assertion - -`.browserErrors` -: List of browser errors encountered - -`.timings.firstByte` -: Time to first byte - -`.timings.tcp` -: TCP connection timing - -`.description` -: Step description - -**Examples:** -```json -{ - "startUrl": "https://datadoghq.com", - "apiTest": { - "request": { - "subType": "http", - "method": "GET", - "url": "https://datadoghq.com" - }, - "result": { - "statusCode": 200 - } - }, - "assertionResults": { - "expected": "100", - "checkType": "equals", - "actual": "200" - }, - "timings": { - "firstByte": 7.1, - "tcp": 5.2 - } -} -``` +{{< partial name="synthetics/template-variables-steps.html" >}} -Examples for `.browserErrors`: - -```json -{ - "name": "Console error", - "description": "Failed to load resource: the server responded with a status of 403 ()", - "type": "js" -}, -{ - "name": "[GET] 403 - https://accounts.google.com/v3/signin/identifier?dsh=S688774280%3A1687962864348747&conti", - "description": "https://accounts.google.com/v3/signin/identifier?dsh=S688774280%3A1687962864348747&continue=https%3A%2F%2Fwww.youtube.com%2Fsignin%3Faction_handle_signin%3Dtrue%26app%3Ddesktop%26hl%3Den%26next%3D%252Fsignin_passive%26feature%3Dpassive&hl=en&ifkv=AeDOFXjMKzxp0wt-b9IzWKz6RS9Kk-VmW5z_fzLP_cjbSWd4hWeP5g53fvdrhX6b2cDVQrNtJ5B7vA&passive=true&service=youtube&uilel=3&flowName=GlifWebSignIn&flowEntry=ServiceLogin\n}} - -{{% collapse-content title= "gRPC" level="h4" expanded=false %}} - -`.callType` -: Call type (`unary` or `healthcheck`) - -`.timings.rpc` -: RPC call timing - -`.response.healthcheck.status` -: Health check status - -`.request.message` -: gRPC request message - -`.response.message` -: gRPC response message - -**Examples:** -```json -{ - "callType": "healthcheck", - "timings": { - "total": 55.3, - "rpc": 9.2, - "dns": 46.1 - }, - "response": { - "healthcheck": { - "status": 1 - } - }, - "request": { - "message": "Ping" - }, - "response": { - "message": "Pong" // Responses can be truncated if too big (only the start is available) - } -} -``` - -{{< /collapse-content >}} - -{{% collapse-content title= "UDP" level="h4" expanded=false %}} - -`.request.message` -: UDP request message - -`.response.message` -: UDP response message - -`.timings.message` -: Message timing - -**Examples:** -```json -{ - "timings": { - "total": 135.3, - "dns": 14.4, - "message": 120.9 - }, - "request": { - "message": "Ping" - }, - "response": { - "message": "Pong" - } -} -``` - -{{< /collapse-content >}} - -{{% collapse-content title= "TCP" level="h4" expanded=false %}} - -`.connectionOutcome` -: Connection result - -`.netpath.routers.ip` -: Router IP addresses - -`.traceroute.latency.min` -: Minimum latency - -`.traceroute.latency.max` -: Maximum latency - -`.traceroute.latency.avg` -: Average latency - -`.traceroute.latency.stddev` -: Standard deviation - -`.traceroute.latency.values` -: Latency values array - -**Examples:** -```json -[ - { - "packetLossPercentage": 1, - "packetsReceived": 0, - "packetsSent": 2, - "routers": [ - { - "ip": "???" - } - ] - }, - { - "packetLossPercentage": 0, - "packetsReceived": 2, - "latency": { - "avg": 0.2375, - "min": 0.189, - "max": 0.286, - "values": [ - 0.189, - 0.286 - ], - "stddev": 0.04849999999999999 - }, - "packetsSent": 2, - "routers": [ - { - "ip": "10.241.134.75" - } - ] - } -] -``` - -{{< /collapse-content >}} - -{{% collapse-content title= "ICMP" level="h4" expanded=false %}} - -`.traceroute` -: Same structure as TCP traceroute - -`.request.host` -: Target host - -`.ping` -: Ping results - -`.latency.min`, `.latency.max`, `.latency.avg`, `.latency.stddev`, `.latency.values` -: Latency measurements (same as TCP) - -**Examples:** -```json -{ - "ping": { - "packetLossPercentage": 0, - "packetsReceived": 4, - "latency": { - "avg": 1.47375, - "min": 1.442, - "max": 1.516, - "values": [ - 1.467, - 1.442, - 1.47, - 1.516 - ], - "stddev": 0.02670557057993708 - }, - "resolvedIp": "18.245.199.70", - "packetsSent": 4, - "packetSize": 56 - } -} -``` - -{{< /collapse-content >}} - -{{% /tab %}} -{{% tab "Protocol tests" %}} - -{{% collapse-content title= "SSL" level="h4" expanded=false %}} - -`.cert` -: SSL certificate information - -`.cipher` -: Cipher suite used - -`.issuer` -: Certificate issuer - -`.subject` -: Certificate subject - -`.valid.from` -: Certificate valid from date - -`.valid.to` -: Certificate valid to date - -`.ocsp` -: OCSP (Online Certificate Status Protocol) information - -`.timings.handshake` -: SSL handshake timing - -**Examples:** -```json - "cipher": TLS_AES_128_GCM_SHA256, - "issuer": { - "C": "US", - "CN": "DigiCert Global G2 TLS RSA SHA256 2020 CA1", - "O": "DigiCert Inc" - }, -``` -```json -{ - "issuer": { - "C": "US", - "CN": "DigiCert Global G2 TLS RSA SHA256 2020 CA1", - "O": "DigiCert Inc" - }, - "valid.from": 1751414400000, //milliseconds - "valid.to": 1783036799000 //milliseconds -} -``` - -{{< /collapse-content >}} - -{{% collapse-content title= "DNS" level="h4" expanded=false %}} - -`.response.records.type` -: DNS record type - -`.response.records.values` -: DNS record values - -**Examples:** -```json -{ - "dns": { - "response": { - "records": { - "type": "A", - "values": ["192.0.2.1", "192.0.2.2"] - } - } - } -} -``` - -{{< /collapse-content >}} - -{{% /tab %}} -{{% tab "Step summary" %}} - -**Step Summary:** -- `.result.steps.` - - `.id`, `.status`, `.type`, `.duration`, `.description`, `.failure.message`, `.code`, `.url` - -The step summary contains the same data as described in [steps](#variables-extracted-by-steps), but you can access it in several ways: - -By step index (0-based): -- `.steps.0` - first step -- `.steps.1` - second step -- `.steps.-1` - last step -- `.steps.-2` - step before last - -By step name: -- `.steps[Click button]` - -By step id: -- `.steps.abc-def-ghi` - -Then you access the data as usual, for example: -- `.steps.-1.status` -- `.steps[Click button].status` -- `.steps.abc-def-ghi.status` - -**Summary Data:** -- `.count.steps.{total,completed}`, `.count.errors`, `.count.hops` (for example, `4`) - -**Service Tag:** -If `service` tag is set: -- `{{service.name}}` -- `{{service.team}}` -- `{{service.docs}}`, `{{service.links}}` - -**Examples**: -```json -{ - "service.name": "API Server", - "service.team": "Backend team", - "service.docs": "https://docs.datadoghq.com/api/" -} -``` - -{{% /tab %}} -{{< /tabs >}} +### Step summary +{{< partial name="synthetics/template-variables-summary.html" >}} ## Further Reading {{< partial name="whats-next/whats-next.html" >}} + +[1]: /synthetics/explore/results_explorer diff --git a/data/synthetics/template_variables.yaml b/data/synthetics/template_variables.yaml new file mode 100644 index 00000000000..31cdb0937e1 --- /dev/null +++ b/data/synthetics/template_variables.yaml @@ -0,0 +1,444 @@ +# Synthetics Template Variables Data +# This file contains all template variable definitions for Synthetic Monitoring notifications. +# Used by: content/en/synthetics/notifications/template_variables.md + +# ============================================================================= +# TEST EXECUTION VARIABLES +# ============================================================================= +test_execution: + description: Use these variables to include details about the test, execution location, device, counts, and result status in your notification messages. + categories: + - name: Test Info + variables: + - path: synthetics.attributes.test + description: The `test` object contains information about the test like its `name`, `type`, `subtype`, and `id` + - path: synthetics.attributes.test.name + description: The name of the test + - path: synthetics.attributes.test.type + description: "Test type (for example, `api`)" + - path: synthetics.attributes.test.subType + description: "Subtype for API tests (for example, `http`, `dns`, and `multi`)" + - path: synthetics.attributes.test.id + description: "The test's public ID (for example, `abc-def-ghi`)" + + - name: Location + variables: + - path: synthetics.attributes.location + description: The `location` object contains information about the location of where the test is run from + - path: synthetics.attributes.location.id + description: "Location ID (for example, `aws:eu-central-1`)" + - path: synthetics.attributes.location.name + description: "Name of the location (for example, `Frankfurt (AWS)`)" + - path: synthetics.attributes.location.privateLocation + description: "`true` for Private Locations" + + - name: Device + note: Applies to browser and mobile tests. + variables: + - path: synthetics.attributes.device + description: The `device` object contains information about the device on which the test is run on + - path: synthetics.attributes.device.id + description: Device identifier + - path: synthetics.attributes.device.name + description: Human-readable device name + - path: synthetics.attributes.device.type + description: Device type classification + - path: synthetics.attributes.device.width + description: Screen width dimension + - path: synthetics.attributes.device.height + description: Screen height dimension + - path: synthetics.attributes.device.browser.type + description: Browser type (browser tests only) + - path: synthetics.attributes.device.platform.name + description: Platform name (mobile tests only) + - path: synthetics.attributes.device.platform.version + description: Platform version (mobile tests only) + + - name: Result + variables: + - path: synthetics.attributes.result + description: The `result` object contains information about the executed test run + - path: synthetics.attributes.result.id + description: Unique result ID + - path: synthetics.attributes.result.status + description: "Test execution status (for example, `passed` or `failed`)" + - path: synthetics.attributes.result.duration + description: Test duration in milliseconds + - path: synthetics.attributes.result.testStartedAt + description: Epoch timestamp in milliseconds when test started + - path: synthetics.attributes.result.testFinishedAt + description: Epoch timestamp in milliseconds when test finished + - path: synthetics.attributes.result.testTriggeredAt + description: Epoch timestamp in milliseconds when test was triggered + - path: synthetics.attributes.result.failure + description: The `failure` object contains information about why the test failed + - path: synthetics.attributes.result.failure.message + description: The failure message + - path: synthetics.attributes.result.failure.code + description: The failure code + + - name: Count + note: Applies to Multistep, Browser, and Mobile tests. + variables: + - path: synthetics.attributes.count + description: The `count` object contains step statistics about the test + - path: synthetics.attributes.count.steps.total + description: The total number of steps + - path: synthetics.attributes.count.steps.completed + description: The number of steps that were run + - path: synthetics.attributes.count.errors + description: The total number of errors that occurred while running the test. For multistep and mobile tests, this is the number of failed steps. For browser tests, this is the sum of all browser errors. + - path: synthetics.attributes.count.hops + description: The number of traceroute hops for TCP and ICMP tests + +# ============================================================================= +# RESULT VARIABLES +# ============================================================================= +result_variables: + description: These variables provide access to local and global variable values used during test execution. Use them to include variable names, types, and values in your notifications. + categories: + - name: Local config variables + note: These are local variables configured for API tests or defined outside individual steps in step-based tests. This also includes variables created by JavaScript code execution. + location: synthetics.attributes.result.variables.config + variables: + - path: synthetics.attributes.result.variables.config.name + description: Variable name + - path: synthetics.attributes.result.variables.config.type + description: Variable type + - path: synthetics.attributes.result.variables.config.secure + description: Whether the variable value is obfuscated + - path: synthetics.attributes.result.variables.config.value + description: Variable value (non-obfuscated only) + + - name: Global variables + note: These are extracted variables whose value updates a global variable value. Available only for **successful test results** and **recovery notifications**. + location: synthetics.attributes.result.variables.extracted + variables: + - path: synthetics.attributes.result.variables.extracted.id + description: Global variable ID + - path: synthetics.attributes.result.variables.extracted.name + description: Variable name + - path: synthetics.attributes.result.variables.extracted.secure + description: Whether the variable value is obfuscated + - path: synthetics.attributes.result.variables.extracted.val + description: "Variable value (note: uses `.val`, not `.value`)" + + - name: Step extracted variables + note: "For tests with steps, step data is contained in `synthetics.attributes.result.steps..extractedValue`. For information on how to access the `` see the [step summary](#step-summary) section." + variables: + - path: synthetics.attributes.result.steps..extractedValue.name + description: Variable name + - path: synthetics.attributes.result.steps..extractedValue.secure + description: Whether the variable value is obfuscated + - path: synthetics.attributes.result.steps..extractedValue.value + description: Variable value (if step was successful) + +# ============================================================================= +# VARIABLES EXTRACTED BY STEPS +# ============================================================================= +step_extracted_variables: + description: For multistep API, browser, and mobile tests, extracted variables are available at the step level within the `synthetics.attributes.variables.extracted` property. These values are only available when the step completes successfully. + categories: + - name: General steps + note: For multistep/browser/mobile tests + groups: + - name: Step properties + variables: + - path: synthetics.attributes.variables.extracted.steps.allowFailure + description: Whether the step is allowed to fail without failing the entire test + - path: synthetics.attributes.variables.extracted.steps.duration + description: Step execution duration in milliseconds + - path: synthetics.attributes.variables.extracted.steps.failure + description: Failure information object containing `.code` and `.message` + - path: synthetics.attributes.variables.extracted.steps.id + description: Unique step identifier + - path: synthetics.attributes.variables.extracted.steps.isCritical + description: Whether the step is critical to the test + - path: synthetics.attributes.variables.extracted.steps.status + description: Step execution status + - path: synthetics.attributes.variables.extracted.steps.type + description: Type of step being executed + - name: Subtest information + variables: + - path: synthetics.attributes.variables.extracted.steps.subTest.id + description: Subtest identifier + - path: synthetics.attributes.variables.extracted.steps.subStep.parentStep.id + description: Parent step identifier + - path: synthetics.attributes.variables.extracted.steps.subStep.parentTest.id + description: Parent test identifier + - path: synthetics.attributes.variables.extracted.steps.subStep.level + description: "Nesting level (1 for subtests, 2 for subtests of subtests)" + + - name: Browser Tests + groups: + - name: General + variables: + - path: synthetics.attributes.result.startUrl + description: URL from test configuration + - name: Steps + variables: + - path: synthetics.attributes.variables.extracted.apiTest.request + description: "API test request configuration (only for \"Run API Test\" steps where `type` is `runApiTest`)" + - path: synthetics.attributes.variables.extracted.apiTest.result + description: API test result data (similar to `attributes.result` for API tests) + - path: synthetics.attributes.variables.extracted.assertionResult.expected + description: Expected value for assertions + - path: synthetics.attributes.variables.extracted.assertionResults.checkType + description: Type of assertion check + - path: synthetics.attributes.variables.extracted.assertionResults.actual + description: Actual value found during assertion + - path: synthetics.attributes.variables.extracted.browserErrors + description: List of browser errors encountered + - path: synthetics.attributes.variables.extracted.timings.firstByte + description: Time to first byte + - path: synthetics.attributes.variables.extracted.timings.tcp + description: TCP connection timing + - path: synthetics.attributes.variables.extracted.description + description: Step description + + - name: Mobile Tests + variables: + - path: synthetics.attributes.variables.extracted.application.versionId + description: Mobile application version identifier + - path: synthetics.attributes.variables.extracted.apiTest + description: API test data (for API test steps within mobile tests) + - path: synthetics.attributes.variables.extracted.description + description: Step description + + - name: API Tests + groups: + - name: Multistep + note: "Follow regular API fields per subType" + variables: + - path: synthetics.attributes.variables.extracted.name + description: Step name + - path: synthetics.attributes.variables.extracted.type + description: Step type + - name: Non-Multistep + variables: + - path: synthetics.attributes.variables.extracted.assertions.actual + description: Actual value from assertion + - path: synthetics.attributes.variables.extracted.assertions.expected + description: Expected value for assertion + - path: synthetics.attributes.variables.extracted.assertions.operator + description: Assertion operator + - path: synthetics.attributes.variables.extracted.assertions.type + description: Assertion type + - path: synthetics.attributes.variables.extracted.dnsResolution.resolvedIp + description: Resolved IP address + - path: synthetics.attributes.variables.extracted.dnsResolution.server + description: DNS server used + - path: synthetics.attributes.variables.extracted.timings.dns + description: DNS resolution time + - path: synthetics.attributes.variables.extracted.timings.tcp + description: TCP connection time + - path: synthetics.attributes.variables.extracted.request.url + description: Request URL + - path: synthetics.attributes.variables.extracted.request.host + description: Request host + - path: synthetics.attributes.variables.extracted.response.body + description: Response body content + - path: synthetics.attributes.variables.extracted.response.statusCode + description: HTTP status code + - path: synthetics.attributes.variables.extracted.response.headers + description: Response headers + - path: synthetics.attributes.variables.extracted.response.httpVersion + description: HTTP version + - path: synthetics.attributes.variables.extracted.response.redirects + description: Redirect information + + - name: Network tests + subtypes: + - name: WebSocket + variables: + - path: synthetics.attributes.variables.extracted.timings.open + description: Time to open connection (in milliseconds) + - path: synthetics.attributes.variables.extracted.timings.receive + description: Time to receive response + - path: synthetics.attributes.variables.extracted.handshake.request + description: Handshake request data + - path: synthetics.attributes.variables.extracted.handshake.response + description: Handshake response data + - path: synthetics.attributes.variables.extracted.request.message + description: WebSocket request message + - path: synthetics.attributes.variables.extracted.response.message + description: WebSocket response message + - path: synthetics.attributes.variables.extracted.close.reason + description: Connection close reason + - path: synthetics.attributes.variables.extracted.close.statusCode + description: Connection close status code + - name: gRPC + variables: + - path: synthetics.attributes.variables.extracted.callType + description: "Call type (`unary` or `healthcheck`)" + - path: synthetics.attributes.variables.extracted.timings.rpc + description: RPC call timing + - path: synthetics.attributes.variables.extracted.response.healthcheck.status + description: Health check status + - path: synthetics.attributes.variables.extracted.request.message + description: gRPC request message + - path: synthetics.attributes.variables.extracted.response.message + description: gRPC response message + - name: UDP + variables: + - path: synthetics.attributes.variables.extracted.request.message + description: UDP request message + - path: synthetics.attributes.variables.extracted.response.message + description: UDP response message + - path: synthetics.attributes.variables.extracted.timings.message + description: Message timing + - name: TCP + variables: + - path: synthetics.attributes.variables.extracted.connectionOutcome + description: Connection result + - path: synthetics.attributes.variables.extracted.netpath.routers.ip + description: Router IP addresses + - path: synthetics.attributes.variables.extracted.traceroute.latency.min + description: Minimum latency + - path: synthetics.attributes.variables.extracted.traceroute.latency.max + description: Maximum latency + - path: synthetics.attributes.variables.extracted.traceroute.latency.avg + description: Average latency + - path: synthetics.attributes.variables.extracted.traceroute.latency.stddev + description: Standard deviation + - path: synthetics.attributes.variables.extracted.traceroute.latency.values + description: Latency values array + - name: ICMP + variables: + - path: synthetics.attributes.variables.extracted.traceroute + description: Same structure as TCP traceroute + - path: synthetics.attributes.variables.extracted.request.host + description: Target host + - path: synthetics.attributes.variables.extracted.ping + description: Ping results + - path: synthetics.attributes.variables.extracted.latency.min + description: Minimum latency + - path: synthetics.attributes.variables.extracted.latency.max + description: Maximum latency + - path: synthetics.attributes.variables.extracted.latency.avg + description: Average latency + - path: synthetics.attributes.variables.extracted.latency.stddev + description: Latency standard deviation + - path: synthetics.attributes.variables.extracted.latency.values + description: Latency values array + + - name: Protocol tests + subtypes: + - name: SSL + variables: + - path: synthetics.attributes.variables.extracted.cert + description: SSL certificate information + - path: synthetics.attributes.variables.extracted.cipher + description: Cipher suite used + - path: synthetics.attributes.variables.extracted.issuer + description: Certificate issuer + - path: synthetics.attributes.variables.extracted.subject + description: Certificate subject + - path: synthetics.attributes.variables.extracted.valid.from + description: Certificate valid from date + - path: synthetics.attributes.variables.extracted.valid.to + description: Certificate valid to date + - path: synthetics.attributes.variables.extracted.ocsp + description: OCSP (Online Certificate Status Protocol) information + - path: synthetics.attributes.variables.extracted.timings.handshake + description: SSL handshake timing + - name: DNS + variables: + - path: synthetics.attributes.variables.extracted.response.records.type + description: DNS record type + - path: synthetics.attributes.variables.extracted.response.records.values + description: DNS record values + - name: HTTP + variables: + # Request + - path: synthetics.attributes.variables.extracted.request + description: Information about the request + - path: synthetics.attributes.variables.extracted.request.method + description: The HTTP method + - path: synthetics.attributes.variables.extracted.request.body + description: The request body if set + - path: synthetics.attributes.variables.extracted.request.headers + description: The request headers + # Response + - path: synthetics.attributes.variables.extracted.response + description: Information about the response + - path: synthetics.attributes.variables.extracted.response.body + description: The response body as string (truncated if too big) + - path: synthetics.attributes.variables.extracted.response.bodySize + description: The size of the full response body + - path: synthetics.attributes.variables.extracted.response.cacheHeaders + description: A dictionary of caching-related headers + - path: synthetics.attributes.variables.extracted.response.cdn + description: The response CDN info if any + - path: synthetics.attributes.variables.extracted.response.cdn.provider + description: "The CDN provider name (for example, `akamai`, `cloudflare`)" + - path: synthetics.attributes.variables.extracted.response.cdn.cache + description: The cache info + - path: synthetics.attributes.variables.extracted.response.cdn.cache.cached + description: If the data was cached + - path: synthetics.attributes.variables.extracted.response.cdn.cache.status + description: The cache status as provided in associated cache header + - path: synthetics.attributes.variables.extracted.response.headers + description: The response headers + - path: synthetics.attributes.variables.extracted.response.httpVersion + description: The HTTP version + - path: synthetics.attributes.variables.extracted.response.redirects + description: A list of redirections if any + - path: synthetics.attributes.variables.extracted.response.redirects.statusCode + description: The HTTP status code for the redirect + - path: synthetics.attributes.variables.extracted.response.redirects.location + description: The returned location to redirect to + - path: synthetics.attributes.variables.extracted.response.statusCode + description: The response HTTP status code + # Timings + - path: synthetics.attributes.variables.extracted.timings.authentication + description: "The time spent for the authentication challenge (for example, NTLM)" + - path: synthetics.attributes.variables.extracted.timings.download + description: The time spent downloading the response + - path: synthetics.attributes.variables.extracted.timings.firstByte + description: The time spent waiting for the first byte of response to be received + - path: synthetics.attributes.variables.extracted.timings.redirect + description: The time spent in HTTP redirections + - path: synthetics.attributes.variables.extracted.timings.ssl + description: The duration of the TLS handshake (only when testing an HTTPS endpoint) + +# ============================================================================= +# STEP SUMMARY +# ============================================================================= +step_summary: + description: Access step data by index, name, or ID to reference specific steps in your notification messages. This section also includes summary counts for total steps, completed steps, and errors. + step_properties: + - ".id" + - ".status" + - ".type" + - ".duration" + - ".description" + - ".failure.message" + - ".code" + - ".url" + reference_methods: + - name: By index (0-based) + description: Use positive numbers to count from the beginning, or negative numbers to count from the end + examples: + - syntax: synthetics.attributes.result.steps.0 + description: First step + - syntax: synthetics.attributes.result.steps.1 + description: Second step + - syntax: synthetics.attributes.result.steps.-1 + description: Last step + - syntax: synthetics.attributes.result.steps.-2 + description: Second to last step + - name: By step name + description: Use the step name in brackets + example: ".steps[Click button]" + - name: By step ID + description: Use the step's unique identifier + example: ".steps.abc-def-ghi" + usage_examples: + - path: synthetics.attributes.result.steps.-1.status + description: Status of the last step + - path: synthetics.attributes.result.steps[Click button].status + description: Status of the step named "Click button" + - path: synthetics.attributes.result.steps.abc-def-ghi.status + description: Status of the step with step ID "abc-def-ghi" + diff --git a/layouts/partials/synthetics/template-variables-execution.html b/layouts/partials/synthetics/template-variables-execution.html new file mode 100644 index 00000000000..f5b633770d4 --- /dev/null +++ b/layouts/partials/synthetics/template-variables-execution.html @@ -0,0 +1,28 @@ +{{/* + Renders Test Execution Variables from data/synthetics/template_variables.yaml + Usage: {{ partial "synthetics/template-variables-execution.html" . }} +*/}} + +{{ $data := .Site.Data.synthetics.template_variables }} + +{{ with $data.test_execution }} +

{{ .description | markdownify }}

+ +
+ +
+ {{ range $idx, $cat := .categories }} +
+ {{ with $cat.note }}

{{ . | markdownify }}

{{ end }} +
+ {{ range $cat.variables }} +
{{ printf "{{%s}}" .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+
+ {{ end }} +
+
+{{ end }} + diff --git a/layouts/partials/synthetics/template-variables-result.html b/layouts/partials/synthetics/template-variables-result.html new file mode 100644 index 00000000000..20480531c02 --- /dev/null +++ b/layouts/partials/synthetics/template-variables-result.html @@ -0,0 +1,29 @@ +{{/* + Renders Result Variables from data/synthetics/template_variables.yaml + Usage: {{ partial "synthetics/template-variables-result.html" . }} +*/}} + +{{ $data := .Site.Data.synthetics.template_variables }} + +{{ with $data.result_variables }} +

{{ .description | markdownify }}

+ +
+ +
+ {{ range $idx, $cat := .categories }} +
+ {{ with $cat.note }}

{{ . | markdownify }}

{{ end }} + {{ with $cat.location }}

Located at {{ printf "{{%s}}" . }}:

{{ end }} +
+ {{ range $cat.variables }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+
+ {{ end }} +
+
+{{ end }} + diff --git a/layouts/partials/synthetics/template-variables-steps.html b/layouts/partials/synthetics/template-variables-steps.html new file mode 100644 index 00000000000..853353128aa --- /dev/null +++ b/layouts/partials/synthetics/template-variables-steps.html @@ -0,0 +1,63 @@ +{{/* + Renders Step Extracted Variables from data/synthetics/template_variables.yaml + Usage: {{ partial "synthetics/template-variables-steps.html" . }} +*/}} + +{{ $data := .Site.Data.synthetics.template_variables }} + +{{ with $data.step_extracted_variables }} +

{{ .description | markdownify }}

+ +
+ +
+ {{ range $idx, $cat := .categories }} +
+ + {{ with $cat.note }}

{{ . | markdownify }}

{{ end }} + + {{/* Handle categories with groups */}} + {{ with $cat.groups }} + {{ range . }} +

{{ .name }}

+ {{ with .note }}

{{ . | markdownify }}

{{ end }} +
+ {{ range .variables }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+ {{ end }} + {{ end }} + + {{/* Handle categories with direct variables (no groups) */}} + {{ with $cat.variables }} +
+ {{ range . }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+ {{ end }} + + {{/* Handle categories with subtypes (Network tests, Protocol tests) */}} + {{ with $cat.subtypes }} + {{ range . }} +
+

{{ .name }}

+
+ {{ range .variables }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+
+ {{ end }} + {{ end }} + +
+ {{ end }} +
+
+{{ end }} + diff --git a/layouts/partials/synthetics/template-variables-summary.html b/layouts/partials/synthetics/template-variables-summary.html new file mode 100644 index 00000000000..23d99da3bf8 --- /dev/null +++ b/layouts/partials/synthetics/template-variables-summary.html @@ -0,0 +1,49 @@ +{{/* + Renders Step Summary from data/synthetics/template_variables.yaml + Usage: {{ partial "synthetics/template-variables-summary.html" . }} +*/}} + +{{ $data := .Site.Data.synthetics.template_variables }} + +{{ with $data.step_summary }} +

{{ .description | markdownify }}

+ +

Each step exposes the following properties: +{{ range $idx, $prop := .step_properties }}{{ if $idx }}, {{ end }}{{ $prop }}{{ end }}. +

+ +

You can reference steps in three ways:

+ +{{ range .reference_methods }} +

{{ .name }}

+

{{ .description | markdownify }}{{ if .example }}: {{ .example }}{{ end }}

+ +{{ with .examples }} + + + + + + + + + {{ range . }} + + + + + {{ end }} + +
SyntaxDescription
{{ .syntax }}{{ .description | markdownify }}
+{{ end }} +{{ end }} + +

Accessing step properties

+

Combine any reference method with a property:

+
    +{{ range .usage_examples }} +
  • {{ printf "{{%s}}" .path }} - {{ .description | markdownify }}
  • +{{ end }} +
+{{ end }} + diff --git a/layouts/partials/synthetics/template-variables.html b/layouts/partials/synthetics/template-variables.html new file mode 100644 index 00000000000..eb7f5d77e5c --- /dev/null +++ b/layouts/partials/synthetics/template-variables.html @@ -0,0 +1,155 @@ +{{/* + Renders Synthetics template variables from data/synthetics/template_variables.yaml + Usage: {{ partial "synthetics/template-variables.html" . }} +*/}} + +{{ $data := .Site.Data.synthetics.template_variables }} + +{{/* Test Execution Variables */}} +{{ with $data.test_execution }} +

Test execution variables

+

{{ .description | markdownify }}

+ +
+ +
+ {{ range $idx, $cat := .categories }} +
+ {{ with $cat.note }}

{{ . | markdownify }}

{{ end }} +
+ {{ range $cat.variables }} +
{{ printf "{{%s}}" .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+
+ {{ end }} +
+
+{{ end }} + +{{/* Result Variables */}} +{{ with $data.result_variables }} +

Result variables

+

{{ .description | markdownify }}

+ +
+ +
+ {{ range $idx, $cat := .categories }} +
+ {{ with $cat.note }}

{{ . | markdownify }}

{{ end }} + {{ with $cat.location }}

Located at {{ printf "{{%s}}" . }}:

{{ end }} +
+ {{ range $cat.variables }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+
+ {{ end }} +
+
+{{ end }} + +{{/* Step Extracted Variables */}} +{{ with $data.step_extracted_variables }} +

Variables extracted by steps

+

{{ .description | markdownify }}

+ +
+ +
+ {{ range $idx, $cat := .categories }} +
+ + {{ with $cat.note }}

{{ . | markdownify }}

{{ end }} + + {{/* Handle categories with groups */}} + {{ with $cat.groups }} + {{ range . }} +

{{ .name }}

+ {{ with .note }}

{{ . | markdownify }}

{{ end }} +
+ {{ range .variables }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+ {{ end }} + {{ end }} + + {{/* Handle categories with direct variables (no groups) */}} + {{ with $cat.variables }} +
+ {{ range . }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+ {{ end }} + + {{/* Handle categories with subtypes (Network tests, Protocol tests) */}} + {{ with $cat.subtypes }} + {{ range . }} +
+

{{ .name }}

+
+ {{ range .variables }} +
{{ .path }}
+
{{ .description | markdownify }}
+ {{ end }} +
+
+ {{ end }} + {{ end }} + +
+ {{ end }} +
+
+{{ end }} + +{{/* Step Summary */}} +{{ with $data.step_summary }} +

Step summary

+

{{ .description | markdownify }}

+ +

Each step exposes the following properties: +{{ range $idx, $prop := .step_properties }}{{ if $idx }}, {{ end }}{{ $prop }}{{ end }}. +

+ +

You can reference steps in three ways:

+ +{{ range .reference_methods }} +

{{ .name }}

+

{{ .description | markdownify }}{{ if .example }}: {{ .example }}{{ end }}

+ +{{ with .examples }} + + + + + + + + + {{ range . }} + + + + + {{ end }} + +
SyntaxDescription
{{ .syntax }}{{ .description | markdownify }}
+{{ end }} +{{ end }} + +

Accessing step properties

+

Combine any reference method with a property:

+
    +{{ range .usage_examples }} +
  • {{ printf "{{%s}}" .path }} - {{ .description | markdownify }}
  • +{{ end }} +
+{{ end }} diff --git a/static/images/synthetics/notifications/action_tab.png b/static/images/synthetics/notifications/action_tab.png new file mode 100644 index 00000000000..17d48e9f733 Binary files /dev/null and b/static/images/synthetics/notifications/action_tab.png differ