使用資料落地設定收集 Analytics 和偵錯資料

總覽

自 1.13.1 版起,新建立的 Apigee 混合式機構可使用新的資料管道,讓執行階段元件可直接將資料寫入控制平面。先前這項作業是透過 UDCA 元件完成,該元件會產生已簽署的網址,並將其寫入 Google Cloud 服務。新的管道可省去 UDCA 和其他相關元件,這些元件負責處理上傳至 Google Cloud 服務的資料。請參閱「使用 Apigee Hybrid 設定資料儲存地」。

設定

您可以按照下列操作說明,設定混合式架構,以便個別元件使用新的資料管道。

設定授權流程

設定執行階段服務帳戶的權限,以便與新管道互動,將資料推送至控制平面。您必須執行這個步驟,才能讓偵錯工作階段和 Analytics 與新管道運作:

curl -X  PATCH -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type:application/json" \
  "https://apigee.googleapis.com/v1/organizations/ORG_NAME/controlPlaneAccess?update_mask=analytics_publisher_identities" \
  -d '{ "analytics_publisher_identities": ["serviceAccount:apigee-runtime@ORG_NAME.iam.gserviceaccount.com"]}'

回應內容應如下所示:

{
  "name": "organizations/newpipeline-hybrid-org/operations/8316aa78-c137-4733-92ec-cc0d2d92fd29",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.apigee.v1.OperationMetadata",
    "operationType": "UPDATE",
    "targetResourceName": "organizations/newpipeline-hybrid-org/controlPlaneAccess",
    "state": "IN_PROGRESS"
  }
}

使用更新回應中的 name 參數,驗證作業狀態:

curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)"  \
  -H "Content-Type:application/json"  \
  "https://apigee.googleapis.com/v1/organizations/ORG_NAME/operations/8316aa78-c137-4733-92ec-cc0d2d92fd29"

回應內容應如下所示:

{
  "name": "organizations/newpipeline-hybrid-org/operations/8316aa78-c137-4733-92ec-cc0d2d92fd29",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.apigee.v1.OperationMetadata",
    "operationType": "UPDATE",
    "targetResourceName": "organizations/newpipeline-hybrid-org/controlPlaneAccess",
    "state": "FINISHED"
  },
  "done": true,
  "response": {
    "@type": "type.googleapis.com/google.cloud.apigee.v1.ControlPlaneAccess",
    "name": "organizations/newpipeline-hybrid-org/controlPlaneAccess"
  }
}

驗證機構的 ControlPlaneAccess 設定:

curl "https://apigee.googleapis.com/v1/organizations/ORG_NAME/controlPlaneAccess" \
-H "Authorization: Bearer $(gcloud auth print-access-token)"

回應內容應如下所示:

{
  "synchronizerIdentities": [
    "serviceAccount:apigee-synchronizer@newpipeline-hybrid-org.iam.gserviceaccount.com"
  ],
  "analyticsPublisherIdentities": [
    "serviceAccount:apigee-runtime@newpipeline-hybrid-org.iam.gserviceaccount.com"
  ]
}

切換新舊管道,以便進行偵錯和 Analytics 資料保留

為服務帳戶提供適當授權後,使用者就能切換 Apigee 執行個體,以便使用新的管道。如要這麼做,請在 overrides.yaml 中設定下列標記。

... rest of the overrides.yaml ...
gcp:
  projectID: PROJECT_ID
  region: ANALYTICS_REGION>  # Specifies the analytics region for the hybrid org. This attribute is
                               # the regional endpoint used to push analytics and debug data to the
                               # control plane. For example: us-central1

newDataPipeline:
  debugSession: true  # this flag enables debug session to use the new data pipeline
  analytics: true     # this flag enables analytics to use the new data pipeline

k8sCluster:
  name: CLUSTER_NAME
  region: CLUSTER_LOCATION # Must be the closest Google Cloud region to your cluster. For example, us-west1
org: ORG_NAME

... rest of the overrides.yaml ...

使用 helm upgrade 指令套用這些變更。一次升級一個環境。使用 --set env=ENV_NAME 指定環境。

helm upgrade ENV_RELEASE_NAME apigee-env/ \
  --install \
  --namespace APIGEE_NAMESPACE \
  --set env=ENV_NAME \
  -f OVERRIDES_FILE
  • ENV_RELEASE_NAME 是先前用來安裝 apigee-env 圖表的名稱。
  • ENV_NAME 是您要升級的環境名稱。