Skip to content

Telemetry #394

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 3 commits into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove sentry
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 18, 2020
commit 2d9657747bd89f7938bd34275f9c136e71f2109c
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"watch": "tsc -watch -p ./"
},
"dependencies": {
"@sentry/node": "^5.19.2",
"@types/assert": "^1.5.1",
"@types/jest": "^26.0.4",
"@types/jsdom": "^16.2.3",
Expand Down
2 changes: 1 addition & 1 deletion src/actions/setupActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as git from '../services/git'
import loadWatchers from './utils/loadWatchers'
import openFiles from './utils/openFiles'
import runCommands from './utils/runCommands'
import onError from '../services/sentry/onError'
import { onError } from '../services/telemetry'
import logger from '../services/logger'

interface SetupActions {
Expand Down
3 changes: 0 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
// init error logging
import './services/sentry/init'

import Editor from './editor'

// vscode editor
Expand Down
11 changes: 0 additions & 11 deletions src/services/sentry/init.ts

This file was deleted.

21 changes: 0 additions & 21 deletions src/services/sentry/onError.ts

This file was deleted.

10 changes: 8 additions & 2 deletions src/services/telemetry/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import TelemetryReporter from 'vscode-extension-telemetry'
import { EXTENSION_ID, VERSION, INSTRUMENTATION_KEY, NODE_ENV } from '../../environment'

/**
* Telemetry
* https://github.com/microsoft/vscode-extension-telemetry
*
*/

interface Properties {
[key: string]: string
}
Expand All @@ -23,13 +29,13 @@ export const deactivate = (): void => {
}
}

export const onError = (error: Error, properties: Properties, measurements: Measurements): void => {
export const onError = (error: Error, properties?: Properties, measurements?: Measurements): void => {
if (reporter) {
reporter.sendTelemetryException(error, properties, measurements)
}
}

export const onEvent = (eventName: string, properties: Properties, measurements: Measurements): void => {
export const onEvent = (eventName: string, properties?: Properties, measurements?: Measurements): void => {
if (reporter) {
reporter.sendTelemetryEvent(eventName, properties, measurements)
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/testRunner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import logger from '../logger'
import parser, { ParserOutput } from './parser'
import parseSubtasks from './subtasks'
import { debounce, throttle } from './throttle'
import onError from '../sentry/onError'
import { onError } from '../telemetry'
import { clearOutput, addOutput } from './output'
import { formatFailOutput } from './formatOutput'

Expand Down
2 changes: 1 addition & 1 deletion src/services/webview/render.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { JSDOM } from 'jsdom'
import * as path from 'path'
import * as vscode from 'vscode'
import onError from '../sentry/onError'
import { onError } from '../telemetry'

const getNonce = (): string => {
let text = ''
Expand Down
762 changes: 0 additions & 762 deletions web-app/.yarn-integrity

This file was deleted.

1 change: 0 additions & 1 deletion web-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
"@alifd/theme-4": "^0.3.1",
"@emotion/babel-preset-css-prop": "^10.0.27",
"@emotion/core": "^10.0.28",
"@sentry/browser": "^5.19.2",
"js-yaml": "^3.14.0",
"markdown-it": "^11.0.0",
"markdown-it-emoji": "^1.4.0",
Expand Down
3 changes: 1 addition & 2 deletions web-app/src/components/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import * as React from 'react'
import onError from '../../services/sentry/onError'
import logger from '../../services/logger'

class ErrorBoundary extends React.Component {
public state = { errorMessage: null }

public componentDidCatch(error: Error, info: any) {
onError(error)
// TODO: onError(error)
// Display fallback UI
this.setState({ errorMessage: error.message })
// You can also log the error to an error reporting service
Expand Down
3 changes: 1 addition & 2 deletions web-app/src/components/Markdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import Prism from 'prismjs'
// @ts-ignore no types for package
import markdownEmoji from 'markdown-it-emoji'
import * as React from 'react'
import onError from '../../services/sentry/onError'
// load prism styles & language support
import './prism'

Expand Down Expand Up @@ -65,7 +64,7 @@ const Markdown = (props: Props) => {
html = md.render(props.children)
} catch (error) {
const message = `Failed to parse markdown for ${props.children}`
onError(new Error(message))
// TODO: onError(new Error(message))
console.log(message)
html = `<div style='background-color: #FFB81A; padding: 0.5rem;'>
<strong style='padding-bottom: 0.5rem;'>ERROR: Failed to parse markdown</strong>
Expand Down
3 changes: 1 addition & 2 deletions web-app/src/components/Router/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as React from 'react'
import onError from '../../services/sentry/onError'

interface RouterProps {
children: React.ReactChildren | React.ReactChildren[]
Expand Down Expand Up @@ -41,7 +40,7 @@ export const Router = ({ children, route }: RouterProps) => {
}
}
const message = `No Route matches for "${JSON.stringify(route)}"`
onError(new Error(message))
// TODO: onError(new Error(message))
console.warn(message)
return null
}
Expand Down
1 change: 0 additions & 1 deletion web-app/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ export const VERSION: string = process.env.VERSION || 'unknown'
export const NODE_ENV: string = process.env.NODE_ENV || 'development'
export const LOG: boolean = (process.env.REACT_APP_LOG || '').toLowerCase() === 'true'
export const TUTORIAL_LIST_URL: string = process.env.REACT_APP_TUTORIAL_LIST_URL || ''
export const SENTRY_DSN: string | null = process.env.REACT_APP_SENTRY_DSN || null

// config variables
export const DISPLAY_RUN_TEST_BUTTON = (process.env.CODEROAD_DISPLAY_RUN_TEST_BUTTON || 'true').toLowerCase() === 'true'
2 changes: 0 additions & 2 deletions web-app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import './mock'

import App from './App'

// init error logging
import './services/sentry/init'
// init initial styles
import './styles/index.css'
// init listeners
Expand Down
5 changes: 2 additions & 3 deletions web-app/src/services/selectors/tutorial.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { createSelector } from 'reselect'
import { MachineContext } from 'typings'
import * as TT from 'typings/tutorial'
import onError from '../../services/sentry/onError'

export const currentTutorial = ({ tutorial }: MachineContext): TT.Tutorial => {
if (!tutorial) {
const error = new Error('Tutorial not found')
onError(error)
// TODO: onError(error)
throw error
}
return tutorial
Expand All @@ -23,7 +22,7 @@ export const currentLevel = (context: MachineContext): TT.Level =>
const levelIndex = levels.findIndex((l: TT.Level) => l.id === context.position.levelId)
if (levelIndex < 0) {
const error = new Error(`Level not found when selecting level for ${tutorial.id}`)
onError(error)
// TODO: onError(error)
throw error
}
const level: TT.Level = levels[levelIndex]
Expand Down
14 changes: 0 additions & 14 deletions web-app/src/services/sentry/init.tsx

This file was deleted.

21 changes: 0 additions & 21 deletions web-app/src/services/sentry/onError.ts

This file was deleted.

3 changes: 1 addition & 2 deletions web-app/src/services/state/actions/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import * as T from 'typings'
import * as TT from 'typings/tutorial'
import { assign, send, ActionFunctionMap } from 'xstate'
import * as selectors from '../../selectors'
import onError from '../../../services/sentry/onError'
import logger from '../../../services/logger'

const contextActions: ActionFunctionMap<T.MachineContext, T.MachineEvent> = {
Expand Down Expand Up @@ -148,7 +147,7 @@ const contextActions: ActionFunctionMap<T.MachineContext, T.MachineEvent> = {
// has next level?
if (!context.tutorial) {
const error = new Error('Tutorial not found')
onError(error)
// TODO: onError(error)
throw error
}
}
Expand Down
52 changes: 0 additions & 52 deletions web-app/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1639,58 +1639,6 @@
prop-types "^15.6.1"
react-lifecycles-compat "^3.0.4"

"@sentry/browser@^5.19.2":
version "5.19.2"
resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-5.19.2.tgz#8bad445b8d1efd50e6510bb43b3018b941f6e5cb"
integrity sha512-o6Z532n+0N5ANDzgR9GN+Q6CU7zVlIJvBEW234rBiB+ZZj6XwTLS1dD+JexGr8lCo8PeXI2rypKcj1jUGLVW8w==
dependencies:
"@sentry/core" "5.19.2"
"@sentry/types" "5.19.2"
"@sentry/utils" "5.19.2"
tslib "^1.9.3"

"@sentry/core@5.19.2":
version "5.19.2"
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-5.19.2.tgz#99a64ef0e55230fc02a083c48fa07ada85de4929"
integrity sha512-sfbBsVXpA0WYJUichz5IhvqKD8xJUfQvsszrTsUKa7PQAMAboOmuh6bo8KquaVQnAZyZWZU08UduvlSV3tA7tw==
dependencies:
"@sentry/hub" "5.19.2"
"@sentry/minimal" "5.19.2"
"@sentry/types" "5.19.2"
"@sentry/utils" "5.19.2"
tslib "^1.9.3"

"@sentry/hub@5.19.2":
version "5.19.2"
resolved "https://registry.yarnpkg.com/@sentry/hub/-/hub-5.19.2.tgz#ab7f3d2d253c3441b2833a530b17c6de2418b2c7"
integrity sha512-2KkEYX4q9TDCOiaVEo2kQ1W0IXyZxJxZtIjDdFQyes9T4ubYlKHAbvCjTxHSQv37lDO4t7sOIApWG9rlkHzlEA==
dependencies:
"@sentry/types" "5.19.2"
"@sentry/utils" "5.19.2"
tslib "^1.9.3"

"@sentry/minimal@5.19.2":
version "5.19.2"
resolved "https://registry.yarnpkg.com/@sentry/minimal/-/minimal-5.19.2.tgz#0fc2fdf9911a0cb31b52f7ccad061b74785724a3"
integrity sha512-rApEOkjy+ZmkeqEItgFvUFxe5l+dht9AumuUzq74pWp+HJqxxv9IVTusKppBsE1adjtmyhwK4O3Wr8qyc75xlw==
dependencies:
"@sentry/hub" "5.19.2"
"@sentry/types" "5.19.2"
tslib "^1.9.3"

"@sentry/types@5.19.2":
version "5.19.2"
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-5.19.2.tgz#ead586f0b64b91c396d3521b938ca25f7b59d655"
integrity sha512-O6zkW8oM1qK5Uma9+B/UMlmlm9/gkw9MooqycWuEhIaKfDBj/yVbwb/UTiJmNkGc5VJQo0v1uXUZZQt6/Xq1GA==

"@sentry/utils@5.19.2":
version "5.19.2"
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-5.19.2.tgz#f2819d9de5abc33173019e81955904247e4a8246"
integrity sha512-gEPkC0CJwvIWqcTcPSdIzqJkJa9N5vZzUZyBvdu1oiyJu7MfazpJEvj3whfJMysSfXJQxoJ+a1IPrA73VY23VA==
dependencies:
"@sentry/types" "5.19.2"
tslib "^1.9.3"

"@storybook/addon-actions@^5.3.19":
version "5.3.19"
resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.3.19.tgz#50548fa6e84bc79ad95233ce23ade4878fc7cfac"
Expand Down
Loading