generated from mattermost/mattermost-plugin-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add telemetry to Todo * Fix bugs with telemetry * Fix lint * Go mod tidy * Close telemetry client on deactivate * Fix typo * Type telemetry source
- Loading branch information
Showing
15 changed files
with
228 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,5 @@ | ||
# Include custom targets and environment variables here | ||
ifndef MM_RUDDER_WRITE_KEY | ||
MM_RUDDER_WRITE_KEY = 1d5bMvdrfWClLxgK1FvV3s4U1tg | ||
endif | ||
GO_BUILD_FLAGS += -ldflags '-X "github.com/mattermost/mattermost-plugin-api/experimental/telemetry.rudderWriteKey=$(MM_RUDDER_WRITE_KEY)"' |
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,55 @@ | ||
package main | ||
|
||
type telemetrySource string | ||
|
||
const ( | ||
sourceCommand telemetrySource = "command" | ||
sourceWebapp telemetrySource = "webapp" | ||
) | ||
|
||
func (p *Plugin) trackCommand(userID, command string) { | ||
p.tracker.TrackUserEvent("command", userID, map[string]interface{}{ | ||
"command": command, | ||
}) | ||
} | ||
|
||
func (p *Plugin) trackAddIssue(userID string, source telemetrySource, attached bool) { | ||
p.tracker.TrackUserEvent("add_issue", userID, map[string]interface{}{ | ||
"source": source, | ||
"attached": attached, | ||
}) | ||
} | ||
|
||
func (p *Plugin) trackSendIssue(userID string, source telemetrySource, attached bool) { | ||
p.tracker.TrackUserEvent("send_issue", userID, map[string]interface{}{ | ||
"source": source, | ||
"attached": attached, | ||
}) | ||
} | ||
|
||
func (p *Plugin) trackCompleteIssue(userID string) { | ||
p.tracker.TrackUserEvent("complete_issue", userID, map[string]interface{}{}) | ||
} | ||
|
||
func (p *Plugin) trackRemoveIssue(userID string) { | ||
p.tracker.TrackUserEvent("remove_issue", userID, map[string]interface{}{}) | ||
} | ||
|
||
func (p *Plugin) trackAcceptIssue(userID string) { | ||
p.tracker.TrackUserEvent("accept_issue", userID, map[string]interface{}{}) | ||
} | ||
|
||
func (p *Plugin) trackBumpIssue(userID string) { | ||
p.tracker.TrackUserEvent("bump_issue", userID, map[string]interface{}{}) | ||
} | ||
|
||
func (p *Plugin) trackFrontend(userID, event string, properties map[string]interface{}) { | ||
if properties == nil { | ||
properties = map[string]interface{}{} | ||
} | ||
p.tracker.TrackUserEvent("frontend_"+event, userID, properties) | ||
} | ||
|
||
func (p *Plugin) trackDailySummary(userID string) { | ||
p.tracker.TrackUserEvent("daily_summary_sent", userID, map[string]interface{}{}) | ||
} |
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
Oops, something went wrong.