Package: jupyterlab-telemetry-producer
JupyterLab Telemetry ProducerA JupyterLab extension for generating telemetry data with a basic JupyterLab event library.This extension relies on thejupyterlab-telemetry-routerextension.Get startedRun the telemetry system with docker compose# enter the configuration_example directory and rundockercompose-pjupyterlab-telemetryup--buildA JupyterLab application with the telemetry system installed and configured will run on localhost:8888.Or install the extension and configure it manuallyTo install the extension, execute:pipinstalljupyterlab-telemetry-producerThejupyterlab-telemetry-routerextension is automatically installed whenjupyterlab-telemetry-produceris installed.Before starting Jupyter Lab with the telemetry system, users need to write their own producer/router configuration files (or use provided configuration examples) andplace them in the correct directory.Examples of producer configurations arehere.Examples of router configurations arehere.Basic JupyterLab Event LibraryOverviewEvent Producer IDEvent Triggered WhenEvent Data StructureNotebookOpenEventa notebook is openedeventName, eventTime, environ: current environment dataNotebookScrollEventuser scrolls on the notebookeventName, eventTime, cells: visible cells after scrollingNotebookVisibleEventuser navigates back to Jupyter LabeventName, eventTime, cells: visible cells when user navigates backNotebookHiddenEventuser leaves the Jupyter Lab tabeventName, eventTimeClipboardCopyEventuser copies from a notebook celleventName, eventTime, cells: cell copied from, selection: copied textClipboardCutEventuser cuts from a notebook celleventName, eventTime, cells: cell cut from, selection: cut textClipboardPasteEventuser pastes to a notebook celleventName, eventTime, cells: cell pasted to, selection: pasted textActiveCellChangeEventuser moves focus to a different celleventName, eventTime, cells: activated cellNotebookSaveEventa notebook is savedeventName, eventTimeCellExecuteEventa cell is executedeventName, eventTime, cells: executed cell, success, kernelError: error detail if execution failedCellAddEventa new cell is addedeventName, eventTime, cells: added cellCellRemoveEventa cell is removedeventName, eventTime, cells: removed cellConfigurationsSyntaxactivateEvents: required. An array of the ids of the events. Only valid event producers (1. has an id associated with the event producer class, and 2. the event id is included inactivatedEvents) will be activated.logNotebookContentEvents: required. An array of the ids of the events. Only valid event producers (1. has an id associated with the event producer class, and 2. the event id is included inlogNotebookContentEvents) will have the router export the entire notebook content along with the event data.The configuration file should be saved into one of the config directories provided byjupyter --path.Examplec.JupyterLabTelemetryProducerApp.activeEvents=['NotebookOpenEvent','NotebookScrollEvent',# 'NotebookVisibleEvent',# 'NotebookHiddenEvent','ClipboardCopyEvent','ClipboardCutEvent','ClipboardPasteEvent','ActiveCellChangeEvent','NotebookSaveEvent','CellExecuteEvent','CellAddEvent','CellRemoveEvent',]c.JupyterLabTelemetryProducerApp.logNotebookContentEvents=['NotebookOpenEvent',# 'NotebookScrollEvent',# 'NotebookVisibleEvent',# 'NotebookHiddenEvent',# 'ClipboardCopyEvent',# 'ClipboardCutEvent',# 'ClipboardPasteEvent',# 'ActiveCellChangeEvent','NotebookSaveEvent',# 'CellExecuteEvent',# 'CellAddEvent',# 'CellRemoveEvent',]UninstallTo remove the extension, execute:pipuninstalljupyterlab-telemetry-producerTroubleshootIf you are seeing the frontend extension, but it is not working, check
that the server extension is enabled:jupyterserverextensionlistIf the server extension is installed and enabled, but you are not seeing
the frontend extension, check the frontend extension is installed:jupyterlabextensionlistContributingTo write your own telemetry producer extensions, a tutorial with a simple demo could be findhere.Development installNote: You will need NodeJS to build the extension package.Thejlpmcommand is JupyterLab's pinned version ofyarnthat is installed with JupyterLab. You may useyarnornpmin lieu ofjlpmbelow.# Clone the repo to your local environment# Change directory to the jupyterlab-telemetry-producer directory# Install package in development modepipinstall-e"."# Link your development version of the extension with JupyterLabjupyterlabextensiondevelop.--overwrite# Server extension must be manually installed in develop modejupyterserverextensionenablejupyterlab-telemetry-producer# Rebuild extension Typescript source after making changesjlpmbuildYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.# Watch the source directory in one terminal, automatically rebuilding when neededjlpmwatch# Run JupyterLab in another terminaljupyterlabWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).By default, thejlpm buildcommand generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:jupyterlabbuild--minimize=FalseDevelopment uninstall# Server extension must be manually disabled in develop modejupyterserverextensiondisablejupyterlab-telemetry-producer
pipuninstalljupyterlab-telemetry-producerIn development mode, you will also need to remove the symlink created byjupyter labextension developcommand. To find its location, you can runjupyter labextension listto figure out where thelabextensionsfolder is located. Then you can remove the symlink namedjupyterlab-telemetry-producerwithin that folder.Packaging the extensionSeeRELEASE