Skip to content
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 #7444

Closed
wants to merge 119 commits into from
Closed

feat(sanity): add telemetry #7444

wants to merge 119 commits into from

Conversation

RitaDias
Copy link
Contributor

Description

Added telemetry to the following actions + fixed issue when adding a version to release made the code that came after the createVersionSuccess not run (wrong id was being passed)

Bundle

  • Bundle Created,
  • Bundle Updated,
  • Bundle Deleted,
  • Bundle Published,
  • Bundle Archived,
  • Bundle Unarchived

Version

  • All Versions created
  • Version created from draft (waiting confirmation)
  • Version created from version (waiting confirmation)

Out of scope (separate stories have been created):

  • Bundle scheduled
  • Bundle Unscheduled

What to review

Does this make sense? Should the messages be different?

bjoerge and others added 30 commits August 26, 2024 13:33
)

* chore: remove futile circular dependency workaround

* refactor(core): lift global listener out of preview store

* fix(preview): cleanup code so it matches current conventions + add some docs

* feat(preview): add unstable_observeDocument + unstable_observeDocuments to preview store

* fix: use includeMutations: false

* fix: expect ts error on includeMutations: false for now
* feat(corel): add bundles store
* docs(sanity): update comment on getAllVersionsOfDocument

* fix(sanity): listing existing versions didn't account for published

* chore(sanity): move latest version up (temp)

* feat(sanity): update navigation of perspective + add "current badge"

* feat(sanity): add global version navigation

* refactor(sanity): hide document version picker, update the document icon

* feat(sanity): update studio nav bar (reduce create button + spacing)

* chore(sanity): general cleanup

* feat(sanity): add version provider, hide only the version picker in document

* chore(sanity): clean up version context

* chore(sanity): clean up, move components & files to single folder

* chore(sanity): clean up, move components & files to single folder

* chore(sanity): add ready button to document footer

* refactor(sanity): remove isVersion and add frontend guardrails

* chore(sanity): clean duplicate component

* chore(sanity): clean up missing dependencies

* refactor(sanity): update button

* refactor(sanity): clear up naming

* chore(sanity): hide ready

* chore(sanity): ready todos

* feat(sanity): add bundle modal + update colours + remove add new version from doc

* refactor(sanity): rename from release to bundle

* refactor(sanity): clean up code for types (bundleform)

* refactor(sanity): update method

* refactor(sanity): update drafts name (draft -> drafts) in LATEST & context

* refactor(sanity): use handleBundleChange instead of two separate methods

* refactor(sanity): update title to use LATEST const

* refactor(sanity): update draft filtering and checks (global and document level)

* refactor(sanity): update context to rely on router & update query to match existing bundles (MOCK)

* refactor(sanity): update handle methods to have callback

* feat(sanity): add guardrails for title naming on bundle create

* docs(sanity): update comments to potentially move things to plugin

* refactor(sanity): merge version badges & icons

* refactor(sanity): use speakingurl instead of toSlug
* docs(sanity): update comment on getAllVersionsOfDocument

* fix(sanity): listing existing versions didn't account for published

* chore(sanity): move latest version up (temp)

* feat(sanity): update navigation of perspective + add "current badge"

* feat(sanity): add global version navigation

* refactor(sanity): hide document version picker, update the document icon

* feat(sanity): update studio nav bar (reduce create button + spacing)

* chore(sanity): general cleanup

* feat(sanity): add version provider, hide only the version picker in document

* feat(releases): create releases tool as default plugin

* feat(releases): styling and components for basic releases overview

* feat(releases): adding release detail page and routing

* feat(releases): uri decoding releaseID

* chore(sanity): clean up version context

* chore(sanity): clean up, move components & files to single folder

* chore(sanity): clean up, move components & files to single folder

* feat(corel): add bundles store

* chore(sanity): add ready button to document footer

* refactor(sanity): remove isVersion and add frontend guardrails

* chore(sanity): clean duplicate component

* chore(sanity): clean up missing dependencies

* refactor(sanity): update button

* chore(corel): use rxjs in bundlesStore listener

* refactor(sanity): clear up naming

* chore(sanity): hide ready

* chore(sanity): ready todos

* feat(corel): add retry to initialFetch

* feat(releases): remove the ready concepts

* feat(corel): include useBundleOperations and story

* fix(corel): update imports paths

* feat(sanity): add bundle modal + update colours + remove add new version from doc

* refactor(sanity): rename from release to bundle

* refactor(sanity): clean up code for types (bundleform)

* refactor(releases): refactor releases to bundles

* feat(releases): using bundle ops to fetch and create add-on bundles

* refactor(releases): type guard for at least one bundle returned

* fix(releases): fixing issue where overview header not hidden when no bundles

* feat(releases): search filters list of releases

* refactor(releases): minor refactor of hooks in BundlesOverview

* refactor(sanity): update method

* feat(releases): addijg concept loosely of bundle documents

* feat(releases): testing for BundlesTable

* feat(releases): testing for BundlesTable

* feat(releases): testing for releases overview page

* refactor(release): fixing types on the custom queries

* refactor(releases): Creating BundleIcon

* refactor(releases): minor refactor and tidy to component logic

* refactor(releases): minor format changes

* refactor(releases): create bundle dialog creates itself and then returns

* refactor(releases): create bundle dialog creates itself and then returns

* feat(releases): minor style update to match prototype on the mode picker

* feat(releases): minor style update to match prototype on the mode picker

* refactor(releases): moving search into table header as per prototype

* chore(corel): add eslintrc change, remove progress icon and update types (#7050)

---------

Co-authored-by: RitaDias <anarita151@gmail.com>
Co-authored-by: Pedro Bonamin <pedrobonamin@gmail.com>
Co-authored-by: Pedro Bonamin <46196328+pedrobonamin@users.noreply.github.com>
@RitaDias RitaDias requested review from juice49, pedrobonamin, jordanl17, bjoerge and a team and removed request for a team, juice49, jordanl17, bjoerge and pedrobonamin August 30, 2024 12:34
@bjoerge bjoerge requested review from a team, bjoerge, juice49 and jordanl17 and removed request for a team, bjoerge and juice49 August 30, 2024 12:44
@@ -67,7 +71,7 @@ export function BundleActions(props: BundleActionsProps): ReactNode {
// set up the listener before executing
const createVersionSuccess = firstValueFrom(
documentStore.pair
.operationEvents(versionId, documentType)
.operationEvents(getPublishedId(documentId), documentType)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch 🙏.

@@ -74,6 +82,12 @@ export const BundleMenuButton = ({disabled, bundle, documentCount}: BundleMenuBu
...bundle,
archivedAt: isBundleArchived ? undefined : new Date().toISOString(),
})

if (isBundleArchived) {
telemetry.log(UnarchivedRelease)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to reason about this code. It might just be that I'm confused, but will this not log an UnarchivedRelease event when deleting an archived release and, below, log an ArchivedRelease event when deleting an unarchived release? Apologies if I'm mistaken, or this is the intention.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know what you mean I also felt a bit confused. This is coming from the bundle object at the top which is not updated fast enough to where this section of the code.

So technically it's:

  • IsBundleArchived true -> it means that it's in the process of becoming false, so the event we want to track is unarchive
  • IsBundleArchived false -> if means that it's in the process of becoming true, so the event we want to track is archive

Even the achivedAt: isBundleArchived ? undefined : new Date().toISOString(), follows the same type of logic. If it's true then set it as undefined because technically it won't be archived anymore, if it's not archived then add the date because it means it'll become archived

I'll add this comment there, unless you feel there is a better way? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juice49 I'm closing this, moved the commits to here #7460 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants