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
20 changes: 12 additions & 8 deletions aws-lambda-calculator/src/aws_lambda_calculator/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,12 @@ def calculate_tiered_cost(
if usage_in_tier > 0:
total_cost += usage_in_tier * rate
prev_threshold += usage_in_tier
logger.debug(f"{usage_in_tier} GB-s x {rate} USD = {usage_in_tier * rate} USD")
steps.append(f"{usage_in_tier} GB-s x {rate} USD = {usage_in_tier * rate} USD")
logger.debug(
f"{usage_in_tier} GB-s x {rate:.8f} USD = {usage_in_tier * rate} USD"
)
steps.append(
f"{usage_in_tier} GB-s x {rate:.8f} USD = {usage_in_tier * rate} USD"
)

# once we've billed all the usage, early exit
if total_compute_gb_sec <= threshold:
Expand All @@ -168,10 +172,10 @@ def calculate_tiered_cost(
remaining = total_compute_gb_sec - prev_threshold
if remaining > 0:
logger.debug(
f"{remaining} GB-s x {overflow_rate} USD = {remaining * overflow_rate} USD"
f"{remaining} GB-s x {overflow_rate:.8f} USD = {remaining * overflow_rate} USD"
)
steps.append(
f"{remaining} GB-s x {overflow_rate} USD = {remaining * overflow_rate} USD"
f"{remaining} GB-s x {overflow_rate:.8f} USD = {remaining * overflow_rate} USD"
)
total_cost += remaining * overflow_rate

Expand Down Expand Up @@ -255,10 +259,10 @@ def calc_monthly_request_charges(
res = float(billable_requests) * float(requests_cost_factor)
if res > 0.0:
logger.debug(
f"{billable_requests} requests x {requests_cost_factor} USD = {res} USD (monthly request charges)"
f"{billable_requests} requests x {requests_cost_factor:.8f} USD = {res} USD (monthly request charges)"
)
steps.append(
f"{billable_requests} requests x {requests_cost_factor} USD = {res} USD (monthly request charges)"
f"{billable_requests} requests x {requests_cost_factor:.8f} USD = {res} USD (monthly request charges)"
)
return res

Expand All @@ -283,13 +287,13 @@ def calc_monthly_ephemeral_storage_charges(
f"{billable_storage} GB x{total_compute_gb_sec} seconds = {gb_s} total storage (GB-s)"
)
logger.debug(
f"{gb_s} GB x {ephemeral_storage_cost_factor} USD = {res} USD (monthly ephemeral storage charges)"
f"{gb_s} GB x {ephemeral_storage_cost_factor:.8f} USD = {res} USD (monthly ephemeral storage charges)"
)
steps.append(
f"{billable_storage} GB x{total_compute_gb_sec} seconds = {gb_s} total storage (GB-s)"
)
steps.append(
f"{gb_s} GB x {ephemeral_storage_cost_factor} USD = {res} USD (monthly ephemeral storage charges)"
f"{gb_s} GB x {ephemeral_storage_cost_factor:.8f} USD = {res} USD (monthly ephemeral storage charges)"
)
return res

Expand Down
15 changes: 10 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ license = "Apache-2.0"
[tool.poetry]
package-mode = false
version = "1.0" # base version
# packages = [
# { include = "cli", from = "src" },
# { include = "lambda", from = "src" }
# # { include = "utils", from = "src" }
# ]

[tool.poetry.requires-plugins]
poetry-plugin-export = ">=1.8"
Expand All @@ -31,6 +26,16 @@ aws-lambda-calculator = { path = "./aws-lambda-calculator", develop = true }
# aws-lambda-calculator = {git = "https://github.com/zMynx/aws-lambda-calculator.git", rev = "feat/package", subdirectory = "aws-lambda-calculator"}
pydantic = "^2.12.3"

[tool.poetry.scripts]
# Full command name
aws-lambda-calculator = "cli:run"
aws-lambda-calculator-lambda = "aws_lambda:handler"

# Short alias
alc = "cli:run"
alc-lambda = "aws_lambda:handler"


[project.urls]
homepage = "https://zmynx.github.io/aws-lambda-calculator"
repository = "https://github.com/zMynx/aws-lambda-calculator"
Expand Down
2 changes: 1 addition & 1 deletion site/app/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Navbar: React.FC = () => {
<div className="flex flex-wrap items-center justify-between">
<div className="flex items-center space-x-2">
<Link to="/" className="text-xl font-bold hover:text-blue-600 dark:hover:text-blue-400 transition-colors duration-200">
🚀 Lambda Calculator
<img src="/logo.svg" alt="Lambda Calculator" className="w-8 h-8 inline mr-2" /> Lambda Calculator
</Link>
</div>

Expand Down
21 changes: 21 additions & 0 deletions site/app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ export const links: Route.LinksFunction = () => [
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",
},
{
rel: "apple-touch-icon",
sizes: "180x180",
href: "/apple-touch-icon.png",
},
{
rel: "icon",
type: "image/png",
sizes: "32x32",
href: "/favicon-32x32.png",
},
{
rel: "icon",
type: "image/png",
sizes: "16x16",
href: "/favicon-16x16.png",
},
{
rel: "manifest",
href: "/site.webmanifest",
},
];

export function Layout({ children }: { children: React.ReactNode }) {
Expand Down
Loading
Loading