Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,34 @@ export function CountGraph(props: {
rateLimitedCount: number;
}[];
}) {
const hasAnyRateLimited = props.data.some((v) => v.rateLimitedCount > 0);
return (
<ThirdwebAreaChart
chartClassName="aspect-[1.5] lg:aspect-[4]"
header={{
title: "Requests Over Time",
description: "Requests over the last 24 hours. All times in UTC.",
}}
config={{
includedCount: {
label: "Successful Requests",
color: "hsl(var(--chart-1))",
},
rateLimitedCount: {
label: "Rate Limited Requests",
color: "hsl(var(--chart-4))",
},
}}
showLegend
config={
hasAnyRateLimited
? {
includedCount: {
label: "Successful Requests",
color: "hsl(var(--chart-1))",
},
rateLimitedCount: {
label: "Rate Limited Requests",
color: "hsl(var(--chart-4))",
},
}
: {
includedCount: {
label: "Successful Requests",
color: "hsl(var(--chart-1))",
},
}
}
showLegend={hasAnyRateLimited}
yAxis
xAxis={{
sameDay: true,
Expand All @@ -39,13 +49,13 @@ export function CountGraph(props: {
toolTipLabelFormatter={(label) => {
return formatDate(new Date(label), "MMM dd, HH:mm");
}}
// @ts-expect-error - sending MORE data than expected is ok
data={props.data
.slice(1, -1)
.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime())
.map((v) => ({
time: v.date,
includedCount: v.includedCount + v.overageCount,
rateLimitedCount: v.rateLimitedCount,
includedCount: Number(v.includedCount) + Number(v.overageCount),
rateLimitedCount: Number(v.rateLimitedCount),
}))}
isPending={false}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export function RateGraph(props: {
},
}}
data={props.data
.slice(1, -1)
.sort((a, b) => new Date(a.date).getTime() - new Date(b.date).getTime())
.map((v) => ({
time: v.date,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default async function RPCUsage(props: {
<CardContent>
<div className="flex items-center justify-between">
<div className="font-bold text-2xl capitalize">
{currentRateLimit} RPS
{currentRateLimit.toLocaleString()} RPS
</div>
<TeamPlanBadge plan={currentPlan} />
</div>
Expand Down
Loading