-
Notifications
You must be signed in to change notification settings - Fork 339
[Telemetry] Add basic telemetry to Jupyter server and begin emitting server events #364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 53 commits
Commits
Show all changes
55 commits
Select commit
Hold shift + click to select a range
344bb57
Add initial eventlog hook
yuvipanda a0f40ea
Install jupyter_telemetry from source
yuvipanda 96bf2f0
Set up an eventlog API endpoint
yuvipanda 06b91e0
Use different naming convention & add test for it
yuvipanda 716ff1b
Don't use f-strings
yuvipanda 8e122fc
Derive JSON Schema files from YAML files
yuvipanda f9a0dfb
Keep event schemas in YAML
yuvipanda c7428e8
Depend on the jupyter_telemetry package
yuvipanda 9437e88
read schemas from new utils function
Zsailer 6e3c80c
Add fix for tables in RTD theme sphinx docs.
Zsailer 4035fd5
add event schema auto-documentation to jupyter notebook docs
Zsailer 23d50a3
format paths in recorded events
Zsailer 3c94970
add documentation for eventlog endpoint
Zsailer e76c91b
return exception as 400 error in eventlog endpoint
Zsailer 2ce7c54
normalize path in emitted event
Zsailer 5794d31
initial tests
Zsailer 7c9d3d5
add initial telemetry docs
Zsailer ef8573d
fix jupyter_telemetry dependency
Zsailer ea9e352
point telemetry at correct dev branch
Zsailer b06f7d6
add tests for eventlog
kiendang 4d7fc23
Merge branch 'master' into jupyter_telemetry
kiendang 7302396
Use correct fixture names
kiendang 2c79b1a
Merge branch 'master' into jupyter_telemetry
kiendang 0ac16dc
Fix import
kiendang 7c81b23
Remove redundant call
kiendang b8ca484
Update telemetry
kiendang ac452cd
Add note about security
kiendang 70f9275
Register client telemetry schemas using entry_points
kiendang 7f50c85
Add working telemetry commit for testing
kiendang 99439b6
Use backported importlib_metadata
kiendang cdc92e9
Merge remote-tracking branch 'upstream/master' into jupyter_telemetry
kiendang 8e69ab0
Ignore errors while registering client events
kiendang e2db0ad
Add client eventlog to list services
kiendang 66accdc
Add tests for client telemetry events
kiendang 4dcd258
Add client telemetry eventlog tests to CI
kiendang 87dca57
Merge branch 'master' into jupyter_telemetry
kiendang 9fd2a5f
Clean up
kiendang f692488
Fix eventlog test
kiendang 21117a6
Use standard lib instead of backport when possible
kiendang 1936503
Fix docs
kiendang e099ccc
Merge branch 'master' into jupyter_telemetry
kiendang bc94f13
Fix docs
kiendang bfbdd17
Refine example
kiendang 0974231
Use same interface for registering file and file object
kiendang 035eb6e
Fix client test ci
kiendang 8179c47
Remove redundant check
kiendang c307a8d
Add docs on registering client events
kiendang e206188
Remove unrelated doc change
kiendang a67bb25
Remove eventlog endpoint
kiendang 7d906af
Use telemetry upstream
kiendang 82e70b8
Use importlib.resources to read event schemas
kiendang 22b682f
Fix docs
kiendang e0c38d2
Doc change notebook server to jupyter server
kiendang 31585e4
Remove eventlog API endpoint doc
kiendang 5703d94
Merge remote-tracking branch 'upstream/master' into jupyter_telemetry
kiendang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* override table width restrictions */ | ||
@media screen and (min-width: 767px) { | ||
|
||
.wy-table-responsive table td { | ||
/* !important prevents the common CSS stylesheets from overriding | ||
this as on RTD they are loaded after this stylesheet */ | ||
white-space: normal !important; | ||
} | ||
|
||
.wy-table-responsive { | ||
overflow: visible !important; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Eventlogging and Telemetry | ||
========================== | ||
|
||
Jupyter Server can be configured to record structured events from a running server using Jupyter's `Telemetry System`_. The types of events that Jupyter Server emits are defined by `JSON schemas`_ listed below_ emitted as JSON data, defined and validated by the JSON schemas listed below. | ||
|
||
|
||
.. _logging: https://docs.python.org/3/library/logging.html | ||
.. _`Telemetry System`: https://github.com/jupyter/telemetry | ||
.. _`JSON schemas`: https://json-schema.org/ | ||
|
||
.. warning:: | ||
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. | ||
|
||
Emitting server events | ||
---------------------- | ||
|
||
Event logging is handled by its ``Eventlog`` object. This leverages Python's standing logging_ library to emit, filter, and collect event data. | ||
|
||
To begin recording events, you'll need to set two configurations: | ||
|
||
1. ``handlers``: tells the EventLog *where* to route your events. This trait is a list of Python logging handlers that route events to | ||
2. ``allows_schemas``: tells the EventLog *which* events should be recorded. No events are emitted by default; all recorded events must be listed here. | ||
|
||
Here's a basic example for emitting events from the `contents` service: | ||
|
||
.. code-block:: | ||
|
||
import logging | ||
|
||
c.EventLog.handlers = [ | ||
logging.FileHandler('event.log'), | ||
] | ||
|
||
c.EventLog.allowed_schemas = [ | ||
'hub.jupyter.org/server-action' | ||
] | ||
|
||
The output is a file, ``"event.log"``, with events recorded as JSON data. | ||
|
||
Server event schemas | ||
-------------------- | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
events/index | ||
|
||
The ``eventlog`` endpoint | ||
------------------------- | ||
|
||
The Notebook Server provides a public REST endpoint for external applications to validate and log events | ||
through the Server's Event Log. | ||
|
||
To log events, send a `POST` request to the `/api/eventlog` endpoint. The body of the request should be a | ||
JSON blog and is required to have the follow keys: | ||
|
||
1. `'schema'` : the event's schema ID. | ||
2. `'version'` : the version of the event's schema. | ||
3. `'event'` : the event data in JSON format. | ||
|
||
Events that are validated by this endpoint must have their schema listed in the `allowed_schemas` trait listed above. | ||
|
||
.. _below: |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.