본문 바로가기

UX

데이터독 Synthetic Test API(CI/CD)

https://docs.datadoghq.com/api/latest/synthetics/

 

Synthetic ID를 통한 결과 확인

curl -X POST \
-H 'Content-Type: application/json' \
-H "DD-API-KEY: xxx" \
-H "DD-APPLICATION-KEY: xxx" \
-d "{
    \"tests\": [
        {
            \"public_id\": \"aur-mea-wzx\"
        }
    ]
}" "https://api.datadoghq.com/api/v1/synthetics/tests/trigger/ci" | jq

 

응답 값

{
  "batch_id": "8f3f1a11-5172-4fbf-a52b-a0961eecd8fe",
  "results": [
    {
      "device": "chrome.laptop_large",
      "result_id": "3801205553305809657",
      "public_id": "aur-mea-wzx",
      "location": 30016
    },
    {
      "device": "edge.laptop_large",
      "result_id": "1060777684909799585",
      "public_id": "aur-mea-wzx",
      "location": 30016
    }
  ],
  "triggered_check_ids": [
    "aur-mea-wzx"
  ],
  "locations": [
    {
      "display_name": "Seoul (AWS)",
      "name": "aws:ap-northeast-2",
      "region": "Asia Pacific",
      "is_active": true,
      "is_public": true,
      "id": 30016,
      "metadata": null
    }
  ]
}

 

 

Synthetic Result ID를 통한 세부 결과 확인

curl -G \
    "https://api.datadoghq.com/api/v1/synthetics/tests/browser/aur-mea-wzx/results/`resultId`"\
    -H "DD-API-KEY: xxxx" \
    -H "DD-APPLICATION-KEY: xxx" | jq

 

응답 값

{
  "status": 0,
  "run_type": 2,
  "check_time": 1666676717019,
  "check_version": 4,
  "result": {
    "stepDetails": [
      {
        "browserErrors": [],
        "vitalsMetrics": [
          {
            "url": "https://shopist.io/",
            "lcp": 1711
          }
        ],
        "skipped": false,
        "description": "Navigate to start URL",
        "warnings": [],
        "url": "about:blank",
        "snapshotBucketKey": false,
        "value": "https://shopist.io/",
        "rumContext": {
          "sessionId": "121aa7d5-cc03-41e9-8c2b-0c2dcd406eda",
          "applicationId": "b184e4e2-ca59-418e-a9fb-47d4a2253004",
          "viewId": "9a7373f4-80b5-426c-9b3c-9a42cb8ae9e7"
        },
        "screenshotBucketKey": true,
        "emailMessageBucketKeys": false,
        "allowFailure": false,
        "duration": 2003,
        "isCritical": false,
        "type": "goToUrlAndMeasureTti",
        "stepId": -1
      },
      {
        "browserErrors": [
          {
            "type": "js",
            "description": "Failed to load resource: the server responded with a status of 403 ()",
            "name": "Console error"
          },
          {
            "status": 403,
            "type": "network",
            "description": "https://session-replay.browser-intake-datadoghq.com/api/v2/replay?ddsource=browser&ddtags=sdk_version%3A4.15.0%2Cservice%3Ashopist.io&dd-api-key=unavailable&dd-evp-origin-version=4.15.0&dd-evp-origin=browser&dd-request-id=8d3b2086-7ed4-47a4-96e3-cb0addd11bb6",
            "name": "[POST] 403 - https://session-replay.browser-intake-datadoghq.com/api/v2/replay?ddsource=browser&ddta"
          },
          {
            "status": 403,
            "type": "network",
            "description": "https://rum.browser-intake-datadoghq.com/api/v2/rum?ddsource=browser&ddtags=sdk_version%3A4.15.0%2Cservice%3Ashopist.io&dd-api-key=unavailable&dd-evp-origin-version=4.15.0&dd-evp-origin=browser&dd-request-id=06508f1b-b10c-4ba2-8544-3e865f7ca797&batch_time=1666676724568",
            "name": "[POST] 403 - https://rum.browser-intake-datadoghq.com/api/v2/rum?ddsource=browser&ddtags=sdk_version"
          },
          {
            "status": 403,
            "type": "network",
            "description": "https://rum.browser-intake-datadoghq.com/api/v2/rum?ddsource=browser&ddtags=sdk_version%3A4.15.0%2Cservice%3Ashopist.io&dd-api-key=unavailable&dd-evp-origin-version=4.15.0&dd-evp-origin=browser&dd-request-id=b335fe99-9bf1-4315-8e5b-e006928445fb&batch_time=1666676726129\n",
            "name": "[POST] 403 - https://rum.browser-intake-datadoghq.com/api/v2/rum?ddsource=browser&ddtags=sdk_version"
          }
        ],
        "vitalsMetrics": [
          {
            "url": "https://shopist.io/department/chairs",
            "lcp": 1376.899,
            "cls": 0
          }
        ],
        "skipped": false,
        "publicId": "j64-tha-xtg",
        "description": "Click on link \"Chairs Shop now\"",
        "emailMessageBucketKeys": false,
        "url": "https://shopist.io/",
        "snapshotBucketKey": false,
        "rumContext": {
          "sessionId": "121aa7d5-cc03-41e9-8c2b-0c2dcd406eda",
          "applicationId": "b184e4e2-ca59-418e-a9fb-47d4a2253004",
          "viewId": "a17d2870-5fe0-430d-87b5-b303bd98e7ba"
        },
        "screenshotBucketKey": true,
        "allowFailure": false,
        "duration": 3150,
        "isCritical": true,
        "type": "click",
        "stepId": 14518061
      }
    ],
    "eventType": "finished",
    "duration": 5153,
    "browserType": "edge",
    "browserVersion": "105.0.1343.27",
    "mainDC": "us1.prod",
    "timeToInteractive": 1689.7999999523163,
    "device": {
      "name": "Laptop Large",
      "height": 1100,
      "width": 1440,
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Edg/105.0.1343.27 DatadogSynthetics",
      "id": "edge.laptop_large",
      "isMobile": false,
      "browser": "edge"
    },
    "metadata": {
      "batch_id": "8f3f1a11-5172-4fbf-a52b-a0961eecd8fe"
    },
    "hasArtifacts": true,
    "passed": true,
    "batch_id": "8f3f1a11-5172-4fbf-a52b-a0961eecd8fe",
    "execution_rule": "blocking",
    "startUrl": "https://shopist.io/",
    "runType": 2
  },
  "probe_dc": "aws:ap-northeast-2",
  "result_id": "1060777684909799585",
  "check": {
    "type": "browser",
    "config": {
      "variables": [],
      "setCookie": "",
      "request": {
        "url": "https://shopist.io/",
        "headers": {},
        "method": "GET"
      },
      "assertions": [],
      "configVariables": []
    },
    "options": {
      "disableCsp": false,
      "retry": {
        "count": 0,
        "interval": 300
      },
      "min_location_failed": 1,
      "min_failure_duration": 0,
      "noScreenshot": false,
      "enableSecurityTesting": false,
      "monitor_options": {
        "renotify_interval": 0
      },
      "disableCors": false,
      "enableProfiling": false,
      "rumSettings": {
        "isEnabled": true,
        "applicationId": "b184e4e2-ca59-418e-a9fb-47d4a2253004",
        "clientTokenId": 95022
      },
      "device_ids": [
        "chrome.laptop_large",
        "edge.laptop_large"
      ],
      "tick_every": 300,
      "ignoreServerCertificateError": false
    }
  },
  "device_id": "edge.laptop_large"
}

'UX' 카테고리의 다른 글

데이터독 RUM 샘플레이트 관련  (0) 2022.11.02