개요

gRPC 테스트로 gRPC 서비스 및 서버를 사전 모니터링할 수 있습니다. 다음 두 가지 유형 중에서 선택할 수 있습니다.

동작 점검 :애플리케이션의 API 엔드포인트에 gRPC 요청을 전송하여 전체 응답 시간, 헤더 또는 본문 콘텐츠 등의 응답과 정의한 조건을 확인합니다.

서비스 상태 점검
gRPC 서비스 상태 점검은 gRPC 서비스 상태 보고의 기준이 됩니다. 본 점검으로 gRPC 서버와 서비스가 응답하고 실행 중이며 원격 프로시저 호출(RPC)을 처리할 수 있는지 확인합니다.

gRPC 서비스 상태 점검을 구현하면 Datadog에 .proto 파일을 제공하지 않아도 gRPC 서비스 상태 점검 테스트를 실행할 수 있습니다. 자세한 내용을 확인하려면 gRPC 커뮤니티가 공유한 서비스 상태 점검 .proto 파일 예시을 참조하세요.

gRPC 테스트는 네트워크 외부에서 또는 내부에서 실행할지 선호도에 따라 관리 위치비공개 위치에서 모두 실행할 수 있습니다. gRPC 테스트는 일정에 맞추어서, 온디맨드 또는 CI/CD 파이프라인 내에서 직접 실행할 수 있습니다.

설정

다음 옵션 중 하나를 사용하여 테스트를 생성할 수 있습니다.

  • 템플릿에서 테스트 생성하기:

    1. 사전에 채워진 템플릿 중 하나에 마우스를 올리고 템플릿 보기를 클릭합니다. 테스트 세부 정보, 요청 세부 정보, 어설션, 알림 조건 및 모니터링 설정이 포함된, 사전에 채워진 설정 정보가 표시되는 사이드 패널이 열립니다.
    2. +테스트 생성하기를 클릭하면 사전 입력된 설정 옵션을 검토하고 편집할 수 있는 요청 정의 페이지가 열립니다. 표시되는 필드는 테스트 초기 생성 시사용할 수 있는 필드와 동일합니다.
    3. 세부 정보 저장을 클릭하여 API 테스트를 제출합니다.

  • 테스트 처음부터 빌드하기:

    1. 테스트를 처음부터 빌드하려면 +처음부터 시작 템플릿을 클릭한 다음 gRPC 요청 유형을 선택합니다.
    2. 테스트를 실행할 호스트포트를 지정합니다. 기본 gRPC 포트는 50051입니다.
    3. 단항 호출(unary call)을 실행하려면 동작 점검을 선택하고, 서비스 상태 점검을 실행하려면 서비스 상태 점검을 선택합니다.

    동작 점검의 경우 서버 리플렉션 또는 프로토 파일 업로드를 지정하여 gRPC 서버를 정의합니다. 원하는 방식을 선택하고 요청 메시지를 포함합니다. Datadog은 스트리밍 방식을 지원하지 않습니다.

    gRPC 요청 정의

    서비스 상태 점검의 경우 서비스의 이름을 입력합니다. gRPC 서버에서 서비스 상태 점검을 전송하려면 해당 필드를 비워둡니다.

    gRPC 요청 정의
  1. 테스트에 고급 옵션(선택 사항)을 추가합니다.

    • 타임아웃: 테스트 시간 초과로 간주하기까지의 시간을 초단위로 지정합니다.
    • 서버 인증서 오류 무시: SSL 인증서의 유효성을 검사할 때 오류가 발생하더라도 연결을 통해 gRPC 테스트를 계속하려면 체크 표시합니다.
    • gRPC 메타데이터: gRPC 요청에 메타데이터를 추가 및 정의하여 서비스 간에 메타데이터를 전달합니다.
    • 클라이언트 인증서: 클라이언트 인증서(.crt) 및 연결된 비공개 키(.key)를 PEM 형식으로 업로드하여 mTLS를 통해 인증합니다.

    openssl 라이브러리를 사용하여 인증서를 변환할 수 있습니다. 예를 들어, PKCS12 인증서를 PEM 형식의 비공개 키 및 인증서로 변환합니다.

       openssl pkcs12 -in <CERT>.p12 -out <CERT_KEY>.key -nodes -nocerts
       openssl pkcs12 -in <CERT>.p12 -out <CERT>.cert -nokeys
    
  2. gRPC 테스트의 이름을 지정합니다.

  3. gRPC 테스트에 환경 태그 및 기타 태그를 추가합니다. 이러한 태그를 사용하여 신서틱 모니터링 & 지속적인 테스트 페이지에서 신서틱 테스트를 필터링할 수 있습니다.

  4. 호출을 클릭하여 요청 설정을 테스트합니다. 화면 오른쪽에 응답 미리보기가 표시됩니다.

  5. 테스트 생성하기를 클릭하여 API 테스트를 제출합니다.

Snippets

When setting up a new Synthetic Monitoring API test, use snippets to automatically fill in basic auth, performance, and regions, rather than selecting these options manually. The following snippets are available:

  • Basic Auth: Automatically test your APIs using pre-populated basic auth headers, JavaScript, bearer token, and API/app key auth variables.

  • Performance: Automatically configure a test with the shortest frequency (one minute), perform a gRPC health check, and test for overall response time latency with a breakdown of network timing.

  • Regions: Automatically test your API endpoint against a location in each of the three primary geographic regions (AMER, APAC and EMEA).

    Screenshot of the left hand side of an API test creation, showing the snippets example

어설션 정의

어서션은 예상되는 테스트 결과를 정의합니다. 전송을 클릭하면 수신한 응답에 기반한 response time의 어서션이 추가됩니다. 테스트를 모니터링하려면 최소 한 개 이상의 어서션을 정의해야합니다.

유형연산자값 유형
응답 시간is less than정수 (ms)
gRPC 응답contains, does not contain, is, is not,
matches, does not match,
jsonpath, xpath
문자열
정규식
gRPC 메타데이터is, is not, contains, does not contain, matches regex, does not match regex, does not exist정수(ms)
정규식

신규 어서션을 클릭하거나 응답 미리보기를 클릭하여 API 테스트당 최대 20개의 어서션을 생성할 수 있습니다.

성공 또는 실패로 gRPC 테스트 어서션 정의
유형연산자값 유형
응답 시간is less than정수 (ms)
서비스 점검 상태is, is not정수 (ms)
gRPC 메타데이터is, is not, contains, does not contain, matches regex, does not match regex, does not exist정수 (ms)

신규 어서션을 클릭하거나 응답 미리보기를 클릭하여 API 테스트당 최대 20개의 어서션을 생성할 수 있습니다.

성공 또는 실패로 gRPC 테스트 어서션 정의

테스트에 응답 본문 어설션이 포함되어 있지 않으면 본문 페이로드가 삭제되고 Synthetics Worker가 설정한 제한 시간 내에서 요청 관련 응답 시간을 반환합니다.

테스트에 응답 본문에 대한 어서션이 포함되어 있고 제한 시간에 도달하면, Assertions on the body/response cannot be run beyond this limit 오류가 나타납니다.

위치 선택

gRPC 테스트를 실행할 위치를 선택합니다. gRPC 테스트는 네트워크 외부 또는 내부에서 테스트를 실행하는 선호도에 따라 관리되는 위치 및 프라이빗 위치에서 모두 실행할 수 있습니다.

Datadog’s out-of-the-box managed locations allow you to test public-facing websites and endpoints from regions where your customers are located.

AWS:

AmericasAsia PacificEMEA
Canada CentralHong KongBahrain
Northern CaliforniaJakartaCape Town
Northern VirginiaMumbaiFrankfurt
OhioOsakaIreland
OregonSeoulLondon
São PauloSingaporeMilan
SydneyParis
TokyoStockholm

GCP:

AmericasAsia PacificEMEA
DallasTokyoFrankfurt
Los Angeles
Oregon
Virginia

Azure:

RegionLocation
AmericasVirginia

The Datadog for Government site (US1-FED) uses the following managed location:

RegionLocation
AmericasUS-West

테스트 빈도 지정

다음과 같이 gRPC 테스트를 수행합니다.

  • 일정에 따라 사용자가 가장 중요한 서비스에 항상 액세스할 수 있도록 보장합니다. Datadog이 gRPC 테스트를 실행할 빈도를 선택하세요.
  • CI/CD 파이프라인 내에서 결함이 있는 코드가 고객 경험에 영향을 미칠지에 대한 염려 없이 제공을 시작할 수 있습니다.
  • 온디맨드로 실행하면 팀에 가장 적합한 시간에 테스트를 실행할 수 있습니다.

Define alert conditions

Set alert conditions to determine the circumstances under which you want a test to fail and trigger an alert.

Alerting rule

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:

  • At least one location was in failure (at least one assertion failed) during the last X minutes;
  • At one moment during the last X minutes, at least n locations were in failure.

Fast retry

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.

Configure the test monitor

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.

  1. 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.

  2. Enter the notification message for your test or use pre-filled monitor messages. This field allows standard Markdown formatting and supports the following conditional variables:

Conditional VariableDescription
{{#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).

Notification messages include the message defined in this section and information about the failing locations. Pre-filled monitor messages are included in the message body section:

Synthetic Monitoring monitor section for API tests, highlighting the pre-filled monitor messages
  1. Specify how often you want your test to re-send the notification message in case of test failure. To prevent renotification on failing tests, check the option Stop re-notifying on X occurrences.

  2. Click Save & Start Recording to save your test configuration and monitor.

For more information, see Synthetic Monitoring notifications.

Create local variables

To create a local variable, click + All steps > Variables. You can select one of the following available builtins to add to your variable string:

{{ numeric(n) }}
Generates a numeric string with n digits.
{{ alphabetic(n) }}
Generates an alphabetic string with n letters.
{{ alphanumeric(n) }}
Generates an alphanumeric string with n characters.
{{ date(n unit, format) }}
Generates a date in one of Datadog’s accepted formats with a value corresponding to the UTC date the test is initiated at + or - n units.
{{ timestamp(n, unit) }}
Generates a timestamp in one of Datadog’s accepted units with a value corresponding to the UTC timestamp the test is initiated at +/- n units.
{{ uuid }}
Generates a version 4 universally unique identifier (UUID).
{{ public-id }}
Injects the Public ID of your test.
{{ result-id }}
Injects the Result ID of your test run.

To obfuscate local variable values in test results, select Hide and obfuscate variable value. Once you have defined the variable string, click Add Variable.

변수 사용

설정 페이지에 정의된 전역 변수를 gRPC 테스트의 URL, 고급 옵션 및 어서션에 사용할 수 있습니다.

변수 목록을 표시하려면 원하는 필드에 {{를 입력하세요.

테스트 실패

하나 이상의 어서션을 충족하지 않거나 요청이 초기에 실패한 경우 테스트는 FAILED로 간주됩니다. 경우에 따라서는 엔드포인트 어서션 테스트 없이 해당 테스트가 실패할 수 있습니다.

다음과 같은 이유로 실패할 수 있습니다.

gRPC specific errors
gRPC은 공식 gRPC 문서에서 찾아볼 수 있는 특정 상태 코드 목록을 갖추고 있습니다.
CONNRESET
원격 서버에 의해 연결이 갑자기 종료되었습니다. 가능한 원인으로는 웹 서버가 응답 도중 오류 또는 충돌이 발생하였거나 웹 서버의 연결이 끊어졌기 때문일 수 있습니다.
DNS
테스트 URL에 대한 DNS 엔트리를 찾을 수 없습니다. 가능한 원인으로는 테스트 URL이 잘못 설정되었거나 DNS 엔티티 설정이 잘못되었기 때문일 수 있습니다.
INVALID_REQUEST
테스트 설정이 유효하지 않습니다(예: URL 오타).
SSL
SSL 연결을 실행할 수 없습니다. 자세한 내용을 확인하려면 전용 오류 페이지를 참조하세요.
TIMEOUT
요청을 적절한 시간 내에 완료할 수 없습니다. 두 가지 유형의 TIMEOUT이 발생할 수 있습니다:
  • TIMEOUT: The request couldn't be completed in a reasonable time.는 요청 시간이 테스트에 정의된 시간 제한에 도달했음을 나타냅니다(기본값은 60초로 설정). 각 요청에 대해 완료된 요청 단계만 네트워크 워터폴에 표시됩니다. 예를 들어, Total response time만 표시된다면 DNS 확인 도중에 시간 초과가 발생한 것입니다.
  • TIMEOUT: Overall test execution couldn't be completed in a reasonable time.은 테스트 시간(요청 및 어서션)이 최대 실행 시간 60.5초에 도달했음을 나타냅니다.

권한

기본적으로 Datadog 관리자 및 Datadog 표준 역할로 설정된 사용자만 신서틱(Synthetic) gRPC 테스트를 생성, 편집, 삭제할 수 있습니다. 신서틱(Synthetic) gRPC 테스트 생성, 편집, 삭제, 접근 권한을 얻으려면 사용자를 이 두 가지 기본 역할 중 하나로 업그레이드하세요.

커스텀 역할 기능을 사용하는 경우 synthetics_readsynthetics_write 권한을 포함하는 모든 커스텀 역할에 사용자를 추가합니다.

액세스 제한

Use granular access control to limit who has access to your test based on roles, teams, or individual users:

  1. Open the permissions section of the form.
  2. Click Edit Access.
Set permissions for your test from Private Locations configuration form
  1. Click Restrict Access.
  2. Select teams, roles, or users.
  3. Click Add.
  4. Select the level of access you want to associate with each of them.
  5. Click Done.
You can view results from a Private Location even without Viewer access to that Private Location.
Access levelView test configurationEdit test configurationView test resultsRun test
No access
ViewerYesYes
EditorYesYesYesYes

참고 자료