|
22 | 22 | UNKNOWN_DICT,
|
23 | 23 | get_resource_name,
|
24 | 24 | get_model_by_reference_paths,
|
| 25 | + get_ocid_substring, |
25 | 26 | )
|
26 | 27 | from ads.aqua.finetune import FineTuneCustomMetadata
|
27 | 28 | from ads.aqua.data import AquaResourceIdentifier
|
@@ -393,9 +394,9 @@ def create(
|
393 | 394 |
|
394 | 395 | model_type = "custom" if is_fine_tuned_model else "service"
|
395 | 396 | deployment_id = deployment.dsc_model_deployment.id
|
396 |
| - telemetry_kwargs = ( |
397 |
| - {"ocid": deployment_id[-8:]} if len(deployment_id) > 8 else {} |
398 |
| - ) |
| 397 | + # we arbitrarily choose last 8 characters of OCID to identify MD in telemetry |
| 398 | + telemetry_kwargs = {"ocid": get_ocid_substring(deployment_id, key_len=8)} |
| 399 | + |
399 | 400 | # tracks unique deployments that were created in the user compartment
|
400 | 401 | self.telemetry.record_event_async(
|
401 | 402 | category=f"aqua/{model_type}/deployment",
|
@@ -461,10 +462,11 @@ def list(self, **kwargs) -> List["AquaDeployment"]:
|
461 | 462 | state = model_deployment.lifecycle_state.upper()
|
462 | 463 | if state in ["ACTIVE", "FAILED"]:
|
463 | 464 | # tracks unique deployments that were listed in the user compartment
|
| 465 | + # we arbitrarily choose last 8 characters of OCID to identify MD in telemetry |
464 | 466 | self.telemetry.record_event_async(
|
465 | 467 | category=f"aqua/deployment",
|
466 | 468 | action="list",
|
467 |
| - detail=deployment_id[-8:] if len(deployment_id) > 8 else "", |
| 469 | + detail=get_ocid_substring(deployment_id, key_len=8), |
468 | 470 | value=state,
|
469 | 471 | )
|
470 | 472 |
|
|
0 commit comments