You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/operators/telemetry.rst
+42-8Lines changed: 42 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ The Notebook Server can be configured to record structured events from a running
11
11
.. warning::
12
12
Do NOT rely on this feature for security or auditing purposes. Neither `server <#emitting-server-events>`_ nor `client <#eventlog-endpoint>`_ events are protected against meddling. For server events, those who have access to the environment can change the server code to emit whatever they want. The same goes for client events where nothing prevents users from sending spurious data to the `eventlog` endpoint.
13
13
14
-
Emitting Server Events
14
+
Emitting server events
15
15
----------------------
16
16
17
17
Event logging is handled by its ``Eventlog`` object. This leverages Python's standing logging_ library to emit, filter, and collect event data.
@@ -37,8 +37,16 @@ Here's a basic example for emitting events from the `contents` service:
37
37
38
38
The output is a file, ``"event.log"``, with events recorded as JSON data.
39
39
40
-
`eventlog` endpoint
41
-
-------------------
40
+
Server event schemas
41
+
--------------------
42
+
43
+
.. toctree::
44
+
:maxdepth:2
45
+
46
+
events/index
47
+
48
+
The ``eventlog`` endpoint
49
+
-------------------------
42
50
43
51
The Notebook Server provides a public REST endpoint for external applications to validate and log events
44
52
through the Server's Event Log.
@@ -54,11 +62,37 @@ Events that are validated by this endpoint must have their schema listed in the
54
62
55
63
.. _below:
56
64
65
+
Register client event schemas
66
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
57
67
58
-
Server Event schemas
59
-
--------------------
68
+
``jupyter_server`` looks for locations of schema files provided by external packages by looking into the ``jupyter_telemetry`` entry point and then loads the files using the ``importlib.resources`` standard library.
60
69
61
-
.. toctree::
62
-
:maxdepth:2
70
+
For example, suppose there is a ``client_events`` package which wants to send events with schemas ``schema1.yaml``, ``schema2.yaml`` and ``extra_schema.yaml`` to the ``eventlog`` endpoint and has the following package structure:
63
71
64
-
events/index
72
+
.. code-block:: text
73
+
74
+
client_events/
75
+
__init__.py
76
+
schemas/
77
+
__init__.py
78
+
schema1.yaml
79
+
schema2.yaml
80
+
extras/
81
+
__init__.py
82
+
extra_schema.yaml
83
+
84
+
``schema1.yaml`` and ``schema2.yaml`` are resources under ``client_events.schemas`` and ``extra_schema.yaml`` under ``client_events.extras``. To make these schemas discoverable by ``jupyter_server``, create an entry point under the ``jupyter_telemetry`` group which resolves to a list containing their locations, in this case ``['client_events.schemas', 'client_events.extras']``:
0 commit comments