Skip to content

Commit

Permalink
fix: remove countly (#1327)
Browse files Browse the repository at this point in the history
* chore: initial removal of countly

* chore: remove countly patch

* fix: remove countly but keep user preferences

* fix: linting werror

* fix: hide telemetry from options page

---------

Co-authored-by: Daniel N <[email protected]>
Co-authored-by: Marcin Rataj <[email protected]>
  • Loading branch information
3 people authored Feb 28, 2025
1 parent c22c558 commit 70790a3
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 734 deletions.
1 change: 1 addition & 0 deletions add-on/src/lib/ipfs-companion.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default async function init (inQuickImport = false) {
await handleConsentFromState(state)
ipfs = await initIpfsClient(browser, state, inQuickImport)
trackView('init')
// TODO: implement tracking of `init` view
} catch (err) {
console.error('[ipfs-companion] Failed to init IPFS client', err)
notify(
Expand Down
40 changes: 0 additions & 40 deletions add-on/src/lib/storage-provider/WebExtensionStorageProvider.ts

This file was deleted.

36 changes: 9 additions & 27 deletions add-on/src/lib/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
import MetricsProvider from '@ipfs-shipyard/ignite-metrics/browser-vanilla'
import PatchedCountly from 'countly-sdk-web'
import debug from 'debug'
import { WebExtensionStorageProvider } from './storage-provider/WebExtensionStorageProvider.js'
import { CompanionState } from '../types/companion.js'
import { consentTypes } from '@ipfs-shipyard/ignite-metrics'
import type { CountlyEvent } from 'countly-web-sdk'

const log = debug('ipfs-companion:telemetry')

const metricsProvider = new MetricsProvider({
appKey: '393f72eb264c28a1b59973da1e0a3938d60dc38a',
autoTrack: false,
metricsService: PatchedCountly,
storage: 'none',
storageProvider: new WebExtensionStorageProvider()
})

/**
*
* @param {import('../types/companion.js').CompanionState} state
Expand All @@ -31,35 +18,30 @@ export async function handleConsentFromState (state: CompanionState): Promise<vo
}
for (const [groupName, isEnabled] of Object.entries(telemetryGroups)) {
if (isEnabled) {
log(`Adding consent for '${groupName}'`)
await metricsProvider.addConsent(groupName as consentTypes)
log(`Telemetry consent for '${groupName}' would be enabled, but tracking has been removed`)
} else {
log(`Removing consent for '${groupName}'`)
await metricsProvider.removeConsent(groupName as consentTypes)
log(`Telemetry consent for '${groupName}' is disabled`)
}
}
}

const ignoredViewsRegex: RegExp[] = []

/**
* TrackView is a wrapper around ignite-metrics trackView
* TrackView is a no-op function that only logs debug messages
* Tracking functionality has been removed
*
* @param view
* @param segments
*/
export function trackView (view: string, segments: Record<string, string>): void {
log('trackView called for view: ', view)
metricsProvider.trackView(view, ignoredViewsRegex, segments)
log('trackView called for view (no-op): ', view)
}

/**
* TrackView is a wrapper around ignite-metrics trackView
* TrackEvent is a no-op function that only logs debug messages
* Tracking functionality has been removed
*
* @param event
* @param segments
*/
export function trackEvent (event: CountlyEvent): void {
log('trackEvent called for event: ', event)
metricsProvider.trackEvent(event)
export function trackEvent (event: object): void {
log('trackEvent called for event (no-op): ', event)
}
8 changes: 1 addition & 7 deletions add-on/src/lib/trackers/requestTracker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import debug from 'debug'
import type browser from 'webextension-polyfill'
import { trackEvent } from '../telemetry.js'

export const DEFAULT_REQUEST_TRACKER_FLUSH_INTERVAL = 1000 * 60 * 60

Expand Down Expand Up @@ -31,12 +30,7 @@ export class RequestTracker {
this.log('nothing to flush')
return
}
trackEvent({
key: this.eventKey,
count,
dur: Date.now() - this.lastSync,
segmentation: Object.assign({}, this.requestTypeStore) as unknown as Record<string, string>
})
// TODO: implement tracking
// reset
this.lastSync = Date.now()
this.requestTypeStore = {}
Expand Down
2 changes: 2 additions & 0 deletions add-on/src/options/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ export default function optionsPage (state, emit) {
logNamespaces: state.options.logNamespaces,
onOptionChange
})}
<!-- we gather no telemetry (https://github.com/ipfs/ipfs-companion/issues/1315), hiding UI for now
${telemetryForm({
telemetryGroupMinimal: state.options.telemetryGroupMinimal,
telemetryGroupMarketing: state.options.telemetryGroupMarketing,
telemetryGroupPerformance: state.options.telemetryGroupPerformance,
telemetryGroupTracking: state.options.telemetryGroupTracking,
onOptionChange
})}
-->
${resetForm({
onOptionsReset
})}
Expand Down
9 changes: 0 additions & 9 deletions add-on/src/types/countly.d.ts

This file was deleted.

53 changes: 27 additions & 26 deletions docs/telemetry/COLLECTED_DATA.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
# Collected telemetry data
# Telemetry Data Collection

Copied from https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/COLLECTED_DATA.template.md
## Telemetry has been removed

## What metrics data do we NOT collect
All telemetry collection has been removed from this project. No data is being collected or sent to any analytics services.

We do not collect any of the below listed items in our metric data:
The previous implementation used Countly for telemetry collection, but this functionality has been completely removed.

1. User identifiable data (names, email addresses, aliases, handles, etc.)
2. CIDs
3. IP addresses
## Privacy

Telemetry is sent to Countly instance at `countly.ipfs.tech`. You can read how they protect your data at [Security, Privacy, and Access FAQ](https://support.count.ly/hc/en-us/articles/360037501372-Security-Privacy-and-Access-FAQ)
Currently, there is no telemetry collection implemented in this project.
As a general rule, we collect only application data; no user data.

## What metrics data DO we collect
## Historical Information

As a general rule, we collect only application data; no user data. Some examples of application data we collect are:
Previously, the project collected application data (not user data) through Countly. The following information is kept for historical reference only:

| Metric data name | Metric feature name | Metric trigger | Analytics use | Notes |
|:-------------------:|---------------------|---------------------------------------------------------|-------------------------------------------------------------------|---------------|
| view:welcome | views | When the welcome view is shown | View count | |
| view:options | views | When the options view is shown | View count | |
| view:quick-import | views | When the quick-import view is shown | View count | |
| view:browser-action | views | When the browser-action view is shown | View count | |
| event:url-resolved | event | Number of URLs resolved by companion | Metrics | |
| event:url-observed | event | Number of URLs observed (including resolved) | Metrics | |
### What metrics data were collected

* "Metric data name" - The app-specific metric/event name we're using for this metric data. (e.g. APP_BOOTSTRAP_START)
* "Metric feature name" - The metric feature the event/metric data correlates to. The group the metric feature belongs to is defined in our [COLLECTION_POLICY](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/COLLECTION_POLICY.md#metric-features-and-their-groupings). (e.g. Minimal)
* "Metric trigger" - An explanation covering when this metric data is triggered. (e.g. On Application init)
* "Analytics use" - An explanation about how this metric data is used for analytics. (e.g. Input to load time calculations)
* "Notes" - Any additional notes. (e.g. Used as a timestamp identifier for when an application is first loaded)
| Metric data name | Metric feature name | Metric trigger | Analytics use |
| :-----------------: | ------------------- | -------------------------------------------- | ------------- |
| view:welcome | views | When the welcome view is shown | View count |
| view:options | views | When the options view is shown | View count |
| view:quick-import | views | When the quick-import view is shown | View count |
| view:browser-action | views | When the browser-action view is shown | View count |
| event:url-resolved | event | Number of URLs resolved by companion | Metrics |
| event:url-observed | event | Number of URLs observed (including resolved) | Metrics |

- "Metric data name" - The app-specific metric/event name we're using for this metric data. (e.g. APP_BOOTSTRAP_START)
- "Metric feature name" - The metric feature the event/metric data correlates to. The group the metric feature belongs to is defined in our [COLLECTION_POLICY](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/COLLECTION_POLICY.md#metric-features-and-their-groupings). (e.g. Minimal)
- "Metric trigger" - An explanation covering when this metric data is triggered. (e.g. On Application init)
- "Analytics use" - An explanation about how this metric data is used for analytics. (e.g. Input to load time calculations)
- "Notes" - Any additional notes. (e.g. Used as a timestamp identifier for when an application is first loaded)

## Other related documents

* [COLLECTION_POLICY](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/COLLECTION_POLICY.md)
* [PRIVACY_POLICY](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/PRIVACY_POLICY.md)
* [FAQs](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/FAQs.md)
- [COLLECTION_POLICY](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/COLLECTION_POLICY.md)
- [PRIVACY_POLICY](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/PRIVACY_POLICY.md)
- [FAQs](https://github.com/ipfs-shipyard/ignite-metrics/blob/main/docs/telemetry/FAQs.md)
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@
"bufferutil": "^4.0.7",
"c8": "7.12.0",
"chai": "4.3.7",
"countly-sdk-web": "23.2.2",
"cross-env": "7.0.3",
"css-loader": "6.7.2",
"download-cli": "1.1.1",
Expand Down Expand Up @@ -155,7 +154,6 @@
"webpack-merge": "5.8.0"
},
"dependencies": {
"@ipfs-shipyard/ignite-metrics": "^2.0.0",
"@material/switch": "10.0.0",
"assert": "2.0.0",
"buffer": "6.0.3",
Expand Down
Loading

0 comments on commit 70790a3

Please sign in to comment.