-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Network metrics #8390
Network metrics #8390
Conversation
Hi @enahum -- sorry for the delay on this. I was able to see the label showing up in the log:
Is the total size suppose to be 0B and latency at 0ms? I am using "github:mattermost/react-native-network-client#ad7b88412f41c5a1024420a4f4c7461883cd0e63" as in package.json. This is my way to test react-native-network-client changes as well. Did I miss anything? My reluctant is the amount of changes involved to make this work. Is it because groupLabel can change at anytime (similar to serverUrl)? (as portrayed here where you can have "entry" and "entry-additional" all within one single lifecycle). |
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.
Can't tell anything specific to implementation but the metrics seems okay to me. Looking forward to analyse these.
@rahimrahman you seem to not have set the collectMetrics config setting to true, not sure how you missed that. As for the changes, the groupLabel is applied in multiple places as we need to know what endpoints to group. For example you'll see entry and entry-additional in this PR but in a future PR I have almost ready to go it will change to the following labels (this labels will be well defined in a type definition):
Why the Deferred? Simply because I thought is better to group them in a way that we can clearly identify the requests that are done for TTI and those that happen after like fetching posts for unread channels threads and in case of this PR also channels for other teams, etc.. but are still part of the initial load. Then we can use the groupLabel to group all the requests that are involved in a particular action like channel switch or post a message or whatever |
Oh shoot, I changed the DEFAULT_CONFIG, and didn't change my LocalConfig. Silly me, thanks! |
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.
Again, sorry for the tardiness. Here's a few thoughts.
app/client/rest/tracking.ts
Outdated
completionTimer?: NodeJS.Timeout; | ||
} | ||
|
||
export default class ClientTraking { |
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.
Spelling error
export default class ClientTraking { | |
export default class ClientTracking { |
app/client/rest/tracking.ts
Outdated
requesting ${urls.length} urls | ||
total Compressed size of: ${getFormattedFileSize(groupData.totalCompressedSize)} | ||
total size of: ${getFormattedFileSize(groupData.totalSize)} | ||
ellapsed time: ${duration / 1000} seconds |
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.
ellapsed time: ${duration / 1000} seconds | |
elapsed time: ${duration / 1000} seconds |
count: number; | ||
metrics?: ClientResponseMetrics; | ||
} | ||
|
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.
Can we add:
export enum GroupLabel {
Entry = 'Entry',
ColdStart = 'ColdStart',
Login = 'Login',
...
}
So we can use it in methods
WebsocketManager.openAll(GroupLabel.Entry);
export const fetchGroupsForChannel = async (serverUrl: string, channelId: string, fetchOnly = false, groupLabel?: GroupLabel) => {
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.
This is done in a future PR as I mentioned in my previous comment, so for this PR it will remain as is
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.
For example you'll see entry and entry-additional in this PR but in a future PR I have almost ready to go it will change to the following labels (this labels will be well defined in a type definition):
Thanks, I missed it.
if (group.urls[url]) { | ||
group.urls[url].count += 1; | ||
} else { | ||
group.urls[url] = { | ||
count: 1, | ||
metrics, | ||
}; | ||
} |
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.
What do you think about using just the path instead of the entire url?
Maybe it will give us more duplicates if any?
LOG {"path": "/api/v4/users/me/preferences", "query": undefined}
LOG {"path": "/api/v4/users/me/teams", "query": undefined}
LOG {"path": "/api/v4/users/me/teams/members", "query": undefined}
LOG {"path": "/api/v4/users/me", "query": undefined}
LOG {"path": "/api/v4/users/me/status", "query": undefined}
LOG {"path": "/api/v4/users/me/teams/rcgiyftm7jyrxnma1osd8zswby/channels/members", "query": undefined}
LOG {"path": "/api/v4/users/me/teams/rcgiyftm7jyrxnma1osd8zswby/channels", "query": "include_deleted=true&last_delete_at=1733860858455"}
LOG {"path": "/api/v4/users/me/teams/rcgiyftm7jyrxnma1osd8zswby/channels/categories", "query": undefined}
if (group.urls[url]) { | |
group.urls[url].count += 1; | |
} else { | |
group.urls[url] = { | |
count: 1, | |
metrics, | |
}; | |
} | |
const [path] = url.split('?'); | |
if (group.urls[path]) { | |
group.urls[path].count += 1; | |
} else { | |
group.urls[path] = { | |
count: 1, | |
metrics, | |
}; | |
} |
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.
They would not be really duplicates though.. I think at this time we can keep the url and if we want to try and refine more then we can do soemething like this
Summary
This PR allows us to collect network metrics for analysis.
Ticket Link
https://mattermost.atlassian.net/browse/MM-61878
Release Note