-
-
Notifications
You must be signed in to change notification settings - Fork 743
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
feat: connection count usage #9294
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Skipped Deployment
|
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files |
@@ -40,6 +42,46 @@ export const toChartData = ( | |||
return { datasets, labels }; | |||
}; | |||
|
|||
export const toConnectionChartData = ( |
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 a copy of existing method with minor modifications
const date = parseISO(dataPoint.period); | ||
const requestCount = dataPoint.trafficTypes[0].count; | ||
|
||
if (dataPoint.period.length === 7) { |
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.
if YYYY-MM then divide requests by 1 day connection (7200 req) and number of days in a month
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.
whew. yeah, this'll work, but it feels iffy. A regex match ([0-9]{4}-[0-9]{2}
) or a date checker would put me more at ease, but it'll also be more computationally expensive.
But even better: may I suggest that you do if (traffic.grouping === 'monthly
)`? That should also give you what you need, and is also less work .
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.
if (dataPoint.period.length === 7) { | |
if (traffic.grouping === 'monthly') { |
requestCount / (daysInMonth * 7200); | ||
} else { | ||
// 1 connection = 7200 requests per day | ||
record[dataPoint.period] = requestCount / 7200; |
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.
daily request quota for one connection is 7200
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.
next PR may change the 7200 to a variant to make it configurable
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 don't have the context, but by and large this looks sane to me. Added a suggestion and a comment to have a look at, but otherwise fine.
// console.log(chartData, chartDataSelection.grouping, chartDataSelection); | ||
|
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.
probably don't need this 😉
const date = parseISO(dataPoint.period); | ||
const requestCount = dataPoint.trafficTypes[0].count; | ||
|
||
if (dataPoint.period.length === 7) { |
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.
whew. yeah, this'll work, but it feels iffy. A regex match ([0-9]{4}-[0-9]{2}
) or a date checker would put me more at ease, but it'll also be more computationally expensive.
But even better: may I suggest that you do if (traffic.grouping === 'monthly
)`? That should also give you what you need, and is also less work .
const date = parseISO(dataPoint.period); | ||
const requestCount = dataPoint.trafficTypes[0].count; | ||
|
||
if (dataPoint.period.length === 7) { |
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.
if (dataPoint.period.length === 7) { | |
if (traffic.grouping === 'monthly') { |
Also, so this only affects visualisations, right? It's not supposed to touch the aggregation metrics in the boxes etc? Because if so, you probably want to do it earlier on. |
@thomasheartman yeah, i deliberately left out the aggregation box since this change is to get a preview in the chart itself with minimal effort. We can iterate on this later and introduce another tab. |
About the changes
Network data usage may show connections instead of raw request count behind a flag.
![Screenshot 2025-02-11 at 15 37 06](https://private-user-images.githubusercontent.com/1394682/412018452-3e22100c-f2b4-48cd-b537-d6c0cef466a4.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0MTU0NzksIm5iZiI6MTczOTQxNTE3OSwicGF0aCI6Ii8xMzk0NjgyLzQxMjAxODQ1Mi0zZTIyMTAwYy1mMmI0LTQ4Y2QtYjUzNy1kNmMwY2VmNDY2YTQucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTNUMDI1MjU5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTQ3YzY0NjNmOTcyZTJkOWVmMTZhZjBkNzMzZGY0OTkyZDVlNzJmZWM2M2YwNzkxMmU1MmJkZjk2ODE5MGU2OCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.w0WlAx6yL6wWuY7rFo9Ct2Qq2gQf5zP-qE-8eoweQq8)
This PR adjusts chart data to visualize connections count (1 connection = 7200 requests per day) in a day or in a month
Important files
Discussion points