Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ShMcK merged 3 commits intomasterfromtelemetry
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletionspackage.json
View file
Open in desktop
Original file line numberDiff line numberDiff 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 All@@ -52,7 +51,8 @@
"node-fetch": "^2.6.0",
"semver": "^7.3.2",
"ts-jest": "^26.1.3",
"typescript": "^3.9.7"
"typescript": "^3.9.7",
"vscode-extension-telemetry": "^0.1.6"
},
"devDependencies": {
"eslint-config-prettier": "^6.11.0",
Expand Down
2 changes: 1 addition & 1 deletionsrc/actions/setupActions.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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
7 changes: 7 additions & 0 deletionssrc/channel/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -20,6 +20,7 @@ import { exec } from '../services/node'
import { WORKSPACE_ROOT, TUTORIAL_URL } from '../environment'
import reset from '../services/reset'
import getLastCommitHash from '../services/reset/lastHash'
import { onEvent } from '../services/telemetry'

const readFileAsync = promisify(readFile)

Expand DownExpand Up@@ -128,6 +129,12 @@ class Channel implements Channel {
try {
const data: TT.Tutorial = action.payload.tutorial

onEvent('tutorial_start', {
tutorial_id: data.id,
tutorial_version: data.version,
tutorial_title: data.summary.title,
})

// validate extension version
const expectedAppVersion = data.config?.appVersions?.vscode
if (expectedAppVersion) {
Expand Down
11 changes: 10 additions & 1 deletionsrc/editor/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
import * as vscode from 'vscode'
import { createCommands } from './commands'
import * as telemetry from '../services/telemetry'

class Editor {
// extension context set on activation
Expand All@@ -22,17 +23,25 @@ class Editor {
workspaceState: this.vscodeExt.workspaceState,
})

const subscribe = (sub: any) => {
this.vscodeExt.subscriptions.push(sub)
}

// register commands
for (const cmd in commands) {
const command: vscode.Disposable = vscode.commands.registerCommand(cmd, commands[cmd])
this.vscodeExt.subscriptions.push(command)
subscribe(command)
}

telemetry.activate(subscribe)
}
public deactivate = (): void => {
// cleanup subscriptions/tasks
for (const disposable of this.vscodeExt.subscriptions) {
disposable.dispose()
}

telemetry.deactivate()
}
}

Expand Down
9 changes: 5 additions & 4 deletionssrc/environment.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
import { getWorkspaceRoot } from './services/workspace'
import * as os from 'os'

// CodeRoad version
export const VERSION = 'unknown'
export const VERSION = require('../package.json').version

export const EXTENSION_ID = 'coderoad'

// Node env
export type Env = 'test' | 'local' | 'development' | 'production'
// @ts-ignore
export const NODE_ENV: Env = process.env.NODE_ENV || 'production'
export const NODE_ENV: Env = process.env.NODE_ENV || 'development'

// toggle logging in development
export const LOG = false

// error logging tool
export constSENTRY_DSN: string | null = null
export constINSTRUMENTATION_KEY = '6ff37c76-72f3-48e3-a1b9-d5636f519b7b'

// uri path to the users project workspace
export const WORKSPACE_ROOT: string = getWorkspaceRoot()
Expand Down
3 changes: 0 additions & 3 deletionssrc/extension.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionssrc/services/sentry/init.ts
View file
Open in desktop

This file was deleted.

21 changes: 0 additions & 21 deletionssrc/services/sentry/onError.ts
View file
Open in desktop

This file was deleted.

43 changes: 43 additions & 0 deletionssrc/services/telemetry/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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
}

interface Measurements {
[key: string]: number
}

let reporter: any

export const activate = (subscribeFn: (reporter: any) => void): void => {
if (NODE_ENV === 'production') {
reporter = new TelemetryReporter(EXTENSION_ID, VERSION, INSTRUMENTATION_KEY)
subscribeFn(reporter)
}
}

export const deactivate = (): void => {
if (reporter) {
reporter.dispose()
}
}

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 => {
if (reporter) {
reporter.sendTelemetryEvent(eventName, properties, measurements)
}
}
2 changes: 1 addition & 1 deletionsrc/services/testRunner/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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 deletionsrc/services/webview/render.ts
View file
Open in desktop
Original file line numberDiff line numberDiff 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
Loading

[8]ページ先頭

©2009-2025 Movatter.jp