Skip to content

Commit cd30be8

Browse files
SG-31082 Improve metrics collection (#103)
* Improve metrics collection * Pass the DCCs group name * Improve syntax
1 parent e890be3 commit cd30be8

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

python/tk_multi_launchapp/base_launcher.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ def launch_version(*args, **kwargs):
138138
app_path,
139139
app_args,
140140
version,
141+
group,
141142
*args,
142143
software_entity=software_entity,
143144
**kwargs
@@ -161,6 +162,7 @@ def _launch_app(
161162
version=None,
162163
file_to_open=None,
163164
software_entity=None,
165+
group=None,
164166
):
165167
"""
166168
Launches an application. No environment variable change is
@@ -180,6 +182,7 @@ def _launch_app(
180182
:param software_entity: (Optional) If set, this is the entity representing
181183
the software entity that is associated with
182184
this launch command.
185+
:param group: (Optional) Group name this command belongs to.
183186
"""
184187
try:
185188
# Clone the environment variables
@@ -276,6 +279,8 @@ def _launch_app(
276279
# Dedicated try/except block: we wouldn't want a metric-related
277280
# exception to prevent execution of the remaining code.
278281
engine = sgtk.platform.current_engine()
282+
engine._host_info["name"] = group or menu_name
283+
engine._host_info["version"] = version_string
279284
engine.log_metric("Launched Software")
280285

281286
except Exception:
@@ -373,6 +378,7 @@ def _launch_callback(
373378
app_path,
374379
app_args,
375380
version=None,
381+
group=None,
376382
file_to_open=None,
377383
software_entity=None,
378384
):
@@ -387,6 +393,7 @@ def _launch_callback(
387393
:param app_args: Args string to pass to the DCC at launch time.
388394
:param version: (Optional) Specific version of DCC to launch. Used to
389395
parse {version}, {v0}, {v1}, ... information from.
396+
:param group: (Optional) Group name in the UI this command belongs to.
390397
:param software_entity: (Optional) If set, this is the entity representing
391398
the software entity that is associated with
392399
this launch command.
@@ -444,6 +451,7 @@ def _launch_callback(
444451
version,
445452
file_to_open,
446453
software_entity,
454+
group,
447455
)
448456

449457
def register_launch_commands(self):

0 commit comments

Comments
 (0)