모니터링

Vertex AI Feature Store(기존)에서 피처스토어 및 특성에 대한 알림을 모니터링하고 설정할 수 있습니다. 예를 들어 운영팀은 피처스토어를 모니터링하여 CPU 사용률을 추적할 수 있습니다. 데이터 과학자와 같은 특성 소유자는 특성 값을 모니터링하여 시간 경과에 따른 드리프트를 감지할 수 있습니다.

피처스토어 및 특성을 모니터링하는 방법은 다음 섹션에 설명되어 있습니다.

피처스토어 모니터링

Vertex AI Feature Store(기존)는 CPU 부하, 스토리지 용량, 요청 지연 시간과 같은 피처스토어에 대한 측정항목을 Cloud Monitoring에 보고합니다. Vertex AI는 이러한 측정항목을 수집하고 보고합니다. 피처스토어 모니터링을 구성하거나 사용 설정할 필요가 없습니다.

기준과 알림을 구성하려면 Cloud Monitoring을 사용합니다. 예를 들어 평균 CPU 부하가 70%를 초과하는 경우 알림을 설정할 수 있으며, 이 경우 피처스토어 노드 수를 늘려야 할 수 있습니다.

Google Cloud 콘솔의 Vertex AI 섹션에서 피처스토어 측정항목을 확인하여 시간 경과에 따른 추세를 확인할 수도 있습니다. 일부 차트의 경우 정보를 더 쉽게 사용할 수 있도록 집계되거나 계산된 값이 콘솔에 표시됩니다. 언제든지 Cloud Monitoring에서 원시 데이터를 볼 수 있습니다.

자세한 내용은 Vertex AI Cloud Monitoring 페이지의 Vertex AI Feature Store(기존) 모니터링 측정항목을 참조하세요.

특성 값 모니터링

특성 값 모니터링을 사용 설정하면 피처스토어에서 특성 값 분포가 어떻게 변하는지 추적할 수 있습니다. 지원되는 특성 값 모니터링 유형은 다음과 같습니다.

  • 스냅샷 분석: Vertex AI Feature Store(기존)는 특성 값의 스냅샷을 주기적으로 만듭니다. 시간이 지남에 따라 더 많은 데이터를 수집하면 특성 값의 분포가 변경되는 것을 확인할 수 있습니다. 이러한 변경사항은 해당 특성을 사용하는 모든 모델을 다시 학습시켜야 할 수 있음을 나타냅니다. 분포 편차가 기준점을 초과할 때마다 이상이 Cloud Logging Concole에 로깅되도록 기준점을 지정할 수 있습니다.

    엔티티 ID가 500만 개를 초과하는 데이터 세트의 경우 Vertex AI Feature Store(기존)는 비활성 기간(일 수)으로 지정한 기간 내에 무작위로 선택된 엔티티 ID 500만 개를 기반으로 스냅샷을 생성합니다.

  • 특성 분석 가져오기: 각 ImportFeatureValues 작업은 Vertex AI Feature Store(기존)에 수집된 값의 분포 통계를 생성합니다. 분포 통계를 이전에 가져온 특성 값 분포 또는 스냅샷 분포(사용 설정된 경우)와 비교하여 이상을 감지하도록 선택할 수 있습니다.

    인스턴스가 500만 개를 초과하는 데이터 세트의 경우 Vertex AI Feature Store(기존)는 다음과 같이 무작위로 선택한 데이터를 기반으로 스냅샷을 생성합니다.

    • 수집된 데이터 세트 내 인스턴스 수가 500만 개를 초과하지만 5000만 개를 초과하지 않으면 무작위로 선택된 인스턴스 5백만 개를 기반으로 스냅샷이 생성됩니다.
    • 수집된 데이터 세트 내 인스턴스 수가 5000만 개를 초과하면 무작위로 선택된 인스턴스의 10%를 기반으로 스냅샷이 생성됩니다.

예를 들어 최근 판매된 주택의 가격을 수집한 다음 주택 가격을 예측하는 모델에 가치를 입력하는 특성을 살펴보겠습니다. 최근에 판매된 주택의 가격이 시간 경과에 따라 크게 변동하거나 일괄적으로 가져온 가치에 학습 데이터에서 크게 벗어난 데이터가 포함될 수 있습니다. Vertex AI Feature Store(기존)는 이러한 변경사항을 알려줍니다. 그러면 최신 정보를 사용하도록 모델을 다시 학습시킬 수 있습니다.

모니터링 구성 설정

모니터링을 시작하기 위해 항목 유형에 대한 모니터링 구성을 정의할 수 있으며 이를 통해 다음 유형의 모든 특성에 대한 모니터링을 수행할 수 있습니다.

  • BOOL
  • STRING
  • DOUBLE
  • INT64

항목 유형을 만들 때 모니터링 구성을 설정할 수 있습니다. disableMonitoring 속성을 설정하여 특정 특성에 대한 모니터링을 선택 해제할 수도 있습니다. 항목 유형 모니터링 구성은 다음과 같습니다.

  • 모니터링 사용 설정 여부. Monitoring은 기본적으로 사용 중지되어있습니다.
  • 이상치를 감지하는 데 사용되는 기준점. 기본 기준점은 0.3입니다.
  • 스냅샷 간 간격 외에 전환 확인 기간(스냅샷 분석용). 기본값은 21입니다.
  • 가져오기 특성 분석을 사용 설정할지 여부. 기본값은 사용 중지됨입니다.

자세한 내용은 API 참조의 FeaturestoreMonitoringConfig 유형을 참조하세요.

모니터링이 사용 설정된 항목 유형 만들기

다음 예시에서는 특성 모니터링이 사용 설정된 항목 유형을 만듭니다.

웹 UI

UI에서는 스냅샷 분석만 지원됩니다.

  1. Google Cloud 콘솔의 Vertex AI 섹션에서 특성 페이지로 이동합니다.

    특성 페이지로 이동

  2. 리전 드롭다운 목록에서 리전을 선택합니다.
  3. 항목 유형 만들기를 클릭합니다.
  4. 특성 모니터링 섹션을 사용 설정됨으로 전환합니다.
  5. Monitoring 시간 간격 필드에 스냅샷 사이의 일수를 입력합니다.
    항목 유형 또는 특성의 모니터링 작업은 항목 유형 또는 특성의 모니터링을 사용 설정한 시간 이후 가장 가까운 정수 시간에 실행됩니다. 예를 들어 월요일 오후 10시 30분에 모니터링을 사용 설정하고 모니터링 시간 간격을 2일로 지정하면 첫 번째 모니터링 작업이 수요일 오후 11시에 실행됩니다.
  6. Monitoring 전환 확인 기간 필드에 각 스냅샷에 대한 전환 확인 일수를 입력합니다.
  7. 숫자 알림 기준점 필드에 숫자 특성의 이상을 감지하는 데 사용된 기준점을 입력하세요.
  8. 범주형 알림 기준점 필드에 이 EntityType의 범주형 특성에 대한 이상 감지에 사용되는 기준점을 입력합니다.
    특성 값 이상 감지에 대한 자세한 내용은 특성 값 이상치 보기를 확인하세요.
  9. 만들기를 클릭합니다.
  10. 특성 테이블에서 항목 유형을 클릭합니다.
  11. 항목에 새 특성을 추가하려면 특성 추가를 클릭합니다.
  12. 특정 특성에 대해 모니터링을 선택 해제하려면 모니터링 사용 설정을 해제합니다.

REST

항목 유형을 만들려면 entityTypes.create 메서드를 사용하여 POST 요청을 전송합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전입니다(예: us-central1).
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID
  • ENTITY_TYPE_ID: 항목 유형의 ID
  • DURATION: 스냅샷 사이의 간격(일)
  • STALENESS_DAYS: 스냅샷 생성 시 확인할 일수
  • NUMERICAL_THRESHOLD_VALUE: 이 항목 유형의 숫자 특성에서 이상을 감지하는 기준점. 통계 편차는 Jenson-Shannon 불일치로 계산합니다.
  • CATEGORICAL_THRESHOLD_VALUE: 이 항목 유형의 범주형 특성에서 이상을 감지하기 위한 기준점입니다. 통계 편차는 L 무한대 거리를 사용하여 계산합니다.
  • IMPORT_FEATURE_ANALYSIS_STATE: 가져오기 특성 분석을 사용 설정할지 여부를 나타내는 상태입니다.
  • IMPORT_FEATURE_ANALYSIS_BASELINE: 사용 설정된 경우 가져오기 특성 분석의 기준입니다.

HTTP 메서드 및 URL:

POST http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes?entityTypeId=ENTITY_TYPE_ID

JSON 요청 본문:

{
  "monitoringConfig": {
    "snapshotAnalysis": {
      "monitoringIntervalDays": "DURATION"
      "stalenessDays": "STALENESS_DAYS"
    }
  },
 "numericalThresholdConfig": {
    "value": "NUMERICAL_THRESHOLD_VALUE"
  },
  "categoricalThresholdConfig": {
    "value": "CATEGORICAL_THRESHOLD_VALUE"
  },
  "importFeatureAnalysis": {
    "state": "IMPORT_FEATURE_ANALYSIS_STATE",
    "anomalyDetectionBaseline": "IMPORT_FEATURE_ANALYSIS_BASELINE"
  }
}

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes?entityTypeId=ENTITY_TYPE_ID"

PowerShell

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes?entityTypeId=ENTITY_TYPE_ID" | Select-Object -Expand Content

다음과 비슷한 출력이 표시됩니다. 응답의 OPERATION_ID를 사용하여 작업 상태를 가져올 수 있습니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.ui.CreateEntityTypeOperationMetadata",
    "genericMetadata": {
      "createTime": "2022-04-29T20:29:05.206525Z",
      "updateTime": "2022-04-29T20:29:05.206525Z"
    }
  }
}

Java

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Vertex AI Java API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.api.gax.longrunning.OperationFuture;
import com.google.cloud.aiplatform.v1.CreateEntityTypeOperationMetadata;
import com.google.cloud.aiplatform.v1.CreateEntityTypeRequest;
import com.google.cloud.aiplatform.v1.EntityType;
import com.google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig;
import com.google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.SnapshotAnalysis;
import com.google.cloud.aiplatform.v1.FeaturestoreName;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

public class CreateEntityTypeMonitoringSample {

  public static void main(String[] args)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String featurestoreId = "YOUR_FEATURESTORE_ID";
    String entityTypeId = "YOUR_ENTITY_TYPE_ID";
    String description = "YOUR_ENTITY_TYPE_DESCRIPTION";
    int monitoringIntervalDays = 1;
    String location = "us-central1";
    String endpoint = "us-central1-aiplatform.googleapis.com:443";
    int timeout = 300;
    createEntityTypeMonitoringSample(
        project,
        featurestoreId,
        entityTypeId,
        description,
        monitoringIntervalDays,
        location,
        endpoint,
        timeout);
  }

  static void createEntityTypeMonitoringSample(
      String project,
      String featurestoreId,
      String entityTypeId,
      String description,
      int monitoringIntervalDays,
      String location,
      String endpoint,
      int timeout)
      throws IOException, InterruptedException, ExecutionException, TimeoutException {

    FeaturestoreServiceSettings featurestoreServiceSettings =
        FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (FeaturestoreServiceClient featurestoreServiceClient =
        FeaturestoreServiceClient.create(featurestoreServiceSettings)) {

      FeaturestoreMonitoringConfig featurestoreMonitoringConfig =
          FeaturestoreMonitoringConfig.newBuilder()
              .setSnapshotAnalysis(
                  SnapshotAnalysis.newBuilder().setMonitoringIntervalDays(monitoringIntervalDays))
              .build();

      EntityType entityType =
          EntityType.newBuilder()
              .setDescription(description)
              .setMonitoringConfig(featurestoreMonitoringConfig)
              .build();

      CreateEntityTypeRequest createEntityTypeRequest =
          CreateEntityTypeRequest.newBuilder()
              .setParent(FeaturestoreName.of(project, location, featurestoreId).toString())
              .setEntityType(entityType)
              .setEntityTypeId(entityTypeId)
              .build();

      OperationFuture<EntityType, CreateEntityTypeOperationMetadata> entityTypeFuture =
          featurestoreServiceClient.createEntityTypeAsync(createEntityTypeRequest);
      System.out.format(
          "Operation name: %s%n", entityTypeFuture.getInitialFuture().get().getName());
      System.out.println("Waiting for operation to finish...");
      EntityType entityTypeResponse = entityTypeFuture.get(timeout, TimeUnit.SECONDS);
      System.out.println("Create Entity Type Monitoring Response");
      System.out.format("Name: %s%n", entityTypeResponse.getName());
    }
  }
}

Node.js

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Vertex AI Node.js API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const entityTypeId = 'YOUR_ENTITY_TYPE_ID';
// const description = 'YOUR_ENTITY_TYPE_DESCRIPTION';
// const duration = <MONITORING_INTERVAL_IN_SECONDS>;
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} =
  require('@google-cloud/aiplatform').v1beta1;

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
  clientOptions
);

async function createEntityTypeMonitoring() {
  // Configure the parent resource
  const parent = `projects/${project}/locations/${location}/featurestores/${featurestoreId}`;

  const entityType = {
    description: description,
    monitoringConfig: {
      snapshotAnalysis: {
        monitoringInterval: {
          seconds: Number(duration),
        },
      },
    },
  };

  const request = {
    parent: parent,
    entityTypeId: entityTypeId,
    entityType: entityType,
  };

  // Create EntityType request
  const [operation] = await featurestoreServiceClient.createEntityType(
    request,
    {timeout: Number(timeout)}
  );
  const [response] = await operation.promise();

  console.log('Create entity type monitoring response');
  console.log(`Name : ${response.name}`);
  console.log('Raw response:');
  console.log(JSON.stringify(response, null, 2));
}
createEntityTypeMonitoring();

추가 언어

Python용 Vertex AI SDK를 설치하고 사용하는 방법은 Python용 Vertex AI SDK 사용을 참조하세요. 자세한 내용은 Python용 Vertex AI SDK API 참고 문서를 확인하세요.

새 특성의 모니터링 사용 중지

다음 예시에서는 모니터링이 사용 중지된 새 특성을 만듭니다.

REST

특성을 만들려면 features.create 메서드를 사용하여 POST 요청을 전송합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전(예: us-central1)
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID
  • ENTITY_TYPE_ID: 항목 유형의 ID
  • FEATURE_ID: 특성의 ID
  • VALUE_TYPE: 특성의 값 유형
  • DISABLE_MONITORING: 모니터링을 명시적으로 선택 해제하려면 true로 설정

HTTP 메서드 및 URL:

POST http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?featureId=/FEATURE_ID

JSON 요청 본문:

{
  "disableMonitoring": "DISABLE_MONITORING",
  "valueType": "VALUE_TYPE"
}

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?featureId=/FEATURE_ID"

PowerShell

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID?featureId=/FEATURE_ID" | Select-Object -Expand Content

다음과 비슷한 출력이 표시됩니다. 응답의 OPERATION_ID를 사용하여 작업 상태를 가져올 수 있습니다.

{
  "name": "projects/PROJECT_ID/locations/LOCATION_ID/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.ui.CreateFeatureOperationMetadata",
    "genericMetadata": {
      "createTime": "2022-04-29T20:29:05.206525Z",
      "updateTime": "2022-04-29T20:29:05.206525Z"
    }
  }
}

모니터링 구성 업데이트

항목 유형을 업데이트할 때 모니터링 구성을 설정할 수 있습니다. disableMonitoring 속성을 설정하여 특정 특성에 대한 모니터링을 선택 해제할 수도 있습니다.

항목 유형 및 특성의 모니터링 구성 업데이트

다음 예시에서는 기존 항목 유형 및 이 항목 유형의 특정 특성에 대한 모니터링 구성을 업데이트합니다.

웹 UI

UI에서는 스냅샷 분석만 지원됩니다.

  1. Google Cloud 콘솔의 Vertex AI 섹션에서 특성 페이지로 이동합니다.
  2. 리전 드롭다운 목록에서 리전을 선택합니다.
  3. 특성 테이블에서 항목 유형 열을 보고 업데이트할 항목 유형을 찾습니다.
  4. 항목 유형 이름을 클릭하여 항목 세부정보 페이지를 봅니다.
  5. 작업 모음에서 정보 수정을 클릭합니다.
  6. Monitoring 시간 간격에 스냅샷 사이의 일수를 입력합니다.
    항목 유형 또는 특성의 모니터링 작업은 항목 유형 또는 특성의 모니터링을 사용 설정한 시간 이후 가장 가까운 정수 시간에 실행됩니다. 예를 들어 월요일 오후 10시 30분에 모니터링을 사용 설정하고 모니터링 시간 간격을 2일로 지정하면 첫 번째 모니터링 작업이 수요일 오후 11시에 실행됩니다.
  7. 업데이트를 클릭합니다.
  8. 마찬가지로 특성 테이블에서 특성 열을 확인하여 업데이트할 특성을 찾습니다.
  9. 특성 이름을 클릭하여 세부정보 페이지를 봅니다.
  10. 작업 모음에서 정보 수정을 클릭합니다.
  11. 특정 특성에 대해 모니터링을 선택 해제하려면 사용 설정된 모니터링을 해제합니다.

REST

항목 유형을 업데이트하려면 entityTypes.patch 메서드를 사용하여 PATCH 요청을 전송합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전입니다(예: us-central1).
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID
  • ENTITY_TYPE_ID: 항목 유형의 ID
  • DURATION_IN_DAYS: 스냅샷 사이의 간격(일)
  • STALENESS_DAYS: 스냅샷 생성 시 확인할 일수
  • NUMERICAL_THRESHOLD_VALUE: 이 항목 유형의 숫자 특성에서 이상을 감지하는 기준점. 통계 편차는 Jenson-Shannon 불일치로 계산합니다.
  • CATEGORICAL_THRESHOLD_VALUE: 이 항목 유형의 범주형 특성에서 이상을 감지하기 위한 기준점입니다. 통계 편차는 L 무한대 거리를 사용하여 계산합니다.
  • IMPORT_FEATURE_ANALYSIS_STATE: 가져오기 특성 분석을 사용 설정할지 여부를 나타내는 상태입니다.
  • IMPORT_FEATURE_ANALYSIS_BASELINE: ???를 나타내는 기준입니다.

HTTP 메서드 및 URL:

PATCH http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID

JSON 요청 본문:

{
  "monitoringConfig": {
    "snapshotAnalysis": {
      "monitoringIntervalDays": "DURATION_IN_DAYS",
      "stalenessDays": "STALENESS_DAYS"
    }
  },
  "numericalThresholdConfig": {
    "value": "NUMERICAL_THRESHOLD_VALUE"
  },
  "categoricalThresholdConfig": {
    "value": "CATEGORICAL_THRESHOLD_VALUE"
  },
  "importFeatureAnalysis": {
    "state": "IMPORT_FEATURE_ANALYSIS_STATE",
    "anomalyDetectionBaseline": "IMPORT_FEATURE_ANALYSIS_BASELINE"
  }
}

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID"

PowerShell

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID" | Select-Object -Expand Content

다음과 비슷한 JSON 응답이 표시됩니다.

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID",
  "createTime": "2021-07-22T23:18:31.339972Z",
  "updateTime": "2021-07-29T22:24:40.221821Z",
  "etag": "AMEw9yPGDpwUwHx39gIDIg5mTQz65GMhnYHRzRslVPonm1g8xTnsTC5YUibmWo2MIuI=",
  "monitoringConfig": {
    "snapshotAnalysis": {
      "monitoringIntervalDays": "DURATION_IN_DAYS",
      "stalenessDays": "STALENESS_DAYS"
    }
  },
  "numericalThresholdConfig": {
    "value": "NUMERICAL_THRESHOLD_VALUE"
  },
  "categoricalThresholdConfig": {
    "value": "CATEGORICAL_THRESHOLD_VALUE"
  },
  "importFeatureAnalysis": {
    "state": "IMPORT_FEATURE_ANALYSIS_STATE",
    "anomalyDetectionBaseline": "IMPORT_FEATURE_ANALYSIS_BASELINE"
  }
}

Java

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Java 설정 안내를 따르세요. 자세한 내용은 Vertex AI Java API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.cloud.aiplatform.v1.EntityType;
import com.google.cloud.aiplatform.v1.EntityTypeName;
import com.google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig;
import com.google.cloud.aiplatform.v1.FeaturestoreMonitoringConfig.SnapshotAnalysis;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceClient;
import com.google.cloud.aiplatform.v1.FeaturestoreServiceSettings;
import com.google.cloud.aiplatform.v1.UpdateEntityTypeRequest;
import java.io.IOException;

public class UpdateEntityTypeMonitoringSample {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    String project = "YOUR_PROJECT_ID";
    String featurestoreId = "YOUR_FEATURESTORE_ID";
    String entityTypeId = "YOUR_ENTITY_TYPE_ID";
    int monitoringIntervalDays = 1;
    String location = "us-central1";
    String endpoint = "us-central1-aiplatform.googleapis.com:443";
    updateEntityTypeMonitoringSample(
        project, featurestoreId, entityTypeId, monitoringIntervalDays, location, endpoint);
  }

  static void updateEntityTypeMonitoringSample(
      String project,
      String featurestoreId,
      String entityTypeId,
      int monitoringIntervalDays,
      String location,
      String endpoint)
      throws IOException {

    FeaturestoreServiceSettings featurestoreServiceSettings =
        FeaturestoreServiceSettings.newBuilder().setEndpoint(endpoint).build();

    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the "close" method on the client to safely clean up any remaining background resources.
    try (FeaturestoreServiceClient featurestoreServiceClient =
        FeaturestoreServiceClient.create(featurestoreServiceSettings)) {
      FeaturestoreMonitoringConfig featurestoreMonitoringConfig =
          FeaturestoreMonitoringConfig.newBuilder()
              .setSnapshotAnalysis(
                  SnapshotAnalysis.newBuilder().setMonitoringIntervalDays(monitoringIntervalDays))
              .build();
      EntityType entityType =
          EntityType.newBuilder()
              .setName(
                  EntityTypeName.of(project, location, featurestoreId, entityTypeId).toString())
              .setMonitoringConfig(featurestoreMonitoringConfig)
              .build();

      UpdateEntityTypeRequest updateEntityTypeRequest =
          UpdateEntityTypeRequest.newBuilder().setEntityType(entityType).build();
      EntityType entityTypeResponse =
          featurestoreServiceClient.updateEntityType(updateEntityTypeRequest);
      System.out.println("Update Entity Type Monitoring Response");
      System.out.println(entityTypeResponse);
    }
  }
}

Node.js

이 샘플을 사용해 보기 전에 Vertex AI 빠른 시작: 클라이언트 라이브러리 사용Node.js 설정 안내를 따르세요. 자세한 내용은 Vertex AI Node.js API 참고 문서를 참조하세요.

Vertex AI에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * TODO(developer): Uncomment these variables before running the sample.\
 * (Not necessary if passing values as arguments)
 */

// const project = 'YOUR_PROJECT_ID';
// const featurestoreId = 'YOUR_FEATURESTORE_ID';
// const entityTypeId = 'YOUR_ENTITY_TYPE_ID';
// const duration = <MONITORING_INTERVAL_IN_SECONDS>;
// const location = 'YOUR_PROJECT_LOCATION';
// const apiEndpoint = 'YOUR_API_ENDPOINT';
// const timeout = <TIMEOUT_IN_MILLI_SECONDS>;

// Imports the Google Cloud Featurestore Service Client library
const {FeaturestoreServiceClient} =
  require('@google-cloud/aiplatform').v1beta1;

// Specifies the location of the api endpoint
const clientOptions = {
  apiEndpoint: apiEndpoint,
};

// Instantiates a client
const featurestoreServiceClient = new FeaturestoreServiceClient(
  clientOptions
);

async function updateEntityTypeMonitoring() {
  // Configure the name resource
  const name = `projects/${project}/locations/${location}/featurestores/${featurestoreId}/entityTypes/${entityTypeId}`;

  // Constructing the monitoring configuration
  const monitoringConfig = {
    snapshotAnalysis: {
      monitoringInterval: {
        seconds: Number(duration),
      },
    },
  };

  // Constructing the entityType
  const entityType = {
    name: name,
    monitoringConfig: monitoringConfig,
  };

  const request = {
    entityType: entityType,
  };

  // Update EntityType request
  const [response] = await featurestoreServiceClient.updateEntityType(
    request,
    {timeout: Number(timeout)}
  );

  console.log('Update entity type monitoring response');
  console.log(`Name : ${response.name}`);
  console.log('Raw response:');
  console.log(JSON.stringify(response, null, 2));
}
updateEntityTypeMonitoring();

특성 모니터링 사용 중지

다음 예시는 기존 특성에 대해 모니터링을 해제합니다.

REST

특성을 업데이트하려면 features.patch 메서드를 사용하여 PATCH 요청을 전송합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • LOCATION_ID: 피처스토어가 있는 리전(예: us-central1)
  • PROJECT_ID: 프로젝트 ID
  • FEATURESTORE_ID: 피처스토어의 ID
  • ENTITY_TYPE_ID: 항목 유형의 ID
  • FEATURE_ID: 업데이트할 특성의 ID
  • DISABLE_MONITORING: 모니터링을 명시적으로 선택 해제하려면 true로 설정

HTTP 메서드 및 URL:

PATCH http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features/FEATURE_ID

JSON 요청 본문:

{
  "disableMonitoring": "DISABLE_MONITORING"
}

요청을 보내려면 다음 옵션 중 하나를 선택합니다.

curl

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

curl -X PATCH \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features/FEATURE_ID"

PowerShell

요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method PATCH `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "http://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features/FEATURE_ID" | Select-Object -Expand Content

다음과 비슷한 JSON 응답이 표시됩니다.

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featurestores/FEATURESTORE_ID/entityTypes/ENTITY_TYPE_ID/features/FEATURE_ID",
  "valueType": "FEATURE_VALUE_TYPE",
  "createTime": "2021-07-22T23:18:31.339972Z",
  "updateTime": "2021-07-29T22:24:40.221821Z",
  "etag": "AMEw9yPGDpwUwHx39gIDIg5mTQz65GMhnYHRzRslVPonm1g8xTnsTC5YUibmWo2MIuI=",
  "disableMonitoring": "DISABLE_MONITORING"
}

특성 값 분포 보기

Google Cloud 콘솔을 사용하여 시간 경과에 따른 특성 값의 분포를 확인합니다.

웹 UI

  1. Google Cloud 콘솔의 Vertex AI 섹션에서 특성 페이지로 이동합니다.

    특성 페이지로 이동

  2. 리전 드롭다운 목록에서 리전을 선택합니다.

  3. 항목 유형의 모든 특성에 대해 특성 값 분포를 보려면 항목 유형 열에서 항목 유형을 클릭합니다.

  4. 특성의 특성 값 분포 측정항목을 보려면 다음 안내를 따르세요.

    1. 특성 열에서 특성을 클릭합니다.

    2. 측정항목 탭을 클릭하여 특성 값 분포 측정항목을 열람합니다.

특성 값 이상 보기

특성 값 분포가 모니터링 파이프라인에서 지정된 기준점을 초과하면 편차로 간주됩니다. 이상치에는 학습-서빙 편향 및 드리프트의 두 가지 유형이 있습니다. 편차를 계산하기 위해 Vertex AI는 프로덕션의 최신 특성 값을 기준값과 비교합니다.

  • 학습-서빙 편향을 감지하기 위해 Vertex AI는 프로덕션에서 최신 특성 값을 학습 데이터에 있는 특성 값의 통계 분포와 비교합니다. 여기에서는 학습 데이터에서 특성 값의 통계 분포가 기준 분포로 고려됩니다. 학습-서빙 편향에 대해 자세히 알아보세요.

  • 드리프트를 감지하기 위해 Vertex AI는 프로덕션의 최신 특성 값을 최소 1시간 전에 발생한 최근의 모니터링 실행으로부터 얻은 특성 값의 통계 분포와 비교합니다. 여기에서 최근 모니터링 실행으로부터 얻은 특성 값의 통계 분포가 기준 분포로 고려됩니다. 드리프트에 대해 자세히 알아보세요.

두 경우 모두 기준 분포를 프로덕션의 최근 특성 값과 비교해서 차이 점수를 계산합니다.

  • 범주형 특성의 경우 L-무한 거리를 사용하여 거리 점수를 계산합니다. 이 경우 거리 점수가 범주형 알림 기준점 필드에 지정한 기준점을 초과하면 비정상으로 식별됩니다.

  • 숫자 특성의 경우 거리 점수는 Jensen-Shannon 분산을 통해 계산됩니다. 이 경우 거리 점수가 숫자 알림 기준점 필드에 지정한 기준점값을 초과하면 이상치로 식별됩니다.

어느 경우든 차이 점수를 계산하는 데 사용되는 기준 분포에 따라 이상치가 학습-서빙 편향 또는 드리프트일 수 있습니다. 이상치 로그는 featurestore_log 로그 이름으로 Cloud Logging에 기록됩니다. Pub/Sub와 같이 Cloud Logging이 지원하는 모든 다운스트림 서비스에 로그를 동기화할 수 있습니다.

알림 기준점 설정에 대한 자세한 내용은 모니터링이 사용 설정된 항목 유형 만들기를 참조하세요.

특정 피처스토어에서 생성된 모든 이상에 대한 쿼리 예시

logName="projects/model-monitoring-demo/logs/aiplatform.googleapis.com%2FFfeaturestore_log"
resource.labels.resource_container=<project_number>
resource.labels.featurestore_id=<featurestore_id>

이상 로그 항목의 예시

{
  "insertId": "ktbx5jf7vdn7b",
  "jsonPayload": {
    "threshold": 0.001,
    "featureName": "projects/<project_number>/locations/us-central1/featurestores/<featurestore_id>/entityTypes/<entity_type_id>/features/<feature_id>",
    "deviation": 1,
    "@type": "type.googleapis.com/google.cloud.aiplatform.logging.FeatureAnomalyLogEntry",
    "objective": "Featurestore Monitoring Snapshot Drift Anomaly"
  },
  "resource": {
    "type": "aiplatform.googleapis.com/Featurestore",
    "labels": {
      "resource_container": "<project_number>",
      "location": "us-central1",
      "featurestore_id": "<featurestore_id>"
    }
  },
  "timestamp": "2022-02-06T00:54:06.455501Z",
  "severity": "WARNING",
  "logName": "projects/model-monitoring-demo/logs/aiplatform.googleapis.com%2Ffeaturestore_log",
  "receiveTimestamp": "2022-02-06T00:54:06.476107155Z"
}

스트리밍 수집에 대한 오프라인 스토리지 쓰기 오류 모니터링

Google Cloud 콘솔을 사용해서 스트리밍 수집 중 오프라인 스토리지에 대한 쓰기 오류를 모니터링합니다.

오프라인 스토리지로의 스트리밍 수집에 대한 측정항목 보기

측정항목 탐색기에서 Vertex AI Feature Store(기존)의 스트리밍 쓰기용 오프라인 스토리지 쓰기 측정항목을 모니터링할 수 있습니다.

웹 UI

  1. Google Cloud 콘솔에서 측정항목 탐색기로 이동합니다.

    측정항목 탐색기로 이동

  2. 툴바에서 탐색기 탭을 선택합니다.

  3. 구성 탭에서 차트에 표시할 데이터를 지정합니다.

    • 리소스 및 측정항목: Vertex AI Feature Store - 스트리밍 쓰기에 대한 오프라인 스토리지 쓰기 측정항목을 선택합니다.

    • 그룹화 기준: error_code를 선택합니다.

    • 최소 정렬 기간: 차트의 데이터를 정렬하기 위한 최소 시간 간격을 지정합니다.

  4. 이러한 필드를 업데이트하면 차트에 다양한 오류 코드에 대한 오프라인 스토리지 쓰기 오류가 표시됩니다.

    차트를 생성한 후 이를 커스텀 대시보드에 추가할 수 있습니다. 자세한 내용은 향후 참조용으로 차트 저장을 참조하세요.

Vertex AI Feature Store(기존) 로그 보기

로그 탐색기에서 오프라인 저장소 쓰기 오류 중에 생성된 로그를 포함하여 피처스토어의 로그 항목을 볼 수 있습니다.

웹 UI

  1. Google Cloud 콘솔에서 로그 탐색기로 이동합니다.

    로그 탐색기로 이동

  2. 쿼리 빌더에서 다음 쿼리 매개변수를 추가한 후 쿼리 실행을 클릭합니다.

    • 리소스: Vertex AI Feature Store를 선택합니다.
    • 로그 이름: Vertex AI API에서 aiplatform.googlapis.com/featurestore_log를 선택합니다.