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

Svelte: Add basic telemetry to svelte implementation #62190

Merged
merged 7 commits into from
Apr 26, 2024

Conversation

vovakulikov
Copy link
Contributor

@vovakulikov vovakulikov commented Apr 25, 2024

Closes #61635

Context

This PR moves the telemetry events out of the web package to the shared package. This allows using this telemetry service in the web-sveltekit package. Also, the wrapper over the original telemetry adds a special isSveltePrototype: true parameter to make a difference later between the original event and the svelte events.

Second thing, this PR adds only a subset of the original event; if you see that some event is missing, please leave a note. Currently, this adds these events

    ViewHomePage = 'Home',
    ViewSearchResultsPage = 'SearchResults',
    ViewRepositoryPage = 'Repository',
    ViewBlobPage = 'Blob',

    SearchSubmit = 'SearchSubmitted',
    SearchResultClick = 'SearchResultClicked',
    ShowHistoryPanel = 'ShowHistoryPanel',
    HideHistoryPanel = 'HideHistoryPanel',
    CodeCopied = 'CodeCopied',
    GoToCodeHost = 'GoToCodeHostClicked',
    GitBlameEnabled = 'GitBlameEnabled',
    SelectSearchFilter = 'SearchFiltersSelectFilter',

For reviewers

Diff got a lot of files due to the telemetry service moving. Check the commit history for easier review.

Next steps

Note that this PR uses old telemetry V1 due to needs around migration amplitude dashboards to new v2 telemetry events. I have a follow up here and I aim to bring new telemetry in June release #62191

Test plan

  • Manually check that page view event and action-based event send actual telemetry events

@vovakulikov vovakulikov requested a review from a team April 25, 2024 20:30
@vovakulikov vovakulikov self-assigned this Apr 25, 2024
@cla-bot cla-bot bot added the cla-signed label Apr 25, 2024
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Apr 25, 2024

📖 Storybook live preview

}
}

export const SVELTE_LOGGER = new SvelteTelemetry()
Copy link
Member

Choose a reason for hiding this comment

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

Should this be part of the context rather than a global?

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 was thinking about this but then I couldn't come up with reasons why it shouldn't be a global singleton. There might be an argument that this could be better for mocking in tests but I can say that there are no big differences in vi.mock vs context mocking, curious about what @fkling thinks

Copy link
Member

Choose a reason for hiding this comment

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

We should really get our formatters all in sync 😄

@vovakulikov vovakulikov force-pushed the vk/add-basic-telemetry-to-svelte-version branch from 78b4919 to e07292f Compare April 26, 2024 10:27
@vovakulikov
Copy link
Contributor Author

To make sure we have time to test it on staging and with amplitude I'm going ahead and merging this, will be happy to change anything later next week if something shows up

@vovakulikov vovakulikov merged commit c2afde8 into main Apr 26, 2024
15 of 16 checks passed
@vovakulikov vovakulikov deleted the vk/add-basic-telemetry-to-svelte-version branch April 26, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add telemetry/logging
3 participants