Skip to content

[supervisor]: gitpod config changed analytics #11653

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

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Jul 26, 2022

Description

This PR adds analytics for .gitpod.yml changes. We are track when changes are persisted to a disk and debounce them for 5s. After last change we analyse changes to top-level elements and report an event for each. It allows us to gain insights in what users are changing on top-level, e.g ports or tasks, and avoid a lot of traffic at the same time. Later we can do more fine grained analysis to see which object properties, like ports.name.

I had to resolve couple issues which were discovered during review or were blocking testing:

  • enable analytics env inside workspace in preview environments to verify with segment
  • don't fire change events for syntactically broken .gitpod.yml files, thank you @andreafalzetti for noticing it
  • adding git hook which keeps goland types up to date with gitpod schema, otherwise we will miss new properties, thank you @mustard-mh for brining forward that yaml parser only see properties which are defined in goland

Related Issue(s)

Fixes #6894

How to test

  • Open staging untrusted.
  • Start a workspace, open .gitpod.yml yet, wait for 5s.
  • You should not yet see any gitpod_config_changed events.
  • Now edit .gitpoy.yml, then you finish wait for 5s.
  • Now you should see gitpod_config_changed events.
  • Edit .gitpod.yml to add some syntax errors and semantic changes, then you finish wait for 5s.
  • You should not yet see any gitpod_config_changed events.
  • Edit .gitpod.yml to fix syntax errors, then you finish wait for 5s.
  • Now you should see gitpod_config_changed events for semantic changes.

Check for regressions:

  • Add new ports and check there are detected in the ports view.

Release Notes

NONE

Documentation

Werft options:

  • /werft with-preview
  • /werft analytics=segment|TEZnsG4QbLSxLfHfNieLYGF4cDwyFWoe

@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-ak-identiy-config-changed.5 because the annotations in the pull request description changed
(with .werft/ from main)

@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch from 085c57f to 185094b Compare July 26, 2022 15:26
@werft-gitpod-dev-com
Copy link

started the job as gitpod-build-ak-identiy-config-changed.7 because the annotations in the pull request description changed
(with .werft/ from main)

@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch from 185094b to 3a6152d Compare July 27, 2022 09:29
@akosyakov
Copy link
Member Author

akosyakov commented Jul 27, 2022

/werft run with-clean-slate-deployment=true

👍 started the job as gitpod-build-ak-identiy-config-changed.9
(with .werft/ from main)

@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch 2 times, most recently from 8f75290 to 225a9b9 Compare July 27, 2022 13:53
@roboquat roboquat added size/XL and removed size/L labels Jul 27, 2022
@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch 4 times, most recently from df87a24 to 327abfb Compare July 29, 2022 12:40
@akosyakov akosyakov marked this pull request as ready for review July 29, 2022 13:00
@akosyakov akosyakov requested review from a team July 29, 2022 13:00
@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch from a745dcd to 11f67f8 Compare August 5, 2022 17:20
@roboquat roboquat added size/XXL and removed size/XL labels Aug 5, 2022
@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch from 11f67f8 to d6d2108 Compare August 8, 2022 13:49
@@ -1,4 +1,4 @@
// Copyright (c) 2020 Gitpod GmbH. All rights reserved.
// Copyright (c) 2022 Gitpod GmbH. All rights reserved.
Copy link
Member Author

Choose a reason for hiding this comment

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

This file auto-generated. I added git hook which regenerates it on commit, see .pre-commit-config.yaml

"description": "Configure JVM options, for instance '-Xmx=4096m'."
}
}
"$ref": "#/definitions/jetbrainsProduct",
Copy link
Member Author

Choose a reason for hiding this comment

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

Refactored to extract a common properties to the definition and stabilize code generation.

@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch 3 times, most recently from b47034b to 86207ad Compare August 8, 2022 16:50
@akosyakov akosyakov changed the title [supervisor]: fix idenity of config-change analytics events [supervisor]: gitpod config changed analytics Aug 9, 2022
Copy link
Contributor

@felladrin felladrin left a comment

Choose a reason for hiding this comment

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

Working as advertised 🎉

I left just a comment about events triggered when the workspace has no .gitpod.yml and we run gp init, which is an edge case.

@akosyakov
Copy link
Member Author

I left just a comment about events triggered when the workspace has no .gitpod.yml and we run gp init, which is an edge case.

let me verify first that it does not happen then a user creates an empty file as well, it does not look good

@akosyakov akosyakov force-pushed the ak/identiy_config_changed branch from 86207ad to 85cc185 Compare August 9, 2022 09:52
@akosyakov
Copy link
Member Author

@felladrin I pushed the fix when https://werft.gitpod-dev.com/job/gitpod-build-ak-identiy-config-changed.38 is ready you can try again.

@akosyakov akosyakov requested a review from felladrin August 9, 2022 10:01
Copy link
Contributor

@andreafalzetti andreafalzetti left a comment

Choose a reason for hiding this comment

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

Great work @akosyakov 🙏

It works as expected when the .gitpod.yml is invalid. I've noticed that when creating with gp init or deleting the whole file it does detect changes for each field but I'd say it's kind of expected and I don't consider it a bug.

@akosyakov
Copy link
Member Author

akosyakov commented Aug 9, 2022

@loujaybee @andreafalzetti Do you think it would be useful to add an attribute like operation to distinguish what happened, i.e. added, updated, removed? I looked right now at analytics it can be misleading, i.e. you can see 2 modifications to tasks, but final maybe was removing so actually tasks are not used. For analytics it maybe interesting to focus only on added and updated? It is rather an easy fix.

@akosyakov
Copy link
Member Author

@loujaybee @andreafalzetti Do you think it would be useful to add an attribute like operation to distinguish what happened, i.e. added, updated, removed? I looked right now at analytics it can be misleading, i.e. you can see 2 modifications to tasks, but final maybe was removing so actually tasks are not used. For analytics it maybe interesting to focus only on added and updated? It is rather an easy fix.

Actually I'm wrong we cannot distinguish removed from updated because our goland types using string types not pointers. It will be quite impactful change, let's leave it for later.

@akosyakov
Copy link
Member Author

/unhold

@roboquat roboquat merged commit 01487c9 into main Aug 9, 2022
@roboquat roboquat deleted the ak/identiy_config_changed branch August 9, 2022 12:54
@roboquat roboquat added deployed: IDE IDE change is running in production deployed: webapp Meta team change is running in production deployed: workspace Workspace team change is running in production deployed Change is completely running in production labels Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deployed: IDE IDE change is running in production deployed: webapp Meta team change is running in production deployed: workspace Workspace team change is running in production deployed Change is completely running in production release-note-none size/XXL team: IDE team: webapp Issue belongs to the WebApp team team: workspace Issue belongs to the Workspace team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement analytics on changes to the .gitpod.yml
7 participants