mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 15:21:05 -05:00
Implements the `AWSInsightsIndexService.*` JSON 1.1 surface backed by synthesizing cost and usage from Floci's existing resource state multiplied by the bundled AWS Pricing snapshot (#821). Covers the nine Cost Explorer operations the FinOps tooling ecosystem most commonly exercises: - `GetCostAndUsage` / `GetCostAndUsageWithResources` — full `TimePeriod`, `Granularity` (DAILY / MONTHLY / HOURLY), `Metrics` (UnblendedCost / BlendedCost / AmortizedCost / NetUnblendedCost / NetAmortizedCost / UsageQuantity / NormalizedUsageAmount), `GroupBy` (DIMENSION / TAG / COST_CATEGORY), and the recursive `Filter` expression tree (`And` / `Or` / `Not` / `Dimensions` / `Tags` / `CostCategories`). - `GetDimensionValues` — returns the dimension values present in the synthesized data; honors filters and search strings. - `GetTags` — returns tag keys / values across enumerated resources. - `GetReservationCoverage` / `GetReservationUtilization` — zero-totalled stubs so callers that hit these endpoints during smoke tests don't fail on `UnknownOperationException`. - `GetSavingsPlansCoverage` / `GetSavingsPlansUtilization` — same stubbed shape. - `GetCostCategories` — empty list (cost-category management is out-of-scope for this PR). `GROUP_BY=RECORD_TYPE` distinguishes `Usage`, `Credit`, `Tax`, `Refund`, `DiscountedUsage`, and the four `SavingsPlan*` variants. `Tax` / `Refund` / `DiscountedUsage` / `SavingsPlan*` are reserved for follow-up PRs; `Credit` is emitted when `FLOCI_SERVICES_CE_CREDIT_USD_MONTHLY > 0`, capped at the synthesized monthly usage so net cost never goes below zero. ## Architecture A new SPI lives in `core/common/`: public interface ResourceUsageEnumerator { Stream<UsageLine> enumerate(Instant start, Instant end, String region); } CDI auto-discovers all `@ApplicationScoped` beans implementing it. Cost Explorer iterates `Instance<ResourceUsageEnumerator>` per request, so adding a new Floci service with cost data is a matter of dropping a new enumerator bean next to the service — zero changes to `CostExplorerService`. The same enumerators will feed the upcoming CUR and BCM Data Exports Parquet writer (#823) without duplication. The bundled enumerators are: - `Ec2UsageEnumerator` — `BoxUsage:<instanceType>` * hours per running instance, priced from the Pricing snapshot. - `S3UsageEnumerator` — `TimedStorage-ByteHrs` * GB-month per bucket, priced from the snapshot. - `LambdaUsageEnumerator` — catalog-only line per function (zero quantity until invocation tracking lands in a follow-up). - `UnpricedServicesEnumerator` — emits zero-quantity catalog rows for the remaining ~30 Floci services so they appear in `GetDimensionValues SERVICE` without contributing billed cost. Each priced enumerator additionally emits a zero-quantity catalog line so the service shows up in `GetDimensionValues SERVICE` even when no resources exist. ## Tests `CostExplorerIntegrationTest` covers all nine operations via RestAssured wire-format assertions: granularity bucketing, filter-expression evaluation, group-by combinations, dimension and tag listings, RI / SP stubs, validation errors. 20 tests, all green. The full Floci test suite stays green with the additions (4030 tests run, 0 failures, 0 errors, excluding the pre-existing local-env flakes documented during PR #821). Refs: https://github.com/orgs/floci-io/discussions/791 Refs: https://github.com/floci-io/floci/issues/822
183 lines
3.6 KiB
YAML
183 lines
3.6 KiB
YAML
quarkus:
|
|
http:
|
|
port: 0
|
|
test-port: 0
|
|
limits:
|
|
max-body-size: ${floci.max-request-size}M
|
|
|
|
floci:
|
|
base-url: "http://localhost:4566"
|
|
default-region: us-east-1
|
|
default-account-id: "000000000000"
|
|
storage:
|
|
mode: memory
|
|
persistent-path: ./target/test-data
|
|
prune-volumes-on-delete: true
|
|
wal:
|
|
compaction-interval-ms: 60000
|
|
services:
|
|
ssm:
|
|
flush-interval-ms: 60000
|
|
dynamodb:
|
|
flush-interval-ms: 60000
|
|
sns:
|
|
flush-interval-ms: 60000
|
|
lambda:
|
|
flush-interval-ms: 60000
|
|
cloudwatchlogs:
|
|
flush-interval-ms: 60000
|
|
cloudwatchmetrics:
|
|
flush-interval-ms: 60000
|
|
secretsmanager:
|
|
flush-interval-ms: 60000
|
|
acm:
|
|
flush-interval-ms: 60000
|
|
opensearch:
|
|
flush-interval-ms: 60000
|
|
|
|
auth:
|
|
validate-signatures: false
|
|
presign-secret: test-secret
|
|
|
|
init-hooks:
|
|
shell-executable: /bin/sh
|
|
timeout-seconds: 5
|
|
shutdown-grace-period-seconds: 2
|
|
|
|
tls:
|
|
enabled: false
|
|
self-signed: true
|
|
|
|
docker:
|
|
log-max-size: "10m"
|
|
log-max-file: "3"
|
|
|
|
services:
|
|
ssm:
|
|
enabled: true
|
|
max-parameter-history: 5
|
|
sqs:
|
|
enabled: true
|
|
default-visibility-timeout: 30
|
|
max-message-size: 262144
|
|
s3:
|
|
enabled: true
|
|
default-presign-expiry-seconds: 3600
|
|
dynamodb:
|
|
enabled: true
|
|
sns:
|
|
enabled: true
|
|
lambda:
|
|
enabled: true
|
|
# aws-config-path:
|
|
hot-reload:
|
|
enabled: true
|
|
apigateway:
|
|
enabled: true
|
|
apigatewayv2:
|
|
enabled: true
|
|
iam:
|
|
enabled: true
|
|
enforcement-enabled: false
|
|
msk:
|
|
enabled: true
|
|
mock: true
|
|
default-image: "redpandadata/redpanda:latest"
|
|
elasticache:
|
|
enabled: true
|
|
proxy-base-port: 6379
|
|
proxy-max-port: 6399
|
|
default-image: "valkey/valkey:8"
|
|
rds:
|
|
enabled: true
|
|
proxy-base-port: 7001
|
|
proxy-max-port: 7099
|
|
default-postgres-image: "postgres:16-alpine"
|
|
default-mysql-image: "mysql:8.0"
|
|
default-mariadb-image: "mariadb:11"
|
|
eventbridge:
|
|
enabled: true
|
|
scheduler:
|
|
enabled: true
|
|
cloudwatchlogs:
|
|
enabled: true
|
|
max-events-per-query: 10000
|
|
cloudwatchmetrics:
|
|
enabled: true
|
|
secretsmanager:
|
|
enabled: true
|
|
default-recovery-window-days: 30
|
|
kinesis:
|
|
enabled: true
|
|
firehose:
|
|
enabled: true
|
|
kms:
|
|
enabled: true
|
|
cognito:
|
|
enabled: true
|
|
stepfunctions:
|
|
enabled: true
|
|
cloudformation:
|
|
enabled: true
|
|
acm:
|
|
enabled: true
|
|
validation-wait-seconds: 0
|
|
athena:
|
|
enabled: true
|
|
mock: true
|
|
glue:
|
|
enabled: true
|
|
ses:
|
|
enabled: true
|
|
opensearch:
|
|
enabled: true
|
|
mock: true
|
|
default-image: "opensearchproject/opensearch:2"
|
|
proxy-base-port: 9400
|
|
proxy-max-port: 9499
|
|
ec2:
|
|
enabled: true
|
|
imds-port: 9169
|
|
ssh-port-range-start: 2200
|
|
ssh-port-range-end: 2299
|
|
mock: true
|
|
ecs:
|
|
enabled: true
|
|
mock: true
|
|
appconfig:
|
|
enabled: true
|
|
appconfigdata:
|
|
enabled: true
|
|
ecr:
|
|
enabled: true
|
|
bedrock-runtime:
|
|
enabled: true
|
|
eks:
|
|
enabled: true
|
|
mock: true
|
|
pipes:
|
|
enabled: true
|
|
elbv2:
|
|
enabled: true
|
|
mock: true
|
|
codebuild:
|
|
enabled: true
|
|
# docker-network: floci-network
|
|
codedeploy:
|
|
enabled: true
|
|
autoscaling:
|
|
enabled: true
|
|
transfer:
|
|
enabled: true
|
|
backup:
|
|
enabled: true
|
|
job-completion-delay-seconds: 1
|
|
route53:
|
|
enabled: true
|
|
textract:
|
|
enabled: true
|
|
pricing:
|
|
enabled: true
|
|
ce:
|
|
enabled: true
|