mirror of
https://github.com/desktop/desktop
synced 2024-09-13 21:31:32 +00:00
Merge pull request #6308 from desktop/i-need-all-the-credits
Add metrics for capturing unattributed commits
This commit is contained in:
commit
306e1cc206
|
@ -114,6 +114,18 @@ export interface IDailyMeasures {
|
|||
|
||||
/** The number of times a conflicted merge was aborted by the user */
|
||||
readonly mergeAbortedAfterConflictsCount: number
|
||||
|
||||
/** The number of commits that will go unattributed to GitHub users */
|
||||
readonly unattributedCommits: number
|
||||
|
||||
/**
|
||||
* The number of times the user made a commit to a repo hosted on
|
||||
* a GitHub Enterprise instance
|
||||
*/
|
||||
readonly enterpriseCommits: number
|
||||
|
||||
/** The number of time the user made a commit to a repo hosted on Github.com */
|
||||
readonly dotcomCommits: number
|
||||
}
|
||||
|
||||
export class StatsDatabase extends Dexie {
|
||||
|
|
|
@ -70,6 +70,9 @@ const DefaultDailyMeasures: IDailyMeasures = {
|
|||
mergedWithConflictWarningHintCount: 0,
|
||||
mergeSuccessAfterConflictsCount: 0,
|
||||
mergeAbortedAfterConflictsCount: 0,
|
||||
unattributedCommits: 0,
|
||||
enterpriseCommits: 0,
|
||||
dotcomCommits: 0,
|
||||
}
|
||||
|
||||
interface IOnboardingStats {
|
||||
|
@ -604,6 +607,35 @@ export class StatsStore implements IStatsStore {
|
|||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Records that the user made a commit using an email address that
|
||||
* was not associated with the user's account on GitHub.com or GitHub
|
||||
* Enterprise, meaning that the commit will not be attributed to the user's
|
||||
* account.
|
||||
*/
|
||||
public recordUnattributedCommit(): Promise<void> {
|
||||
return this.updateDailyMeasures(m => ({
|
||||
unattributedCommits: m.unattributedCommits + 1,
|
||||
}))
|
||||
}
|
||||
|
||||
/**
|
||||
* Records that the user made a commit to a repository hosted on
|
||||
* a GitHub Enterprise instance
|
||||
*/
|
||||
public recordCommitToEnterprise(): Promise<void> {
|
||||
return this.updateDailyMeasures(m => ({
|
||||
enterpriseCommits: m.enterpriseCommits + 1,
|
||||
}))
|
||||
}
|
||||
|
||||
/** Records that the user made a commit to a repository hosted on GitHub.com */
|
||||
public recordCommitToDotcom(): Promise<void> {
|
||||
return this.updateDailyMeasures(m => ({
|
||||
dotcomCommits: m.dotcomCommits + 1,
|
||||
}))
|
||||
}
|
||||
|
||||
/** Set whether the user has opted out of stats reporting. */
|
||||
public async setOptOut(
|
||||
optOut: boolean,
|
||||
|
|
|
@ -1724,6 +1724,28 @@ export class AppStore extends TypedBaseStore<IAppState> {
|
|||
this.statsStore.recordCoAuthoredCommit()
|
||||
}
|
||||
|
||||
const account = getAccountForRepository(this.accounts, repository)
|
||||
if (repository.gitHubRepository !== null) {
|
||||
if (account !== null) {
|
||||
if (account.endpoint === getDotComAPIEndpoint()) {
|
||||
this.statsStore.recordCommitToDotcom()
|
||||
} else {
|
||||
this.statsStore.recordCommitToEnterprise()
|
||||
}
|
||||
|
||||
const { commitAuthor } = state
|
||||
if (commitAuthor !== null) {
|
||||
const commitEmailMatchesAccount = account.emails.some(
|
||||
email =>
|
||||
email.email.toLowerCase() === commitAuthor.email.toLowerCase()
|
||||
)
|
||||
if (!commitEmailMatchesAccount) {
|
||||
this.statsStore.recordUnattributedCommit()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
await this._refreshRepository(repository)
|
||||
await this.refreshChangesSection(repository, {
|
||||
includingStatus: true,
|
||||
|
|
|
@ -55,3 +55,6 @@ These are general metrics about feature usage and specific feature behaviors. Th
|
|||
| `mergedWithConflictWarningHintCount` | The number of times the user has merged after seeing the 'you have XX conflicted files' warning. | To understand how frequently people are merging even though they know there will be conflicts |
|
||||
| `mergeSuccessAfterConflictsCount` | The number of times the user successfully completes a merge after a merge conflict. | To understand how effectively users are able to resolve conflicts and complete their merge successfully |
|
||||
| `mergeAbortedAfterConflictsCount` | The number of times the user aborts a merge after a merge conflict. | To understand the frequency of merges that are never completed after attempting to merge and hitting a merge conflict |
|
||||
| `unattributedCommits` | The number of commits that will go unattributed to GitHub users. | To understand how frequently commits in GitHub Desktop are unattributed and how highly we should prioritize design for those instances |
|
||||
| `enterpriseCommits` | The number of times the user made a commit to a repo hosted on a GitHub Enterprise instance. | To understand the total percentage of commits made to GitHub Enterprise repos to help prioritize our work associated with enterprise use of GitHub Desktop compared to GitHub |
|
||||
| `dotcomCommits` | The number of time the user made a commit to a repo hosted on Github.com. | To understand the total percentage of commits made to GitHub repos compared to GitHub Enterprise and other remotes to help prioritize our work and focus areas |
|
||||
|
|
Loading…
Reference in a new issue