Skip to content

Commit

Permalink
telemetry/add kedro_Viz_version to heaps (#2194)
Browse files Browse the repository at this point in the history
* add kedro_Viz_version to heaps

Signed-off-by: Huong Nguyen <huongg1409@gmail>

* update release note

Signed-off-by: Huong Nguyen <huongg1409@gmail>

* shortern the syntax

Signed-off-by: Huong Nguyen <huongg1409@gmail>

* update release note and lint error

Signed-off-by: Huong Nguyen <huongg1409@gmail>

* Fix lint error

Signed-off-by: Huong Nguyen <huongg1409@gmail>

* set version in base.py

Signed-off-by: Huong Nguyen <huongg1409@gmail>

* revert back to the old syntax

Signed-off-by: Huong Nguyen <huongg1409@gmail>

---------

Signed-off-by: Huong Nguyen <huongg1409@gmail>
Co-authored-by: Huong Nguyen <huongg1409@gmail>
  • Loading branch information
Huongg and Huong Nguyen authored Nov 19, 2024
1 parent e8beb31 commit ca734e4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Please follow the established format:
- Refactor `DatasetStatsHook` to avoid showing error when dataset doesn't have file size info (#2174)
- Fix 404 error when accessing the experiment tracking page on the demo site (#2179)
- Add check for port availability before starting Kedro Viz to prevent unintended browser redirects when the port is already in use (#2176)
- Include Kedro Viz version in telemetry.. (#2194)


# Release 10.0.0
Expand Down
4 changes: 3 additions & 1 deletion package/kedro_viz/api/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ async def index():
env = Environment(loader=FileSystemLoader(_HTML_DIR))
if should_add_telemetry:
telemetry_content = env.get_template("telemetry.html").render(
heap_app_id=heap_app_id, heap_user_identity=heap_user_identity
heap_app_id=heap_app_id,
heap_user_identity=heap_user_identity,
kedro_viz_version=__version__,
)
injected_head_content.append(telemetry_content)

Expand Down
4 changes: 3 additions & 1 deletion package/kedro_viz/integrations/deployment/base_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ def _ingest_heap_analytics(self):
if should_add_telemetry:
logger.debug("Ingesting heap analytics.")
telemetry_content = env.get_template("telemetry.html").render(
heap_app_id=heap_app_id, heap_user_identity=heap_user_identity
heap_app_id=heap_app_id,
heap_user_identity=heap_user_identity,
kedro_viz_version=__version__,
)
injected_head_content.append(telemetry_content)

Expand Down
3 changes: 3 additions & 0 deletions public/telemetry.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src="https://cdn.heapanalytics.com/js/heap-"+e+".js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(r,a);for(var n=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","resetIdentity","removeEventProperty","setEventProperties","track","unsetEventProperty"],o=0;o<p.length;o++)heap[p[o]]=n(p[o])};
heap.load("{{ heap_app_id }}");
heap.identify("{{ heap_user_identity }}");
heap.addEventProperties({
kedro_viz_version: "{{ kedro_viz_version }}",
});
</script>
</head>

0 comments on commit ca734e4

Please sign in to comment.