Skip to content

Commit

Permalink
chore: fix certified events emitting
Browse files Browse the repository at this point in the history
  • Loading branch information
mhamilton723 committed Jan 7, 2025
1 parent ec2c1c1 commit 7c1cc81
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,10 @@ def _log_base_dict(self, info: Dict[str, str], feature_name: Optional[str] = Non
if feature_name is not None and running_on_synapse_internal():
from synapse.ml.fabric.telemetry_utils import report_usage_telemetry

keys_to_remove = ["libraryName", "method"]
attributes = {
key: value for key, value in info.items() if key not in keys_to_remove
}
report_usage_telemetry(
feature_name=self.library_name,
activity_name=feature_name,
attributes=attributes,
attributes={},
)
self.logger.info(json.dumps(info))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ trait SynapseMLLogging extends Logging {
Future {
logToCertifiedEvents(
info("libraryName"),
featureName.get,
info -- Seq("libraryName", "method")
featureName.get
)
}.failed.map {
case e: Exception => logErrorBase("certifiedEventLogging", e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ object CertifiedEventClient {


private[ml] def logToCertifiedEvents(featureName: String,
activityName: String,
attributes: Map[String, String]): Unit = {

activityName: String): Unit = {
if (runningOnFabric) {
val payload =
s"""{
|"timestamp":${Instant.now().getEpochSecond},
|"feature_name":"$featureName",
|"activity_name":"$activityName",
|"attributes":${attributes.toJson.compactPrint}
|"attributes":{}
|}""".stripMargin

FabricClient.usagePost(CertifiedEventUri, payload)
Expand Down

0 comments on commit 7c1cc81

Please sign in to comment.