Skip to content

Commit 1bb1c20

Browse files
authored
Collect Anonymous Analytics Data on Opt-In Basis
- Adds optional analytics data collection using Posthog - Adds documentation on what data is collected and why Resolves #63
1 parent 50ca1b9 commit 1bb1c20

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1032
-107
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Request Access To Analytics Data
3+
about:
4+
title:
5+
labels: ''
6+
assignees: ''
7+
---
8+
9+
<!-- Please state why you request access to our analytics data and what you plan to do with it. -->
10+
<!-- Refer to https://github.com/swissmanu/rxjs-debugging-for-vscode/blob/main/ANALYTICS.md for further information. -->

.github/workflows/build.yml

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ jobs:
9090

9191
- name: Production Build
9292
run: yarn nx run-many --target=build --configuration=prod --projects=extension,runtime-webpack
93+
env:
94+
POSTHOG_HOST: snapshot
95+
POSTHOG_PROJECT_API_KEY: snapshot
9396

9497
- name: 'extension: Create VSIX'
9598
run: yarn nx package extension
@@ -111,16 +114,54 @@ jobs:
111114
path: 'packages/runtime-webpack/*.tgz'
112115
retention-days: 10
113116

114-
publish:
117+
publish-marketplace:
115118
if: github.event == 'release' && github.event.action == 'published'
116119
needs:
117120
- unit-test
121+
- lint
118122
- integration-test
123+
runs-on: ubuntu-latest
124+
environment:
125+
name: production
126+
url: https://marketplace.visualstudio.com/items?itemName=manuelalabor.rxjs-debugging-for-vs-code
127+
steps:
128+
- name: Checkout
129+
uses: actions/checkout@v2
130+
131+
- name: Install Node.js
132+
uses: actions/setup-node@v2
133+
with:
134+
node-version: ${{ env.NODE_VERSION }}
135+
registry-url: 'https://registry.npmjs.org'
136+
137+
- name: Install Dependencies
138+
run: yarn --immutable
139+
140+
- name: Create Production Build
141+
run: yarn nx run-many --target=build --configuration=prod --projects=extension
142+
env:
143+
POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }}
144+
POSTHOG_PROJECT_API_KEY: ${{ secrets.POSTHOG_PROJECT_API_KEY }}
145+
146+
- name: 'Publish to Marketplace'
147+
run: yarn nx run-many --target=publish --projects=extension
148+
env:
149+
VSCE_PAT: ${{ secrets.AZURE_ACCESS_TOKEN }}
150+
151+
publish-npm:
152+
if: github.event == 'release' && github.event.action == 'published'
153+
needs:
154+
- unit-test
119155
- lint
156+
- integration-test
120157
runs-on: ubuntu-latest
158+
environment:
159+
name: production
160+
url: https://www.npmjs.com/package/@rxjs-debugging/runtime-webpack
121161
steps:
122162
- name: Checkout
123163
uses: actions/checkout@v2
164+
124165
- name: Install Node.js
125166
uses: actions/setup-node@v2
126167
with:
@@ -129,11 +170,11 @@ jobs:
129170

130171
- name: Install Dependencies
131172
run: yarn --immutable
132-
- name: Production Build
133-
run: yarn nx run-many --target=build --configuration=prod --projects=extension,runtime-webpack
134173

135-
- name: 'Publish'
174+
- name: Create Production Build
175+
run: yarn nx run-many --target=build --configuration=prod --projects=runtime-webpack
176+
177+
- name: 'Publish to npm'
136178
run: yarn nx run-many --target=publish --projects=runtime-webpack
137179
env:
138-
VSCE_PAT: ${{ secrets.AZURE_ACCESS_TOKEN }}
139180
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

ANALYTICS.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Extension Usage Analytics
2+
3+
> 🥽 For Science!
4+
5+
The initial version of "RxJS Debugging for Visual Studio Code" resulted from a [research project](./RESEARCH.md). Doing (serious) research relies on empirical data. Thus, "RxJS Debugging for Visual Studio Code" asks its users to opt-in to collecting user behavior analytics data on its first activation.
6+
7+
It is essential for us that our users understand what data we collect and why we do it. This document gives full disclosure on [every event and data point](#tracked-events) we collect. We reveal further [where and how information is stored](#data-transmission-and-storage) and how you can [access it for your research work or contribution to the extension](#open-source-open-research-and-open-data) itself.
8+
9+
## Tracked Events
10+
11+
If analytics is enabled, the extension tracks user behavior at events detailed below. Each event consists of an [anonymized machine identifier provided by Visual Studio Code](https://code.visualstudio.com/api/references/vscode-api#env) and a set of event-specific data points.
12+
13+
All data points are carefully crafted to protect the users' privacy while providing empirical evidence for future research work. The machine identifier **DOES NOT** reveal the identity of users accordingly. Its sole purpose is the consolidation of events that belong together over time.
14+
15+
We discard IP addresses before storing any tracking event. This makes it impossible to reconstruct or estimate your geographical location later.
16+
17+
The following list documents all tracked analytic events. Feel free to review their implementation directly in the source code: [packages/extension/src/analytics](./packages/extension/src/analytics).
18+
19+
### Extension Started
20+
21+
| Data Point | Reason | Example Values |
22+
| ------------------------------------------------------------ | ------------------------------------------------------------ | --------------------------- |
23+
| [**Visual Studio Code Version**](https://code.visualstudio.com/api/references/vscode-api#env) | The version of your Visual Studio Code installation.<br />This data point helps us to understand, which versions of Visual Studio Code are relevant for our users. It allows us to decide on if we can stop supporting outdated versions of Visual Studio Code, or not. | `1.61.0` |
24+
| [**Visual Studio Code Language**](https://code.visualstudio.com/api/references/vscode-api#env) | The preferred language of your Visual Studio Code installation.<br />This data point allows us to prioritze the languages for which we might translate "RxJS Debugging for Visual Studio Code" next. | `en-US`, `de-CH`, `fr`, ... |
25+
| **Extension Version** | Identifies the version of "RxJS Debugging for Visual Studio Code" currently installed on your machine.<br />This data point helps us understand how our users install updates of our extension after release. | `1.0.0` |
26+
27+
### Debug Session Started
28+
29+
| Data Point | Reason | Example Values |
30+
| ---------------- | ------------------------------------------------------------ | ------------------- |
31+
| **Runtime Type** | The runtime type declares how the RxJS debugger connects to your application.<br />This data point helps us to understand what kind of RxJS applications (e.g. backend or frontend) our users debug most. | `nodejs`, `webpack` |
32+
33+
### Debug Session Stopped
34+
35+
*This event does not include any additional data points.*
36+
37+
### Operator Log Point Enabled/Disabled
38+
39+
| Data Point | Reason | Example Values |
40+
| ----------------- | ------------------------------------------------------------ | --------------------- |
41+
| **Operator Name** | Identifies **[built-in operators](https://rxjs.dev/api?type=function)** for which you enable/disable a log point. We will **NOT** track the name of a custom operator nor anything else related to your source code (line numbers, structure, etc.)<br />This data point helps us to understand which operators are the most problematic ones for our users. Thus, it helps us to build better debugging tools in the future accordingly. | `map`, `flatMap`, ... |
42+
43+
## Data Transmission and Storage
44+
45+
All analytic events are securely transmitted over an HTTPS connection.
46+
47+
Usage analytics data is collected using [Posthog](https://posthog.com/). It runs on the premises of the [Eastern Switzerland University of Applied Sciences (OST)](https://ost.ch) where all data ist stored as well.
48+
49+
## Open Source, Open Research and Open Data
50+
51+
[Posthog](https://posthog.com/) does not allow the creation of read-only users at the time of writing this document. 🙏 Please [create an issue](https://github.com/swissmanu/rxjs-debugging-for-vscode/issues/new?template=request_analytics_data_access.md) using the appropriate template if you want to access to the collected analytics data for your own research project or contribution to the extension. We happily assist you either with an export of a data set or grant you access to Posthog itself if required.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Next
44

55
- Feature: Support Debugging of Browser-based Applications [#43](https://github.com/swissmanu/rxjs-debugging-for-vscode/issues/43)
6+
- Feature: Collect Analytics Data on Opt-In [#63](https://github.com/swissmanu/rxjs-debugging-for-vscode/issues/63)
67
- Improvement: Add Integration Test for Operator Log Points [#49](https://github.com/swissmanu/rxjs-debugging-for-vscode/issues/49)
78
- Bugfix: Enabled Log Point stays where it was enabled once [#102](https://github.com/swissmanu/rxjs-debugging-for-vscode/issues/102)
89

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Jump right in and explore, how "RxJS Debugging for Visual Studio Code" can impro
6161

6262
https://github.com/swissmanu/playground-rxjs-debugging-for-vscode
6363

64+
## Analytics Data
65+
66+
The "RxJS Debugger for Visual Studio Code" extension collects usage analytics data from users who opted-in. See [ANALYTICS.md](./ANALYTICS.md) for more information on what data is collected and why.
67+
6468
## Research
6569

6670
This extension is based on research by Manuel Alabor. See [RESEARCH.md](./RESEARCH.md) for more information.

RESEARCH.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
"RxJS Debugging for Visual Studio Code" is the result the master studies research by Manuel Alabor on the topic how developers debug RxJS-based code.
44

55
- Manuel Alabor and Markus Stolze. 2020. Debugging of RxJS-based applications. In Proceedings of the 7th ACM SIGPLAN International Workshop on Reactive and Event-Based Languages and Systems (REBLS 2020). Association for Computing Machinery, New York, NY, USA, 15–24. DOI: https://doi.org/10.1145/3427763.3428313
6-
76
- Manuel Alabor. 2021. User Journey: Debugging of RxJS-Based Applications. https://alabor.me/research/user-journey-debugging-of-rxjs-based-applications/
87

9-
8+
9+
## Open Research
10+
11+
"RxJS Debugging for Visual Studio Code" collects usage analytics data on an opt-in basis. We provide open access to this data for research projects. Please refer to [ANALYTICS.md](./ANALYTICS.md) for further information.

packages/extension/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
docs/
2-
README.md
2+
*.md
33
LICENSE

packages/extension/package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,22 @@
3232
"configuration": {
3333
"title": "%rxjs-debugging.config.title%",
3434
"properties": {
35-
"debug.rxjs.recommendOperatorLogPointsWithAnIcon": {
35+
"rxjsDebugging.recommendOperatorLogPointsWithAnIcon": {
3636
"description": "%rxjs-debugging.config.recommendOperatorLogPointsWithAnIcon%",
3737
"type": "boolean",
3838
"default": true
3939
},
40-
"debug.rxjs.hideLiveLogWhenStoppingDebugger": {
40+
"rxjsDebugging.hideLiveLogWhenStoppingDebugger": {
4141
"description": "%rxjs-debugging.config.hideLiveLogWhenStoppingDebugger%",
4242
"type": "boolean",
4343
"default": true
4444
},
45-
"debug.rxjs.logLevel": {
45+
"rxjsDebugging.enableUsageAnalytics": {
46+
"markdownDescription": "%rxjs-debugging.config.enableUsageAnalytics%",
47+
"type": "boolean",
48+
"default": false
49+
},
50+
"rxjsDebugging.logLevel": {
4651
"description": "%rxjs-debugging.config.logLevel%",
4752
"type": "string",
4853
"default": "Never",
@@ -88,6 +93,7 @@
8893
"devDependencies": {
8994
"@rollup/plugin-commonjs": "21.0.1",
9095
"@rollup/plugin-inject": "4.0.3",
96+
"@rollup/plugin-json": "4.1.0",
9197
"@rollup/plugin-node-resolve": "13.0.6",
9298
"@rollup/plugin-typescript": "8.3.0",
9399
"@types/jest": "26.0.24",
@@ -110,6 +116,7 @@
110116
"@rxjs-debugging/runtime": "0.0.0",
111117
"@rxjs-debugging/telemetry": "0.0.0",
112118
"inversify": "5.1.1",
119+
"posthog-node": "1.2.0",
113120
"reflect-metadata": "0.1.13",
114121
"spicery": "2.1.2",
115122
"typescript": "4.4.4",

packages/extension/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"rxjs-debugging.config.hideLiveLogWhenStoppingDebugger": "When enabled, live log values are hidden automatically after stopping the debugger.",
44
"rxjs-debugging.config.recommendOperatorLogPointsWithAnIcon": "When enabled, recommended operator log points will be indicated using an icon at the beginning of the line. Hint: You can toggle this setting using the related command in the command palette as well.",
55
"rxjs-debugging.config.logLevel": "Internal log level for the extension. (reload required)",
6+
"rxjs-debugging.config.enableUsageAnalytics": "When enabled, anonymized behavior data is collected to further improve RxJS Debugging and fuel future research projects looking into RxJS Debugging.\n\n\nYour individual identity will neither be revealed nor can be reconstructed at any time.\n\nSee [ANALYTICS.md](https://github.com/swissmanu/rxjs-debugging-for-vscode/blob/main/ANALYTICS.md) for a full disclosure on what data for what reason gets collected, where it is stored and how you can get access to it.\n\n\nThank you for considering your contribution 🙏",
67

78
"rxjs-debugging.command.toggleOperatorLogPointGutterIcon": "Toggle gutter icon for recommended operator log points"
89
}

packages/extension/rollup.config.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import commonjs from '@rollup/plugin-commonjs';
22
import inject from '@rollup/plugin-inject';
3+
import json from '@rollup/plugin-json';
34
import nodeResolve from '@rollup/plugin-node-resolve';
45
import typescript from '@rollup/plugin-typescript';
56
import * as path from 'path';
67
import copy from 'rollup-plugin-copy';
78
import { terser } from 'rollup-plugin-terser';
9+
import packageJson from './package.json';
810

911
const terserOptions = { format: { comments: () => false } };
12+
const POSTHOG_PROJECT_API_KEY = process.env['POSTHOG_PROJECT_API_KEY'] ?? null;
13+
const POSTHOG_HOST = process.env['POSTHOG_HOST'] ?? null;
1014

1115
/**
1216
* @type {import('rollup').RollupOptions}
@@ -15,6 +19,20 @@ export default ({ configMode }) => {
1519
const doProductionBuild = configMode === 'production';
1620
const doTestBuild = configMode === 'test';
1721

22+
if (doProductionBuild && (POSTHOG_PROJECT_API_KEY === null || POSTHOG_HOST === null)) {
23+
console.error(
24+
'POSTHOG_PROJECT_API_KEY and/or POSTHOG_HOST environment variables are missing. Cannot create production build.'
25+
);
26+
process.exit(1);
27+
return;
28+
}
29+
30+
const intro = `
31+
const EXTENSION_VERSION = "${packageJson.version}";
32+
const POSTHOG_PROJECT_API_KEY = "${POSTHOG_PROJECT_API_KEY}";
33+
const POSTHOG_HOST = "${POSTHOG_HOST}"
34+
`;
35+
1836
return {
1937
input: {
2038
extension: 'src/extension.ts',
@@ -24,12 +42,14 @@ export default ({ configMode }) => {
2442
dir: 'out',
2543
format: 'commonjs',
2644
sourcemap: !doProductionBuild,
45+
intro,
2746
},
2847
external: [
2948
'vscode',
3049
...(doProductionBuild ? [] : ['typescript']), // Faster dev builds without including TypeScript
3150
],
3251
plugins: [
52+
json(),
3353
commonjs({
3454
ignore: ['bufferutil', 'utf-8-validate'], // Ignore optional peer dependencies of ws
3555
}),
@@ -46,7 +66,7 @@ export default ({ configMode }) => {
4666
targets: [
4767
{ src: '../runtime-nodejs/out/**/*', dest: './out/runtime-nodejs' },
4868
{ src: '../../docs/*', dest: './docs' },
49-
{ src: '../../README.md', dest: './' },
69+
{ src: '../../*.md', dest: './' },
5070
{ src: '../../LICENSE', dest: './' },
5171
],
5272
}),

0 commit comments

Comments
 (0)