Tenant

Ternary provides Recommendations and Anomaly Tracking to bring unusual spend to your attention. However, some customers may wish to customize the features' default behaviors to better suit their needs. You can customize your Tenant's preferences through the Ternary API.

Getting Started

Before you set your Anomaly Profile, you will need to fetch your current Tenant configuration.

API Request

GET /tenants/{YOUR_TENANT_ID}

API Response

{
"id": "YOUR_TENANT_ID",
"displayName": "YOUR_TENANT_DISPLAY_NAME",
"serviceAccountID": "YOUR_SERVICE_ACCOUNT_ID",
"dataProjectID": "YOUR_DATA_PROJECT_ID",
"dataDatasetID": "YOUR_DATASET_ID",
"dataLocation": "YOUR_DATA_LOCATION",
"profile": null,
"reseller": false
}

Anomaly Profile

To configure the profile for billing anomalies, set the profile.anomaly field as in the following example:

API Request

PUT /tenants/{YOUR_TENANT_ID}

{
"id": "YOUR_TENANT_ID",
"displayName": "YOUR_TENANT_DISPLAY_NAME",
"serviceAccountID": "YOUR_SERVICE_ACCOUNT_ID",
"dataProjectID": "YOUR_DATA_PROJECT_ID",
"dataDatasetID": "YOUR_DATASET_ID",
"dataLocation": "YOUR_DATA_LOCATION",
"profile": {
"anomaly": {
"threshold": 200,
"standardDeviations": 2,
"lookbackPeriodSeconds": 43200
}
},
"reseller": false
}

The fields in the profile.anomaly have these meanings:

  • Threshold: the minimum absolute delta between anomalous hourly spend and average hourly spend.
  • StandardDeviations: the minimum standard deviations between anomalous hourly spend and average hourly spend.
  • LookbackPeriodSeconds: the number of seconds over which to estimate baseline spend.

BigQuery Anomaly Profile

BigQuery anomaly tracking applies to projects for which you have defined a BigQueryMonitoring config. To configure the profile for BigQuery anomalies, set the profile.bigQueryAnomaly field as in the following example:

API Request

PUT /tenants/{YOUR_TENANT_ID}

{
"id": "YOUR_TENANT_ID",
"displayName": "YOUR_TENANT_DISPLAY_NAME",
"serviceAccountID": "YOUR_SERVICE_ACCOUNT_ID",
"dataProjectID": "YOUR_DATA_PROJECT_ID",
"dataDatasetID": "YOUR_DATASET_ID",
"dataLocation": "YOUR_DATA_LOCATION",
"profile": {
"bigQueryAnomaly": {
"minEstimateUSD": 500.0
},
},
"reseller": false
}

The fields in the profile.bigQueryAnomaly have these meanings:

  • MinEstimateUSD: the minimum absolute spend, per project-region pair, during a fifteen-minute window, to be considered anomalous.

Kubernetes Recommendation Profile

To configure the profile for Kubernetes recommendations, set the profile.kubernetesRecommendation field as in the following example:

API Request

PUT /tenants/{YOUR_TENANT_ID}

{
"id": "YOUR_TENANT_ID",
"displayName": "YOUR_TENANT_DISPLAY_NAME",
"serviceAccountID": "YOUR_SERVICE_ACCOUNT_ID",
"dataProjectID": "YOUR_DATA_PROJECT_ID",
"dataDatasetID": "YOUR_DATASET_ID",
"dataLocation": "YOUR_DATA_LOCATION",
"profile": {
"kubernetesRecommendation": {
"nodepoolMinCostWastedPerHour": 0.1,
"workloadMinCostWastedPerHour": 0.5
},
},
"reseller": false
}

The fields in the profile.kubernetesRecommendation have these meanings:

  • NodepoolMinCostWastedPerHour: the minimum hourly waste per nodepool to trigger a recommendation.
  • WorkloadMinCostWastedPerHour: the minimum hourly waste per workload to trigger a recommendation.

Recommendation Profile

To configure the profile for recommendations, set the profile.recommendation field as in the following example:

{
"id": "YOUR_TENANT_ID",
"displayName": "YOUR_TENANT_DISPLAY_NAME",
"serviceAccountID": "YOUR_SERVICE_ACCOUNT_ID",
"dataProjectID": "YOUR_DATA_PROJECT_ID",
"dataDatasetID": "YOUR_DATASET_ID",
"dataLocation": "YOUR_DATA_LOCATION",
"profile": {
"recommendation": {
"absoluteIncreaseUSDThreshold": 400,
"relativeIncreaseUSDThreshold": 0.1
},
},
"reseller": false
}

The fields in the profile.recommendation have these meanings:

  • AbsoluteIncreaseUSDThreshold: the minimum increase in a recommendation's EstimateUSD to trigger an alert.
  • RelativeIncreaseUSDThreshold: the minimum increase in a recommendation's EstimateUSD as a ratio to trigger an alert.

Both conditions must be satisfied, and if let unset a reasonable default is used.