-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DM-47389: Publish app metrics events
- Loading branch information
Showing
40 changed files
with
1,556 additions
and
748 deletions.
There are no files selected for viewing
This file contains 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 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,3 @@ | ||
### New features | ||
|
||
- Publish [application metrics](https://safir.lsst.io/user-guide/metrics/index.html) |
This file contains 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 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 |
---|---|---|
|
@@ -8,6 +8,7 @@ | |
-c main.txt | ||
|
||
# Testing | ||
anys | ||
asgi-lifespan | ||
coverage[toml] | ||
documenteer[guide] | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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 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 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,103 @@ | ||
"""App metrics events.""" | ||
|
||
from datetime import timedelta | ||
from typing import override | ||
|
||
from safir.dependencies.metrics import EventMaker | ||
from safir.metrics import EventManager, EventPayload | ||
|
||
|
||
class EventBase(EventPayload): | ||
"""Attributes on every mobu event.""" | ||
|
||
flock: str | None | ||
business: str | ||
username: str | ||
|
||
|
||
class NotebookBase(EventBase): | ||
"""Attributes for all notebook-related events.""" | ||
|
||
notebook: str | ||
repo: str | ||
repo_ref: str | ||
repo_hash: str | ||
|
||
|
||
class NotebookExecution(NotebookBase): | ||
"""Reported after a notebook is finished executing.""" | ||
|
||
duration: timedelta | None | ||
success: bool | ||
|
||
|
||
class NotebookCellExecution(NotebookBase): | ||
"""Reported after a notebook cell is finished executing.""" | ||
|
||
duration: timedelta | None | ||
cell_id: str | ||
success: bool | ||
|
||
|
||
class NubladoPythonExecution(EventBase): | ||
"""Reported after a nublado python execution.""" | ||
|
||
duration: timedelta | None | ||
success: bool | ||
code: str | ||
|
||
|
||
class NubladoSpawnLab(EventBase): | ||
"""Reported for every attempt to spawn a lab.""" | ||
|
||
duration: timedelta | ||
success: bool | ||
|
||
|
||
class NubladoDeleteLab(EventBase): | ||
"""Reported for every attempt to delete a lab.""" | ||
|
||
duration: timedelta | ||
success: bool | ||
|
||
|
||
class GitLfsCheck(EventBase): | ||
"""Reported from Git LFS businesses.""" | ||
|
||
success: bool | ||
duration: timedelta | None = None | ||
|
||
|
||
class TapQuery(EventBase): | ||
"""Reported when a TAP query is executed.""" | ||
|
||
success: bool | ||
duration: timedelta | None | ||
sync: bool | ||
|
||
|
||
class Events(EventMaker): | ||
"""Container for app metrics event publishers.""" | ||
|
||
@override | ||
async def initialize(self, manager: EventManager) -> None: | ||
self.tap_query = await manager.create_publisher("tap_query", TapQuery) | ||
self.git_lfs_check = await manager.create_publisher( | ||
"git_lfs_check", GitLfsCheck | ||
) | ||
self.notebook_execution = await manager.create_publisher( | ||
"notebook_execution", NotebookExecution | ||
) | ||
self.notebook_cell_execution = await manager.create_publisher( | ||
"notebook_cell_execution", NotebookCellExecution | ||
) | ||
self.nublado_python_execution = await manager.create_publisher( | ||
"nublado_python_execution", NubladoPythonExecution | ||
) | ||
self.nublado_spawn_lab = await manager.create_publisher( | ||
"nublado_spawn_lab", NubladoSpawnLab | ||
) | ||
|
||
self.nublado_delete_lab = await manager.create_publisher( | ||
"nublado_delete_", NubladoDeleteLab | ||
) |
This file contains 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 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 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
Oops, something went wrong.