-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update readme to have useful link for open bugs * add request for metrics * update typescript version * cleanup and add metrics component * cleanup tslint * cleanup interfaces * add metrics and config integration * increment versions * use DI instead * add tests cleanup stricts * fix lintings * add platform
- Loading branch information
Showing
15 changed files
with
432 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import {platform} from "os"; | ||
import {Request} from "./wrappers/request"; | ||
import {Uuid} from "./wrappers/uuid"; | ||
|
||
const PLATFORM = platform(); | ||
const GA_TRACKING_ID = ""; // add before a release; | ||
const EXT_NAME = "vscode-coverage-gutters"; | ||
const EXT_VERSION = "0.4.0"; | ||
|
||
export class Reporter { | ||
private readonly cid: string; | ||
private readonly enableMetrics: boolean; | ||
private readonly request: Request; | ||
|
||
constructor(request: Request, uuid: Uuid, enableMetrics: boolean) { | ||
this.request = request; | ||
this.cid = uuid.get(); | ||
this.enableMetrics = enableMetrics; | ||
} | ||
|
||
public sendEvent( | ||
category: string, | ||
action: string, | ||
label?: string, | ||
value?: number, | ||
) { | ||
if (!this.enableMetrics) { return; } | ||
const data = { | ||
an: EXT_NAME, | ||
av: EXT_VERSION, | ||
cid: this.cid, | ||
ea: action, | ||
ec: category, | ||
el: label, | ||
ev: value, | ||
t: "event", | ||
tid: GA_TRACKING_ID, | ||
ua: PLATFORM, | ||
v: "1", | ||
}; | ||
|
||
return this.request.post("https://www.google-analytics.com/collect", { form: data }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {post} from "request"; | ||
|
||
export interface IOptions { form?: object; } | ||
|
||
export class Request { | ||
public post(uri: string, options?: IOptions): void { | ||
post(uri, options); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {v4} from "uuid"; | ||
|
||
export class Uuid { | ||
public get(): string { | ||
return v4(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.