Add web3 usage metrics, prepare for web3 removal#9144
Merged
Conversation
71ccb60 to
44298af
Compare
rekmarks
commented
Aug 6, 2020
Collaborator
Builds ready [44298af]
Page Load Metrics (605 ± 18 ms)
|
Gudahtt
reviewed
Aug 7, 2020
44298af to
9c64bb4
Compare
* move web3 metrics method to new middleware
7a68f35 to
004adc8
Compare
rekmarks
commented
Aug 7, 2020
| * Create middleware for handling certain methods and preprocessing permissions requests. | ||
| */ | ||
| export default function createMethodMiddleware ({ | ||
| export default function createPermissionsMethodMiddleware ({ |
Member
Author
There was a problem hiding this comment.
This file and all references to its export were renamed to disambiguate it from the new top-level methodMiddleware.
Gudahtt
reviewed
Aug 7, 2020
14f6452 to
70b50a0
Compare
Gudahtt
reviewed
Aug 7, 2020
| import 'web3/dist/web3.min.js' | ||
|
|
||
| const shouldLogUsage = !([ | ||
| 'docs.metamask.io', |
Member
There was a problem hiding this comment.
Interesting - are these sites using web3?
Member
There was a problem hiding this comment.
Ah right, the test dapp definitely is. For the others, it might be useful to know if they're using the injected web3 instance though. That would be something we should fix.
Member
Author
There was a problem hiding this comment.
I swear to verify this manually 😄
Gudahtt
approved these changes
Aug 7, 2020
Member
Gudahtt
left a comment
There was a problem hiding this comment.
LGTM! Though I did have one outstanding suggestion, of relatively low importance.
Collaborator
Builds ready [70b50a0]
Page Load Metrics (677 ± 48 ms)
|
Gudahtt
pushed a commit
that referenced
this pull request
Aug 7, 2020
* add web3 usage metrics * move web3 metrics method to new middleware * rename some methods, files, and exports
Merged
Gudahtt
added a commit
that referenced
this pull request
Aug 10, 2020
* origin/master: (44 commits) Add category in eventOpts (#9164) Update changelog for v8.0.7 (#9161) Version v8.0.7 Remove web3 e2e tests (#9159) Add web3 usage metrics, prepare for web3 removal (#9144) Use `pathname` instead of URL for `currentPath` metrics parameter (#9158) Remove `url` parameter from `metricsEvent` (#9157) Change MetaMetrics category for background events (#9155) remove .network-name height Use luxon@1.24.1 (#9154) Update 'react-devtools' to ^4.8.0 (#9140) Fix connection removal bug (#9137) Add source map validator to CI (#9135) Update source map validator target files (#9133) Improve sourcemap validator console report (#9131) Add `validate-source-maps` npm script (#9134) Non-zero exit code upon failure to validate source maps (#9132) Update `brfs` from v1.6.1 to v2.0.2 (#9115) Factor out `getEnvironment` function in build script (#9114) Update `browserify` from v16.2.3 to v16.5.1 (#9113) ...
Gudahtt
added a commit
that referenced
this pull request
Aug 18, 2020
The web3 usage metrics added in #9144 assumed that all web3 properties were strings. When a `Symbol` property is accessed, our `inpage.js` script crashes because the `Symbol` cannot be serialized correctly. A check has been added for non-string property access. The metric event in these cases is set to the string "typeof ", followed by the type of the key. (e.g. `typeof symbol` for a `Symbol` property). Fixes #9234
Gudahtt
added a commit
that referenced
this pull request
Aug 18, 2020
The web3 usage metrics added in #9144 assumed that all web3 properties were strings. When a `Symbol` property is accessed, our `inpage.js` script crashes because the `Symbol` cannot be serialized correctly. A check has been added for non-string property access. The metric event in these cases is set to the string "typeof ", followed by the type of the key. (e.g. `typeof symbol` for a `Symbol` property). Fixes #9234
Gudahtt
added a commit
that referenced
this pull request
Aug 18, 2020
The web3 usage metrics added in #9144 assumed that all web3 properties were strings. When a `Symbol` property is accessed, our `inpage.js` script crashes because the `Symbol` cannot be serialized correctly. A check has been added for non-string property access. The metric event in these cases is set to the string "typeof ", followed by the type of the key. (e.g. `typeof symbol` for a `Symbol` property). Fixes #9234
Gudahtt
added a commit
that referenced
this pull request
Aug 19, 2020
The web3 usage metrics added in #9144 assumed that all web3 properties were strings. When a `Symbol` property is accessed, our `inpage.js` script crashes because the `Symbol` cannot be serialized correctly. A check has been added for non-string property access. The metric event in these cases is set to the string "typeof ", followed by the type of the key. (e.g. `typeof symbol` for a `Symbol` property). Fixes #9234
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds
window.web3usage metrics for users that opted in to metrics. It also consolidates someweb3-related functionality, and adds a method and a middleware to perform the metrics-sending work.window.web3usage metrics via new RPC method:metamask_logInjectedWeb3Usagewindow.web3usage metrics onwindow.web3property access and assignment, via proxy handlersweb3-related code intoauto-reload.js; rename file tosetupWeb3.jsmetamask_logInjectedWeb3Usageimplementationmetamask-controllermethod for sending backend metricsmethodMiddleware.jstopermissionsMethodMiddleware.jsto distinguish from new top-levelmethodMiddleware