@@ -62,6 +62,22 @@ def get_reflex_version() -> str:
6262 return constants .Reflex .VERSION
6363
6464
65+ def _get_app_class_name () -> str | None :
66+ """Get the app class name if available.
67+
68+ Returns:
69+ The app class name (e.g. "App", "AppEnterprise") or None if not available.
70+ """
71+ try :
72+ from reflex .utils .prerequisites import get_and_validate_app
73+
74+ app_info = get_and_validate_app ()
75+ except Exception :
76+ return None
77+ else :
78+ return app_info .app .__class__ .__name__
79+
80+
6581def get_cpu_count () -> int :
6682 """Get the number of CPUs.
6783
@@ -184,12 +200,16 @@ def _prepare_event(event: str, **kwargs) -> _Event | None:
184200 if not event_data :
185201 return None
186202
187- additional_keys = ["template" , "context" , "detail" , "user_uuid" ]
203+ additional_keys = ["template" , "context" , "detail" , "user_uuid" , "app_class" ]
188204
189205 properties = event_data ["properties" ]
190206
207+ # Auto-detect app class if not provided
208+ if "app_class" not in kwargs :
209+ kwargs ["app_class" ] = _get_app_class_name ()
210+
191211 for key in additional_keys :
192- if key in properties or key not in kwargs :
212+ if key in properties or key not in kwargs or kwargs [ key ] is None :
193213 continue
194214
195215 properties [key ] = kwargs [key ]
0 commit comments