Skip to main content

Telemetry

CircleCI codecov Documentation Status

Telemetry for Jupyter Applications and extensions.

Telemetry (təˈlemətrē): the process of recording and transmitting the readings of an instrument. [Oxford Dictionaries]

Jupyter Telemetry enables Jupyter Applications (e.g. Jupyter Server, Jupyter Notebook, JupyterLab, JupyterHub, etc.) to record events—i.e. actions by application users—and transmit them to remote (or local) destinations as structured data. It works with Python's standard logging library to handle the transmission of events allowing users to send events to local files, over the web, etc.

Install

Jupyter's Telemetry library can be installed from PyPI.

pip install jupyter_telemetry

Basic Usage

Telemetry provides a configurable traitlets object, EventLog, for structured event-logging in Python. It leverages Python's standard logging library for filtering, handling, and recording events. All events are validated (using jsonschema) against registered JSON schemas.

Let's look at a basic example of an EventLog.

import logging
from jupyter_telemetry import EventLog


eventlog = EventLog(
    # Use logging handlers to route where events
    # should be record.
    handlers=[
        logging.FileHandler('events.log')
    ],
    # List schemas of events that should be recorded.
    allowed_schemas=[
        'uri.to.event.schema'
    ]
)

EventLog has two configurable traits:

  • handlers: a list of Python's logging handlers.
  • allowed_schemas: a list of event schemas to record.

Event schemas must be registered with the EventLog for events to be recorded. An event schema looks something like:

{
  "$id": "url.to.event.schema",
  "title": "My Event",
  "description": "All events must have a name property.",
  "type": "object",
  "properties": {
    "name": {
      "title": "Name",
      "description": "Name of event",
      "type": "string"
    }
  },
  "required": ["name"],
  "version": 1
}

2 fields are required:

  • $id: a valid URI to identify the schema (and possibly fetch it from a remote address).
  • version: the version of the schema.

The other fields follow standard JSON schema structure.

Schemas can be registered from a Python dict object, a file, or a URL. This example loads the above example schema from file.

# Register the schema.
eventlog.register_schema_file('schema.json')

Events are recorded using the record_event method. This method validates the event data and routes the JSON string to the Python logging handlers listed in the EventLog.

# Record an example event.
event = {'name': 'example event'}
eventlog.record_event(
    schema_id='url.to.event.schema',
    version=1,
    event=event
)

Release files for jupyter-telemetry 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jupyter-telemetry 0.1.0
File Size Uploaded
jupyter_telemetry-0.1.0.tar.gz 9.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for jupyter-telemetry 0.1.0
File Interpreter ABI Platform
jupyter_telemetry-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size:16.7 kB

Release files / jupyter_telemetry-0.1.0.tar.gz

Download URL jupyter_telemetry-0.1.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
445c613ae3df70d255fe3de202f936bba8b77b4055c43207edf22468ac875314
BLAKE2b-256 checksum
How to use checksums
c459edd04590235d9afe2b2b49ec449c6146dc71b717110f4a1034d52eb54303
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.4

Release files / jupyter_telemetry-0.1.0-py3-none-any.whl

Download URL jupyter_telemetry-0.1.0-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1de3e423b23aa40ca4a4238d65c56dda544061ff5aedc3f7647220ed7e3b9589
BLAKE2b-256 checksum
How to use checksums
90ab8d565a0797dacf82dea161ba5c40bd1f3ddbf365e3f7f8fd63007f03b19f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page