-
Notifications
You must be signed in to change notification settings - Fork 30
feat(dgw): list Gateway-generated artifacts in the recording manifest #2003
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
Open
irvingouj@Devolutions (irvingoujAtDevolution)
wants to merge
25
commits into
master
Choose a base branch
from
feat/jrec-manifest-logs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+466
−29
Open
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
1a7095a
feat(dgw): list session recording logs separately in the manifest
irvingoujAtDevolution f51e5c9
fix(dgw): refuse /shadow while only a session log is pushed
irvingoujAtDevolution 796f4ff
refactor(dgw): use artifact naming for the session ZIP plan
irvingoujAtDevolution 9f48746
feat(dgw): push session logs via materialType=log
irvingoujAtDevolution aea2d4e
refactor(dgw): push session logs on their own route
irvingoujAtDevolution 0b61db5
refactor(dgw): push session logs with category=log
irvingoujAtDevolution c72b6f7
refactor(dgw): call the pushed file kind a category and keep the log …
irvingoujAtDevolution e9e9a40
feat(dgw): list non-recording artifacts by role in the manifest
irvingoujAtDevolution 577a807
refactor(dgw): name the push destination PushTarget and pin role names
irvingoujAtDevolution 296aeb8
fix(dgw): name the artifact query param kind and keep artifacts out o…
irvingoujAtDevolution f1c439f
refactor(dgw): track pushes per kind so artifacts never touch the rec…
irvingoujAtDevolution ca0a6b1
refactor(dgw): hard-type the manifest artifacts per kind
irvingoujAtDevolution 2dc82c9
refactor(dgw): move the artifact types into artifacts.rs
irvingoujAtDevolution b62c8d9
refactor(dgw): keep artifact pushes out of the recording lifecycle
irvingoujAtDevolution 0ca58cd
docs(dgw): rewrite the recording intent for artifacts
irvingoujAtDevolution 808f4b4
refactor(dgw): update the last recording entry like master did
irvingoujAtDevolution ccd9116
refactor(dgw): trim the JREC push and ZIP changes back toward master
irvingoujAtDevolution 9d3a40a
refactor(dgw): drop artifact pushes; add artifacts from Gateway only
irvingoujAtDevolution da4f172
docs(dgw): artifacts have no push endpoint yet
irvingoujAtDevolution 26126aa
refactor(dgw): drop unused ArtifactKind derives
irvingoujAtDevolution 5b0b8ab
refactor(dgw): stream artifacts through a writer instead of moving a …
irvingoujAtDevolution 67b93c7
refactor(dgw): move the artifact writer into artifacts.rs
irvingoujAtDevolution b560157
refactor(dgw): add artifacts only to recorded sessions
irvingoujAtDevolution e86ed29
refactor(dgw): hand out a listed artifact file instead of a streaming…
irvingoujAtDevolution 172c8af
Merge branch 'master' into feat/jrec-manifest-logs
irvingoujAtDevolution 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| use serde::{Deserialize, Serialize}; | ||
|
|
||
| use crate::token::RecordingFileType; | ||
|
|
||
| /// Non-recording artifacts, one list per [`ArtifactKind`]. Each list is append-only, like `files`: names | ||
| /// are derived from positions. | ||
| #[derive(Debug, Clone, Default, Serialize, Deserialize)] | ||
| #[serde(rename_all = "kebab-case")] | ||
| pub(crate) struct JrecArtifacts { | ||
| #[serde(default, skip_serializing_if = "Vec::is_empty")] | ||
| ai_analysis: Vec<JrecArtifact>, | ||
| } | ||
|
|
||
| impl JrecArtifacts { | ||
| pub(crate) fn is_empty(&self) -> bool { | ||
| let Self { ai_analysis } = self; | ||
| ai_analysis.is_empty() | ||
| } | ||
|
|
||
| pub(crate) fn into_file_names(self) -> impl IntoIterator<Item = String> { | ||
| let Self { ai_analysis } = self; | ||
| ai_analysis.into_iter().map(|artifact| artifact.file_name) | ||
| } | ||
|
|
||
| pub(crate) fn of_kind_mut(&mut self, kind: ArtifactKind) -> &mut Vec<JrecArtifact> { | ||
| match kind { | ||
| ArtifactKind::AiAnalysis => &mut self.ai_analysis, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug, Clone, Serialize, Deserialize)] | ||
| #[serde(rename_all = "camelCase")] | ||
| pub(crate) struct JrecArtifact { | ||
| pub(crate) file_name: String, | ||
| } | ||
|
|
||
| /// Kind of a non-recording artifact, used as its key in the manifest `artifacts` object. | ||
| #[derive(Debug, Clone, Copy, PartialEq, Eq)] | ||
| pub enum ArtifactKind { | ||
| AiAnalysis, | ||
| } | ||
|
|
||
| impl ArtifactKind { | ||
| pub const fn as_str(self) -> &'static str { | ||
| match self { | ||
| ArtifactKind::AiAnalysis => "ai-analysis", | ||
| } | ||
| } | ||
|
|
||
| pub(crate) const fn file_type(self) -> RecordingFileType { | ||
| match self { | ||
| ArtifactKind::AiAnalysis => RecordingFileType::SessionRecordingLog, | ||
| } | ||
| } | ||
|
|
||
| /// Name of the artifact at `index` in its kind's list, such as `ai-analysis-0.slog`. | ||
| pub(crate) fn file_name(self, index: usize) -> String { | ||
| format!("{}-{index}.{}", self.as_str(), self.file_type().extension()) | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
||
| #[test] | ||
| fn manifest_key_is_the_kind_name() { | ||
| let kind = ArtifactKind::AiAnalysis; | ||
| let mut artifacts = JrecArtifacts::default(); | ||
| artifacts.of_kind_mut(kind).push(JrecArtifact { | ||
| file_name: "file".to_owned(), | ||
| }); | ||
|
|
||
| let json = serde_json::to_value(&artifacts).expect("serialize artifacts"); | ||
| let keys: Vec<_> = json.as_object().expect("object").keys().collect(); | ||
| assert_eq!(keys, [kind.as_str()]); | ||
| } | ||
| } |
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,10 @@ | ||
| # Recording | ||
| Gateway recording is a continuous stream of bytes pushed from the client who pocesses the valid recording token. | ||
| The url is `/jet/jrec/push/{sessionId}?fileType={fileType}`. | ||
| We expect the `fileType` to be one of the following file types: `webm`, `cast`, `trp` and `slog`, which must be specified. | ||
| When connection is established with request of recordings for the session, if recording is not enabled within a short period of time, the connection will be closed with indication of violation of the recording policy. | ||
|
|
||
|
|
||
| # Artifacts | ||
| Artifacts are files that are not recordings, currently only have `ai-analysis` with combination to `slog` file type. | ||
| Currently, we do not have an api endpoint to push artifacts, but we will have one in the future. |
Oops, something went wrong.
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.