-
Notifications
You must be signed in to change notification settings - Fork 129
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
Release 3.2.5 #937
Merged
Merged
Release 3.2.5 #937
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
297a8e1
fix rudder key secret name (#929)
trilopin fc6394c
fix hook order race with telemetry (#930)
trilopin 695edcd
Fix telemetry hook race locally (#935)
trilopin ae7b79d
revert to go1.13 and fix lint
trilopin 66e812c
bump 3.2.5
trilopin 65ca11d
make apply
trilopin 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
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
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,95 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/mattermost/mattermost-plugin-jira/server/telemetry" | ||
) | ||
|
||
func (p *Plugin) TrackEvent(event string, properties map[string]interface{}) { | ||
err := p.tracker.TrackEvent(event, properties) | ||
if err != nil { | ||
p.API.LogDebug("Error sending telemetry event", "event", event, "error", err.Error()) | ||
} | ||
} | ||
|
||
func (p *Plugin) TrackUserEvent(event, userID string, properties map[string]interface{}) { | ||
err := p.tracker.TrackUserEvent(event, userID, properties) | ||
if err != nil { | ||
p.API.LogDebug("Error sending user telemetry event", "event", event, "error", err.Error()) | ||
} | ||
} | ||
|
||
func (p *Plugin) OnSendDailyTelemetry() { | ||
args := map[string]interface{}{} | ||
|
||
// Jira instances | ||
server, cloud := 0, 0 | ||
instances, err := p.instanceStore.LoadInstances() | ||
if err != nil { | ||
p.API.LogWarn("Failed to get instances for telemetry", "error", err) | ||
} else { | ||
for _, id := range instances.IDs() { | ||
switch instances.Get(id).Type { | ||
case ServerInstanceType: | ||
server++ | ||
case CloudInstanceType: | ||
cloud++ | ||
} | ||
} | ||
args["instance_count"] = server + cloud | ||
if server > 0 { | ||
args["server_instance_count"] = server | ||
} | ||
if cloud > 0 { | ||
args["cloud_instance_count"] = cloud | ||
} | ||
|
||
// Subscriptions | ||
numSubscriptions := 0 | ||
var subs *Subscriptions | ||
for _, id := range instances.IDs() { | ||
subs, err = p.getSubscriptions(id) | ||
if err != nil { | ||
p.API.LogWarn("Failed to get subscriptions for telemetry", "error", err) | ||
} | ||
numSubscriptions += len(subs.Channel.ByID) | ||
} | ||
|
||
args["subscriptions"] = numSubscriptions | ||
} | ||
|
||
// Connected users | ||
connected, err := p.userStore.CountUsers() | ||
if err != nil { | ||
p.API.LogWarn("Failed to get the number of connected users for telemetry", "error", err) | ||
} else { | ||
args["connected_user_count"] = connected | ||
} | ||
|
||
p.TrackEvent("stats", args) | ||
} | ||
|
||
// Initialize telemetry setups the tracker/clients needed to send telemetry data. | ||
// The telemetry.NewTrackerConfig(...) param will take care of extract/parse the config to set the right settings. | ||
// If you don't want the default behavior you still can pass a different telemetry.TrackerConfig data. | ||
func (p *Plugin) initializeTelemetry() { | ||
var err error | ||
|
||
// Telemetry client | ||
p.telemetryClient, err = telemetry.NewRudderClient() | ||
if err != nil { | ||
p.API.LogWarn("Telemetry client not started", "error", err.Error()) | ||
return | ||
} | ||
|
||
// Get config values | ||
p.tracker = telemetry.NewTracker( | ||
p.telemetryClient, | ||
p.API.GetDiagnosticId(), | ||
p.API.GetServerVersion(), | ||
manifest.ID, | ||
manifest.Version, | ||
"jira", | ||
telemetry.NewTrackerConfig(p.API.GetConfig()), | ||
telemetry.NewLogger(p.API), | ||
) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this in addition to the cherry-pick because the linter complained.