-
Notifications
You must be signed in to change notification settings - Fork 435
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
feat(sanity): add telemetry for versions #7460
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
4fda385
fix(sanity): issue where the createVersionSuccess was never resolving
RitaDias 6c67887
feat(sanity): add telemetry when adding version
RitaDias 4fe49b4
refactor(sanity): rename bundles to releases telemetry
RitaDias 40d5be6
feat(sanity): add telemetry when creating release
RitaDias e93f38d
feat(sanity): add telemetry when updating release
RitaDias 4484c1b
feat(sanity): add telemetry when deleting release
RitaDias 7994a5a
feat(sanity): add telemetry when publishing release
RitaDias 76e9db9
feat(sanity): add telemetry when archive and unarchive release
RitaDias 9640377
chore(sanity): fix dependencies
RitaDias a4374e7
feat(sanity): add telemetry when creating a draft
RitaDias f1bd4b6
refactor(sanity): add telemetry for tracking drafts and include version
RitaDias 64bf480
refactor(sanity): update telemetry request for creating release
RitaDias 98f2e7d
refactor(sanity): reuse interface for OriginInfo
RitaDias b3b64cf
docs(sanity): clarify unarchive / archive telemetry track
RitaDias 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
77 changes: 77 additions & 0 deletions
77
packages/sanity/src/core/bundles/__telemetry__/releases.telemetry.ts
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,77 @@ | ||
import {defineEvent} from '@sanity/telemetry' | ||
|
||
interface VersionInfo { | ||
/** | ||
* document type that was added | ||
*/ | ||
schemaType: string | ||
|
||
/** | ||
* the origin of the version created (from a draft or from a version) | ||
*/ | ||
documentOrigin: 'draft' | 'version' | ||
} | ||
|
||
/** | ||
* When a document (version) is successfully added to a release | ||
* @internal | ||
*/ | ||
export const AddedVersion = defineEvent<VersionInfo>({ | ||
name: 'Add version of document to release', | ||
version: 1, | ||
description: 'User added a document to a release', | ||
}) | ||
|
||
/** When a release is successfully created | ||
* @internal | ||
*/ | ||
export const CreatedRelease = defineEvent({ | ||
name: 'Create release', | ||
version: 1, | ||
description: 'User created a release', | ||
}) | ||
|
||
/** When a release is successfully updated | ||
* @internal | ||
*/ | ||
export const UpdatedRelease = defineEvent({ | ||
name: 'Update release', | ||
version: 1, | ||
description: 'User updated a release', | ||
}) | ||
|
||
/** When a release is successfully deleted | ||
* @internal | ||
*/ | ||
export const DeletedRelease = defineEvent({ | ||
name: 'Delete release', | ||
version: 1, | ||
description: 'User deleted a release', | ||
}) | ||
|
||
/** When a release is successfully published | ||
* @internal | ||
*/ | ||
export const PublishedRelease = defineEvent({ | ||
name: 'Publish release', | ||
version: 1, | ||
description: 'User published a release', | ||
}) | ||
|
||
/** When a release is successfully archived | ||
* @internal | ||
*/ | ||
export const ArchivedRelease = defineEvent({ | ||
name: 'Archive release', | ||
version: 1, | ||
description: 'User archived a release', | ||
}) | ||
|
||
/** When a release is successfully unarchived | ||
* @internal | ||
*/ | ||
export const UnarchivedRelease = defineEvent({ | ||
name: 'Unarchive release', | ||
version: 1, | ||
description: 'User unarchived a release', | ||
}) |
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 |
---|---|---|
|
@@ -50,7 +50,7 @@ import {usePaneRouter} from '../../components' | |
import {structureLocaleNamespace} from '../../i18n' | ||
import {type PaneMenuItem} from '../../types' | ||
import {useStructureTool} from '../../useStructureTool' | ||
import {DocumentURLCopied} from './__telemetry__' | ||
import {CreatedDraft, DocumentURLCopied} from './__telemetry__' | ||
import { | ||
DEFAULT_MENU_ITEM_GROUPS, | ||
EMPTY_PARAMS, | ||
|
@@ -328,6 +328,10 @@ export const DocumentPaneProvider = memo((props: DocumentPaneProviderProps) => { | |
}) | ||
|
||
patchRef.current = (event: PatchEvent) => { | ||
// when creating a new draft | ||
if (!editState.draft && !editState.published && !editState.version) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The first section |
||
telemetry.log(CreatedDraft) | ||
} | ||
patch.execute(toMutationPatches(event.patches), initialValue.value) | ||
} | ||
|
||
|
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A thought here, though I'm unsure if this does or doesn't align with our current telemetry strategies elsewhere. But interested in your thoughts - tracking how/where a release is created eg. from the global perspective menu or from within the releases plugin
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's true that might be interesting to know 💡
I'll add it! Thank you for the idea Jordan, great catch!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added it on 64bf480
I kept the terms as
origin: 'structure' | 'release-plugin'
because we know that the section where we create releases from thestructure
tool will likely change where it is (and might not end up in the nav bar as is now) and kept the name simple asrelease-plugin
because I don't think we'll have multiple places where we'll be able to create the release within the plugin (nor do I know if we need that sort of granularity) + with the re-design it might not be in the "overview" :)Thoughts are welcome!