Skip to content
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

[MM-37324] Add telemetry #230

Merged
merged 11 commits into from
Sep 28, 2021
Merged

[MM-37324] Add telemetry #230

merged 11 commits into from
Sep 28, 2021

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Aug 4, 2021

Summary

Add telemetry to the Apps Framework. Right now only the proxy package has access to the telemetry, but it can be easily added to any other package that needs it. We are tracking:

  • Every Install, with the AppID and AppType of the App installed
  • Every Uninstall, also with the AppID and AppType
  • Every call performed, with the AppID and the location (this will help us to know which bindings are more popular)

Feel free to suggest any other event worth tracking.

Ticket Link

https://mattermost.atlassian.net/browse/MM-37324

@larkox larkox added 1: PM Review Requires review by a product manager 2: Dev Review Requires review by a core committer labels Aug 4, 2021
@larkox larkox added the 3: QA Review Requires review by a QA tester label Aug 4, 2021
@aaronrothschild
Copy link
Contributor

aaronrothschild commented Aug 4, 2021

Adding @enelson720 so this is on his radar.

@larkox can we log when each user has authenticated with each app? (or some indication of how many different users are using an app on a particular server)

  • ie: "On this server 12% of users are using App X" and

  • "Looking across all Apps, on average Y% of users are using apps"

  • "Looking across all servers, App X,Y,Z are most popular amongst users based on authenticated calls"

  • Track Scopes used (ie: User, act_as_admin), by Apps

@larkox
Copy link
Contributor Author

larkox commented Aug 4, 2021

@aaronrothschild It is possible to log each time a user finish the OAuth steps for App X if the App X is using the Mattermost OAuth abstraction (mainly useful for lambda).

It is also possible for the calls register the acting user ID, and therefore see how many people per server is using the bindings. Nevertheless, we would have to do some filtering (either on code or interpreting the analytics) to filter out the "get bindings" call, since that one will be done by all users.

@aaronrothschild
Copy link
Contributor

@larkox I'd like to track those actions so we can track installation vs authentication vs ongoing usage if possible.

return
}

_ = t.tracker.TrackEvent("uninstall", map[string]interface{}{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"uninstall"- > "call' ?

})
}

func (t *Telemetry) TrackCall(appID string, location string) {
Copy link
Contributor

@catalintomai catalintomai Aug 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be too noisy - tracking every call? It can boil down to what are our goals with this change (like what metrics are we targeting, what do we want to understand better, etc.). Also, do we envision (in the future) for users/app developers to pick and choose what telemetry they want to record, specific to their app (like having two types of telemetry metrics - ours and theirs)? cc: @aaronrothschild

@larkox
Copy link
Contributor Author

larkox commented Aug 9, 2021

I have added a new event for OAuth complete, and instead of tracking every single call (including bindings calls) we will just be registering "submit calls".

@levb levb added this to the v0.8.0 milestone Aug 9, 2021
@levb
Copy link
Contributor

levb commented Aug 9, 2021

What's up with cypress tests?

@hanzei hanzei added the Awaiting Submitter Action Blocked on the author label Aug 10, 2021
@codecov-commenter
Copy link

codecov-commenter commented Aug 10, 2021

Codecov Report

Merging #230 (99a4aa5) into master (2d91438) will increase coverage by 0.02%.
The diff coverage is 40.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #230      +/-   ##
==========================================
+ Coverage   24.77%   24.79%   +0.02%     
==========================================
  Files          52       52              
  Lines        3306     3311       +5     
==========================================
+ Hits          819      821       +2     
- Misses       2407     2410       +3     
  Partials       80       80              
Impacted Files Coverage Δ
server/proxy/install.go 0.00% <0.00%> (ø)
server/proxy/oauth2.go 0.00% <0.00%> (ø)
server/proxy/uninstall.go 0.00% <0.00%> (ø)
server/httpin/restapi/call.go 85.48% <100.00%> (+0.48%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2d91438...99a4aa5. Read the comment docs.

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work 👍 Looking forward to seeing the metrics

server/proxy/oauth2.go Outdated Show resolved Hide resolved
server/telemetry/telemetry.go Outdated Show resolved Hide resolved
server/telemetry/telemetry.go Outdated Show resolved Hide resolved
@larkox larkox removed 1: PM Review Requires review by a product manager 2: Dev Review Requires review by a core committer labels Aug 13, 2021
@larkox larkox removed the Awaiting Submitter Action Blocked on the author label Aug 13, 2021
@larkox
Copy link
Contributor Author

larkox commented Aug 25, 2021

@DHaussermann Gentle reminder to review this. Not sure if you want to test it, since it is just adding telemetry.

@hanzei hanzei added the Docs/Needed Requires documentation label Aug 25, 2021
@larkox
Copy link
Contributor Author

larkox commented Aug 31, 2021

@DHaussermann Friendly reminder on this.

@hanzei
Copy link
Contributor

hanzei commented Sep 2, 2021

@larkox Also here

@larkox
Copy link
Contributor Author

larkox commented Sep 6, 2021

Added the environment variable to work with telemetry.

@hanzei hanzei changed the title Add telemetry [MM-37324] Add telemetry Sep 21, 2021
@hanzei
Copy link
Contributor

hanzei commented Sep 28, 2021

Discussed offline. QA testing will happen on Community. @larkox Please merge.

@larkox larkox merged commit 4cd4927 into mattermost:master Sep 28, 2021
@aaronrothschild
Copy link
Contributor

aaronrothschild commented Sep 28, 2021

FYI @enelson720 this is new Telemetry that will be coming in for Apps Framework (ie: apps installed, uninstalled, etc.)

@larkox for future, would it make sense for us to track "how" an app is installed? (marketplace vs /apps install)

@larkox
Copy link
Contributor Author

larkox commented Sep 29, 2021

@aaronrothschild Yes, it makes sense. Not 100% sure if we have the mechanism to make the distinction (I guess so, but not 100% sure). Feel free to create a ticket to track it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: QA Review Requires review by a QA tester Docs/Needed Requires documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants