Skip to content

Commit 4ef2fa6

Browse files
authored
Add deployment ID dimension to Realtime API metrics (#1376)
1 parent 34bc79f commit 4ef2fa6

File tree

3 files changed

+11
-0
lines changed

3 files changed

+11
-0
lines changed

pkg/operator/resources/realtimeapi/api.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,11 @@ func RefreshAPI(apiName string, force bool) (string, error) {
150150
return "", errors.Wrap(err, "upload api spec")
151151
}
152152

153+
// Reupload api spec to the same PredictorID but with the new DeploymentID
154+
if err := config.AWS.UploadJSONToS3(api, config.Cluster.Bucket, api.PredictorKey); err != nil {
155+
return "", errors.Wrap(err, "upload predictor spec")
156+
}
157+
153158
if err := applyK8sDeployment(api, prevDeployment); err != nil {
154159
return "", err
155160
}

pkg/operator/resources/realtimeapi/metrics.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,10 @@ func getAPIDimensions(api *spec.API) []*cloudwatch.Dimension {
236236
Name: aws.String("PredictorID"),
237237
Value: aws.String(api.PredictorID),
238238
},
239+
{
240+
Name: aws.String("DeploymentID"),
241+
Value: aws.String(api.DeploymentID),
242+
},
239243
}
240244
}
241245

pkg/workloads/cortex/lib/type/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __init__(self, provider, storage, model_dir, cache_dir=".", **kwargs):
3232
self.provider = provider
3333
self.id = kwargs["id"]
3434
self.predictor_id = kwargs["predictor_id"]
35+
self.deployment_id = kwargs["deployment_id"]
3536
self.key = kwargs["key"]
3637
self.metadata_root = kwargs["metadata_root"]
3738
self.name = kwargs["name"]
@@ -70,6 +71,7 @@ def metric_dimensions_with_id(self):
7071
return [
7172
{"Name": "APIName", "Value": self.name},
7273
{"Name": "PredictorID", "Value": self.predictor_id},
74+
{"Name": "DeploymentID", "Value": self.deployment_id},
7375
]
7476

7577
def metric_dimensions(self):

0 commit comments

Comments
 (0)